http://git-wip-us.apache.org/repos/asf/ode/blob/4b87e5b1/bpel-rest-extensions/src/main/java/org/apache/ode/bpel/extension/bpel4restlight/Bpel4RestLightUtil.java ---------------------------------------------------------------------- diff --git a/bpel-rest-extensions/src/main/java/org/apache/ode/bpel/extension/bpel4restlight/Bpel4RestLightUtil.java b/bpel-rest-extensions/src/main/java/org/apache/ode/bpel/extension/bpel4restlight/Bpel4RestLightUtil.java index 37c3386..ca56a15 100644 --- a/bpel-rest-extensions/src/main/java/org/apache/ode/bpel/extension/bpel4restlight/Bpel4RestLightUtil.java +++ b/bpel-rest-extensions/src/main/java/org/apache/ode/bpel/extension/bpel4restlight/Bpel4RestLightUtil.java @@ -1,20 +1,16 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. */ package org.apache.ode.bpel.extension.bpel4restlight; @@ -33,263 +29,253 @@ import org.w3c.dom.Node; import org.xml.sax.SAXException; /** - * This class provides some utility methods for the BPEL REST extension - * activities. + * This class provides some utility methods for the BPEL REST extension activities. * * @author Michael Hahn ([email protected]) * */ public class Bpel4RestLightUtil { - private static final String VARIABLE_VALUE_REFERENCE = "$bpelvar["; - - /** - * This method extracts the request message payload from the provided extension - * activity. This request payload is either provided through a specified BPEL - * variable ('request' attribute) or statically defined within the process model - * as the child node of the extension activity. - * - * @param context - * The extension context required to resolve variable values - * @param element - * The extension activity DOM element containing the request payload - * @return The request message payload - * - * @throws FaultException - */ - public static String extractRequestPayload(ExtensionContext context, Element element) throws FaultException { - String requestPayload = null; - - String requestPayloadVariableName = getMethodAttributeValue(context, element, - MethodAttribute.REQUEST_PAYLOAD_VARIABLE); - - // Check if a reference to a variable is specified - if (requestPayloadVariableName != null && !requestPayloadVariableName.isEmpty()) { - // Get the request variable value - Node requestVariableNode = context.readVariable(requestPayloadVariableName); - - // Check if the specified variable provides data - if (requestVariableNode != null) { - requestPayload = variableData2String(requestVariableNode); - } - } - - // If no variable was specified or the variable doesn't provide data, we check - // if a static request payload is specified as the child element of the - // extension activity - if (requestPayload == null) { - Node request = DOMUtils.findChildByType(element, Node.ELEMENT_NODE); - - if (request != null) { - requestPayload = DOMUtils.domToString(request); - } - } - - if (requestPayload == null) { - throw new FaultException(Bpel4RestLightExtensionBundle.FAULT_QNAME, - "REST extension activity does not specify any request payload."); - } - - return requestPayload; - } - - /** - * This method writes the response payload to a specified BPEL variable. - * - * @param context - * The extension context required to resolve a variable and write a - * new value to it - * @param responsePayload - * The payload of the response which will be written to the specified - * variable - * @param processVariableName - * The name of the variable to write to - * @throws FaultException - */ - public static void writeResponsePayload(ExtensionContext context, Object responsePayload, - String processVariableName) throws FaultException { - if (responsePayload != null && !responsePayload.toString().isEmpty()) { - OScope.Variable bpelVariable = context.getVisibleVariables().get(processVariableName); - - // Create a new instance of the variables' type, to see if we need a wrapper - Document doc = DOMUtils.newDocument(); - Node val = bpelVariable.getType().newInstance(doc); - - // Check if we need a temporary simple type wrapper - if (val.getNodeType() == Node.TEXT_NODE) { - // Create a wrapper element and add the response payload as text node - Element tempwrapper = doc.createElementNS(null, "temporary-simple-type-wrapper"); - doc.appendChild(tempwrapper); - tempwrapper.appendChild(val); - - // Set the response payload - val.setTextContent(responsePayload.toString()); - - // Return the wrapper element - val = tempwrapper; - } else { - // Convert the structured XML response payload to DOM - try { - val = DOMUtils.stringToDOM(responsePayload.toString()); - } catch (SAXException e) { - throw new FaultException(Bpel4RestLightExtensionBundle.FAULT_QNAME, - "BPEL4REST: Writing the response payload to BPEL variable '" + processVariableName - + "' caused an exception: " + e.getMessage(), - e); - } catch (IOException e) { - throw new FaultException(Bpel4RestLightExtensionBundle.FAULT_QNAME, - "BPEL4REST: Writing the response payload to BPEL variable '" + processVariableName - + "' caused an exception: " + e.getMessage(), - e); - } - } - - // Write the variable value - context.writeVariable(bpelVariable, val); - } - } - - public static String extractAcceptHeader(ExtensionContext context, Element element) throws FaultException { - return getMethodAttributeValue(context, element, MethodAttribute.ACCEPT_HEADER); - } - - /** - * This method extracts special predefined attributes (see - * {@link MethodAttribute}) from an extension activity. Therefore, references to - * a variable value via '$bpelVar[varName]' are also automatically resolved. - * - * @param context - * The extension context required to resolve variable values - * @param element - * The extension activity DOM element containing the attribute value - * @param methodAttribute - * Attribute whose content has to be returned - * @return The value of the attribute - * @throws FaultException - */ - public static String getMethodAttributeValue(ExtensionContext context, Element element, - MethodAttribute methodAttribute) throws FaultException { - - String result = ""; - - switch (methodAttribute) { - - case REQUEST_URI: - result = element.getAttribute("uri"); - - if (result == null || result.isEmpty()) { - result = element.getAttribute("requestUri"); - } else { - // Resolve a possible variable value reference - result = resolveVariableValueReference(context, result); - } - - break; - case REQUEST_PAYLOAD_VARIABLE: - result = element.getAttribute("request"); - - if (result == null || result.isEmpty()) { - result = element.getAttribute("requestPayload"); - } - break; - case RESPONSE_PAYLOAD_VARIABLE: - result = element.getAttribute("response"); - - if (result == null || result.isEmpty()) { - result = element.getAttribute("responsePayload"); - } - break; - case STATUS_CODE_VARIABLE: - result = element.getAttribute("statusCode"); - break; - case ACCEPT_HEADER: - result = element.getAttribute("accept"); - - // Resolve a possible variable value reference - if (result != null && !result.isEmpty()) { - result = resolveVariableValueReference(context, result); - } - - break; - } - - return result; - } - - /** - * Resolves references to variable values specified in an extension activity via - * '$bpelVar[varName]'. - * - * @param context - * The extension context to lookup and resolve variables and their - * values. - * @param variableValueReference - * A potential variable value reference. - * - * @return If the 'variableValueReference' parameter contains a variable value - * reference ($bpelVar[varName]), the actual value of the variable is - * returned, else the provided parameter value is returned. - * @throws FaultException - */ - public static String resolveVariableValueReference(ExtensionContext context, String variableValueReference) - throws FaultException { - String variableValue = variableValueReference; - - // Check if a concrete variable name ("varName") or a reference to the value of - // a variable - // is specified ("$bpelVar[varName]") - if (variableValueReference.startsWith(VARIABLE_VALUE_REFERENCE)) { - String variableName = variableValueReference.substring(variableValueReference.indexOf("[") + 1, - variableValueReference.indexOf("]")); - - Variable variable = context.getVisibleVariables().get(variableName); - - // We only support simple type variables, therefore the value of the variable is - // directly provided within a <temporary-simple-type-wrapper/> element. - if (variable != null && isSimpleType(variable.getType())) { - Node variableContent = context.readVariable(variableName); - - if (variableContent.getTextContent() != null) { - variableValue = variableContent.getTextContent(); - } - } else { - throw new FaultException(Bpel4RestLightExtensionBundle.FAULT_QNAME, - "References to the value of a BPEL variable using '$bpelVar[varName]' only support simple type variables."); - } - } - - return variableValue; - } - - public static String variableData2String(Node variableData) { - String result = null; - - if (variableData != null) { - if ("temporary-simple-type-wrapper".equals(variableData.getLocalName())) { - result = variableData.getTextContent(); - } else { - result = DOMUtils.domToString(variableData); - } - } - - return result; - } - - /** - * Checks if the type is a simple type or not. - * - * @param type - * to check - * - * @return True, if the type is simple, False otherwise. - */ - private static boolean isSimpleType(OVarType type) { - boolean result = false; - - if (type instanceof OXsdTypeVarType) { - result = ((OXsdTypeVarType) type).isSimple(); - } - - return result; - } + private static final String VARIABLE_VALUE_REFERENCE = "$bpelvar["; + + /** + * This method extracts the request message payload from the provided extension activity. This + * request payload is either provided through a specified BPEL variable ('request' attribute) or + * statically defined within the process model as the child node of the extension activity. + * + * @param context The extension context required to resolve variable values + * @param element The extension activity DOM element containing the request payload + * @return The request message payload + * + * @throws FaultException + */ + public static String extractRequestPayload(ExtensionContext context, Element element) + throws FaultException { + String requestPayload = null; + + String requestPayloadVariableName = + getMethodAttributeValue(context, element, MethodAttribute.REQUEST_PAYLOAD_VARIABLE); + + // Check if a reference to a variable is specified + if (requestPayloadVariableName != null && !requestPayloadVariableName.isEmpty()) { + // Get the request variable value + Node requestVariableNode = context.readVariable(requestPayloadVariableName); + + // Check if the specified variable provides data + if (requestVariableNode != null) { + requestPayload = variableData2String(requestVariableNode); + } + } + + // If no variable was specified or the variable doesn't provide data, we check + // if a static request payload is specified as the child element of the + // extension activity + if (requestPayload == null) { + Node request = DOMUtils.findChildByType(element, Node.ELEMENT_NODE); + + if (request != null) { + requestPayload = DOMUtils.domToString(request); + } + } + + if (requestPayload == null) { + throw new FaultException(Bpel4RestLightExtensionBundle.FAULT_QNAME, + "REST extension activity does not specify any request payload."); + } + + return requestPayload; + } + + /** + * This method writes the response payload to a specified BPEL variable. + * + * @param context The extension context required to resolve a variable and write a new value to + * it + * @param responsePayload The payload of the response which will be written to the specified + * variable + * @param processVariableName The name of the variable to write to + * @throws FaultException + */ + public static void writeResponsePayload(ExtensionContext context, Object responsePayload, + String processVariableName) throws FaultException { + if (responsePayload != null && !responsePayload.toString().isEmpty()) { + OScope.Variable bpelVariable = context.getVisibleVariables().get(processVariableName); + + // Create a new instance of the variables' type, to see if we need a wrapper + Document doc = DOMUtils.newDocument(); + Node val = bpelVariable.getType().newInstance(doc); + + // Check if we need a temporary simple type wrapper + if (val.getNodeType() == Node.TEXT_NODE) { + // Create a wrapper element and add the response payload as text node + Element tempwrapper = doc.createElementNS(null, "temporary-simple-type-wrapper"); + doc.appendChild(tempwrapper); + tempwrapper.appendChild(val); + + // Set the response payload + val.setTextContent(responsePayload.toString()); + + // Return the wrapper element + val = tempwrapper; + } else { + // Convert the structured XML response payload to DOM + try { + val = DOMUtils.stringToDOM(responsePayload.toString()); + } catch (SAXException e) { + throw new FaultException(Bpel4RestLightExtensionBundle.FAULT_QNAME, + "BPEL4REST: Writing the response payload to BPEL variable '" + + processVariableName + "' caused an exception: " + + e.getMessage(), + e); + } catch (IOException e) { + throw new FaultException(Bpel4RestLightExtensionBundle.FAULT_QNAME, + "BPEL4REST: Writing the response payload to BPEL variable '" + + processVariableName + "' caused an exception: " + + e.getMessage(), + e); + } + } + + // Write the variable value + context.writeVariable(bpelVariable, val); + } + } + + public static String extractAcceptHeader(ExtensionContext context, Element element) + throws FaultException { + return getMethodAttributeValue(context, element, MethodAttribute.ACCEPT_HEADER); + } + + /** + * This method extracts special predefined attributes (see {@link MethodAttribute}) from an + * extension activity. Therefore, references to a variable value via '$bpelVar[varName]' are + * also automatically resolved. + * + * @param context The extension context required to resolve variable values + * @param element The extension activity DOM element containing the attribute value + * @param methodAttribute Attribute whose content has to be returned + * @return The value of the attribute + * @throws FaultException + */ + public static String getMethodAttributeValue(ExtensionContext context, Element element, + MethodAttribute methodAttribute) throws FaultException { + + String result = ""; + + switch (methodAttribute) { + + case REQUEST_URI: + result = element.getAttribute("uri"); + + if (result == null || result.isEmpty()) { + result = element.getAttribute("requestUri"); + } else { + // Resolve a possible variable value reference + result = resolveVariableValueReference(context, result); + } + + break; + case REQUEST_PAYLOAD_VARIABLE: + result = element.getAttribute("request"); + + if (result == null || result.isEmpty()) { + result = element.getAttribute("requestPayload"); + } + break; + case RESPONSE_PAYLOAD_VARIABLE: + result = element.getAttribute("response"); + + if (result == null || result.isEmpty()) { + result = element.getAttribute("responsePayload"); + } + break; + case STATUS_CODE_VARIABLE: + result = element.getAttribute("statusCode"); + break; + case ACCEPT_HEADER: + result = element.getAttribute("accept"); + + // Resolve a possible variable value reference + if (result != null && !result.isEmpty()) { + result = resolveVariableValueReference(context, result); + } + + break; + } + + return result; + } + + /** + * Resolves references to variable values specified in an extension activity via + * '$bpelVar[varName]'. + * + * @param context The extension context to lookup and resolve variables and their values. + * @param variableValueReference A potential variable value reference. + * + * @return If the 'variableValueReference' parameter contains a variable value reference + * ($bpelVar[varName]), the actual value of the variable is returned, else the provided + * parameter value is returned. + * @throws FaultException + */ + public static String resolveVariableValueReference(ExtensionContext context, + String variableValueReference) throws FaultException { + String variableValue = variableValueReference; + + // Check if a concrete variable name ("varName") or a reference to the value of + // a variable + // is specified ("$bpelVar[varName]") + if (variableValueReference.startsWith(VARIABLE_VALUE_REFERENCE)) { + String variableName = variableValueReference.substring( + variableValueReference.indexOf("[") + 1, variableValueReference.indexOf("]")); + + Variable variable = context.getVisibleVariables().get(variableName); + + // We only support simple type variables, therefore the value of the variable is + // directly provided within a <temporary-simple-type-wrapper/> element. + if (variable != null && isSimpleType(variable.getType())) { + Node variableContent = context.readVariable(variableName); + + if (variableContent.getTextContent() != null) { + variableValue = variableContent.getTextContent(); + } + } else { + throw new FaultException(Bpel4RestLightExtensionBundle.FAULT_QNAME, + "References to the value of a BPEL variable using '$bpelVar[varName]' only support simple type variables."); + } + } + + return variableValue; + } + + public static String variableData2String(Node variableData) { + String result = null; + + if (variableData != null) { + if ("temporary-simple-type-wrapper".equals(variableData.getLocalName())) { + result = variableData.getTextContent(); + } else { + result = DOMUtils.domToString(variableData); + } + } + + return result; + } + + /** + * Checks if the type is a simple type or not. + * + * @param type to check + * + * @return True, if the type is simple, False otherwise. + */ + private static boolean isSimpleType(OVarType type) { + boolean result = false; + + if (type instanceof OXsdTypeVarType) { + result = ((OXsdTypeVarType) type).isSimple(); + } + + return result; + } }
http://git-wip-us.apache.org/repos/asf/ode/blob/4b87e5b1/bpel-rest-extensions/src/main/java/org/apache/ode/bpel/extension/bpel4restlight/MethodAttribute.java ---------------------------------------------------------------------- diff --git a/bpel-rest-extensions/src/main/java/org/apache/ode/bpel/extension/bpel4restlight/MethodAttribute.java b/bpel-rest-extensions/src/main/java/org/apache/ode/bpel/extension/bpel4restlight/MethodAttribute.java index 2b3866a..e83cebf 100644 --- a/bpel-rest-extensions/src/main/java/org/apache/ode/bpel/extension/bpel4restlight/MethodAttribute.java +++ b/bpel-rest-extensions/src/main/java/org/apache/ode/bpel/extension/bpel4restlight/MethodAttribute.java @@ -1,31 +1,31 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. */ package org.apache.ode.bpel.extension.bpel4restlight; /** - * - * This enumeration is used to decouple DOM attribute names from their - * String representation within a certain library (for portability support) + * + * This enumeration is used to decouple DOM attribute names from their String representation within + * a certain library (for portability support) * * @author Michael Hahn ([email protected]) * */ public enum MethodAttribute { - REQUEST_URI, REQUEST_PAYLOAD_VARIABLE, RESPONSE_PAYLOAD_VARIABLE, STATUS_CODE_VARIABLE, ACCEPT_HEADER; -} \ No newline at end of file + REQUEST_URI, + REQUEST_PAYLOAD_VARIABLE, + RESPONSE_PAYLOAD_VARIABLE, + STATUS_CODE_VARIABLE, + ACCEPT_HEADER; +} http://git-wip-us.apache.org/repos/asf/ode/blob/4b87e5b1/bpel-rest-extensions/src/main/java/org/apache/ode/bpel/extension/bpel4restlight/http/HighLevelRestApi.java ---------------------------------------------------------------------- diff --git a/bpel-rest-extensions/src/main/java/org/apache/ode/bpel/extension/bpel4restlight/http/HighLevelRestApi.java b/bpel-rest-extensions/src/main/java/org/apache/ode/bpel/extension/bpel4restlight/http/HighLevelRestApi.java index 2596079..759bbd5 100644 --- a/bpel-rest-extensions/src/main/java/org/apache/ode/bpel/extension/bpel4restlight/http/HighLevelRestApi.java +++ b/bpel-rest-extensions/src/main/java/org/apache/ode/bpel/extension/bpel4restlight/http/HighLevelRestApi.java @@ -1,20 +1,16 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. */ package org.apache.ode.bpel.extension.bpel4restlight.http; @@ -31,166 +27,160 @@ import org.apache.ode.bpel.common.FaultException; import org.apache.ode.bpel.extension.bpel4restlight.Bpel4RestLightExtensionBundle; /** - * This class wraps HTTP method functionality and thereby abstracts from low - * level library-specific code to simplify its usage. + * This class wraps HTTP method functionality and thereby abstracts from low level library-specific + * code to simplify its usage. * * @author Michael Hahn ([email protected]) */ public class HighLevelRestApi { - /** - * This method implements the HTTP PUT Method - * - * @param uri - * The URI of the target resource - * @param requestPayload - * The payload of the request message - * @param acceptHeaderValue - * The value of the accept header field to be set - * @return A HttpResponseMessage providing the response message payload and - * status code. - * - * @exception FaultException - */ - public static HttpResponseMessage Put(String uri, String requestPayload, String acceptHeaderValue) - throws FaultException { - - PutMethod method = new PutMethod(uri); - - HighLevelRestApi.setAcceptHeader(method, acceptHeaderValue); - try { - method.setRequestEntity(new StringRequestEntity(requestPayload, "application/xml", "UTF-8")); - } catch (UnsupportedEncodingException e) { - throw new FaultException(Bpel4RestLightExtensionBundle.FAULT_QNAME, - "BPEL4REST: Execution of HTTP method '" + method.getName() + "' caused an exception.", e); - } - - HttpResponseMessage responseMessage = LowLevelRestApi.executeHttpMethod(method); - // Remove <?xml... in front of response - HighLevelRestApi.cleanResponseBody(responseMessage); - - return responseMessage; - } - - /** - * This method implements the HTTP POST Method - * - * @param uri - * The URI of the target resource - * @param requestPayload - * The payload of the request message - * @param acceptHeaderValue - * The value of the accept header field to be set - * @return A HttpResponseMessage providing the response message payload and - * status code. - * - * @exception FaultException - */ - public static HttpResponseMessage Post(String uri, String requestPayload, String acceptHeaderValue) - throws FaultException { - - PostMethod method = null; - if (uri.contains("?")) { - String[] split = uri.split("\\?"); - method = new PostMethod(split[0]); - method.setQueryString(HighLevelRestApi.createNameValuePairArrayFromQuery(split[1])); - } else { - method = new PostMethod(uri); - } - - try { - method.setRequestEntity(new StringRequestEntity(requestPayload, "application/xml", "UTF-8")); - } catch (UnsupportedEncodingException e) { - throw new FaultException(Bpel4RestLightExtensionBundle.FAULT_QNAME, - "BPEL4REST: Execution of HTTP method '" + method.getName() + "' caused an exception.", e); - } - - HighLevelRestApi.setAcceptHeader(method, acceptHeaderValue); - HttpResponseMessage responseMessage = LowLevelRestApi.executeHttpMethod(method); - // Remove <?xml... in front of response - HighLevelRestApi.cleanResponseBody(responseMessage); - - return responseMessage; - } - - /** - * This method implements the HTTP GET Method - * - * @param uri - * The URI of the target resource - * @param acceptHeaderValue - * The value of the accept header field to be set - * @return A HttpResponseMessage providing the response message payload and - * status code. - * - * @exception FaultException - */ - public static HttpResponseMessage Get(String uri, String acceptHeaderValue) throws FaultException { - GetMethod method = null; - if (uri.contains("?")) { - String[] split = uri.split("\\?"); - method = new GetMethod(split[0]); - method.setQueryString(HighLevelRestApi.createNameValuePairArrayFromQuery(split[1])); - } else { - method = new GetMethod(uri); - } - HighLevelRestApi.setAcceptHeader(method, acceptHeaderValue); - HttpResponseMessage responseMessage = LowLevelRestApi.executeHttpMethod(method); - HighLevelRestApi.cleanResponseBody(responseMessage); - return responseMessage; - } - - /** - * This method implements the HTTP DELETE Method - * - * @param uri - * The URI of the target resource - * @param acceptHeaderValue - * The value of the accept header field to be set - * @return A HttpResponseMessage providing the response message payload and - * status code. - * - * @exception FaultException - */ - public static HttpResponseMessage Delete(String uri, String acceptHeaderValue) throws FaultException { - - DeleteMethod method = new DeleteMethod(uri); - HighLevelRestApi.setAcceptHeader(method, acceptHeaderValue); - HttpResponseMessage responseMessage = LowLevelRestApi.executeHttpMethod(method); - HighLevelRestApi.cleanResponseBody(responseMessage); - return responseMessage; - } - - private static NameValuePair[] createNameValuePairArrayFromQuery(String query) { - // example: - // csarID=Moodle.csar&serviceTemplateID={http://www.example.com/tosca/ServiceTemplates/Moodle}Moodle&nodeTemplateID={http://www.example.com/tosca/ServiceTemplates/Moodle}VmApache - String[] pairs = query.trim().split("&"); - NameValuePair[] nameValuePairArray = new NameValuePair[pairs.length]; - int count = 0; - for (String pair : pairs) { - String[] keyValue = pair.split("="); - NameValuePair nameValuePair = new NameValuePair(); - nameValuePair.setName(keyValue[0]); - nameValuePair.setValue(keyValue[1]); - nameValuePairArray[count] = nameValuePair; - count++; - } - return nameValuePairArray; - } - - private static void setAcceptHeader(HttpMethodBase method, String value) { - if (!value.equals("")) { - method.setRequestHeader("Accept", value); - } else { - method.setRequestHeader("Accept", "application/xml"); - } - } - - private static void cleanResponseBody(HttpResponseMessage responseMessage) { - if (responseMessage.getResponseBody() != null) { - String temp = responseMessage.getResponseBody() - .replace("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>", ""); - responseMessage.setResponseBody(temp); - } - } + /** + * This method implements the HTTP PUT Method + * + * @param uri The URI of the target resource + * @param requestPayload The payload of the request message + * @param acceptHeaderValue The value of the accept header field to be set + * @return A HttpResponseMessage providing the response message payload and status code. + * + * @exception FaultException + */ + public static HttpResponseMessage Put(String uri, String requestPayload, + String acceptHeaderValue) throws FaultException { + + PutMethod method = new PutMethod(uri); + + HighLevelRestApi.setAcceptHeader(method, acceptHeaderValue); + try { + method.setRequestEntity( + new StringRequestEntity(requestPayload, "application/xml", "UTF-8")); + } catch (UnsupportedEncodingException e) { + throw new FaultException(Bpel4RestLightExtensionBundle.FAULT_QNAME, + "BPEL4REST: Execution of HTTP method '" + method.getName() + + "' caused an exception.", + e); + } + + HttpResponseMessage responseMessage = LowLevelRestApi.executeHttpMethod(method); + // Remove <?xml... in front of response + HighLevelRestApi.cleanResponseBody(responseMessage); + + return responseMessage; + } + + /** + * This method implements the HTTP POST Method + * + * @param uri The URI of the target resource + * @param requestPayload The payload of the request message + * @param acceptHeaderValue The value of the accept header field to be set + * @return A HttpResponseMessage providing the response message payload and status code. + * + * @exception FaultException + */ + public static HttpResponseMessage Post(String uri, String requestPayload, + String acceptHeaderValue) throws FaultException { + + PostMethod method = null; + if (uri.contains("?")) { + String[] split = uri.split("\\?"); + method = new PostMethod(split[0]); + method.setQueryString(HighLevelRestApi.createNameValuePairArrayFromQuery(split[1])); + } else { + method = new PostMethod(uri); + } + + try { + method.setRequestEntity( + new StringRequestEntity(requestPayload, "application/xml", "UTF-8")); + } catch (UnsupportedEncodingException e) { + throw new FaultException(Bpel4RestLightExtensionBundle.FAULT_QNAME, + "BPEL4REST: Execution of HTTP method '" + method.getName() + + "' caused an exception.", + e); + } + + HighLevelRestApi.setAcceptHeader(method, acceptHeaderValue); + HttpResponseMessage responseMessage = LowLevelRestApi.executeHttpMethod(method); + // Remove <?xml... in front of response + HighLevelRestApi.cleanResponseBody(responseMessage); + + return responseMessage; + } + + /** + * This method implements the HTTP GET Method + * + * @param uri The URI of the target resource + * @param acceptHeaderValue The value of the accept header field to be set + * @return A HttpResponseMessage providing the response message payload and status code. + * + * @exception FaultException + */ + public static HttpResponseMessage Get(String uri, String acceptHeaderValue) + throws FaultException { + GetMethod method = null; + if (uri.contains("?")) { + String[] split = uri.split("\\?"); + method = new GetMethod(split[0]); + method.setQueryString(HighLevelRestApi.createNameValuePairArrayFromQuery(split[1])); + } else { + method = new GetMethod(uri); + } + HighLevelRestApi.setAcceptHeader(method, acceptHeaderValue); + HttpResponseMessage responseMessage = LowLevelRestApi.executeHttpMethod(method); + HighLevelRestApi.cleanResponseBody(responseMessage); + return responseMessage; + } + + /** + * This method implements the HTTP DELETE Method + * + * @param uri The URI of the target resource + * @param acceptHeaderValue The value of the accept header field to be set + * @return A HttpResponseMessage providing the response message payload and status code. + * + * @exception FaultException + */ + public static HttpResponseMessage Delete(String uri, String acceptHeaderValue) + throws FaultException { + + DeleteMethod method = new DeleteMethod(uri); + HighLevelRestApi.setAcceptHeader(method, acceptHeaderValue); + HttpResponseMessage responseMessage = LowLevelRestApi.executeHttpMethod(method); + HighLevelRestApi.cleanResponseBody(responseMessage); + return responseMessage; + } + + private static NameValuePair[] createNameValuePairArrayFromQuery(String query) { + // example: + // csarID=Moodle.csar&serviceTemplateID={http://www.example.com/tosca/ServiceTemplates/Moodle}Moodle&nodeTemplateID={http://www.example.com/tosca/ServiceTemplates/Moodle}VmApache + String[] pairs = query.trim().split("&"); + NameValuePair[] nameValuePairArray = new NameValuePair[pairs.length]; + int count = 0; + for (String pair : pairs) { + String[] keyValue = pair.split("="); + NameValuePair nameValuePair = new NameValuePair(); + nameValuePair.setName(keyValue[0]); + nameValuePair.setValue(keyValue[1]); + nameValuePairArray[count] = nameValuePair; + count++; + } + return nameValuePairArray; + } + + private static void setAcceptHeader(HttpMethodBase method, String value) { + if (!value.equals("")) { + method.setRequestHeader("Accept", value); + } else { + method.setRequestHeader("Accept", "application/xml"); + } + } + + private static void cleanResponseBody(HttpResponseMessage responseMessage) { + if (responseMessage.getResponseBody() != null) { + String temp = responseMessage.getResponseBody() + .replace("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>", ""); + responseMessage.setResponseBody(temp); + } + } } http://git-wip-us.apache.org/repos/asf/ode/blob/4b87e5b1/bpel-rest-extensions/src/main/java/org/apache/ode/bpel/extension/bpel4restlight/http/HttpMethod.java ---------------------------------------------------------------------- diff --git a/bpel-rest-extensions/src/main/java/org/apache/ode/bpel/extension/bpel4restlight/http/HttpMethod.java b/bpel-rest-extensions/src/main/java/org/apache/ode/bpel/extension/bpel4restlight/http/HttpMethod.java index 650d095..faf1b01 100644 --- a/bpel-rest-extensions/src/main/java/org/apache/ode/bpel/extension/bpel4restlight/http/HttpMethod.java +++ b/bpel-rest-extensions/src/main/java/org/apache/ode/bpel/extension/bpel4restlight/http/HttpMethod.java @@ -1,20 +1,16 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. */ package org.apache.ode.bpel.extension.bpel4restlight.http; @@ -24,5 +20,5 @@ package org.apache.ode.bpel.extension.bpel4restlight.http; * @author Michael Hahn ([email protected]) */ public enum HttpMethod { - PUT, POST, GET, DELETE -} \ No newline at end of file + PUT, POST, GET, DELETE +} http://git-wip-us.apache.org/repos/asf/ode/blob/4b87e5b1/bpel-rest-extensions/src/main/java/org/apache/ode/bpel/extension/bpel4restlight/http/HttpResponseMessage.java ---------------------------------------------------------------------- diff --git a/bpel-rest-extensions/src/main/java/org/apache/ode/bpel/extension/bpel4restlight/http/HttpResponseMessage.java b/bpel-rest-extensions/src/main/java/org/apache/ode/bpel/extension/bpel4restlight/http/HttpResponseMessage.java index 7695598..89997ee 100644 --- a/bpel-rest-extensions/src/main/java/org/apache/ode/bpel/extension/bpel4restlight/http/HttpResponseMessage.java +++ b/bpel-rest-extensions/src/main/java/org/apache/ode/bpel/extension/bpel4restlight/http/HttpResponseMessage.java @@ -1,62 +1,55 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. */ package org.apache.ode.bpel.extension.bpel4restlight.http; /** - * This class is used to wrap information of a HTTP response message in a - * library neutral format + * This class is used to wrap information of a HTTP response message in a library neutral format * * @author Michael Hahn ([email protected]) */ public class HttpResponseMessage { - private int statusCode; - private String responseBody; + private int statusCode; + private String responseBody; - /** - * @return the statusCode - */ - public int getStatusCode() { - return this.statusCode; - } + /** + * @return the statusCode + */ + public int getStatusCode() { + return this.statusCode; + } - /** - * @param statusCode - * the statusCode to set - */ - protected void setStatusCode(int statusCode) { - this.statusCode = statusCode; - } + /** + * @param statusCode the statusCode to set + */ + protected void setStatusCode(int statusCode) { + this.statusCode = statusCode; + } - /** - * @return the responseBody - */ - public String getResponseBody() { - return this.responseBody; - } + /** + * @return the responseBody + */ + public String getResponseBody() { + return this.responseBody; + } - /** - * @param responseBody - * the responseBody to set - */ - protected void setResponseBody(String responseBody) { - this.responseBody = responseBody; - } + /** + * @param responseBody the responseBody to set + */ + protected void setResponseBody(String responseBody) { + this.responseBody = responseBody; + } } http://git-wip-us.apache.org/repos/asf/ode/blob/4b87e5b1/bpel-rest-extensions/src/main/java/org/apache/ode/bpel/extension/bpel4restlight/http/LowLevelRestApi.java ---------------------------------------------------------------------- diff --git a/bpel-rest-extensions/src/main/java/org/apache/ode/bpel/extension/bpel4restlight/http/LowLevelRestApi.java b/bpel-rest-extensions/src/main/java/org/apache/ode/bpel/extension/bpel4restlight/http/LowLevelRestApi.java index 474d5ed..122f2e6 100644 --- a/bpel-rest-extensions/src/main/java/org/apache/ode/bpel/extension/bpel4restlight/http/LowLevelRestApi.java +++ b/bpel-rest-extensions/src/main/java/org/apache/ode/bpel/extension/bpel4restlight/http/LowLevelRestApi.java @@ -1,20 +1,16 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. */ package org.apache.ode.bpel.extension.bpel4restlight.http; @@ -27,65 +23,67 @@ import org.apache.ode.bpel.common.FaultException; import org.apache.ode.bpel.extension.bpel4restlight.Bpel4RestLightExtensionBundle; /** - * This class eases HTTP method execution by providing fault handling and - * automated response information processing + * This class eases HTTP method execution by providing fault handling and automated response + * information processing * * @author Michael Hahn ([email protected]) */ public class LowLevelRestApi { - // HttpClient used for communication - private static HttpClient httpClient = new HttpClient(); + // HttpClient used for communication + private static HttpClient httpClient = new HttpClient(); - /** - * Executes a passed HttpMethod (method type is either PUT, POST, GET or DELETE) - * and returns a HttpResponseMessage - * - * @param method - * Method to execute - * @return HttpResponseMessage which contains all information about the - * execution - */ - public static HttpResponseMessage executeHttpMethod(HttpMethod method) throws FaultException { + /** + * Executes a passed HttpMethod (method type is either PUT, POST, GET or DELETE) and returns a + * HttpResponseMessage + * + * @param method Method to execute + * @return HttpResponseMessage which contains all information about the execution + */ + public static HttpResponseMessage executeHttpMethod(HttpMethod method) throws FaultException { - HttpResponseMessage responseMessage = null; + HttpResponseMessage responseMessage = null; - try { - // Execute Request - LowLevelRestApi.httpClient.executeMethod(method); - - responseMessage = LowLevelRestApi.extractResponseInformation(method); - } catch (HttpException e) { - throw new FaultException(Bpel4RestLightExtensionBundle.FAULT_QNAME, - "BPEL4REST: Execution of HTTP method '" + method.getName() + "' caused an exception: " + e.getMessage(), e); - } catch (IOException e) { - throw new FaultException(Bpel4RestLightExtensionBundle.FAULT_QNAME, - "BPEL4REST: Execution of HTTP method '" + method.getName() + "' caused an exception: " + e.getMessage(), e); - } finally { - // Release connection - method.releaseConnection(); - } + try { + // Execute Request + LowLevelRestApi.httpClient.executeMethod(method); - // Extract response information and return - return responseMessage; - } + responseMessage = LowLevelRestApi.extractResponseInformation(method); + } catch (HttpException e) { + throw new FaultException(Bpel4RestLightExtensionBundle.FAULT_QNAME, + "BPEL4REST: Execution of HTTP method '" + method.getName() + + "' caused an exception: " + e.getMessage(), + e); + } catch (IOException e) { + throw new FaultException(Bpel4RestLightExtensionBundle.FAULT_QNAME, + "BPEL4REST: Execution of HTTP method '" + method.getName() + + "' caused an exception: " + e.getMessage(), + e); + } finally { + // Release connection + method.releaseConnection(); + } - /** - * Extracts the response information from an executed HttpMethod - * - * @param method - * The HTTP method - * @return The extracted response information - * @throws IOException - */ - private static HttpResponseMessage extractResponseInformation(HttpMethod method) throws IOException { - // Create and return HttpResponseMethod - HttpResponseMessage responseMessage = new HttpResponseMessage(); - - responseMessage.setStatusCode(method.getStatusCode()); - responseMessage.setResponseBody(method.getResponseBodyAsString()); + // Extract response information and return + return responseMessage; + } - return responseMessage; - } + /** + * Extracts the response information from an executed HttpMethod + * + * @param method The HTTP method + * @return The extracted response information + * @throws IOException + */ + private static HttpResponseMessage extractResponseInformation(HttpMethod method) + throws IOException { + // Create and return HttpResponseMethod + HttpResponseMessage responseMessage = new HttpResponseMessage(); + + responseMessage.setStatusCode(method.getStatusCode()); + responseMessage.setResponseBody(method.getResponseBodyAsString()); + + return responseMessage; + } } http://git-wip-us.apache.org/repos/asf/ode/blob/4b87e5b1/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java ---------------------------------------------------------------------- diff --git a/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java b/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java index 50def20..60f5e34 100644 --- a/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java +++ b/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java @@ -1002,24 +1002,24 @@ public class BpelProcess { _expLangRuntimeRegistry = new ExpressionLanguageRuntimeRegistry(); registerExprLang(_oprocess); - // Checking for registered extension bundles, throw an exception when - // a "mustUnderstand" extension is not available - _mustUnderstandExtensions = new HashSet<String>(); - for (OProcess.OExtension extension : _oprocess.getDeclaredExtensions()) { - if (extension.isMustUnderstand()) { - if (_engine._contexts.extensionRegistry.get(extension.getNamespace()) == null) { - String msg = __msgs.msgExtensionMustUnderstandError(_pid, - extension.getNamespace()); - __log.error(msg); - throw new BpelEngineException(msg); - } else { - _mustUnderstandExtensions.add(extension.getNamespace()); - } - } else { - __log.warn("The process declares the extension namespace " + extension.getNamespace() - + " that is unkown to the engine"); - } - } + // Checking for registered extension bundles, throw an exception when + // a "mustUnderstand" extension is not available + _mustUnderstandExtensions = new HashSet<String>(); + for (OProcess.OExtension extension : _oprocess.getDeclaredExtensions()) { + if (extension.isMustUnderstand()) { + if (_engine._contexts.extensionRegistry.get(extension.getNamespace()) == null) { + String msg = __msgs.msgExtensionMustUnderstandError(_pid, + extension.getNamespace()); + __log.error(msg); + throw new BpelEngineException(msg); + } else { + _mustUnderstandExtensions.add(extension.getNamespace()); + } + } else { + __log.warn("The process declares the extension namespace " + + extension.getNamespace() + " that is unkown to the engine"); + } + } setRoles(_oprocess); initExternalVariables(); http://git-wip-us.apache.org/repos/asf/ode/blob/4b87e5b1/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java ---------------------------------------------------------------------- diff --git a/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java b/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java index 939541c..5a576de 100644 --- a/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java +++ b/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java @@ -1537,32 +1537,34 @@ public class BpelRuntimeContextImpl implements BpelRuntimeContext { _forceFlush = true; } - public void executeExtension(QName extensionId, ExtensionContext context, Element element, ExtensionResponse extResponseChannel) throws FaultException { - __log.debug("Execute extension activity"); - final String extResponseChannelStr = ProcessUtil.exportChannel(extResponseChannel); - - ExtensionOperation ea = createExtensionActivityImplementation(extensionId); - if (ea == null) { - if (_bpelProcess._mustUnderstandExtensions.contains(extensionId.getNamespaceURI())) { - //TODO - __log.warn("Lookup of extension activity " + extensionId + " failed."); - throw new FaultException(ExtensibilityQNames.UNKNOWN_EO_FAULT_NAME, "Lookup of extension operation " + extensionId + " failed."); - } else { - // act like <empty> - do nothing - completeExtensionExecution(extResponseChannelStr, null); - return; - } - } - - try { - // should be running in a pooled thread - ea.run(context, element); - completeExtensionExecution(extResponseChannelStr, null); - } catch (RuntimeException e) { - __log.error("Error during execution of extension activity.", e); - completeExtensionExecution(extResponseChannelStr, e); - } - } + public void executeExtension(QName extensionId, ExtensionContext context, Element element, + ExtensionResponse extResponseChannel) throws FaultException { + __log.debug("Execute extension activity"); + final String extResponseChannelStr = ProcessUtil.exportChannel(extResponseChannel); + + ExtensionOperation ea = createExtensionActivityImplementation(extensionId); + if (ea == null) { + if (_bpelProcess._mustUnderstandExtensions.contains(extensionId.getNamespaceURI())) { + // TODO + __log.warn("Lookup of extension activity " + extensionId + " failed."); + throw new FaultException(ExtensibilityQNames.UNKNOWN_EO_FAULT_NAME, + "Lookup of extension operation " + extensionId + " failed."); + } else { + // act like <empty> - do nothing + completeExtensionExecution(extResponseChannelStr, null); + return; + } + } + + try { + // should be running in a pooled thread + ea.run(context, element); + completeExtensionExecution(extResponseChannelStr, null); + } catch (RuntimeException e) { + __log.error("Error during execution of extension activity.", e); + completeExtensionExecution(extResponseChannelStr, e); + } + } private void completeExtensionExecution(final String channelId, final Throwable t) { if (t != null) { http://git-wip-us.apache.org/repos/asf/ode/blob/4b87e5b1/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelServerImpl.java ---------------------------------------------------------------------- diff --git a/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelServerImpl.java b/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelServerImpl.java index 9344e84..b1f9083 100644 --- a/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelServerImpl.java +++ b/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelServerImpl.java @@ -177,12 +177,12 @@ public class BpelServerImpl implements BpelServer, Scheduler.JobProcessor { } public void registerExtensionBundle(AbstractExtensionBundle bundle) { - _contexts.extensionRegistry.put(bundle.getNamespaceURI(), bundle); - bundle.registerExtensionActivities(); + _contexts.extensionRegistry.put(bundle.getNamespaceURI(), bundle); + bundle.registerExtensionActivities(); } public void unregisterExtensionBundle(String nsURI) { - _contexts.extensionRegistry.remove(nsURI); + _contexts.extensionRegistry.remove(nsURI); } public void registerExternalVariableEngine(ExternalVariableModule eve) { http://git-wip-us.apache.org/repos/asf/ode/blob/4b87e5b1/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/Contexts.java ---------------------------------------------------------------------- diff --git a/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/Contexts.java b/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/Contexts.java index 0d0ff2f..22e8afb 100644 --- a/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/Contexts.java +++ b/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/Contexts.java @@ -70,7 +70,7 @@ public class Contexts { public CustomProcessProperties customProcessProperties = new CustomProcessProperties(); - /** Global extension bundle registry **/ + /** Global extension bundle registry **/ final Map<String, AbstractExtensionBundle> extensionRegistry = new ConcurrentHashMap<String, AbstractExtensionBundle>(); } http://git-wip-us.apache.org/repos/asf/ode/blob/4b87e5b1/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/Messages.java ---------------------------------------------------------------------- diff --git a/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/Messages.java b/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/Messages.java index 35dac34..0081e43 100644 --- a/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/Messages.java +++ b/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/Messages.java @@ -192,8 +192,8 @@ public class Messages extends MessageBundle { } public String msgExtensionMustUnderstandError(QName name, String extensionUri) { - return format("Deployment of process \"{0}\" failed. The process model requires the " + - "engine to understand language extensions defined by {1}. No extension bundle " + - "has been registered for this namespace.", name, extensionUri); + return format("Deployment of process \"{0}\" failed. The process model requires the " + + "engine to understand language extensions defined by {1}. No extension bundle " + + "has been registered for this namespace.", name, extensionUri); } } http://git-wip-us.apache.org/repos/asf/ode/blob/4b87e5b1/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ASSIGN.java ---------------------------------------------------------------------- diff --git a/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ASSIGN.java b/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ASSIGN.java index 0881ac0..53e25be 100644 --- a/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ASSIGN.java +++ b/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ASSIGN.java @@ -677,43 +677,52 @@ class ASSIGN extends ACTIVITY { return data; } - private void invokeExtensionAssignOperation(OAssign.ExtensionAssignOperation eao) throws FaultException { - try { - final ExtensionContext helper = new ExtensionContextImpl(this._scopeFrame, getBpelRuntimeContext()); - final ExtensionResponse responseChannel = newChannel(ExtensionResponse.class); - - getBpelRuntimeContext().executeExtension(eao.getExtensionName(), helper, DOMUtils.stringToDOM(eao.getNestedElement()), responseChannel); - - object(new ReceiveProcess() { - private static final long serialVersionUID = 1467660715539203917L; - }.setChannel(responseChannel).setReceiver(new ExtensionResponse() { - private static final long serialVersionUID = 509910466826372712L; - - public void onCompleted() { - _self.parent.completed(null, CompensationHandler.emptySet()); - } - - public void onFailure(Throwable t) { - StringWriter sw = new StringWriter(); - t.printStackTrace(new PrintWriter(sw)); - FaultData fault = createFault(_self.o.getOwner().getConstants().getQnSubLanguageExecutionFault(), _self.o, sw.getBuffer().toString()); - _self.parent.completed(fault, CompensationHandler.emptySet()); - }; + private void invokeExtensionAssignOperation(OAssign.ExtensionAssignOperation eao) + throws FaultException { + try { + final ExtensionContext helper = + new ExtensionContextImpl(this._scopeFrame, getBpelRuntimeContext()); + final ExtensionResponse responseChannel = newChannel(ExtensionResponse.class); + + getBpelRuntimeContext().executeExtension(eao.getExtensionName(), helper, + DOMUtils.stringToDOM(eao.getNestedElement()), responseChannel); + + object(new ReceiveProcess() { + private static final long serialVersionUID = 1467660715539203917L; + }.setChannel(responseChannel).setReceiver(new ExtensionResponse() { + private static final long serialVersionUID = 509910466826372712L; + + public void onCompleted() { + _self.parent.completed(null, CompensationHandler.emptySet()); + } + + public void onFailure(Throwable t) { + StringWriter sw = new StringWriter(); + t.printStackTrace(new PrintWriter(sw)); + FaultData fault = createFault( + _self.o.getOwner().getConstants().getQnSubLanguageExecutionFault(), + _self.o, sw.getBuffer().toString()); + _self.parent.completed(fault, CompensationHandler.emptySet()); + }; })); - } catch (FaultException fault) { + } catch (FaultException fault) { __log.error("Exception while invoking extension assign operation", fault); FaultData faultData = createFault(fault.getQName(), _self.o, fault.getMessage()); _self.parent.completed(faultData, CompensationHandler.emptySet()); - } catch (SAXException e) { - __log.error("Exception while invoking extension assign operation", e); - FaultData faultData = createFault(ExtensibilityQNames.INVALID_EXTENSION_ELEMENT, _self.o, "The nested element of extension assign operation '" + eao.getExtensionName() + "' is no valid XML."); - _self.parent.completed(faultData, CompensationHandler.emptySet()); - } catch (IOException e) { - __log.error("Exception while invoking extension assign operation", e); - FaultData faultData = createFault(ExtensibilityQNames.INVALID_EXTENSION_ELEMENT, _self.o, "The nested element of extension assign operation '" + eao.getExtensionName() + "' is no valid XML."); - _self.parent.completed(faultData, CompensationHandler.emptySet()); - } + } catch (SAXException e) { + __log.error("Exception while invoking extension assign operation", e); + FaultData faultData = createFault(ExtensibilityQNames.INVALID_EXTENSION_ELEMENT, + _self.o, "The nested element of extension assign operation '" + + eao.getExtensionName() + "' is no valid XML."); + _self.parent.completed(faultData, CompensationHandler.emptySet()); + } catch (IOException e) { + __log.error("Exception while invoking extension assign operation", e); + FaultData faultData = createFault(ExtensibilityQNames.INVALID_EXTENSION_ELEMENT, + _self.o, "The nested element of extension assign operation '" + + eao.getExtensionName() + "' is no valid XML."); + _self.parent.completed(faultData, CompensationHandler.emptySet()); + } } private class EvaluationContextProxy implements EvaluationContext { http://git-wip-us.apache.org/repos/asf/ode/blob/4b87e5b1/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/EXTENSIONACTIVITY.java ---------------------------------------------------------------------- diff --git a/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/EXTENSIONACTIVITY.java b/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/EXTENSIONACTIVITY.java index 9182c38..dfa5771 100644 --- a/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/EXTENSIONACTIVITY.java +++ b/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/EXTENSIONACTIVITY.java @@ -1,20 +1,16 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. */ package org.apache.ode.bpel.runtime; @@ -35,62 +31,75 @@ import org.slf4j.LoggerFactory; import org.xml.sax.SAXException; /** - * JacobRunnable that delegates the work of the <code>extensionActivity</code> - * activity to a registered extension implementation. + * JacobRunnable that delegates the work of the <code>extensionActivity</code> activity to a + * registered extension implementation. * * @author Tammo van Lessen (University of Stuttgart) */ public class EXTENSIONACTIVITY extends ACTIVITY { - private static final long serialVersionUID = 1L; - private static final Logger __log = LoggerFactory - .getLogger(EXTENSIONACTIVITY.class); + private static final long serialVersionUID = 1L; + private static final Logger __log = LoggerFactory.getLogger(EXTENSIONACTIVITY.class); private OExtensionActivity _oext; - public EXTENSIONACTIVITY(ActivityInfo self, ScopeFrame scopeFrame, - LinkFrame linkFrame) { - super(self, scopeFrame, linkFrame); - _oext = (OExtensionActivity) _self.o; - } + public EXTENSIONACTIVITY(ActivityInfo self, ScopeFrame scopeFrame, LinkFrame linkFrame) { + super(self, scopeFrame, linkFrame); + _oext = (OExtensionActivity) _self.o; + } - public final void run() { + public final void run() { try { - final ExtensionResponse responseChannel = newChannel(ExtensionResponse.class); - final ExtensionContext helper = new ExtensionContextImpl(_scopeFrame, getBpelRuntimeContext()); + final ExtensionResponse responseChannel = newChannel(ExtensionResponse.class); + final ExtensionContext helper = + new ExtensionContextImpl(_scopeFrame, getBpelRuntimeContext()); - getBpelRuntimeContext().executeExtension(_oext.getExtensionName(), helper, DOMUtils.stringToDOM(_oext.getNestedElement()), responseChannel); - - object(new ReceiveProcess() { - private static final long serialVersionUID = 3643564901004147956L; - }.setChannel(responseChannel).setReceiver(new ExtensionResponse() { - private static final long serialVersionUID = -6977609968638662977L; + getBpelRuntimeContext().executeExtension(_oext.getExtensionName(), helper, + DOMUtils.stringToDOM(_oext.getNestedElement()), responseChannel); - public void onCompleted() { - _self.parent.completed(null, CompensationHandler.emptySet()); - } + object(new ReceiveProcess() { + private static final long serialVersionUID = 3643564901004147956L; + }.setChannel(responseChannel).setReceiver(new ExtensionResponse() { + private static final long serialVersionUID = -6977609968638662977L; - public void onFailure(Throwable t) { - StringWriter sw = new StringWriter(); - t.printStackTrace(new PrintWriter(sw)); - FaultData fault = createFault(_oext.getOwner().getConstants().getQnSubLanguageExecutionFault(), _oext, sw.getBuffer().toString()); - _self.parent.completed(fault, CompensationHandler.emptySet()); - }; + public void onCompleted() { + _self.parent.completed(null, CompensationHandler.emptySet()); + } + + public void onFailure(Throwable t) { + StringWriter sw = new StringWriter(); + t.printStackTrace(new PrintWriter(sw)); + FaultData fault = createFault( + _oext.getOwner().getConstants().getQnSubLanguageExecutionFault(), _oext, + sw.getBuffer().toString()); + _self.parent.completed(fault, CompensationHandler.emptySet()); + }; })); - } catch (FaultException fault) { - __log.error("Exception while invoking extension activity '" + _oext.getName() + "'.", fault); + } catch (FaultException fault) { + __log.error("Exception while invoking extension activity '" + _oext.getName() + "'.", + fault); FaultData faultData = createFault(fault.getQName(), _oext, fault.getMessage()); _self.parent.completed(faultData, CompensationHandler.emptySet()); - } catch (SAXException e) { - __log.error("Exception while invoking extension activity '" + _oext.getName() + "'.", e); - FaultData faultData = createFault(ExtensibilityQNames.INVALID_EXTENSION_ELEMENT, _self.o, "The nested element of extension activity '" + _oext.getName() + "' for extension '" + _oext.getExtensionName() + "' is no valid XML."); - _self.parent.completed(faultData, CompensationHandler.emptySet()); - } catch (IOException e) { - __log.error("Exception while invoking extension activity '" + _oext.getName() + "'.", e); - FaultData faultData = createFault(ExtensibilityQNames.INVALID_EXTENSION_ELEMENT, _self.o, "The nested element of extension activity '" + _oext.getName() + "' for extension '" + _oext.getExtensionName() + "' is no valid XML."); - _self.parent.completed(faultData, CompensationHandler.emptySet()); - } + } catch (SAXException e) { + __log.error("Exception while invoking extension activity '" + _oext.getName() + "'.", + e); + FaultData faultData = + createFault(ExtensibilityQNames.INVALID_EXTENSION_ELEMENT, _self.o, + "The nested element of extension activity '" + _oext.getName() + + "' for extension '" + _oext.getExtensionName() + + "' is no valid XML."); + _self.parent.completed(faultData, CompensationHandler.emptySet()); + } catch (IOException e) { + __log.error("Exception while invoking extension activity '" + _oext.getName() + "'.", + e); + FaultData faultData = + createFault(ExtensibilityQNames.INVALID_EXTENSION_ELEMENT, _self.o, + "The nested element of extension activity '" + _oext.getName() + + "' for extension '" + _oext.getExtensionName() + + "' is no valid XML."); + _self.parent.completed(faultData, CompensationHandler.emptySet()); + } - } + } } http://git-wip-us.apache.org/repos/asf/ode/blob/4b87e5b1/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ExtensionContextImpl.java ---------------------------------------------------------------------- diff --git a/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ExtensionContextImpl.java b/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ExtensionContextImpl.java index f51b449..9e69dc7 100644 --- a/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ExtensionContextImpl.java +++ b/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ExtensionContextImpl.java @@ -1,20 +1,16 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. */ package org.apache.ode.bpel.runtime; @@ -35,83 +31,72 @@ import org.w3c.dom.Node; * @author Tammo van Lessen (University of Stuttgart) */ public class ExtensionContextImpl implements ExtensionContext { - private BpelRuntimeContext _context; - private ScopeFrame _scopeFrame; - - public ExtensionContextImpl(ScopeFrame scopeFrame, - BpelRuntimeContext context) { - _context = context; - _scopeFrame = scopeFrame; - } - - public List<OLink> getLinks() throws FaultException { - // TODO Auto-generated method stub - return null; - } - - public Long getProcessId() { - return _context.getPid(); - } - - public Map<String, OScope.Variable> getVisibleVariables() - throws FaultException { - Map<String, OScope.Variable> visVars = new HashMap<String, OScope.Variable>(); - - OActivity current = _scopeFrame.oscope; - while (current != null) { - if (current instanceof OScope) { - for (String varName : ((OScope) current).getVariables() - .keySet()) { - if (!visVars.containsKey(varName)) { - visVars.put(varName, ((OScope) current).getVariables() - .get(varName)); - } - } - } - current = current.getParent(); - } - - return visVars; - } - - public boolean isLinkActive(OLink olink) throws FaultException { - // TODO Auto-generated method stub - return false; - } - - public String readMessageProperty(Variable variable, OProperty property) - throws FaultException { - VariableInstance vi = _scopeFrame.resolve(variable); - return _context.readProperty(vi, property); - } - - public Node readVariable(OScope.Variable variable) throws FaultException { - VariableInstance vi = _scopeFrame.resolve(variable); - return _context.readVariable(vi.scopeInstance, - vi.declaration.getName(), true); - } - - public void writeVariable(String variableName, Node value) - throws FaultException { - VariableInstance vi = _scopeFrame - .resolve(getVisibleVariable(variableName)); - _context.writeVariable(vi, value); - } - - public Node readVariable(String variableName) throws FaultException { - VariableInstance vi = _scopeFrame - .resolve(getVisibleVariable(variableName)); - return _context.readVariable(vi.scopeInstance, - vi.declaration.getName(), true); - } - - public void writeVariable(Variable variable, Node value) - throws FaultException { - VariableInstance vi = _scopeFrame.resolve(variable); - _context.writeVariable(vi, value); - } - - private Variable getVisibleVariable(String varName) { - return _scopeFrame.oscope.getVisibleVariable(varName); - } + private BpelRuntimeContext _context; + private ScopeFrame _scopeFrame; + + public ExtensionContextImpl(ScopeFrame scopeFrame, BpelRuntimeContext context) { + _context = context; + _scopeFrame = scopeFrame; + } + + public List<OLink> getLinks() throws FaultException { + // TODO Auto-generated method stub + return null; + } + + public Long getProcessId() { + return _context.getPid(); + } + + public Map<String, OScope.Variable> getVisibleVariables() throws FaultException { + Map<String, OScope.Variable> visVars = new HashMap<String, OScope.Variable>(); + + OActivity current = _scopeFrame.oscope; + while (current != null) { + if (current instanceof OScope) { + for (String varName : ((OScope) current).getVariables().keySet()) { + if (!visVars.containsKey(varName)) { + visVars.put(varName, ((OScope) current).getVariables().get(varName)); + } + } + } + current = current.getParent(); + } + + return visVars; + } + + public boolean isLinkActive(OLink olink) throws FaultException { + // TODO Auto-generated method stub + return false; + } + + public String readMessageProperty(Variable variable, OProperty property) throws FaultException { + VariableInstance vi = _scopeFrame.resolve(variable); + return _context.readProperty(vi, property); + } + + public Node readVariable(OScope.Variable variable) throws FaultException { + VariableInstance vi = _scopeFrame.resolve(variable); + return _context.readVariable(vi.scopeInstance, vi.declaration.getName(), true); + } + + public void writeVariable(String variableName, Node value) throws FaultException { + VariableInstance vi = _scopeFrame.resolve(getVisibleVariable(variableName)); + _context.writeVariable(vi, value); + } + + public Node readVariable(String variableName) throws FaultException { + VariableInstance vi = _scopeFrame.resolve(getVisibleVariable(variableName)); + return _context.readVariable(vi.scopeInstance, vi.declaration.getName(), true); + } + + public void writeVariable(Variable variable, Node value) throws FaultException { + VariableInstance vi = _scopeFrame.resolve(variable); + _context.writeVariable(vi, value); + } + + private Variable getVisibleVariable(String varName) { + return _scopeFrame.oscope.getVisibleVariable(varName); + } } http://git-wip-us.apache.org/repos/asf/ode/blob/4b87e5b1/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/channels/ExtensionResponse.java ---------------------------------------------------------------------- diff --git a/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/channels/ExtensionResponse.java b/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/channels/ExtensionResponse.java index 3720391..faf4e5f 100644 --- a/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/channels/ExtensionResponse.java +++ b/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/channels/ExtensionResponse.java @@ -1,20 +1,16 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. */ package org.apache.ode.bpel.runtime.channels; @@ -27,8 +23,8 @@ import org.apache.ode.jacob.Channel; */ public interface ExtensionResponse extends Channel { - void onCompleted(); - - void onFailure(Throwable t); - + void onCompleted(); + + void onFailure(Throwable t); + } http://git-wip-us.apache.org/repos/asf/ode/blob/4b87e5b1/bpel-runtime/src/test/java/org/apache/ode/bpel/elang/xpath20/runtime/MockCompilerContext.java ---------------------------------------------------------------------- diff --git a/bpel-runtime/src/test/java/org/apache/ode/bpel/elang/xpath20/runtime/MockCompilerContext.java b/bpel-runtime/src/test/java/org/apache/ode/bpel/elang/xpath20/runtime/MockCompilerContext.java index ff92db5..561e79f 100644 --- a/bpel-runtime/src/test/java/org/apache/ode/bpel/elang/xpath20/runtime/MockCompilerContext.java +++ b/bpel-runtime/src/test/java/org/apache/ode/bpel/elang/xpath20/runtime/MockCompilerContext.java @@ -251,7 +251,7 @@ public class MockCompilerContext implements CompilerContext { } public boolean isExtensionDeclared(String namespace) { - // TODO Auto-generated method stub - return false; - } + // TODO Auto-generated method stub + return false; + } } http://git-wip-us.apache.org/repos/asf/ode/blob/4b87e5b1/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/CoreBpelTest.java ---------------------------------------------------------------------- diff --git a/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/CoreBpelTest.java b/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/CoreBpelTest.java index 18dd7a8..aa3a871 100644 --- a/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/CoreBpelTest.java +++ b/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/CoreBpelTest.java @@ -482,10 +482,9 @@ public class CoreBpelTest extends TestCase implements BpelRuntimeContext { public void checkInvokeExternalPermission() {} - public void executeExtension(QName extensionId, ExtensionContext context, - Element element, - ExtensionResponse extResponseChannel) throws FaultException { - // TODO Auto-generated method stub - - } + public void executeExtension(QName extensionId, ExtensionContext context, Element element, + ExtensionResponse extResponseChannel) throws FaultException { + // TODO Auto-generated method stub + + } }
