Merge branch 'master' of https://github.com/apache/ode
diff --git a/Gemfile b/Gemfile
index 7c016bc..043be3d 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,6 +1,6 @@
source 'https://rubygems.org'
-gem 'buildr', '>= 1.5.3'
+gem 'buildr', '= 1.5.3'
# rspec dependencies for check()
gem 'rspec-expectations', '= 2.14.3'
diff --git a/Rakefile b/Rakefile
index 63bd0fe..eec6027 100644
--- a/Rakefile
+++ b/Rakefile
@@ -102,7 +102,7 @@
libs = projects("axis2", "bpel-api", "bpel-compiler", "bpel-connector", "bpel-dao",
"bpel-epr", "bpel-nobj", "bpel-obj", "bpel-ql", "bpel-runtime", "scheduler-simple",
"bpel-schemas", "bpel-store", "dao-hibernate", "jca-ra", "jca-server",
- "utils", "dao-jpa", "agents", "clustering"),
+ "utils", "dao-jpa", "agents", "clustering", "bpel-rest-extensions"),
AXIS2_ALL, ANNONGEN, BACKPORT, COMMONS.codec, COMMONS.collections, COMMONS.fileupload, COMMONS.io, COMMONS.httpclient, COMMONS.beanutils,
COMMONS.lang, COMMONS.pool, DERBY, DERBY_TOOLS, JACOB, JAXEN, JAVAX.activation, JAVAX.ejb, JAVAX.javamail,
JAVAX.connector, JAVAX.jms, JAVAX.persistence, JAVAX.transaction, JAVAX.stream, JIBX,
@@ -323,7 +323,7 @@
SPRING_TEST, COMMONS.codec, SLF4J, LOG4J2
test.using :properties=>{ "org.apache.ode.autoRetireProcess"=>"true" }
- test.with projects("bpel-nobj", "bpel-obj", "bpel-schemas", "bpel-scripts"),
+ test.with projects("bpel-nobj", "bpel-obj", "bpel-schemas", "bpel-scripts", "bpel-rest-extensions"),
COMMONS.collections, COMMONS.lang, DERBY, JACOB, JAVAX.connector,
JAVAX.stream, JAVAX.transaction, JAVAX.connector, JAXEN, HSQLDB, SAXON, XERCES, XMLBEANS, XALAN, GERONIMO.transaction, SPRING, HIBERNATE, DOM4J, H2::REQUIRES, JACKSON
@@ -514,7 +514,7 @@
# libs = artifacts(package(:jar),
# projects("bpel-api", "bpel-api-jca", "bpel-compiler", "bpel-connector", "bpel-dao",
# "bpel-epr", "jca-ra", "jca-server", "bpel-nobj", "bpel-ql", "bpel-runtime",
-# "scheduler-simple", "bpel-schemas", "bpel-store", "dao-hibernate", "dao-jpa", "utils", "agents"),
+# "scheduler-simple", "bpel-schemas", "bpel-store", "dao-hibernate", "dao-jpa", "utils", "agents", "bpel-rest-extensions"),
# ANT, AXIOM, BACKPORT, COMMONS.codec, COMMONS.collections, COMMONS.dbcp, COMMONS.lang, COMMONS.pool,
# COMMONS.primitives, DERBY, GERONIMO.connector, GERONIMO.transaction, JACOB, JAVAX.connector,
# JAVAX.ejb, JAVAX.jms, JAVAX.persistence, JAVAX.stream, JAVAX.transaction, JAXEN, OPENJPA,
@@ -647,7 +647,7 @@
# define "jbi-bundle" do
# ode_libs = artifacts(projects("bpel-api", "bpel-api-jca", "bpel-compiler", "bpel-connector", "bpel-dao", "bpel-epr",
# "jca-ra", "jca-server", "bpel-nobj", "bpel-obj", "bpel-ql", "bpel-runtime", "scheduler-simple",
-# "bpel-schemas", "bpel-store", "dao-hibernate", "dao-jpa", "utils", "agents"))
+# "bpel-schemas", "bpel-store", "dao-hibernate", "dao-jpa", "utils", "agents", "bpel-rest-extensions"))
# libs = artifacts(ANT, AXIOM, BACKPORT, COMMONS.codec, COMMONS.collections, COMMONS.dbcp, COMMONS.lang, COMMONS.pool,
# COMMONS.primitives, COMMONS.io, DERBY, GERONIMO.connector, GERONIMO.transaction, JACOB, JAVAX.connector,
# JAVAX.ejb, JAVAX.jms, JAVAX.persistence, JAVAX.stream, JAVAX.transaction, JAXEN, LOG4J2, OPENJPA,
@@ -718,6 +718,12 @@
package(:jar).with :manifest=>_("src/main/resources/META-INF/MANIFEST.MF")
end
+ desc "BPEL REST Extensions"
+ define "bpel-rest-extensions" do
+ compile.with projects("bpel-api", "bpel-nobj", "bpel-runtime", "utils"), COMMONS.codec, COMMONS.httpclient, SLF4J, LOG4J2
+ package :jar
+ end
+
# sources and javadocs of jbi-karaf-examples are packaged separately.
# package_with_sources :except => ["jbi-karaf-examples:helloworld2-osgi", "jbi-karaf-examples:ping-pong-osgi"]
# package_with_javadoc :except => ["jbi-karaf-examples:helloworld2-osgi", "jbi-karaf-examples:ping-pong-osgi"] unless ENV["JAVADOC"] =~ /^(no|off|false|skip)$/i
diff --git a/axis2-war/src/main/webapp/WEB-INF/conf/ode-axis2.properties b/axis2-war/src/main/webapp/WEB-INF/conf/ode-axis2.properties
index 03ac79c..ed6d2d1 100644
--- a/axis2-war/src/main/webapp/WEB-INF/conf/ode-axis2.properties
+++ b/axis2-war/src/main/webapp/WEB-INF/conf/ode-axis2.properties
@@ -101,3 +101,7 @@
## Clustering Implementation class.
#ode-axis2.clustering.impl.class = org.apache.ode.clustering.hazelcast.HazelcastClusterImpl
+
+## Extension Bundles
+## FQCNs, comma separated.
+#ode-axis2.extension.bundles=[packageName].[bundleClassName]
diff --git a/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java b/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java
index e002695..2d9f0ca 100644
--- a/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java
+++ b/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java
@@ -19,13 +19,38 @@
package org.apache.ode.axis2;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Properties;
+import java.util.StringTokenizer;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ThreadFactory;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.sql.DataSource;
+import javax.transaction.HeuristicMixedException;
+import javax.transaction.HeuristicRollbackException;
+import javax.transaction.InvalidTransactionException;
+import javax.transaction.NotSupportedException;
+import javax.transaction.RollbackException;
+import javax.transaction.Synchronization;
+import javax.transaction.SystemException;
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+import javax.transaction.xa.XAResource;
+
import org.apache.axis2.AxisFault;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
import org.apache.commons.httpclient.params.HttpConnectionManagerParams;
import org.apache.commons.httpclient.util.IdleConnectionTimeoutThread;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.apache.ode.axis2.deploy.DeploymentPoller;
import org.apache.ode.axis2.service.DeploymentWebService;
import org.apache.ode.axis2.service.ManagementService;
@@ -35,11 +60,17 @@
import org.apache.ode.bpel.clapi.ClusterProcessStore;
import org.apache.ode.bpel.connector.BpelServerConnector;
import org.apache.ode.bpel.dao.BpelDAOConnectionFactory;
+import org.apache.ode.bpel.eapi.AbstractExtensionBundle;
import org.apache.ode.bpel.engine.BpelServerImpl;
import org.apache.ode.bpel.engine.CountLRUDehydrationPolicy;
import org.apache.ode.bpel.engine.cron.CronScheduler;
import org.apache.ode.bpel.extvar.jdbc.JdbcExternalVariableModule;
-import org.apache.ode.bpel.iapi.*;
+import org.apache.ode.bpel.iapi.BpelEventListener;
+import org.apache.ode.bpel.iapi.EndpointReferenceContext;
+import org.apache.ode.bpel.iapi.ProcessConf;
+import org.apache.ode.bpel.iapi.ProcessStoreEvent;
+import org.apache.ode.bpel.iapi.ProcessStoreListener;
+import org.apache.ode.bpel.iapi.Scheduler;
import org.apache.ode.bpel.intercept.MessageExchangeInterceptor;
import org.apache.ode.bpel.memdao.BpelDAOConnectionFactoryImpl;
import org.apache.ode.bpel.pmapi.InstanceManagement;
@@ -52,20 +83,8 @@
import org.apache.ode.store.ProcessStoreImpl;
import org.apache.ode.utils.GUID;
import org.apache.ode.utils.fs.TempFileManager;
-
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
-import javax.sql.DataSource;
-import javax.transaction.*;
-import javax.transaction.xa.XAResource;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.*;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ThreadFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Server class called by our Axis hooks to handle all ODE lifecycle management.
@@ -195,6 +214,7 @@
registerEventListeners();
registerMexInterceptors();
registerExternalVariableModules();
+ registerExtensionActivityBundles();
_store.loadAll();
if (_clusterManager != null) {
@@ -691,6 +711,30 @@
}
+ // Add support for extension bundles based on ODE 2.0 alpha branch
+ private void registerExtensionActivityBundles() {
+ String extensionsStr = _odeConfig.getExtensionActivityBundles();
+
+ if (extensionsStr != null) {
+ // TODO replace StringTokenizer by regex
+ for (String bundleCN : extensionsStr.split("\\s*(,|;)\\s*")) {
+ try {
+ // instantiate bundle
+ AbstractExtensionBundle bundle = (AbstractExtensionBundle) Class
+ .forName(bundleCN).newInstance();
+
+ // register extension bundle (BPEL server)
+ _bpelServer.registerExtensionBundle(bundle);
+ } catch (Exception e) {
+ __log.warn("Couldn't register the extension bundle runtime "
+ + bundleCN
+ + ", the class couldn't be "
+ + "loaded properly.");
+ }
+ }
+ }
+ }
+
private class ProcessStoreListenerImpl implements ProcessStoreListener {
public void onProcessStoreEvent(ProcessStoreEvent event) {
diff --git a/bpel-api/src/main/java/org/apache/ode/bpel/eapi/AbstractExtensionBundle.java b/bpel-api/src/main/java/org/apache/ode/bpel/eapi/AbstractExtensionBundle.java
new file mode 100644
index 0000000..2210242
--- /dev/null
+++ b/bpel-api/src/main/java/org/apache/ode/bpel/eapi/AbstractExtensionBundle.java
@@ -0,0 +1,71 @@
+/*
+ * 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
+ *
+ * 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.eapi;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+/**
+* Abstract class that bundles and registers <code><extensionActivity></code> and
+* <code><extensionAssignOperation></code> implementations related to a particular namespace.
+*
+* @author Tammo van Lessen (University of Stuttgart)
+*/
+public abstract class AbstractExtensionBundle {
+ private Map<String, Class<? extends ExtensionOperation>> extensionsByName = new HashMap<String, Class<? extends ExtensionOperation>>();
+
+ /**
+ * Returns the extension namespace this bundle provides implementations for.
+ * @return
+ */
+ public abstract String getNamespaceURI();
+
+ /**
+ * Register extension operations.
+ */
+ public abstract void registerExtensionActivities();
+
+ /**
+ * Register an {@link ExtensionOperation} implementation as <code><extensionActivity></code>.
+ *
+ * @param localName
+ * @param activity
+ */
+ protected final void registerExtensionOperation(String localName, Class<? extends ExtensionOperation> operation) {
+ extensionsByName.put(localName, operation);
+ }
+
+ /**
+ * Returns a list of the local names of registered extension operations.
+ */
+ public final Set<String> getExtensionOperationNames() {
+ return Collections.unmodifiableSet(extensionsByName.keySet());
+ }
+
+ public final Class<? extends ExtensionOperation> getExtensionOperationClass(String localName) {
+ return extensionsByName.get(localName);
+ }
+
+ public final ExtensionOperation getExtensionOperationInstance(String localName) throws InstantiationException, IllegalAccessException {
+ return getExtensionOperationClass(localName).newInstance();
+ }
+
+}
diff --git a/bpel-api/src/main/java/org/apache/ode/bpel/eapi/ExtensionContext.java b/bpel-api/src/main/java/org/apache/ode/bpel/eapi/ExtensionContext.java
new file mode 100644
index 0000000..2ffbba7
--- /dev/null
+++ b/bpel-api/src/main/java/org/apache/ode/bpel/eapi/ExtensionContext.java
@@ -0,0 +1,128 @@
+/*
+ * 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
+ *
+ * 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.eapi;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.ode.bpel.common.FaultException;
+import org.apache.ode.bpel.obj.OLink;
+import org.apache.ode.bpel.obj.OProcess;
+import org.apache.ode.bpel.obj.OScope;
+import org.w3c.dom.Node;
+
+
+/**
+ * Context for executing extension activities or extension assign operations.
+ * Implementations of the {@link ExtensionOperation} class use this interface to access BPEL
+ * variables, property sets and link status.
+ *
+ * @author Tammo van Lessen (University of Stuttgart)
+ */
+public interface ExtensionContext {
+
+ /**
+ * Returns a list of variables visible in the current scope.
+ *
+ * @return an unmodifiable list of visible variables.
+ * @throws FaultException
+ */
+ Map<String, OScope.Variable> getVisibleVariables() throws FaultException;
+
+ /**
+ * Returns a list of links.
+ *
+ * @return an unmodifiable list of visible variables.
+ * @throws FaultException
+ */
+ List<OLink> getLinks() throws FaultException;
+
+ /**
+ * Read the value of a BPEL variable.
+ *
+ * @param variable
+ * variable to read
+ * @param part
+ * the part (or <code>null</code>)
+ * @return the value of the variable, wrapped in a <code>Node</code>
+ */
+ Node readVariable(OScope.Variable variable) throws FaultException;
+
+ /**
+ * Read the value of a BPEL variable.
+ *
+ * @param variableName
+ * variable to read
+ * @param part
+ * the part (or <code>null</code>)
+ * @return the value of the variable, wrapped in a <code>Node</code>
+ */
+ Node readVariable(String variableName) throws FaultException;
+
+ /**
+ * Write the value into a BPEL variable.
+ *
+ * @param variable
+ * variable to write
+ * @param value
+ * the value to be stored into the variable
+ * @return the value of the variable, wrapped in a <code>Node</code>
+ */
+ void writeVariable(OScope.Variable variable, Node value) throws FaultException;
+
+ /**
+ * Write the value into a BPEL variable.
+ *
+ * @param variableName
+ * variable to write
+ * @param value
+ * the value to be stored into the variable
+ * @return the value of the variable, wrapped in a <code>Node</code>
+ */
+ void writeVariable(String variableName, Node value) throws FaultException;
+
+ /**
+ * Read the value of a BPEL property.
+ *
+ * @param variable
+ * variable containing property
+ * @param property
+ * property to read
+ * @return value of the property
+ */
+ String readMessageProperty(OScope.Variable variable, OProcess.OProperty property)
+ throws FaultException;
+
+ /**
+ * Obtain the status of a control link.
+ *
+ * @param olink
+ * link to check
+ * @return <code>true</code> if the link is active, <code>false</code>
+ * otherwise.
+ */
+ boolean isLinkActive(OLink olink) throws FaultException;
+
+ /**
+ * Reads the current process instance id.
+ * @return instance id
+ */
+ Long getProcessId();
+
+}
diff --git a/bpel-api/src/main/java/org/apache/ode/bpel/eapi/ExtensionOperation.java b/bpel-api/src/main/java/org/apache/ode/bpel/eapi/ExtensionOperation.java
new file mode 100644
index 0000000..8bcba6c
--- /dev/null
+++ b/bpel-api/src/main/java/org/apache/ode/bpel/eapi/ExtensionOperation.java
@@ -0,0 +1,39 @@
+/*
+ * 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
+ *
+ * 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.eapi;
+
+import org.apache.ode.bpel.common.FaultException;
+import org.w3c.dom.Element;
+
+/**
+ * This is the basis interface for implementations of
+ * <code><extensionAssignOperation></code> and <code><extensionActivity></code>
+ * nodes.
+ *
+ * Implementations of this interface must provide a default constructor as they are created
+ * using reflection.
+ *
+ * @see AbstractExtensionBundle
+ *
+ * @author Tammo van Lessen (University of Stuttgart)
+ */
+public interface ExtensionOperation {
+
+ void run(ExtensionContext context, Element element) throws FaultException;
+}
diff --git a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/AssignGenerator.java b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/AssignGenerator.java
index a2b5f25..79cf3eb 100644
--- a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/AssignGenerator.java
+++ b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/AssignGenerator.java
@@ -23,7 +23,9 @@
import org.apache.ode.bpel.compiler.api.CompilationException;
import org.apache.ode.bpel.compiler.bom.Activity;
import org.apache.ode.bpel.compiler.bom.AssignActivity;
+import org.apache.ode.bpel.compiler.bom.AssignActivity.AssignOperation;
import org.apache.ode.bpel.compiler.bom.Copy;
+import org.apache.ode.bpel.compiler.bom.ExtensionAssignOperation;
import org.apache.ode.bpel.compiler.bom.ExtensionVal;
import org.apache.ode.bpel.compiler.bom.From;
import org.apache.ode.bpel.compiler.bom.LiteralVal;
@@ -48,6 +50,7 @@
* Generates code for <code><assign></code> activities.
*
* @author Maciej Szefler ( m s z e f l e r @ g m a i l . c o m )
+ * @author Tammo van Lessen (University of Stuttgart)
*/
class AssignGenerator extends DefaultActivityGenerator {
private static final Logger __log = LoggerFactory.getLogger(AssignGenerator.class);
@@ -62,7 +65,9 @@
public void compile(OActivity dest, Activity source) {
OAssign oassign = (OAssign) dest;
AssignActivity ad = (AssignActivity) source;
- for (Copy scopy : ad.getCopies()) {
+ for (AssignOperation operation : ad.getOperations()) {
+ if (operation instanceof Copy) {
+ Copy scopy = (Copy) operation;
OAssign.Copy ocopy = new OAssign.Copy(_context.getOProcess());
ocopy.setKeepSrcElementName(scopy.isKeepSrcElement());
ocopy.setIgnoreMissingFromData(scopy.isIgnoreMissingFromData());
@@ -81,11 +86,40 @@
ocopy.setFrom(compileFrom(scopy.getFrom(), toResultType[0]));
verifyCopy(ocopy);
- oassign.getCopy().add(ocopy);
+ oassign.getOperations().add(ocopy);
} catch (CompilationException ce) {
_context.recoveredFromError(scopy, ce);
}
+ } else if (operation instanceof ExtensionAssignOperation) {
+ ExtensionAssignOperation sop = (ExtensionAssignOperation) operation;
+ OAssign.ExtensionAssignOperation oext = new OAssign.ExtensionAssignOperation(
+ _context.getOProcess());
+ oext.setDebugInfo(new DebugInfo(_context.getSourceLocation(),
+ sop.getLineNo(), source.getExtensibilityElements()));
+ try {
+ if (source.is20Draft()) {
+ throw new CompilationException(
+ __cmsgs.errExtensibleAssignNotSupported());
+ }
+ Element el = sop.getNestedElement();
+ if (el == null) {
+ throw new CompilationException(__cmsgs
+ .errMissingExtensionAssignOperationElement()
+ .setSource(sop));
+ }
+ if (!_context.isExtensionDeclared(el.getNamespaceURI())) {
+ throw new CompilationException(__cmsgs
+ .errUndeclaredExtensionAssignOperation()
+ .setSource(sop));
+ }
+ oext.setExtensionName(DOMUtils.getElementQName(el));
+ oext.setNestedElement(DOMUtils.domToString(el));
+ oassign.getOperations().add(oext);
+ } catch (CompilationException ce) {
+ _context.recoveredFromError(sop, ce);
+ }
+ }
}
}
diff --git a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/AssignGeneratorMessages.java b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/AssignGeneratorMessages.java
index 74252dc..abef091 100644
--- a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/AssignGeneratorMessages.java
+++ b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/AssignGeneratorMessages.java
@@ -86,4 +86,18 @@
return this.formatCompilationMessage("To-spec format is unrecognized.");
}
+ /**ExtensionAssignOperation's nested element missing*/
+ public CompilationMessage errMissingExtensionAssignOperationElement(){
+ return this.formatCompilationMessage("Extensibility element in <extensionAssignOperation> is missing.");
+ }
+
+ /**ExtensionAssignOperation's nested element missing*/
+ public CompilationMessage errUndeclaredExtensionAssignOperation(){
+ return this.formatCompilationMessage("Extension namespace of <extensionAssignOperation> has not been declared.");
+ }
+
+ /**Draft extensibleAssign is not supported.*/
+ public CompilationMessage errExtensibleAssignNotSupported(){
+ return this.formatCompilationMessage("ExtensibleAssign is not supported, please upgrade to BPEL 2.0 final.");
+ }
}
diff --git a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelC.java b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelC.java
index ff1bd34..9436838 100644
--- a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelC.java
+++ b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelC.java
@@ -522,5 +522,4 @@
}
}
}
-
}
diff --git a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler.java b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler.java
index 00d8ccd..b29580a 100644
--- a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler.java
+++ b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler.java
@@ -63,6 +63,7 @@
import org.apache.ode.bpel.compiler.bom.CorrelationSet;
import org.apache.ode.bpel.compiler.bom.Expression;
import org.apache.ode.bpel.compiler.bom.Expression11;
+import org.apache.ode.bpel.compiler.bom.Extension;
import org.apache.ode.bpel.compiler.bom.FaultHandler;
import org.apache.ode.bpel.compiler.bom.Import;
import org.apache.ode.bpel.compiler.bom.LinkSource;
@@ -138,7 +139,7 @@
private Date _generatedDate;
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("rawtypes")
private HashMap<Class, ActivityGenerator> _actGenerators = new HashMap<Class, ActivityGenerator>();
private boolean _supressJoinFailure = false;
@@ -182,6 +183,8 @@
private URI _processURI;
+ private final Set<String> _declaredExtensionNS = new HashSet<String>();
+
BpelCompiler(WSDLFactory4BPEL wsdlFactory) {
_wsdlFactory = wsdlFactory;
_wsdlRegistry = new WSDLRegistry(this);
@@ -733,6 +736,11 @@
}
}
+ // compile extensions
+ for (Extension e : _processDef.getExtensions()) {
+ compileExtension(e);
+ }
+
OScope procesScope = new OScope(_oprocess, null);
procesScope.setName("__PROCESS_SCOPE:" + (process.getName()));
procesScope.setDebugInfo(createDebugInfo(process, null));
@@ -1628,17 +1636,41 @@
for (OActivity act : _compiledActivities) {
if (act instanceof OAssign) {
OAssign assign = (OAssign) act;
- for (OAssign.Copy copy : assign.getCopy()) {
- if (copy.getTo() instanceof OAssign.PartnerLinkRef) {
- if (((OAssign.PartnerLinkRef) copy.getTo()).getPartnerLink().getName().equals(plink))
- return true;
- }
- }
+ for (OAssign.OAssignOperation operation : assign.getOperations()) {
+ if (operation instanceof OAssign.Copy) {
+ OAssign.Copy copy = (OAssign.Copy) operation;
+ if (copy.getTo() instanceof OAssign.PartnerLinkRef) {
+ if (((OAssign.PartnerLinkRef) copy.getTo()).getPartnerLink()
+ .getName().equals(plink))
+ return true;
+ }
+ }
+ }
}
}
return false;
}
+ /**
+ * Registers a declared extension. Since compilation may take place
+ * independently of the target engine configuration, the compiler will not
+ * check whether a extension implementation is registered.
+ */
+ private void compileExtension(Extension ext) {
+ OProcess.OExtension oextension = new OProcess.OExtension(_oprocess);
+ oextension.setNamespace(ext.getNamespaceURI());
+ oextension.setMustUnderstand(ext.isMustUnderstand());
+
+ oextension.setDebugInfo(createDebugInfo(_processDef,
+ "Extension " + ext.getNamespaceURI()));
+
+ _declaredExtensionNS.add(ext.getNamespaceURI());
+ _oprocess.getDeclaredExtensions().add(oextension);
+
+ if (__log.isDebugEnabled())
+ __log.debug("Compiled extension " + oextension);
+ }
+
public Definition[] getWsdlDefinitions() {
Definition[] result = new Definition[_wsdlRegistry.getDefinitions().length];
for (int m = 0; m < _wsdlRegistry.getDefinitions().length; m++) {
@@ -1657,7 +1689,7 @@
return type;
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("rawtypes")
private ActivityGenerator findActivityGen(Activity source) {
Class actClass = source.getClass();
@@ -1674,7 +1706,7 @@
throw new CompilationException(__cmsgs.errUnknownActivity(actClass.getName()).setSource(source));
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("rawtypes")
protected void registerActivityCompiler(Class defClass, ActivityGenerator generator) {
if (__log.isDebugEnabled()) {
__log.debug("Adding compiler for nodes class \"" + defClass.getName() + " = " + generator);
@@ -1709,12 +1741,16 @@
_expLanguageCompilers.put(expLangUri, expressionCompiler);
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("rawtypes")
protected void registerExpressionLanguage(String expLangUri, String classname) throws Exception {
Class cls = Class.forName(classname);
registerExpressionLanguage(expLangUri, (ExpressionCompiler) cls.newInstance());
}
+ public boolean isExtensionDeclared(String namespace) {
+ return _declaredExtensionNS.contains(namespace);
+ }
+
public List<OActivity> getActivityStack() {
ArrayList<OActivity> rval = new ArrayList<OActivity>(_structureStack._stack);
Collections.reverse(rval);
diff --git a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler20.java b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler20.java
index 7bba612..e4b1f0d 100644
--- a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler20.java
+++ b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler20.java
@@ -23,6 +23,7 @@
import org.apache.ode.bpel.compiler.bom.CompensateActivity;
import org.apache.ode.bpel.compiler.bom.CompensateScopeActivity;
import org.apache.ode.bpel.compiler.bom.EmptyActivity;
+import org.apache.ode.bpel.compiler.bom.ExtensionActivity;
import org.apache.ode.bpel.compiler.bom.FlowActivity;
import org.apache.ode.bpel.compiler.bom.ForEachActivity;
import org.apache.ode.bpel.compiler.bom.IfActivity;
@@ -71,6 +72,7 @@
registerActivityCompiler(TerminateActivity.class, new TerminateGenerator());
registerActivityCompiler(RethrowActivity.class, new RethrowGenerator());
registerActivityCompiler(ForEachActivity.class, new ForEachGenerator());
+ registerActivityCompiler(ExtensionActivity.class, new ExtensionActivtityGenerator());
registerExpressionLanguage(OASIS_EXPLANG_XPATH_1_0, new XPath10ExpressionCompilerBPEL20());
diff --git a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler20Draft.java b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler20Draft.java
index 8faf69a..bb9f082 100644
--- a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler20Draft.java
+++ b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler20Draft.java
@@ -23,6 +23,7 @@
import org.apache.ode.bpel.compiler.bom.Bpel20QNames;
import org.apache.ode.bpel.compiler.bom.CompensateScopeActivity;
import org.apache.ode.bpel.compiler.bom.EmptyActivity;
+import org.apache.ode.bpel.compiler.bom.ExtensionActivity;
import org.apache.ode.bpel.compiler.bom.FlowActivity;
import org.apache.ode.bpel.compiler.bom.ForEachActivity;
import org.apache.ode.bpel.compiler.bom.IfActivity;
@@ -70,6 +71,7 @@
registerActivityCompiler(TerminateActivity.class, new TerminateGenerator());
registerActivityCompiler(RethrowActivity.class, new RethrowGenerator());
registerActivityCompiler(ForEachActivity.class, new ForEachGenerator());
+ registerActivityCompiler(ExtensionActivity.class, new ExtensionActivtityGenerator());
registerExpressionLanguage(OASIS_EXPLANG_XPATH_1_0, new XPath10ExpressionCompilerBPEL20Draft());
try {
diff --git a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ExtensionActivityGeneratorMessages.java b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ExtensionActivityGeneratorMessages.java
new file mode 100644
index 0000000..5971bc8
--- /dev/null
+++ b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ExtensionActivityGeneratorMessages.java
@@ -0,0 +1,43 @@
+/*
+ * 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
+ *
+ * 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.compiler;
+
+import org.apache.ode.bpel.compiler.api.CompilationMessage;
+import org.apache.ode.bpel.compiler.api.CompilationMessageBundle;
+
+/**
+ * @author Tammo van Lessen (University of Stuttgart)
+ */
+public class ExtensionActivityGeneratorMessages extends
+ CompilationMessageBundle {
+
+ /** ExtensionActivity is empty. */
+ public CompilationMessage errMissingExtensionActivityElement() {
+ return this
+ .formatCompilationMessage("Extensibility element in <extensionActivity> is missing.");
+ }
+
+ /** Extension namespace is not yet declared. */
+ public CompilationMessage errUndeclaredExtensionActivity() {
+ return this
+ .formatCompilationMessage("Extension namespace of <extensionActivity> has not been declared.");
+ }
+
+}
diff --git a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ExtensionActivtityGenerator.java b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ExtensionActivtityGenerator.java
new file mode 100644
index 0000000..25b298a
--- /dev/null
+++ b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ExtensionActivtityGenerator.java
@@ -0,0 +1,81 @@
+/*
+ * 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
+ *
+ * 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.compiler;
+
+import org.apache.ode.bpel.compiler.api.CompilationException;
+import org.apache.ode.bpel.compiler.bom.Activity;
+import org.apache.ode.bpel.compiler.bom.CompositeActivity;
+import org.apache.ode.bpel.compiler.bom.ExtensionActivity;
+import org.apache.ode.bpel.obj.OActivity;
+import org.apache.ode.bpel.obj.OExtensionActivity;
+import org.apache.ode.utils.DOMUtils;
+import org.apache.ode.utils.msg.MessageBundle;
+import org.w3c.dom.Element;
+
+/**
+ * Generates code for <code><empty></code> activities.
+ *
+ * @author Tammo van Lessen
+ */
+public class ExtensionActivtityGenerator extends DefaultActivityGenerator {
+ private static final ExtensionActivityGeneratorMessages __cmsgs = MessageBundle
+ .getMessages(ExtensionActivityGeneratorMessages.class);
+
+ public void compile(OActivity output, Activity srcx) {
+ ExtensionActivity src = (ExtensionActivity) srcx;
+ OExtensionActivity oactivity = (OExtensionActivity) output;
+ Element child = src.getFirstExtensibilityElement();
+ try {
+ if (child == null) {
+ throw new CompilationException(
+ __cmsgs.errMissingExtensionActivityElement());
+ }
+ if (!_context.isExtensionDeclared(child.getNamespaceURI())) {
+ throw new CompilationException(__cmsgs
+ .errUndeclaredExtensionActivity().setSource(src));
+ }
+
+ oactivity.setExtensionName(DOMUtils.getElementQName(child));
+ oactivity.setNestedElement(DOMUtils.domToString(child));
+
+ compileChildren(oactivity, (ExtensionActivity) src);
+
+ } catch (CompilationException e) {
+ _context.recoveredFromError(src, e);
+ }
+ }
+
+ public OActivity newInstance(Activity src) {
+ return new OExtensionActivity(_context.getOProcess(),
+ _context.getCurrent());
+ }
+
+ protected void compileChildren(OExtensionActivity dest,
+ CompositeActivity src) {
+ for (Activity child : src.getActivities()) {
+ try {
+ OActivity compiledChild = _context.compile(child);
+ dest.getChildren().add(compiledChild);
+ } catch (CompilationException ce) {
+ _context.recoveredFromError(child, ce);
+ }
+ }
+ }
+
+}
diff --git a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/api/CompilerContext.java b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/api/CompilerContext.java
index 5d9f634..457bdb0 100644
--- a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/api/CompilerContext.java
+++ b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/api/CompilerContext.java
@@ -146,6 +146,8 @@
Map<URI, Source> getSchemaSources();
+ boolean isExtensionDeclared(String namespace);
+
/**
* Retrieves the base URI that the BPEL Process execution contextis running relative to.
*
diff --git a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/AssignActivity.java b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/AssignActivity.java
index f503a83..8c436f4 100644
--- a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/AssignActivity.java
+++ b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/AssignActivity.java
@@ -18,6 +18,7 @@
*/
package org.apache.ode.bpel.compiler.bom;
+import java.util.ArrayList;
import java.util.List;
import org.w3c.dom.Element;
@@ -26,6 +27,9 @@
* BOM representation of the BPEL <code><assign></code> activity. The
* <code><assign></code> activity is simply a collection of
* <code><copy></code> entries ({@link Copy}).
+ *
+ * @author Ode team
+ * @author Tammo van Lessen (University of Stuttgart)
*/
public class AssignActivity extends Activity {
@@ -41,4 +45,38 @@
public List<Copy> getCopies() {
return getChildren(Copy.class);
}
+
+ /**
+ * Get the list of <code><extensionAssignOperation></code> entries for this activity.
+ *
+ * @return extensionAssignOperation entries
+ */
+ public List<ExtensionAssignOperation> getExtensionAssignOperations() {
+ return getChildren(ExtensionAssignOperation.class);
+ }
+
+ /**
+ * Get the list of all assign operation entries (<code>copy</code>
+ * and <code>extensionAssignOperation</code>) for this activity.
+ *
+ * @return assign operation entries
+ */
+ public List<AssignOperation> getOperations() {
+ //all children objects
+ List<BpelObject> children = getChildren(BpelObject.class);
+
+ //aggregate only copy and extensionAssignOperation entries
+ List<AssignOperation> ops = new ArrayList<AssignOperation>();
+ for (BpelObject bo: children) {
+ if ((bo instanceof Copy)
+ ||(bo instanceof ExtensionAssignOperation)) {
+ ops.add((AssignOperation)bo);
+ }
+ }
+
+ return ops;
+ }
+
+ /** Marker interface for assign operations */
+ public static interface AssignOperation {}
}
diff --git a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Bpel20QNames.java b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Bpel20QNames.java
index 492514e..3e962a0 100644
--- a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Bpel20QNames.java
+++ b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Bpel20QNames.java
@@ -109,6 +109,10 @@
public static final QName FINAL_PROPQUERY = new QName(NS_WSBPEL2_0_FINAL_VARPROP, "query");
public static final QName FINAL_PLINKTYPE = new QName(NS_WSBPEL2_0_FINAL_PLINK, "partnerLinkType");
public static final QName FINAL_PLINKROLE = new QName(NS_WSBPEL2_0_FINAL_PLINK, "role");
+ public static final QName FINAL_EXTENSIONS = newFinalQName("extensions");
+ public static final QName FINAL_EXTENSION = newFinalQName("extension");
+ public static final QName FINAL_EXTENSION_ASSIGN_OPERATION = newFinalQName("extensionAssignOperation");
+ public static final QName FINAL_EXTENSION_ACTIVITY = newFinalQName("extensionActivity");
/** Some BPEL 2.0 Draft Elements **/
public static final QName PROCESS = newQName("process");
@@ -183,6 +187,10 @@
public static final QName PROPERTY = newQName("property");
public static final QName PLINKTYPE = new QName(NS_WSBPEL_PARTNERLINK_2004_03, "partnerLinkType");
public static final QName PLINKROLE = new QName(NS_WSBPEL_PARTNERLINK_2004_03, "role");
+ public static final QName EXTENSIONS = newQName("extensions");
+ public static final QName EXTENSION = newQName("extension");
+ public static final QName EXTENSIBLE_ASSIGN = newQName("extensibleAssign");
+ public static final QName EXTENSION_ACTIVITY = newQName("extensionActivity");
/** Not part of BPEL, but handy to have. */
public static final String NS_RDF = "http://www.w3.org/2000/01/rdf-schema#";
diff --git a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/BpelObject.java b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/BpelObject.java
index d479265..b300db6 100644
--- a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/BpelObject.java
+++ b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/BpelObject.java
@@ -130,7 +130,7 @@
return e.getElement();
}
- public Element getFirstExtensibilityElementElement() {
+ public Element getFirstExtensibilityElement() {
Element child = null;
NodeList nl = getElement().getChildNodes();
for (int i = 0; i < nl.getLength(); ++i) {
diff --git a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/BpelObjectFactory.java b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/BpelObjectFactory.java
index 7ab2acb..f2b64aa 100644
--- a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/BpelObjectFactory.java
+++ b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/BpelObjectFactory.java
@@ -131,6 +131,10 @@
_mappings.put(Bpel20QNames.FINAL_EVENTHANDLERS, BpelObject.class);
_mappings.put(Bpel20QNames.FINAL_TARGETS,Targets.class);
_mappings.put(Bpel20QNames.FINAL_SOURCES,Sources.class);
+ _mappings.put(Bpel20QNames.FINAL_EXTENSIONS,Extensions.class);
+ _mappings.put(Bpel20QNames.FINAL_EXTENSION,Extension.class);
+ _mappings.put(Bpel20QNames.FINAL_EXTENSION_ACTIVITY,ExtensionActivity.class);
+ _mappings.put(Bpel20QNames.FINAL_EXTENSION_ASSIGN_OPERATION,ExtensionAssignOperation.class);
//
// BPEL 2.0 draft Mappings
@@ -207,6 +211,10 @@
_mappings.put(Bpel20QNames.TARGETS,Targets.class);
_mappings.put(Bpel20QNames.SOURCES,Sources.class);
_mappings.put(Bpel20QNames.RDF_LABEL,RdfLabel.class);
+ _mappings.put(Bpel20QNames.EXTENSIONS,Extensions.class);
+ _mappings.put(Bpel20QNames.EXTENSION,Extension.class);
+ _mappings.put(Bpel20QNames.EXTENSION_ACTIVITY,ExtensionActivity.class);
+ _mappings.put(Bpel20QNames.EXTENSIBLE_ASSIGN,ExtensionAssignOperation.class);
//
// BPEL 1.1 Mappings
diff --git a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Copy.java b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Copy.java
index 1764828..22523e0 100644
--- a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Copy.java
+++ b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Copy.java
@@ -18,6 +18,7 @@
*/
package org.apache.ode.bpel.compiler.bom;
+import org.apache.ode.bpel.compiler.bom.AssignActivity.AssignOperation;
import org.w3c.dom.Element;
/**
@@ -25,7 +26,7 @@
* (L-value) and a "right hand side (R-value). The value on the right hand side
* is copied to the location referenced in the left hand side.
*/
-public class Copy extends BpelObject {
+public class Copy extends BpelObject implements AssignOperation {
public Copy(Element el) {
super(el);
diff --git a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/ExtensibilityQNames.java b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/ExtensibilityQNames.java
index b838e98..8f87d57 100644
--- a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/ExtensibilityQNames.java
+++ b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/ExtensibilityQNames.java
@@ -31,8 +31,6 @@
public static final QName FAILURE_HANDLING_RETRY_DELAY = new QName(NS_ACTIVITY_RECOVERY, "retryDelay");
public static final QName FAILURE_HANDLING_FAULT_ON = new QName(NS_ACTIVITY_RECOVERY, "faultOnFailure");
-
-
//
// External variables
//
@@ -46,5 +44,10 @@
/** Attribute holding the name of the "related" variable. */
public static final QName EXTVAR_RELATED = new QName(EXTVAR_NS, "relates-to");
+ public static final String NS_BPEL_EXTENSIBILITY = "http://ode.apache.org/bpelExtensibility";
+
+ public static final QName UNKNOWN_EO_FAULT_NAME = new QName(NS_BPEL_EXTENSIBILITY, "unknownExtensionOperation");
+
+ public static final QName INVALID_EXTENSION_ELEMENT = new QName(NS_BPEL_EXTENSIBILITY, "invalidExtensionElement");
}
diff --git a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Extension.java b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Extension.java
new file mode 100644
index 0000000..2a5a755
--- /dev/null
+++ b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Extension.java
@@ -0,0 +1,41 @@
+/*
+ * 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
+ *
+ * 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.compiler.bom;
+
+import org.w3c.dom.Element;
+
+/**
+ * BOM representation of the BPEL <code><extension></code> element.
+ *
+ * @author Tammo van Lessen (University of Stuttgart)
+ */
+public class Extension extends BpelObject {
+
+ public Extension(Element el) {
+ super(el);
+ }
+
+ public boolean isMustUnderstand() {
+ return getAttribute("mustUnderstand", "no").equals("yes");
+ }
+
+ public String getNamespaceURI() {
+ return getAttribute("namespace", null);
+ }
+}
diff --git a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/ExtensionActivity.java b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/ExtensionActivity.java
new file mode 100644
index 0000000..575f401
--- /dev/null
+++ b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/ExtensionActivity.java
@@ -0,0 +1,98 @@
+/*
+ * 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
+ *
+ * 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.compiler.bom;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.w3c.dom.Element;
+
+/**
+ * BOM representation of the BPEL <code><extensionActivity></code>
+ * activity. The <code><extensionActivity></code> activity contains a
+ * nested DOM element that represents the actual extension element. According to
+ * the BPEL 2.0 PR1 specification, the standards elements and standards
+ * attributes are not located in the extensionActivity element but in the nested
+ * element. Therefore the convenient access methods for standards
+ * attributes/elements are overridden to refer to the nested elements.
+ *
+ * @author Tammo van Lessen (University of Stuttgart)
+ */
+public class ExtensionActivity extends CompositeActivity {
+ private Activity _childActivity;
+
+ public ExtensionActivity(Element el) {
+ super(el);
+ _childActivity = null;
+ Element child = getFirstExtensibilityElement();
+ if (child != null) {
+ _childActivity = new Activity(getFirstExtensibilityElement());
+ }
+ }
+
+ @Override
+ public Expression getJoinCondition() {
+ if (_childActivity == null) {
+ return null;
+ }
+ return _childActivity.getJoinCondition();
+ }
+
+ @Override
+ public List<LinkSource> getLinkSources() {
+ if (_childActivity == null) {
+ return Collections.emptyList();
+ }
+ return _childActivity.getLinkSources();
+ }
+
+ @Override
+ public List<LinkTarget> getLinkTargets() {
+ if (_childActivity == null) {
+ return Collections.emptyList();
+ }
+ return _childActivity.getLinkTargets();
+ }
+
+ @Override
+ public String getName() {
+ if (_childActivity == null) {
+ return null;
+ }
+ return _childActivity.getName();
+ }
+
+ @Override
+ public SuppressJoinFailure getSuppressJoinFailure() {
+ if (_childActivity == null) {
+ return SuppressJoinFailure.NOTSET;
+ }
+ return _childActivity.getSuppressJoinFailure();
+ }
+
+ @Override
+ public List<Activity> getActivities() {
+ if (_childActivity == null) {
+ return Collections.emptyList();
+ }
+
+ return _childActivity.getChildren(Activity.class);
+ }
+
+}
diff --git a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/ExtensionAssignOperation.java b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/ExtensionAssignOperation.java
new file mode 100644
index 0000000..9356618
--- /dev/null
+++ b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/ExtensionAssignOperation.java
@@ -0,0 +1,53 @@
+/*
+ * 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
+ *
+ * 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.compiler.bom;
+
+import org.apache.ode.bpel.compiler.bom.AssignActivity.AssignOperation;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * BOM representation of the BPEL <code><extensionAssignOperation></code>.
+ *
+ * @author Tammo van Lessen (University of Stuttgart)
+ */
+public class ExtensionAssignOperation extends BpelObject implements AssignOperation {
+ private Element _childElement;
+
+ public ExtensionAssignOperation(Element el) {
+ super(el);
+ }
+
+ public Element getNestedElement() {
+ if (_childElement == null) {
+ NodeList nl = getElement().getChildNodes();
+ for (int i = 0; i < nl.getLength(); ++i) {
+ Node node = nl.item(i);
+ if (node.getNodeType() == Node.ELEMENT_NODE &&
+ !Bpel20QNames.NS_WSBPEL2_0.equals(node.getNamespaceURI())) {
+ _childElement = (Element) node;
+ break;
+ }
+ }
+ }
+ return _childElement;
+ }
+
+}
diff --git a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Extensions.java b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Extensions.java
new file mode 100644
index 0000000..5f7365b
--- /dev/null
+++ b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Extensions.java
@@ -0,0 +1,34 @@
+/*
+ * 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
+ *
+ * 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.compiler.bom;
+
+import org.w3c.dom.Element;
+
+/**
+ * BOM representation of the BPEL <code><extension></code> element.
+ *
+ * @author Tammo van Lessen (University of Stuttgart)
+ */
+public class Extensions extends BpelObject {
+
+ public Extensions(Element el) {
+ super(el);
+ }
+
+}
diff --git a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Process.java b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Process.java
index 694c10c..017c175 100644
--- a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Process.java
+++ b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Process.java
@@ -20,6 +20,7 @@
import org.w3c.dom.Element;
+import java.util.Collections;
import java.util.List;
import java.util.Set;
@@ -111,4 +112,16 @@
return getChildren(Import.class);
}
+ /**
+ * Get the <code><extensions></code>(s) of the process.
+ *
+ * @return {@link Set} of {@link Extension}s
+ */
+ public List<Extension> getExtensions() {
+ Extensions extensions = getFirstChild(Extensions.class);
+ if (extensions == null)
+ return Collections.emptyList();
+ return extensions.getChildren(Extension.class);
+
+ }
}
diff --git a/bpel-compiler/src/test/java/org/apache/ode/bpel/compiler/XPathTest.java b/bpel-compiler/src/test/java/org/apache/ode/bpel/compiler/XPathTest.java
index 57f6ea4..429783e 100644
--- a/bpel-compiler/src/test/java/org/apache/ode/bpel/compiler/XPathTest.java
+++ b/bpel-compiler/src/test/java/org/apache/ode/bpel/compiler/XPathTest.java
@@ -301,4 +301,8 @@
public NSContext tryCacheNamespaceContext(NSContext nsContext) {
return nsContext;
}
+
+ public boolean isExtensionDeclared(String namespace) {
+ return false;
+ }
}
diff --git a/bpel-epr/src/main/java/org/apache/ode/il/config/OdeConfigProperties.java b/bpel-epr/src/main/java/org/apache/ode/il/config/OdeConfigProperties.java
index c03edf6..a828086 100644
--- a/bpel-epr/src/main/java/org/apache/ode/il/config/OdeConfigProperties.java
+++ b/bpel-epr/src/main/java/org/apache/ode/il/config/OdeConfigProperties.java
@@ -112,6 +112,8 @@
public static final String DEFAULT_CLUSTERING_IMPL_CLASS_NAME = "org.apache.ode.clustering.hazelcast.HazelcastClusterImpl";
+ public static final String PROP_EXTENSION_BUNDLES = "extension.bundles";
+
private File _cfgFile;
private String _prefix;
@@ -384,4 +386,7 @@
return Integer.valueOf(getProperty(PROP_MIGRATION_TRANSACTION_TIMEOUT, String.valueOf(0)));
}
+ public String getExtensionActivityBundles() {
+ return getProperty(PROP_EXTENSION_BUNDLES);
+ }
}
diff --git a/bpel-nobj/src/main/java/org/apache/ode/bpel/obj/OAssign.java b/bpel-nobj/src/main/java/org/apache/ode/bpel/obj/OAssign.java
index 8db6375..b0b5868 100644
--- a/bpel-nobj/src/main/java/org/apache/ode/bpel/obj/OAssign.java
+++ b/bpel-nobj/src/main/java/org/apache/ode/bpel/obj/OAssign.java
@@ -32,36 +32,37 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnore;
-public class OAssign extends OActivity implements Serializable{
+public class OAssign extends OActivity implements Serializable {
public static final long serialVersionUID = -1L;
- private static final String COPY = "copy";
+ private static final String OPERATION = "operation";
@JsonCreator
public OAssign(){
}
+
public OAssign(OProcess owner, OActivity parent) {
super(owner, parent);
- setCopy(new ArrayList<Copy>());
+ setOperations(new ArrayList<OAssignOperation>());
}
@Override
public void dehydrate() {
super.dehydrate();
- for (Copy copy : getCopy()) {
- copy.dehydrate();
+ for (OAssignOperation operation : getOperations()) {
+ operation.dehydrate();
}
}
@SuppressWarnings("unchecked")
@JsonIgnore
- public List<Copy> getCopy() {
- Object o = fieldContainer.get(COPY);
- return o == null ? null : (List<Copy>)o;
+ public List<OAssignOperation> getOperations() {
+ Object o = fieldContainer.get(OPERATION);
+ return o == null ? null : (List<OAssignOperation>)o;
}
- public void setCopy(List<Copy> copy) {
- if (getCopy() == null){
- fieldContainer.put(COPY, copy);
+ public void setOperations(List<OAssignOperation> operation) {
+ if (getOperations() == null){
+ fieldContainer.put(OPERATION, operation);
}
}
@@ -69,12 +70,31 @@
return "{OAssign : " + getName() + ", joinCondition="
+ getJoinCondition() + "}";
}
+
+ /**
+ * Base class for assign operations.
+ */
+ public static abstract class OAssignOperation extends OBase implements Serializable {
+ private static final long serialVersionUID = -3042873658302758854L;
+
+ public enum Type { Copy, ExtensionOperation }
+
+ @JsonCreator
+ public OAssignOperation() {
+ }
+
+ public OAssignOperation(OProcess owner) {
+ super(owner);
+ }
+
+ public abstract Type getType();
+ }
/**
- * Assignmenet copy entry, i.e. what the assignment consits of.
+ * Assignment copy entry, i.e. what the assignment consists of.
*/
- public static class Copy extends OBase implements Serializable{
- public static final long serialVersionUID = -1L;
+ public static class Copy extends OAssignOperation implements Serializable {
+ public static final long serialVersionUID = -1L;
private static final String TO = "to";
private static final String FROM = "from";
private static final String KEEPSRCELEMENTNAME = "keepSrcElementName";
@@ -86,10 +106,12 @@
public Copy(){
initPrimitive();
}
+
public Copy(OProcess owner) {
super(owner);
initPrimitive();
}
+
private void initPrimitive(){
setIgnoreMissingFromData(false);
setIgnoreUninitializedFromVariable(false);
@@ -107,13 +129,13 @@
@JsonIgnore
public RValue getFrom() {
Object o = fieldContainer.get(FROM);
- return o == null ? null : (RValue)o;
+ return o == null ? null : (RValue)o;
}
@JsonIgnore
public boolean isIgnoreMissingFromData() {
Object o = fieldContainer.get(IGNOREMISSINGFROMDATA);
- return o == null ? false : (Boolean)o;
+ return o == null ? false : (Boolean)o;
}
@JsonIgnore
@@ -125,19 +147,19 @@
@JsonIgnore
public boolean isInsertMissingToData() {
Object o = fieldContainer.get(INSERTMISSINGTODATA);
- return o == null ? false : (Boolean)o;
+ return o == null ? false : (Boolean)o;
}
@JsonIgnore
public boolean isKeepSrcElementName() {
Object o = fieldContainer.get(KEEPSRCELEMENTNAME);
- return o == null ? false : (Boolean)o;
+ return o == null ? false : (Boolean)o;
}
@JsonIgnore
public LValue getTo() {
Object o = fieldContainer.get(TO);
- return o == null ? null : (LValue)o;
+ return o == null ? null : (LValue)o;
}
public void setFrom(RValue from) {
@@ -169,7 +191,65 @@
public String toString() {
return "{OCopy " + getTo() + "=" + getFrom() + "}";
}
+
+ @JsonIgnore
+ public Type getType() {
+ return Type.Copy;
+ }
}
+
+ /**
+ * Assignment extension operation entry, i.e. what the assignment consists of.
+ */
+ public static class ExtensionAssignOperation extends OAssignOperation {
+ private static final long serialVersionUID = 1L;
+
+ private static final String EXTENSIONNAME = "extensionName";
+ private static final String NESTEDELEMENT = "nestedElement";
+
+ @JsonCreator
+ public ExtensionAssignOperation(){
+ }
+
+ public ExtensionAssignOperation(OProcess owner) {
+ super(owner);
+ }
+
+ @JsonIgnore
+ public QName getExtensionName() {
+ Object o = fieldContainer.get(EXTENSIONNAME);
+ return o == null ? null : (QName) o;
+ }
+
+ @JsonIgnore
+ public String getNestedElement() {
+ Object o = fieldContainer.get(NESTEDELEMENT);
+ return o == null ? null : (String)o;
+ }
+
+ public void setExtensionName(QName extensionName) {
+ fieldContainer.put(EXTENSIONNAME, extensionName);
+ }
+
+ public void setNestedElement(String nestedElement) {
+ fieldContainer.put(NESTEDELEMENT, nestedElement);
+ }
+
+ public String toString() {
+ return "{OExtensionAssignOperation; " + getExtensionName() + "}";
+ }
+
+ @Override
+ public void dehydrate() {
+ super.dehydrate();
+ setExtensionName(null);
+ setNestedElement(null);
+ }
+
+ public Type getType() {
+ return Type.ExtensionOperation;
+ }
+ }
/**
* Direct reference: selects named child of the message document element.
diff --git a/bpel-nobj/src/main/java/org/apache/ode/bpel/obj/OExtensionActivity.java b/bpel-nobj/src/main/java/org/apache/ode/bpel/obj/OExtensionActivity.java
new file mode 100644
index 0000000..2c3632a
--- /dev/null
+++ b/bpel-nobj/src/main/java/org/apache/ode/bpel/obj/OExtensionActivity.java
@@ -0,0 +1,102 @@
+/*
+ * 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
+ *
+ * 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.obj;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+
+/**
+ * Compiled representation of the BPEL <code><extensionActivity></code>
+ * activity.
+ * <p>
+ * Adapted initial version for compatibility with new ODE object model (bpel-nobj).
+ *
+ * @author Tammo van Lessen (University of Stuttgart), Michael Hahn (mhahn.dev@gmail.com)
+ */
+public class OExtensionActivity extends OActivity implements Serializable {
+
+ static final long serialVersionUID = -1L;
+
+ private static final String EXTENSIONNAME = "extensionName";
+ private static final String NESTEDELEMENT = "nestedElement";
+ private static final String CHILDREN = "children";
+
+ @JsonCreator
+ public OExtensionActivity(){
+ }
+
+ public OExtensionActivity(OProcess owner, OActivity parent) {
+ super(owner, parent);
+ setChildren(new ArrayList<OActivity>());
+ }
+
+ @JsonIgnore
+ public QName getExtensionName() {
+ Object o = fieldContainer.get(EXTENSIONNAME);
+ return o == null ? null : (QName) o;
+ }
+
+ @JsonIgnore
+ public String getNestedElement() {
+ Object o = fieldContainer.get(NESTEDELEMENT);
+ return o == null ? null : (String)o;
+ }
+
+ @SuppressWarnings("unchecked")
+ @JsonIgnore
+ public List<OActivity> getChildren() {
+ Object o = fieldContainer.get(CHILDREN);
+ return o == null ? null : (List<OActivity>)o;
+ }
+
+ public void setExtensionName(QName extensionName) {
+ fieldContainer.put(EXTENSIONNAME, extensionName);
+ }
+
+ public void setNestedElement(String nestedElement) {
+ fieldContainer.put(NESTEDELEMENT, nestedElement);
+ }
+
+ void setChildren(List<OActivity> children) {
+ if (getChildren() == null) {
+ fieldContainer.put(CHILDREN, children);
+ }
+ }
+
+ public String toString() {
+ return "{OExtensionActivity; " + getExtensionName() + "}";
+ }
+
+ @Override
+ public void dehydrate() {
+ super.dehydrate();
+ setExtensionName(null);
+ setNestedElement(null);
+ for (OBase obase : getChildren()) {
+ obase.dehydrate();
+ }
+ getChildren().clear();
+ }
+}
diff --git a/bpel-nobj/src/main/java/org/apache/ode/bpel/obj/OProcess.java b/bpel-nobj/src/main/java/org/apache/ode/bpel/obj/OProcess.java
index 2296210..b4a3d2a 100644
--- a/bpel-nobj/src/main/java/org/apache/ode/bpel/obj/OProcess.java
+++ b/bpel-nobj/src/main/java/org/apache/ode/bpel/obj/OProcess.java
@@ -20,7 +20,6 @@
import java.io.IOException;
import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.net.URI;
import java.util.ArrayList;
@@ -92,7 +91,10 @@
private static final String XSDTYPES = "xsdTypes";
private static final String XSLSHEETS = "xslSheets";
private static final String NAMESPACECONTEXT = "namespaceContext";
-
+
+ /** All declared extensions in the process. **/
+ private static final String DECLAREDEXTENSIONS = "declaredExtensions";
+
/**
* This constructor should only be used by Jackson when deserialize.
*/
@@ -114,6 +116,8 @@
setXsdTypes(new HashMap<QName, OXsdTypeVarType>());
setXslSheets(new HashMap<URI, OXslSheet>());
+ setDeclaredExtensions(new HashSet<OExtension>());
+
setChildIdCounter(0);
}
@@ -130,6 +134,7 @@
getElementTypes().clear();
getXsdTypes().clear();
getXslSheets().clear();
+ getDeclaredExtensions().clear();
}
@Override
@@ -164,6 +169,7 @@
return o == null ? 0 : (Integer)o;
}
+ @SuppressWarnings("unchecked")
@JsonIgnore
public List<OBase> getChildren() {
Object o = fieldContainer.get(CHILDREN);
@@ -182,9 +188,9 @@
return o == null ? null : (OConstants)o;
}
+ @SuppressWarnings("rawtypes")
@ObjectDiffProperty(ignore = true)
@JsonIgnore
- @SuppressWarnings("unchecked")
public List<String> getCorrelators() {
// MOVED from ProcessSchemaGenerator
List<String> correlators = new ArrayList<String>();
@@ -311,7 +317,14 @@
Object o = fieldContainer.get(XSLSHEETS);
return o == null ? null : (HashMap<URI, OXslSheet>)o;
}
-
+
+ @SuppressWarnings("unchecked")
+ @JsonIgnore
+ public Set<OExtension> getDeclaredExtensions() {
+ return (Set<OExtension>) fieldContainer
+ .get(DECLAREDEXTENSIONS);
+ }
+
public void setAllPartnerLinks(Set<OPartnerLink> allPartnerLinks) {
if (getAllPartnerLinks() == null) {
fieldContainer.put(ALLPARTNERLINKS, allPartnerLinks);
@@ -398,7 +411,13 @@
fieldContainer.put(XSLSHEETS, xslSheets);
}
}
-
+
+ public void setDeclaredExtensions(Set<OExtension> extensions) {
+ if (getDeclaredExtensions() == null) {
+ fieldContainer.put(DECLAREDEXTENSIONS, extensions);
+ }
+ }
+
private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException{
ois.defaultReadObject();
fieldContainer.remove(NAMESPACECONTEXT);
@@ -535,6 +554,42 @@
}
}
+
+ public static class OExtension extends OBase implements Serializable {
+ public static final long serialVersionUID = -1L ;
+
+ private static final String NAMESPACE = "namespaceURI";
+ private static final String MUSTUNDERSTAND = "mustUnderstand";
+
+ @JsonCreator
+ public OExtension(){}
+
+ public OExtension(OProcess process) { super(process); }
+
+ @JsonIgnore
+ public String getNamespace() {
+ Object o = fieldContainer.get(NAMESPACE);
+ return o == null ? null : (String)o;
+ }
+
+ @JsonIgnore
+ public boolean isMustUnderstand() {
+ Object o = fieldContainer.get(MUSTUNDERSTAND);
+ return o == null ? false : (Boolean)o;
+ }
+
+ public void setNamespace(String namespaceURI) {
+ fieldContainer.put(NAMESPACE, namespaceURI);
+ }
+
+ public void setMustUnderstand(boolean mustUnderstand) {
+ fieldContainer.put(MUSTUNDERSTAND, mustUnderstand);
+ }
+
+ public String toString() {
+ return "{OExtension " + getNamespace() + (isMustUnderstand() ? " mustUnderstand" : "") + "}";
+ }
+ }
/**
* custom deserializer of OProcess.
diff --git a/bpel-nobj/src/main/java/org/apache/ode/bpel/obj/migrate/DeepEqualityHelper.java b/bpel-nobj/src/main/java/org/apache/ode/bpel/obj/migrate/DeepEqualityHelper.java
index a3430c5..e012ac5 100644
--- a/bpel-nobj/src/main/java/org/apache/ode/bpel/obj/migrate/DeepEqualityHelper.java
+++ b/bpel-nobj/src/main/java/org/apache/ode/bpel/obj/migrate/DeepEqualityHelper.java
@@ -287,7 +287,7 @@
private EqualityComparator getCustomComparator(Object obj) {
for (EqualityComparator c : comparators){
- if (c.canHanle(obj)){
+ if (c.canHandle(obj)){
return c;
}
}
diff --git a/bpel-nobj/src/main/java/org/apache/ode/bpel/obj/migrate/DomElementComparator.java b/bpel-nobj/src/main/java/org/apache/ode/bpel/obj/migrate/DomElementComparator.java
index ec4b0ca..f67918f 100644
--- a/bpel-nobj/src/main/java/org/apache/ode/bpel/obj/migrate/DomElementComparator.java
+++ b/bpel-nobj/src/main/java/org/apache/ode/bpel/obj/migrate/DomElementComparator.java
@@ -76,7 +76,7 @@
return str;
}
@Override
- public Boolean canHanle(Object obj) {
+ public Boolean canHandle(Object obj) {
return obj instanceof Element;
}
diff --git a/bpel-nobj/src/main/java/org/apache/ode/bpel/obj/migrate/EqualityComparator.java b/bpel-nobj/src/main/java/org/apache/ode/bpel/obj/migrate/EqualityComparator.java
index 69ad056..567c3b8 100644
--- a/bpel-nobj/src/main/java/org/apache/ode/bpel/obj/migrate/EqualityComparator.java
+++ b/bpel-nobj/src/main/java/org/apache/ode/bpel/obj/migrate/EqualityComparator.java
@@ -13,7 +13,7 @@
* decide if the comparator can handle the specified object.
* Usually called before {@link EqualityComparator#objectsEqual(Object, Object)} are invoked.
*/
- Boolean canHanle(Object obj);
+ Boolean canHandle(Object obj);
void setDeepEquality(DeepEqualityHelper deepEquality);
}
diff --git a/bpel-nobj/src/main/java/org/apache/ode/bpel/obj/migrate/ExtensibeImplEqualityComp.java b/bpel-nobj/src/main/java/org/apache/ode/bpel/obj/migrate/ExtensibeImplEqualityComp.java
index 6f2bd5f..78672a9 100644
--- a/bpel-nobj/src/main/java/org/apache/ode/bpel/obj/migrate/ExtensibeImplEqualityComp.java
+++ b/bpel-nobj/src/main/java/org/apache/ode/bpel/obj/migrate/ExtensibeImplEqualityComp.java
@@ -84,7 +84,7 @@
}
}
@Override
- public Boolean canHanle(Object obj) {
+ public Boolean canHandle(Object obj) {
return obj instanceof ExtensibleImpl;
}
diff --git a/bpel-nobj/src/main/java/org/apache/ode/bpel/obj/migrate/OmOld2new.java b/bpel-nobj/src/main/java/org/apache/ode/bpel/obj/migrate/OmOld2new.java
index 4fedd01..aeb0050 100644
--- a/bpel-nobj/src/main/java/org/apache/ode/bpel/obj/migrate/OmOld2new.java
+++ b/bpel-nobj/src/main/java/org/apache/ode/bpel/obj/migrate/OmOld2new.java
@@ -7,6 +7,7 @@
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
@@ -15,70 +16,72 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.ode.bpel.obj.ExtensibleImpl;
+import org.apache.ode.bpel.obj.OProcess.OExtension;
/**
* Migrate from old Omodel classes to new ones.
+ *
* @author fangzhen
* @see ObjectTraverser
*/
-public class OmOld2new extends AbstractObjectVisitor{
- private static final Logger __log = LoggerFactory.getLogger(OmOld2new.class);
-
+public class OmOld2new extends AbstractObjectVisitor {
+ private static final Logger __log = LoggerFactory.getLogger(OmOld2new.class);
+
private static Map<String, String> beanPkgMap = new HashMap<String, String>();
- static{
+ static {
beanPkgMap.put("org.apache.ode.bpel.o", "org.apache.ode.bpel.obj");
beanPkgMap.put("org.apache.ode.bpel.elang.xpath10.o", "org.apache.ode.bpel.elang.xpath10.obj");
beanPkgMap.put("org.apache.ode.bpel.elang.xpath20.o", "org.apache.ode.bpel.elang.xpath20.obj");
beanPkgMap.put("org.apache.ode.bpel.elang.xquery10.o", "org.apache.ode.bpel.elang.xquery10.obj");
}
-
- public Object visit(Object obj){
+
+ public Object visit(Object obj) {
__log.debug("migrating object: " + obj.getClass() + "@" + System.identityHashCode(obj));
Object n;
/*
- * we use two category of visitXXX methods here. The first visitXXX(Object)
- * return corresponding new object instance without fulfilling its contents,
- * which avoids recursively call. And then assign the new object. then fill contents.
- * other wise, on cyclic reference case, the object re-visited but hasn't prepared yet.
- * However, this workaround assumes that the new object is mutable, which is true in our case.
+ * we use two category of visitXXX methods here. The first visitXXX(Object)
+ * return corresponding new object instance without fulfilling its contents,
+ * which avoids recursively call. And then assign the new object. then fill
+ * contents. other wise, on cyclic reference case, the object re-visited but
+ * hasn't prepared yet. However, this workaround assumes that the new object is
+ * mutable, which is true in our case.
*/
- if (isMap(obj)){
+ if (isMap(obj)) {
n = visitMap(obj);
- }else if (isCollection(obj)){
+ } else if (isCollection(obj)) {
n = visitCollection(obj);
- }else if (isArray(obj)){
+ } else if (isArray(obj)) {
n = visitArray(obj);
- }else{
+ } else {
n = visitPojo(obj);
}
rtab.assign(obj, n);
-
- if (isMap(obj)){
+
+ if (isMap(obj)) {
visitMap(obj, n);
- }else if (isCollection(obj)){
+ } else if (isCollection(obj)) {
visitCollection(obj, n);
- }else if (isArray(obj)){
+ } else if (isArray(obj)) {
visitArray(obj, n);
- }else{
+ } else {
visitPojo(obj, n);
}
return n;
}
-
@Override
protected boolean isCollection(Object old) {
return (old instanceof Collection);
}
- private boolean isOmodelBean(Object old){
+ private boolean isOmodelBean(Object old) {
Class<?> cls = old.getClass();
- if (beanPkgMap.containsKey(cls.getPackage().getName()) &&
- !cls.getSimpleName().equals("Serializer")){
+ if (beanPkgMap.containsKey(cls.getPackage().getName()) && !cls.getSimpleName().equals("Serializer")) {
return true;
}
return false;
}
+
@Override
public Object visitArray(Object old) {
throw new UnsupportedOperationException("Create new Array is unsupported");
@@ -89,14 +92,14 @@
}
@Override
- @SuppressWarnings({ "rawtypes"})
+ @SuppressWarnings({ "rawtypes" })
public Object visitCollection(Object old) {
Collection o = (Collection) old;
try {
Collection n = o.getClass().newInstance();
return n;
- } catch (Exception e){
- //should not get here
+ } catch (Exception e) {
+ // should not get here
e.printStackTrace();
}
return null;
@@ -106,7 +109,7 @@
private void visitCollection(Object old, Object nu) {
Collection o = (Collection) old;
Collection n = (Collection) nu;
- for (Object obj : o){
+ for (Object obj : o) {
n.add(traverse.traverseObject(obj));
}
}
@@ -115,81 +118,135 @@
@SuppressWarnings({ "rawtypes", "unchecked" })
public Object visitMap(Object old) {
Map o = (Map) old;
- try{
+ try {
Map n = o.getClass().newInstance();
return n;
- }catch (Exception e){
- //should not get here
- e.printStackTrace();
+ } catch (Exception e) {
+ // should not get here
+ e.printStackTrace();
}
return null;
}
+
@SuppressWarnings({ "unchecked", "rawtypes" })
private void visitMap(Object obj, Object nu) {
- Set<Entry> entries = ((Map)obj).entrySet();
- Map n = (Map)nu;
- for (Entry e : entries){
+ Set<Entry> entries = ((Map) obj).entrySet();
+ Map n = (Map) nu;
+ for (Entry e : entries) {
n.put(traverse.traverseObject(e.getKey()), traverse.traverseObject(e.getValue()));
}
}
@Override
public Object visitPojo(Object old) {
- if (!isOmodelBean(old)){
+ if (!isOmodelBean(old)) {
return old;
- }else{
+ } else {
return initiateNew(old);
}
}
private void visitPojo(Object old, Object n) {
- if (isOmodelBean(old)){
- constructNewOm(old, n);
+ if (isOmodelBean(old)) {
+ // @hahnml: We need some special handling for the migration of OAssign model
+ // elements since the new OModel supports extension assign operations.
+ if (old.getClass().getSimpleName().equals("OAssign")) {
+ constructNewOAssign(old, n);
+ } else {
+ constructNewOm(old, n);
+ }
}
}
+
/**
- * construct new omodel instances from old ones. Assume <code>old</code> is an old OmodelBean
+ * construct new omodel instances from old ones. Assume <code>old</code> is an
+ * old OmodelBean
+ *
* @param old
* @return
*/
private Object constructNewOm(Object old, Object tn) {
assert tn instanceof ExtensibleImpl;
ExtensibleImpl n = (ExtensibleImpl) tn;
- List<Field> fields = getAllFields(old.getClass());
+ List<Field> fields = getAllFields(old.getClass());
Map<String, Object> fieldMap = n.getFieldContainer();
- for (Field f : fields){
- if ((f.getModifiers() & Modifier.STATIC) != 0){
- continue; //skip static fields
+ for (Field f : fields) {
+ if ((f.getModifiers() & Modifier.STATIC) != 0) {
+ continue; // skip static fields
}
f.setAccessible(true);
- try{
+ try {
String fname = f.getName();
Object fvalue = f.get(old);
- if (fvalue != null){
+ if (fvalue != null) {
fieldMap.put(fname, traverse.traverseObject(fvalue));
- }else{
+ } else {
fieldMap.put(fname, null);
}
} catch (Exception e) {
RuntimeException rte = new RuntimeException(
- "Error when try to construct corresponding new Omodel class from old one:"
- +old.getClass() + "; Failed on field:" + f.getName());
+ "Error when try to construct corresponding new Omodel class from old one:" + old.getClass()
+ + "; Failed on field:" + f.getName());
rte.initCause(e);
throw rte;
}
}
+
+ // @hahnml: We need to add the new "declaredExtensions" field to the process for
+ // equality.
+ if (old.getClass().getSimpleName().equals("OProcess")) {
+ fieldMap.put("declaredExtensions", new HashSet<OExtension>());
+ }
+
n.setClassVersion(1);
n.setOriginalVersion(0);
return n;
}
-
+
+ private Object constructNewOAssign(Object old, Object tn) {
+ assert tn instanceof ExtensibleImpl;
+ ExtensibleImpl n = (ExtensibleImpl) tn;
+ List<Field> fields = getAllFields(old.getClass());
+ Map<String, Object> fieldMap = n.getFieldContainer();
+ for (Field f : fields) {
+ if ((f.getModifiers() & Modifier.STATIC) != 0) {
+ continue; // skip static fields
+ }
+ f.setAccessible(true);
+ try {
+ String fname = f.getName();
+ Object fvalue = f.get(old);
+
+ if (fname.equals("copy")) {
+ fname = "operation";
+ }
+
+ if (fvalue != null) {
+ fieldMap.put(fname, traverse.traverseObject(fvalue));
+ } else {
+ fieldMap.put(fname, null);
+ }
+ } catch (Exception e) {
+ RuntimeException rte = new RuntimeException(
+ "Error when try to construct corresponding new Omodel class from old one:" + old.getClass()
+ + "; Failed on field:" + f.getName());
+ rte.initCause(e);
+ throw rte;
+ }
+ }
+
+ n.setClassVersion(1);
+ n.setOriginalVersion(0);
+ return n;
+ }
+
private List<Field> getAllFields(Class cls) {
return getAllFieldsRec(cls, new ArrayList<Field>());
}
private List<Field> getAllFieldsRec(Class cls, ArrayList<Field> fields) {
Class par = cls.getSuperclass();
- if (par != null){
+ if (par != null) {
getAllFieldsRec(par, fields);
}
fields.addAll(Arrays.asList(cls.getDeclaredFields()));
@@ -205,8 +262,7 @@
return cons.newInstance();
} catch (Exception e) {
RuntimeException rte = new RuntimeException(
- "Error when try to initiate corresponding new Omodel class of old one:"
- + old.getClass());
+ "Error when try to initiate corresponding new Omodel class of old one:" + old.getClass());
rte.initCause(e);
throw rte;
}
diff --git a/bpel-obj/src/main/java/org/apache/ode/bpel/o/OProcess.java b/bpel-obj/src/main/java/org/apache/ode/bpel/o/OProcess.java
index 717b9e2..7fe5d31 100644
--- a/bpel-obj/src/main/java/org/apache/ode/bpel/o/OProcess.java
+++ b/bpel-obj/src/main/java/org/apache/ode/bpel/o/OProcess.java
@@ -114,12 +114,12 @@
return processName;
}
- @SuppressWarnings("unchecked")
- public Collection getExpressionLanguages() {
+ @SuppressWarnings("rawtypes")
+ public Collection getExpressionLanguages() {
throw new UnsupportedOperationException(); // TODO: implement me!
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("rawtypes")
public List<String> getCorrelators() {
// MOVED from ProcessSchemaGenerator
List<String> correlators = new ArrayList<String>();
diff --git a/bpel-rest-extensions/src/main/java/org/apache/ode/bpel/extension/bpel4restlight/Bpel4RestLightExtensionBundle.java b/bpel-rest-extensions/src/main/java/org/apache/ode/bpel/extension/bpel4restlight/Bpel4RestLightExtensionBundle.java
new file mode 100644
index 0000000..32b5e61
--- /dev/null
+++ b/bpel-rest-extensions/src/main/java/org/apache/ode/bpel/extension/bpel4restlight/Bpel4RestLightExtensionBundle.java
@@ -0,0 +1,50 @@
+/*
+ * 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
+ *
+ * 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;
+
+import javax.xml.namespace.QName;
+
+import org.apache.ode.bpel.eapi.AbstractExtensionBundle;
+import org.apache.ode.utils.Namespaces;
+
+/**
+ * Extension bundle for basic REST operation support in BPEL.
+ *
+ * @author Michael Hahn (mhahn.dev@gmail.com)
+ *
+ */
+public class Bpel4RestLightExtensionBundle extends AbstractExtensionBundle {
+
+ public static final String NAMESPACE = "http://www.apache.org/ode/bpel/extensions/bpel4restlight";
+
+ public static final QName FAULT_QNAME = new QName(Namespaces.ODE_EXTENSION_NS, "bpel4RestExtensions");
+
+ @Override
+ public String getNamespaceURI() {
+ return NAMESPACE;
+ }
+
+ @Override
+ public void registerExtensionActivities() {
+ super.registerExtensionOperation("PUT", Bpel4RestLightOperation.class);
+ super.registerExtensionOperation("GET", Bpel4RestLightOperation.class);
+ super.registerExtensionOperation("POST", Bpel4RestLightOperation.class);
+ super.registerExtensionOperation("DELETE", Bpel4RestLightOperation.class);
+ }
+}
diff --git a/bpel-rest-extensions/src/main/java/org/apache/ode/bpel/extension/bpel4restlight/Bpel4RestLightOperation.java b/bpel-rest-extensions/src/main/java/org/apache/ode/bpel/extension/bpel4restlight/Bpel4RestLightOperation.java
new file mode 100644
index 0000000..3506435
--- /dev/null
+++ b/bpel-rest-extensions/src/main/java/org/apache/ode/bpel/extension/bpel4restlight/Bpel4RestLightOperation.java
@@ -0,0 +1,101 @@
+/*
+ * 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
+ *
+ * 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;
+
+import org.apache.ode.bpel.common.FaultException;
+import org.apache.ode.bpel.eapi.ExtensionContext;
+import org.apache.ode.bpel.eapi.ExtensionOperation;
+import org.apache.ode.bpel.extension.bpel4restlight.http.HighLevelRestApi;
+import org.apache.ode.bpel.extension.bpel4restlight.http.HttpMethod;
+import org.apache.ode.bpel.extension.bpel4restlight.http.HttpResponseMessage;
+import org.w3c.dom.Element;
+
+/**
+ *
+ * This class provides the implementation of the four typical REST operations
+ * GET, PUT, POST and DELETE through corresponding BPEL extension activities
+ * ({@link Bpel4RestLightExtensionBundle}).
+ *
+ * @author Michael Hahn (mhahn.dev@gmail.com)
+ *
+ */
+public class Bpel4RestLightOperation implements ExtensionOperation {
+
+ public void run(ExtensionContext context, Element element) throws FaultException {
+ String httpMethod = element.getLocalName();
+
+ // Extract requestUri
+ String requestUri = Bpel4RestLightUtil.getMethodAttributeValue(context, element, MethodAttribute.REQUEST_URI);
+
+ HttpResponseMessage responseMessage = null;
+
+ // Execute corresponding HttpMethod via the HighLevelRestApi
+ switch (HttpMethod.valueOf(httpMethod)) {
+
+ case PUT: {
+ String requestPayload = Bpel4RestLightUtil.extractRequestPayload(context, element);
+ String acceptHeader = Bpel4RestLightUtil.extractAcceptHeader(context, element);
+ responseMessage = HighLevelRestApi.Put(requestUri, requestPayload, acceptHeader);
+ break;
+ }
+
+ case POST: {
+ String requestPayload = Bpel4RestLightUtil.extractRequestPayload(context, element);
+ String acceptHeader = Bpel4RestLightUtil.extractAcceptHeader(context, element);
+ responseMessage = HighLevelRestApi.Post(requestUri, requestPayload, acceptHeader);
+ break;
+ }
+
+ case GET: {
+ String acceptHeader = Bpel4RestLightUtil.extractAcceptHeader(context, element);
+ responseMessage = HighLevelRestApi.Get(requestUri, acceptHeader);
+ break;
+ }
+
+ case DELETE: {
+ String acceptHeader = Bpel4RestLightUtil.extractAcceptHeader(context, element);
+ responseMessage = HighLevelRestApi.Delete(requestUri, acceptHeader);
+ break;
+ }
+ default:
+ break;
+ }
+
+ processResponseMessage(responseMessage, context, element);
+ }
+
+ private void processResponseMessage(HttpResponseMessage responseMessage, ExtensionContext context, Element element)
+ throws FaultException {
+ // Write responsePayload to designated variable
+ String responsePayloadVariableName = Bpel4RestLightUtil.getMethodAttributeValue(context, element,
+ MethodAttribute.RESPONSE_PAYLOAD_VARIABLE);
+ String statusCodeVariableName = Bpel4RestLightUtil.getMethodAttributeValue(context, element,
+ MethodAttribute.STATUS_CODE_VARIABLE);
+
+
+ if (responsePayloadVariableName != null && !responsePayloadVariableName.isEmpty()) {
+ Bpel4RestLightUtil.writeResponsePayload(context, responseMessage.getResponseBody(),
+ responsePayloadVariableName);
+ }
+
+ if (statusCodeVariableName != null && !statusCodeVariableName.isEmpty()) {
+ Bpel4RestLightUtil.writeResponsePayload(context, responseMessage.getStatusCode(), statusCodeVariableName);
+ }
+ }
+}
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
new file mode 100644
index 0000000..37c3386
--- /dev/null
+++ b/bpel-rest-extensions/src/main/java/org/apache/ode/bpel/extension/bpel4restlight/Bpel4RestLightUtil.java
@@ -0,0 +1,295 @@
+/*
+ * 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
+ *
+ * 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;
+
+import java.io.IOException;
+
+import org.apache.ode.bpel.common.FaultException;
+import org.apache.ode.bpel.eapi.ExtensionContext;
+import org.apache.ode.bpel.obj.OScope;
+import org.apache.ode.bpel.obj.OScope.Variable;
+import org.apache.ode.bpel.obj.OVarType;
+import org.apache.ode.bpel.obj.OXsdTypeVarType;
+import org.apache.ode.utils.DOMUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.xml.sax.SAXException;
+
+/**
+ * This class provides some utility methods for the BPEL REST extension
+ * activities.
+ *
+ * @author Michael Hahn (mhahn.dev@gmail.com)
+ *
+ */
+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;
+ }
+}
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
new file mode 100644
index 0000000..2b3866a
--- /dev/null
+++ b/bpel-rest-extensions/src/main/java/org/apache/ode/bpel/extension/bpel4restlight/MethodAttribute.java
@@ -0,0 +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
+ *
+ * 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.
+ */
+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)
+ *
+ * @author Michael Hahn (mhahn.dev@gmail.com)
+ *
+ */
+public enum MethodAttribute {
+ REQUEST_URI, REQUEST_PAYLOAD_VARIABLE, RESPONSE_PAYLOAD_VARIABLE, STATUS_CODE_VARIABLE, ACCEPT_HEADER;
+}
\ No newline at end of file
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
new file mode 100644
index 0000000..2596079
--- /dev/null
+++ b/bpel-rest-extensions/src/main/java/org/apache/ode/bpel/extension/bpel4restlight/http/HighLevelRestApi.java
@@ -0,0 +1,196 @@
+/*
+ * 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
+ *
+ * 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;
+
+import java.io.UnsupportedEncodingException;
+
+import org.apache.commons.httpclient.HttpMethodBase;
+import org.apache.commons.httpclient.NameValuePair;
+import org.apache.commons.httpclient.methods.DeleteMethod;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.commons.httpclient.methods.PostMethod;
+import org.apache.commons.httpclient.methods.PutMethod;
+import org.apache.commons.httpclient.methods.StringRequestEntity;
+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.
+ *
+ * @author Michael Hahn (mhahn.dev@gmail.com)
+ */
+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);
+ }
+ }
+}
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
new file mode 100644
index 0000000..650d095
--- /dev/null
+++ b/bpel-rest-extensions/src/main/java/org/apache/ode/bpel/extension/bpel4restlight/http/HttpMethod.java
@@ -0,0 +1,28 @@
+/*
+ * 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
+ *
+ * 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 enumeration is intended to simplify identifying different HTTP-methods
+ *
+ * @author Michael Hahn (mhahn.dev@gmail.com)
+ */
+public enum HttpMethod {
+ PUT, POST, GET, DELETE
+}
\ No newline at end of file
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
new file mode 100644
index 0000000..7695598
--- /dev/null
+++ b/bpel-rest-extensions/src/main/java/org/apache/ode/bpel/extension/bpel4restlight/http/HttpResponseMessage.java
@@ -0,0 +1,62 @@
+/*
+ * 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
+ *
+ * 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
+ *
+ * @author Michael Hahn (mhahn.dev@gmail.com)
+ */
+public class HttpResponseMessage {
+
+ private int statusCode;
+ private String responseBody;
+
+ /**
+ * @return the statusCode
+ */
+ public int getStatusCode() {
+ return this.statusCode;
+ }
+
+ /**
+ * @param statusCode
+ * the statusCode to set
+ */
+ protected void setStatusCode(int statusCode) {
+ this.statusCode = statusCode;
+ }
+
+ /**
+ * @return the responseBody
+ */
+ public String getResponseBody() {
+ return this.responseBody;
+ }
+
+ /**
+ * @param responseBody
+ * the responseBody to set
+ */
+ protected void setResponseBody(String responseBody) {
+ this.responseBody = responseBody;
+ }
+
+}
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
new file mode 100644
index 0000000..474d5ed
--- /dev/null
+++ b/bpel-rest-extensions/src/main/java/org/apache/ode/bpel/extension/bpel4restlight/http/LowLevelRestApi.java
@@ -0,0 +1,91 @@
+/*
+ * 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
+ *
+ * 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;
+
+import java.io.IOException;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.HttpMethod;
+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
+ *
+ * @author Michael Hahn (mhahn.dev@gmail.com)
+ */
+public class LowLevelRestApi {
+
+ // 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 {
+
+ 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();
+ }
+
+ // Extract response information and return
+ 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;
+ }
+
+}
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 0150c97..50def20 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
@@ -19,7 +19,6 @@
package org.apache.ode.bpel.engine;
import java.io.File;
-import java.io.InputStream;
import java.net.URI;
import java.util.ArrayList;
import java.util.Collection;
@@ -131,6 +130,8 @@
private ReplacementMap _replacementMap;
final ProcessConf _pconf;
+ Set<String> _mustUnderstandExtensions;
+
/** {@link MessageExchangeInterceptor}s registered for this process. */
private final List<MessageExchangeInterceptor> _mexInterceptors = new ArrayList<MessageExchangeInterceptor>();
@@ -959,6 +960,7 @@
// }
_replacementMap = null;
_expLangRuntimeRegistry = null;
+ _mustUnderstandExtensions = null;
}
private void doHydrate() {
@@ -1000,6 +1002,25 @@
_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");
+ }
+ }
+
setRoles(_oprocess);
initExternalVariables();
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 f4c9fec..939541c 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
@@ -37,6 +37,7 @@
import org.apache.ode.bpel.common.CorrelationKeySet;
import org.apache.ode.bpel.common.FaultException;
import org.apache.ode.bpel.common.ProcessState;
+import org.apache.ode.bpel.compiler.bom.ExtensibilityQNames;
import org.apache.ode.bpel.dao.CorrelationSetDAO;
import org.apache.ode.bpel.dao.CorrelatorDAO;
import org.apache.ode.bpel.dao.MessageDAO;
@@ -48,6 +49,9 @@
import org.apache.ode.bpel.dao.ScopeDAO;
import org.apache.ode.bpel.dao.ScopeStateEnum;
import org.apache.ode.bpel.dao.XmlDataDAO;
+import org.apache.ode.bpel.eapi.AbstractExtensionBundle;
+import org.apache.ode.bpel.eapi.ExtensionContext;
+import org.apache.ode.bpel.eapi.ExtensionOperation;
import org.apache.ode.bpel.evar.ExternalVariableModule.Value;
import org.apache.ode.bpel.evar.ExternalVariableModuleException;
import org.apache.ode.bpel.evt.CorrelationSetWriteEvent;
@@ -89,6 +93,7 @@
import org.apache.ode.bpel.runtime.Selector;
import org.apache.ode.bpel.runtime.VariableInstance;
import org.apache.ode.bpel.runtime.channels.ActivityRecovery;
+import org.apache.ode.bpel.runtime.channels.ExtensionResponse;
import org.apache.ode.bpel.runtime.channels.FaultData;
import org.apache.ode.bpel.runtime.channels.InvokeResponse;
import org.apache.ode.bpel.runtime.channels.PickResponse;
@@ -1531,4 +1536,67 @@
public void forceFlush() {
_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);
+ }
+ }
+
+ private void completeExtensionExecution(final String channelId, final Throwable t) {
+ if (t != null) {
+ _vpu.inject(new BpelJacobRunnable() {
+ private static final long serialVersionUID = -1L;
+
+ public void run() {
+ importChannel(channelId, ExtensionResponse.class).onFailure(t);
+ }
+ });
+ } else {
+ _vpu.inject(new BpelJacobRunnable() {
+ private static final long serialVersionUID = -1L;
+
+ public void run() {
+ importChannel(channelId, ExtensionResponse.class).onCompleted();
+ }
+ });
+ }
+ }
+
+ private ExtensionOperation createExtensionActivityImplementation(QName name) {
+ if (name == null) {
+ return null;
+ }
+ AbstractExtensionBundle bundle = _bpelProcess._engine._contexts.extensionRegistry.get(name.getNamespaceURI());
+ if (bundle == null) {
+ return null;
+ } else {
+ try {
+ return (ExtensionOperation)bundle.getExtensionOperationInstance(name.getLocalPart());
+ } catch (Exception e) {
+ return null;
+ }
+ }
+ }
}
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 3966fc1..9344e84 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
@@ -40,6 +40,7 @@
import org.apache.ode.bpel.dao.BpelDAOConnectionFactory;
import org.apache.ode.bpel.dao.DeferredProcessInstanceCleanable;
import org.apache.ode.bpel.dao.ProcessDAO;
+import org.apache.ode.bpel.eapi.AbstractExtensionBundle;
import org.apache.ode.bpel.engine.cron.CronScheduler;
import org.apache.ode.bpel.engine.migration.MigrationHandler;
import org.apache.ode.bpel.evar.ExternalVariableModule;
@@ -175,6 +176,15 @@
}
}
+ public void registerExtensionBundle(AbstractExtensionBundle bundle) {
+ _contexts.extensionRegistry.put(bundle.getNamespaceURI(), bundle);
+ bundle.registerExtensionActivities();
+ }
+
+ public void unregisterExtensionBundle(String nsURI) {
+ _contexts.extensionRegistry.remove(nsURI);
+ }
+
public void registerExternalVariableEngine(ExternalVariableModule eve) {
_contexts.externalVariableEngines.put(eve.getName(), eve);
}
@@ -317,6 +327,7 @@
__log.debug("Registering process " + conf.getProcessId() + " with server.");
BpelProcess process = createBpelProcess(conf);
+
process._classLoader = Thread.currentThread().getContextClassLoader();
_engine.registerProcess(process);
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 a965d58..0d0ff2f 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
@@ -21,6 +21,7 @@
import org.apache.ode.bpel.clapi.ClusterManager;
import org.apache.ode.bpel.dao.BpelDAOConnectionFactory;
+import org.apache.ode.bpel.eapi.AbstractExtensionBundle;
import org.apache.ode.bpel.iapi.BindingContext;
import org.apache.ode.bpel.iapi.BpelEventListener;
import org.apache.ode.bpel.iapi.EndpointReferenceContext;
@@ -32,6 +33,8 @@
import java.util.HashMap;
import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import javax.xml.namespace.QName;
@@ -67,4 +70,7 @@
public CustomProcessProperties customProcessProperties = new CustomProcessProperties();
+ /** Global extension bundle registry **/
+ final Map<String, AbstractExtensionBundle> extensionRegistry = new ConcurrentHashMap<String, AbstractExtensionBundle>();
+
}
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 20f0fd8..35dac34 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
@@ -191,4 +191,9 @@
return format("Scheduled job failed; jobDetail={0}", jobDetail);
}
+ 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);
+ }
}
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 0f442b9..0881ac0 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
@@ -18,9 +18,21 @@
*/
package org.apache.ode.bpel.runtime;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.net.URI;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
import org.apache.ode.bpel.common.FaultException;
+import org.apache.ode.bpel.compiler.bom.ExtensibilityQNames;
+import org.apache.ode.bpel.eapi.ExtensionContext;
+import org.apache.ode.bpel.evar.ExternalVariableModuleException;
import org.apache.ode.bpel.evt.PartnerLinkModificationEvent;
import org.apache.ode.bpel.evt.ScopeEvent;
import org.apache.ode.bpel.evt.VariableModificationEvent;
@@ -39,11 +51,14 @@
import org.apache.ode.bpel.obj.OProcess.OProperty;
import org.apache.ode.bpel.obj.OScope;
import org.apache.ode.bpel.obj.OScope.Variable;
+import org.apache.ode.bpel.runtime.channels.ExtensionResponse;
import org.apache.ode.bpel.runtime.channels.FaultData;
+import org.apache.ode.jacob.ReceiveProcess;
import org.apache.ode.utils.DOMUtils;
import org.apache.ode.utils.Namespaces;
import org.apache.ode.utils.msg.MessageBundle;
-import org.apache.ode.bpel.evar.ExternalVariableModuleException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -53,17 +68,11 @@
import org.w3c.dom.Text;
import org.xml.sax.SAXException;
-import javax.xml.namespace.QName;
-
-import java.io.IOException;
-import java.net.URI;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-
/**
* Assign activity run-time template.
+ *
+ * @author Ode team
+ * @author Tammo van Lessen (University of Stuttgart) - extensionAssignOperation
*/
class ASSIGN extends ACTIVITY {
private static final long serialVersionUID = 1L;
@@ -78,27 +87,40 @@
}
public void run() {
- OAssign oassign = getOAsssign();
+ OAssign oassign = getOAssign();
FaultData faultData = null;
- for (OAssign.Copy aCopy : oassign.getCopy()) {
+ for (OAssign.OAssignOperation operation : oassign.getOperations()) {
try {
- copy(aCopy);
+ if (operation instanceof OAssign.Copy) {
+ copy((OAssign.Copy) operation);
+ } else if (operation instanceof OAssign.ExtensionAssignOperation) {
+ invokeExtensionAssignOperation((OAssign.ExtensionAssignOperation) operation);
+ }
} catch (FaultException fault) {
- if (aCopy.isIgnoreMissingFromData()) {
- if (fault.getQName().equals(getOAsssign().getOwner().getConstants().getQnSelectionFailure()) &&
- (fault.getCause() != null && "ignoreMissingFromData".equals(fault.getCause().getMessage()))) {
- continue;
- }
- }
- if (aCopy.isIgnoreUninitializedFromVariable()) {
- if (fault.getQName().equals(getOAsssign().getOwner().getConstants().getQnUninitializedVariable()) &&
- (fault.getCause() == null || !"throwUninitializedToVariable".equals(fault.getCause().getMessage()))) {
- continue;
- }
- }
- faultData = createFault(fault.getQName(), aCopy, fault
+ if (operation instanceof OAssign.Copy) {
+ if (((OAssign.Copy) operation).isIgnoreMissingFromData()) {
+ if (fault
+ .getQName()
+ .equals(getOAssign().getOwner().getConstants().getQnSelectionFailure())
+ && (fault.getCause() != null && "ignoreMissingFromData"
+ .equals(fault.getCause().getMessage()))) {
+ continue;
+ }
+ }
+ if (((OAssign.Copy) operation).isIgnoreUninitializedFromVariable()) {
+ if (fault
+ .getQName()
+ .equals(getOAssign().getOwner().getConstants().getQnUninitializedVariable())
+ && (fault.getCause() == null || !"throwUninitializedToVariable"
+ .equals(fault.getCause().getMessage()))) {
+ continue;
+ }
+ }
+ }
+
+ faultData = createFault(fault.getQName(), operation, fault
.getMessage());
break;
} catch (ExternalVariableModuleException e) {
@@ -122,7 +144,7 @@
return __log;
}
- private OAssign getOAsssign() {
+ private OAssign getOAssign() {
return (OAssign) _self.o;
}
@@ -135,12 +157,12 @@
lvar = _scopeFrame.resolve(to.getVariable());
} catch (RuntimeException e) {
__log.error("iid: " + getBpelRuntimeContext().getPid() + " error evaluating lvalue");
- throw new FaultException(getOAsssign().getOwner().getConstants().getQnSelectionFailure(), e.getMessage());
+ throw new FaultException(getOAssign().getOwner().getConstants().getQnSelectionFailure(), e.getMessage());
}
if (lvar == null) {
String msg = __msgs.msgEvalException(to.toString(), "Could not resolve variable in current scope");
if (__log.isDebugEnabled()) __log.debug(to + ": " + msg);
- throw new FaultException(getOAsssign().getOwner().getConstants().getQnSelectionFailure(), msg);
+ throw new FaultException(getOAssign().getOwner().getConstants().getQnSelectionFailure(), msg);
}
if (!napi.isVariableInitialized(lvar)) {
Document doc = DOMUtils.newDocument();
@@ -243,16 +265,16 @@
String msg = __msgs.msgEvalException(from.toString(), e.getMessage());
if (__log.isDebugEnabled()) __log.debug(from + ": " + msg);
if (e.getCause() instanceof FaultException) throw (FaultException)e.getCause();
- throw new FaultException(getOAsssign().getOwner().getConstants().getQnSelectionFailure(), msg);
+ throw new FaultException(getOAssign().getOwner().getConstants().getQnSelectionFailure(), msg);
}
if (l.size() == 0) {
String msg = __msgs.msgRValueNoNodesSelected(expr.toString());
if (__log.isDebugEnabled()) __log.debug(from + ": " + msg);
- throw new FaultException(getOAsssign().getOwner().getConstants().getQnSelectionFailure(), msg, new Throwable("ignoreMissingFromData"));
+ throw new FaultException(getOAssign().getOwner().getConstants().getQnSelectionFailure(), msg, new Throwable("ignoreMissingFromData"));
} else if (l.size() > 1) {
String msg = __msgs.msgRValueMultipleNodesSelected(expr.toString());
if (__log.isDebugEnabled()) __log.debug(from + ": " + msg);
- throw new FaultException(getOAsssign().getOwner().getConstants().getQnSelectionFailure(), msg);
+ throw new FaultException(getOAssign().getOwner().getConstants().getQnSelectionFailure(), msg);
}
retVal = (Node) l.get(0);
} else if (from instanceof OAssign.Literal) {
@@ -288,7 +310,7 @@
if (__log.isDebugEnabled())
__log.debug(from + ": " + msg);
throw new FaultException(
- getOAsssign().getOwner().getConstants().getQnSelectionFailure(),
+ getOAssign().getOwner().getConstants().getQnSelectionFailure(),
msg);
}
@@ -303,7 +325,7 @@
if (__log.isDebugEnabled())
__log.debug(from + ": " + msg);
throw new FaultException(
- getOAsssign().getOwner().getConstants().getQnSelectionFailure(),
+ getOAssign().getOwner().getConstants().getQnSelectionFailure(),
msg);
}
@@ -317,7 +339,7 @@
if (__log.isDebugEnabled())
__log.debug(from + ": " + msg);
throw new FaultException(
- getOAsssign().getOwner().getConstants().getQnSelectionFailure(),
+ getOAssign().getOwner().getConstants().getQnSelectionFailure(),
msg);
}
} else {
@@ -326,7 +348,7 @@
if (__log.isErrorEnabled())
__log.error(from + ": " + msg);
throw new FaultException(
- getOAsssign().getOwner().getConstants().getQnSelectionFailure(), msg);
+ getOAssign().getOwner().getConstants().getQnSelectionFailure(), msg);
}
// Now verify we got something.
@@ -335,7 +357,7 @@
if (__log.isDebugEnabled())
__log.debug(from + ": " + msg);
throw new FaultException(
- getOAsssign().getOwner().getConstants().getQnSelectionFailure(), msg);
+ getOAssign().getOwner().getConstants().getQnSelectionFailure(), msg);
}
// Now check that we got the right thing.
@@ -351,7 +373,7 @@
__log.debug(from + ": " + msg);
throw new FaultException(
- getOAsssign().getOwner().getConstants().getQnSelectionFailure(), msg);
+ getOAssign().getOwner().getConstants().getQnSelectionFailure(), msg);
}
@@ -608,7 +630,7 @@
if (__log.isDebugEnabled())
__log.debug(lvaluePtr + ": " + msg);
throw new FaultException(
- getOAsssign().getOwner().getConstants().getQnSelectionFailure(), msg);
+ getOAssign().getOwner().getConstants().getQnSelectionFailure(), msg);
}
return lvalue;
@@ -648,13 +670,52 @@
String msg = __msgs.msgEvalException(expression.toString(), e.getMessage());
if (__log.isDebugEnabled()) __log.debug(expression + ": " + msg);
if (e.getCause() instanceof FaultException) throw (FaultException)e.getCause();
- throw new FaultException(getOAsssign().getOwner().getConstants().getQnSubLanguageExecutionFault(), msg);
+ throw new FaultException(getOAssign().getOwner().getConstants().getQnSubLanguageExecutionFault(), msg);
}
}
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());
+ };
+ }));
+
+ } 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());
+ }
+ }
+
private class EvaluationContextProxy implements EvaluationContext {
private Variable _var;
diff --git a/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ActivityTemplateFactory.java b/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ActivityTemplateFactory.java
index 1942328..16ece33 100644
--- a/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ActivityTemplateFactory.java
+++ b/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ActivityTemplateFactory.java
@@ -43,6 +43,7 @@
if (type instanceof OWhile) return new WHILE(ai, scopeFrame, linkFrame);
if (type instanceof OForEach) return new FOREACH(ai, scopeFrame, linkFrame);
if (type instanceof ORepeatUntil) return new REPEATUNTIL(ai,scopeFrame,linkFrame);
+ if (type instanceof OExtensionActivity) return new EXTENSIONACTIVITY(ai, scopeFrame, linkFrame);
throw new IllegalArgumentException("Unknown type: " + type);
}
diff --git a/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/BpelRuntimeContext.java b/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/BpelRuntimeContext.java
index 448af9a..30b318a 100644
--- a/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/BpelRuntimeContext.java
+++ b/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/BpelRuntimeContext.java
@@ -18,27 +18,29 @@
*/
package org.apache.ode.bpel.runtime;
+import java.net.URI;
import java.util.Collection;
import java.util.Date;
-import java.net.URI;
import javax.wsdl.Operation;
import javax.xml.namespace.QName;
import org.apache.ode.bpel.common.CorrelationKey;
import org.apache.ode.bpel.common.FaultException;
+import org.apache.ode.bpel.eapi.ExtensionContext;
+import org.apache.ode.bpel.evar.ExternalVariableModuleException;
import org.apache.ode.bpel.evt.ProcessInstanceEvent;
+import org.apache.ode.bpel.iapi.ProcessConf.PartnerRoleConfig;
import org.apache.ode.bpel.obj.OPartnerLink;
import org.apache.ode.bpel.obj.OProcess;
import org.apache.ode.bpel.obj.OScope;
import org.apache.ode.bpel.obj.OScope.Variable;
import org.apache.ode.bpel.runtime.channels.ActivityRecovery;
+import org.apache.ode.bpel.runtime.channels.ExtensionResponse;
import org.apache.ode.bpel.runtime.channels.FaultData;
import org.apache.ode.bpel.runtime.channels.InvokeResponse;
import org.apache.ode.bpel.runtime.channels.PickResponse;
import org.apache.ode.bpel.runtime.channels.TimerResponse;
-import org.apache.ode.bpel.evar.ExternalVariableModuleException;
-import org.apache.ode.bpel.iapi.ProcessConf.PartnerRoleConfig;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -311,4 +313,6 @@
ClassLoader getProcessClassLoader();
void checkInvokeExternalPermission();
+
+ void executeExtension(QName extensionId, ExtensionContext context, Element element, ExtensionResponse extResponseChannel) throws FaultException;
}
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
new file mode 100644
index 0000000..9182c38
--- /dev/null
+++ b/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/EXTENSIONACTIVITY.java
@@ -0,0 +1,96 @@
+/*
+ * 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
+ *
+ * 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;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+import org.apache.ode.bpel.common.FaultException;
+import org.apache.ode.bpel.compiler.bom.ExtensibilityQNames;
+import org.apache.ode.bpel.eapi.ExtensionContext;
+import org.apache.ode.bpel.obj.OExtensionActivity;
+import org.apache.ode.bpel.runtime.channels.ExtensionResponse;
+import org.apache.ode.bpel.runtime.channels.FaultData;
+import org.apache.ode.jacob.ReceiveProcess;
+import org.apache.ode.utils.DOMUtils;
+import org.slf4j.Logger;
+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.
+ *
+ * @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 OExtensionActivity _oext;
+
+ public EXTENSIONACTIVITY(ActivityInfo self, ScopeFrame scopeFrame,
+ LinkFrame linkFrame) {
+ super(self, scopeFrame, linkFrame);
+ _oext = (OExtensionActivity) _self.o;
+ }
+
+ public final void run() {
+ try {
+ 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;
+
+ 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);
+ 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());
+ }
+
+ }
+
+}
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
new file mode 100644
index 0000000..f51b449
--- /dev/null
+++ b/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ExtensionContextImpl.java
@@ -0,0 +1,117 @@
+/*
+ * 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
+ *
+ * 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;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.ode.bpel.common.FaultException;
+import org.apache.ode.bpel.eapi.ExtensionContext;
+import org.apache.ode.bpel.obj.OActivity;
+import org.apache.ode.bpel.obj.OLink;
+import org.apache.ode.bpel.obj.OProcess.OProperty;
+import org.apache.ode.bpel.obj.OScope;
+import org.apache.ode.bpel.obj.OScope.Variable;
+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);
+ }
+}
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
new file mode 100644
index 0000000..3720391
--- /dev/null
+++ b/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/channels/ExtensionResponse.java
@@ -0,0 +1,34 @@
+/*
+ * 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
+ *
+ * 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;
+
+import org.apache.ode.jacob.Channel;
+
+/**
+ * Response channel for extension activity executions.
+ *
+ * @author Tammo van Lessen (University of Stuttgart)
+ */
+public interface ExtensionResponse extends Channel {
+
+ void onCompleted();
+
+ void onFailure(Throwable t);
+
+}
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 1c4acb9..ff92db5 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
@@ -249,4 +249,9 @@
public NSContext tryCacheNamespaceContext(NSContext nsContext) {
return nsContext;
}
+
+ public boolean isExtensionDeclared(String namespace) {
+ // TODO Auto-generated method stub
+ return false;
+ }
}
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 456c1cf..18dd7a8 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
@@ -34,6 +34,7 @@
import org.apache.ode.bpel.common.FaultException;
import org.apache.ode.bpel.evar.ExternalVariableModuleException;
import org.apache.ode.bpel.evt.ProcessInstanceEvent;
+import org.apache.ode.bpel.eapi.ExtensionContext;
import org.apache.ode.bpel.iapi.ProcessConf.PartnerRoleConfig;
import org.apache.ode.bpel.obj.OCatch;
import org.apache.ode.bpel.obj.OEmpty;
@@ -48,6 +49,7 @@
import org.apache.ode.bpel.obj.OSequence;
import org.apache.ode.bpel.obj.OThrow;
import org.apache.ode.bpel.runtime.channels.ActivityRecovery;
+import org.apache.ode.bpel.runtime.channels.ExtensionResponse;
import org.apache.ode.bpel.runtime.channels.FaultData;
import org.apache.ode.bpel.runtime.channels.InvokeResponse;
import org.apache.ode.bpel.runtime.channels.PickResponse;
@@ -480,4 +482,10 @@
public void checkInvokeExternalPermission() {}
+ public void executeExtension(QName extensionId, ExtensionContext context,
+ Element element,
+ ExtensionResponse extResponseChannel) throws FaultException {
+ // TODO Auto-generated method stub
+
+ }
}
diff --git a/bpel-store/src/main/java/org/apache/ode/store/DeploymentUnitDir.java b/bpel-store/src/main/java/org/apache/ode/store/DeploymentUnitDir.java
index b8a6d16..2af6b90 100644
--- a/bpel-store/src/main/java/org/apache/ode/store/DeploymentUnitDir.java
+++ b/bpel-store/src/main/java/org/apache/ode/store/DeploymentUnitDir.java
@@ -20,7 +20,6 @@
import java.io.File;
import java.io.FileFilter;
-import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
@@ -50,10 +49,7 @@
import org.apache.ode.bpel.dd.TDeployment;
import org.apache.ode.bpel.dd.TDeployment.Process;
import org.apache.ode.bpel.iapi.ContextException;
-import org.apache.ode.bpel.obj.OProcess;
import org.apache.ode.bpel.obj.serde.DeSerializer;
-import org.apache.ode.bpel.obj.serde.OmDeserializer;
-import org.apache.ode.bpel.obj.serde.OmSerdeFactory;
import org.apache.ode.utils.InternPool;
import org.apache.ode.utils.InternPool.InternableBlock;
import org.apache.ode.utils.fs.FileUtils;
diff --git a/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java b/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java
index 00a7c14..5524018 100644
--- a/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java
+++ b/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java
@@ -88,8 +88,6 @@
protected File _configDir;
-
-
/**
* Executor used to process DB transactions. Allows us to isolate the TX context, and to ensure that only one TX gets executed a
* time. We don't really care to parallelize these operations because: i) HSQL does not isolate transactions and we don't want
diff --git a/bpel-test/src/test/java/org/apache/ode/test/RestExtensionActivitiesTest.java b/bpel-test/src/test/java/org/apache/ode/test/RestExtensionActivitiesTest.java
new file mode 100644
index 0000000..e300260
--- /dev/null
+++ b/bpel-test/src/test/java/org/apache/ode/test/RestExtensionActivitiesTest.java
@@ -0,0 +1,269 @@
+/*
+ * 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
+ *
+ * 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.test;
+
+import java.io.IOException;
+import java.net.HttpURLConnection;
+import java.net.InetSocketAddress;
+
+import javax.xml.namespace.QName;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.ode.bpel.common.FaultException;
+import org.apache.ode.bpel.extension.bpel4restlight.Bpel4RestLightExtensionBundle;
+import org.apache.ode.bpel.iapi.MessageExchange;
+import org.apache.ode.utils.DOMUtils;
+import org.junit.Test;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+import com.sun.net.httpserver.HttpExchange;
+import com.sun.net.httpserver.HttpHandler;
+import com.sun.net.httpserver.HttpServer;
+
+/**
+ * This class runs some initial test cases for the BPEL REST extension bundle
+ *
+ * @author Michael Hahn (mhahn.dev@gmail.com)
+ *
+ */
+public class RestExtensionActivitiesTest extends BPELTestAbstract {
+
+ private HttpServer httpServer;
+
+ private int port = 8085;
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+
+ // Register the extension bundle at the ODE server
+ _server.registerExtensionBundle(new Bpel4RestLightExtensionBundle());
+
+ // Start a test HTTP server for executing the REST extension activities
+ httpServer = HttpServer.create(new InetSocketAddress(port), 0);
+
+ // Create handler to reply HTTP calls
+ httpServer.createContext("/test", new HttpHandler() {
+ public void handle(HttpExchange exchange) throws IOException {
+ handleHttpRequest(exchange);
+ }
+ });
+
+ httpServer.start();
+ }
+
+ /**
+ * Tests the "GET" REST extension activity.
+ *
+ * @throws Throwable
+ */
+ @Test
+ public void testGetExtAct() throws Throwable {
+ go("/bpel/2.0/TestRestGetExtAct");
+ }
+
+ /**
+ * Tests the "POST" REST extension activity.
+ *
+ * @throws Throwable
+ */
+ @Test
+ public void testPostExtAct() throws Throwable {
+ go("/bpel/2.0/TestRestPostExtAct");
+ }
+
+ /**
+ * Tests the "POST" REST extension activity with a static wrapped request
+ * message.
+ *
+ * @throws Throwable
+ */
+ @Test
+ public void testPostExtActWithWrappedRequest() throws Throwable {
+ go("/bpel/2.0/TestRestPostExtAct2");
+ }
+
+ /**
+ * Tests the "PUT" REST extension activity.
+ *
+ * @throws Throwable
+ */
+ @Test
+ public void testPutExtAct() throws Throwable {
+ go("/bpel/2.0/TestRestPutExtAct");
+ }
+
+ /**
+ * Tests the "DELETE" REST extension activity.
+ *
+ * @throws Throwable
+ */
+ @Test
+ public void testDeleteExtAct() throws Throwable {
+ go("/bpel/2.0/TestRestDeleteExtAct");
+ }
+
+ /**
+ * Tests the HTTP status code variable of a REST extension activity.
+ *
+ * @throws Throwable
+ */
+ @Test
+ public void testRestExtActStatusCode() throws Throwable {
+ go("/bpel/2.0/TestRestExtActStatusCode");
+ }
+
+ /**
+ * Tests a BPEL REST extension activity with complex type variables.
+ *
+ * @throws Throwable
+ */
+ @Test
+ public void testRestExtActComplexTypeVar() throws Throwable {
+ go("/bpel/2.0/TestRestExtActComplexTypeVar");
+ }
+
+ /**
+ * Tests the "POST" REST extension activity with an invalid URL value message.
+ *
+ * @throws Throwable
+ */
+ @Test
+ public void testPostExtActWithWrongURL() throws Throwable {
+ deploy("/bpel/2.0/TestPostExtActWithWrongURL");
+
+ Invocation inv = addInvoke("REST-POST#1", new QName("http://ode/bpel/unit-test.wsdl", "HelloService"), "hello",
+ "<message><TestPart>Hello</TestPart></message>", null);
+ inv.expectedFinalStatus = MessageExchange.Status.FAULT;
+ inv.expectedInvokeException = FaultException.class;
+
+ go();
+ }
+
+ private void handleHttpRequest(HttpExchange exchange) throws IOException {
+ String method = exchange.getRequestMethod();
+
+ if (method.toUpperCase().equals("GET")) {
+ String response = "<service:getResponse xmlns:service=\"http://www.example.org/restApi\">\n"
+ + " <service:result>GET response data</service:result>\n"
+ + " </service:getResponse>";
+
+ byte[] bResponse = response.getBytes();
+
+ exchange.sendResponseHeaders(HttpURLConnection.HTTP_OK, bResponse.length);
+ exchange.getResponseBody().write(bResponse);
+ exchange.close();
+ } else if (method.toUpperCase().equals("POST")) {
+ String request = IOUtils.toString(exchange.getRequestBody());
+
+ String requestValue = "";
+ try {
+ Node reqNode = DOMUtils.stringToDOM(request);
+
+ NodeList list = reqNode.getChildNodes();
+ int i = 0;
+ while (i < list.getLength()) {
+ Node node = list.item(i);
+ if (node.getNodeType() == Node.ELEMENT_NODE && ((Element) node).getLocalName().equals("value")) {
+ requestValue = node.getTextContent();
+ }
+ i++;
+ }
+
+ String response = "<service:postResponse xmlns:service=\"http://www.example.org/restApi\">\n"
+ + " <service:result>" + requestValue + " Result</service:result>\n"
+ + " </service:postResponse>";
+
+ byte[] bResponse = response.getBytes();
+
+ exchange.sendResponseHeaders(HttpURLConnection.HTTP_OK, bResponse.length);
+ exchange.getResponseBody().write(bResponse);
+ } catch (SAXException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+
+ exchange.sendResponseHeaders(HttpURLConnection.HTTP_INTERNAL_ERROR, 0);
+ }
+
+ exchange.close();
+ } else if (method.toUpperCase().equals("PUT")) {
+ String request = IOUtils.toString(exchange.getRequestBody());
+
+ String requestValue = "";
+ try {
+ Node reqNode = DOMUtils.stringToDOM(request);
+
+ NodeList list = reqNode.getChildNodes();
+ int i = 0;
+ while (i < list.getLength()) {
+ Node node = list.item(i);
+ if (node.getNodeType() == Node.ELEMENT_NODE && ((Element) node).getLocalName().equals("value")) {
+ requestValue = node.getTextContent();
+ }
+ i++;
+ }
+
+ String response = "<service:putResponse xmlns:service=\"http://www.example.org/restApi\">\n"
+ + " <service:result>" + requestValue + " Result</service:result>\n"
+ + " </service:putResponse>";
+
+ byte[] bResponse = response.getBytes();
+
+ exchange.sendResponseHeaders(HttpURLConnection.HTTP_OK, bResponse.length);
+ exchange.getResponseBody().write(bResponse);
+ } catch (SAXException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+
+ exchange.sendResponseHeaders(HttpURLConnection.HTTP_INTERNAL_ERROR, 0);
+ }
+
+ exchange.close();
+ } else if (method.toUpperCase().equals("DELETE")) {
+ if (exchange.getRequestURI().getPath().endsWith("/test")) {
+ String response = "<service:deleteResponse xmlns:service=\"http://www.example.org/restApi\">\n"
+ + " <service:result>DELETE Method Test</service:result>\n"
+ + " </service:deleteResponse>";
+
+ byte[] bResponse = response.getBytes();
+
+ exchange.sendResponseHeaders(HttpURLConnection.HTTP_OK, bResponse.length);
+ exchange.getResponseBody().write(bResponse);
+ exchange.close();
+ } else {
+ exchange.sendResponseHeaders(HttpURLConnection.HTTP_NOT_FOUND, 0);
+ exchange.close();
+ }
+ } else {
+ exchange.sendResponseHeaders(HttpURLConnection.HTTP_NOT_FOUND, 0);
+ exchange.close();
+ }
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ super.tearDown();
+
+ // Stop the server
+ httpServer.stop(0);
+ }
+}
diff --git a/bpel-test/src/test/resources/bpel/2.0/TestPostExtActWithWrongURL/TestPostExtActWithWrongURL.bpel b/bpel-test/src/test/resources/bpel/2.0/TestPostExtActWithWrongURL/TestPostExtActWithWrongURL.bpel
new file mode 100644
index 0000000..da9a726
--- /dev/null
+++ b/bpel-test/src/test/resources/bpel/2.0/TestPostExtActWithWrongURL/TestPostExtActWithWrongURL.bpel
@@ -0,0 +1,100 @@
+<!--
+ ~ 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
+ ~
+ ~ 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.
+ -->
+<process name="TestPostExtActWithWrongURL"
+ targetNamespace="http://ode/bpel/unit-test"
+ xmlns:bpws="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
+ xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
+ xmlns:tns="http://ode/bpel/unit-test"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:test="http://ode/bpel/unit-test.wsdl"
+ xmlns:service="http://www.example.org/restApi"
+ xmlns:bpel4RestLight="http://www.apache.org/ode/bpel/extensions/bpel4restlight"
+ queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"
+ expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0">
+
+ <import location="TestPostExtActWithWrongURL.wsdl"
+ namespace="http://ode/bpel/unit-test.wsdl"
+ importType="http://schemas.xmlsoap.org/wsdl/" />
+
+ <import location="restApi.xsd"
+ namespace="http://www.example.org/restApi"
+ importType="http://www.w3.org/2001/XMLSchema"/>
+
+ <extensions>
+ <extension mustUnderstand="yes" namespace="http://www.apache.org/ode/bpel/extensions/bpel4restlight"/>
+ </extensions>
+
+ <partnerLinks>
+ <partnerLink name="helloPartnerLink"
+ partnerLinkType="test:HelloPartnerLinkType"
+ myRole="me" />
+ </partnerLinks>
+
+ <variables>
+ <variable name="myVar" messageType="test:HelloMessage"/>
+ <variable name="restUrl" type="xsd:string"/>
+ <variable name="restRequest" element="service:postRequest"/>
+ <variable name="restResponse" element="service:postResponse"/>
+ <variable name="response" messageType="test:ResponseMessage"></variable>
+ </variables>
+
+ <sequence>
+ <receive
+ name="start"
+ partnerLink="helloPartnerLink"
+ portType="test:HelloPortType"
+ operation="hello"
+ variable="myVar"
+ createInstance="yes"/>
+
+ <assign name="assign1">
+ <copy>
+ <from><literal>http://localhost:8086/test</literal></from>
+ <to variable="restUrl"/>
+ </copy>
+ <copy>
+ <from>
+ <literal>
+ <service:postRequest xmlns:service="http://www.example.org/restApi">
+ <service:value>POST Method Test</service:value>
+ </service:postRequest>
+ </literal>
+ </from>
+ <to variable="restRequest"/>
+ </copy>
+ </assign>
+
+ <extensionActivity>
+ <bpel4RestLight:POST accept="application/xml" request="restRequest" response="restResponse" uri="$bpelvar[restUrl]"/>
+ </extensionActivity>
+
+ <assign name="assign2">
+ <copy>
+ <from variable="restResponse"></from>
+ <to part="TestPart" variable="response"></to>
+ </copy>
+ </assign>
+
+ <reply name="end"
+ partnerLink="helloPartnerLink"
+ portType="test:HelloPortType"
+ operation="hello"
+ variable="response"/>
+ </sequence>
+</process>
diff --git a/bpel-test/src/test/resources/bpel/2.0/TestPostExtActWithWrongURL/TestPostExtActWithWrongURL.wsdl b/bpel-test/src/test/resources/bpel/2.0/TestPostExtActWithWrongURL/TestPostExtActWithWrongURL.wsdl
new file mode 100644
index 0000000..2270a8b
--- /dev/null
+++ b/bpel-test/src/test/resources/bpel/2.0/TestPostExtActWithWrongURL/TestPostExtActWithWrongURL.wsdl
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!--
+ ~ 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
+ ~
+ ~ 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.
+ -->
+
+<wsdl:definitions
+ targetNamespace="http://ode/bpel/unit-test.wsdl"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:tns="http://ode/bpel/unit-test.wsdl"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:bpws="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
+ xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype">
+
+ <wsdl:message name="HelloMessage">
+ <wsdl:part name="TestPart" type="xsd:string"/>
+ </wsdl:message>
+
+ <wsdl:message name="ResponseMessage">
+ <wsdl:part name="TestPart" type="xsd:anyType"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloPortType">
+ <wsdl:operation name="hello">
+ <wsdl:input message="tns:HelloMessage" name="TestIn"/>
+ <wsdl:output message="tns:ResponseMessage" name="TestOut"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="HelloSoapBinding" type="tns:HelloPortType">
+ <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="hello">
+ <soap:operation soapAction="" style="rpc"/>
+ <wsdl:input>
+ <soap:body
+ namespace="http://ode/bpel/unit-test.wsdl"
+ use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body
+ namespace="http://ode/bpel/unit-test.wsdl"
+ use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="HelloService">
+ <wsdl:port name="HelloPort" binding="tns:HelloSoapBinding">
+ <soap:address location="http://localhost:8080/ode/processes/helloWorld"/>
+ </wsdl:port>
+ </wsdl:service>
+
+ <plnk:partnerLinkType name="HelloPartnerLinkType">
+ <plnk:role name="me" portType="tns:HelloPortType"/>
+ <plnk:role name="you" portType="tns:HelloPortType"/>
+ </plnk:partnerLinkType>
+</wsdl:definitions>
+
diff --git a/bpel-test/src/test/resources/bpel/2.0/TestPostExtActWithWrongURL/deploy.xml b/bpel-test/src/test/resources/bpel/2.0/TestPostExtActWithWrongURL/deploy.xml
new file mode 100644
index 0000000..5ee5c95
--- /dev/null
+++ b/bpel-test/src/test/resources/bpel/2.0/TestPostExtActWithWrongURL/deploy.xml
@@ -0,0 +1,30 @@
+<!--
+ ~ 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
+ ~
+ ~ 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.
+ -->
+<deploy xmlns="http://www.apache.org/ode/schemas/dd/2007/03"
+ xmlns:pns="http://ode/bpel/unit-test"
+ xmlns:wns="http://ode/bpel/unit-test.wsdl">
+
+
+ <process name="pns:TestPostExtActWithWrongURL">
+ <active>true</active>
+ <provide partnerLink="helloPartnerLink">
+ <service name="wns:HelloService" port="HelloPort"/>
+ </provide>
+ </process>
+</deploy>
diff --git a/bpel-test/src/test/resources/bpel/2.0/TestPostExtActWithWrongURL/restApi.xsd b/bpel-test/src/test/resources/bpel/2.0/TestPostExtActWithWrongURL/restApi.xsd
new file mode 100644
index 0000000..b521dc7
--- /dev/null
+++ b/bpel-test/src/test/resources/bpel/2.0/TestPostExtActWithWrongURL/restApi.xsd
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/restApi"
+ xmlns:tns="http://www.example.org/restApi" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+
+ <xsd:complexType name="postRequestType">
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="postResponseType">
+ <xsd:sequence>
+ <xsd:element name="result" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:element name="postRequest" type="tns:postRequestType"></xsd:element>
+ <xsd:element name="postResponse" type="tns:postResponseType"></xsd:element>
+</schema>
\ No newline at end of file
diff --git a/bpel-test/src/test/resources/bpel/2.0/TestRestDeleteExtAct/TestRestDeleteExtAct.bpel b/bpel-test/src/test/resources/bpel/2.0/TestRestDeleteExtAct/TestRestDeleteExtAct.bpel
new file mode 100644
index 0000000..82a29fc
--- /dev/null
+++ b/bpel-test/src/test/resources/bpel/2.0/TestRestDeleteExtAct/TestRestDeleteExtAct.bpel
@@ -0,0 +1,89 @@
+<!--
+ ~ 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
+ ~
+ ~ 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.
+ -->
+<process name="TestRestDeleteExtAct"
+ targetNamespace="http://ode/bpel/unit-test"
+ xmlns:bpws="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
+ xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
+ xmlns:tns="http://ode/bpel/unit-test"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:test="http://ode/bpel/unit-test.wsdl"
+ xmlns:service="http://www.example.org/restApi"
+ xmlns:bpel4RestLight="http://www.apache.org/ode/bpel/extensions/bpel4restlight"
+ queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"
+ expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0">
+
+ <import location="TestRestDeleteExtAct.wsdl"
+ namespace="http://ode/bpel/unit-test.wsdl"
+ importType="http://schemas.xmlsoap.org/wsdl/" />
+
+ <import location="restApi.xsd"
+ namespace="http://www.example.org/restApi"
+ importType="http://www.w3.org/2001/XMLSchema"/>
+
+ <extensions>
+ <extension mustUnderstand="yes" namespace="http://www.apache.org/ode/bpel/extensions/bpel4restlight"/>
+ </extensions>
+
+ <partnerLinks>
+ <partnerLink name="helloPartnerLink"
+ partnerLinkType="test:HelloPartnerLinkType"
+ myRole="me" />
+ </partnerLinks>
+
+ <variables>
+ <variable name="myVar" messageType="test:HelloMessage"/>
+ <variable name="restUrl" type="xsd:string"/>
+ <variable name="restResponse" element="service:deleteResponse"/>
+ <variable name="response" messageType="test:ResponseMessage"></variable>
+ </variables>
+
+ <sequence>
+ <receive
+ name="start"
+ partnerLink="helloPartnerLink"
+ portType="test:HelloPortType"
+ operation="hello"
+ variable="myVar"
+ createInstance="yes"/>
+
+ <assign name="assign1">
+ <copy>
+ <from><literal>http://localhost:8085/test</literal></from>
+ <to variable="restUrl"/>
+ </copy>
+ </assign>
+
+ <extensionActivity>
+ <bpel4RestLight:DELETE accept="application/xml" response="restResponse" uri="$bpelvar[restUrl]"/>
+ </extensionActivity>
+
+ <assign name="assign2">
+ <copy>
+ <from variable="restResponse"></from>
+ <to part="TestPart" variable="response"></to>
+ </copy>
+ </assign>
+
+ <reply name="end"
+ partnerLink="helloPartnerLink"
+ portType="test:HelloPortType"
+ operation="hello"
+ variable="response"/>
+ </sequence>
+</process>
diff --git a/bpel-test/src/test/resources/bpel/2.0/TestRestDeleteExtAct/TestRestDeleteExtAct.wsdl b/bpel-test/src/test/resources/bpel/2.0/TestRestDeleteExtAct/TestRestDeleteExtAct.wsdl
new file mode 100644
index 0000000..2270a8b
--- /dev/null
+++ b/bpel-test/src/test/resources/bpel/2.0/TestRestDeleteExtAct/TestRestDeleteExtAct.wsdl
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!--
+ ~ 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
+ ~
+ ~ 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.
+ -->
+
+<wsdl:definitions
+ targetNamespace="http://ode/bpel/unit-test.wsdl"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:tns="http://ode/bpel/unit-test.wsdl"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:bpws="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
+ xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype">
+
+ <wsdl:message name="HelloMessage">
+ <wsdl:part name="TestPart" type="xsd:string"/>
+ </wsdl:message>
+
+ <wsdl:message name="ResponseMessage">
+ <wsdl:part name="TestPart" type="xsd:anyType"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloPortType">
+ <wsdl:operation name="hello">
+ <wsdl:input message="tns:HelloMessage" name="TestIn"/>
+ <wsdl:output message="tns:ResponseMessage" name="TestOut"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="HelloSoapBinding" type="tns:HelloPortType">
+ <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="hello">
+ <soap:operation soapAction="" style="rpc"/>
+ <wsdl:input>
+ <soap:body
+ namespace="http://ode/bpel/unit-test.wsdl"
+ use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body
+ namespace="http://ode/bpel/unit-test.wsdl"
+ use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="HelloService">
+ <wsdl:port name="HelloPort" binding="tns:HelloSoapBinding">
+ <soap:address location="http://localhost:8080/ode/processes/helloWorld"/>
+ </wsdl:port>
+ </wsdl:service>
+
+ <plnk:partnerLinkType name="HelloPartnerLinkType">
+ <plnk:role name="me" portType="tns:HelloPortType"/>
+ <plnk:role name="you" portType="tns:HelloPortType"/>
+ </plnk:partnerLinkType>
+</wsdl:definitions>
+
diff --git a/bpel-test/src/test/resources/bpel/2.0/TestRestDeleteExtAct/deploy.xml b/bpel-test/src/test/resources/bpel/2.0/TestRestDeleteExtAct/deploy.xml
new file mode 100644
index 0000000..46d55f8
--- /dev/null
+++ b/bpel-test/src/test/resources/bpel/2.0/TestRestDeleteExtAct/deploy.xml
@@ -0,0 +1,30 @@
+<!--
+ ~ 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
+ ~
+ ~ 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.
+ -->
+<deploy xmlns="http://www.apache.org/ode/schemas/dd/2007/03"
+ xmlns:pns="http://ode/bpel/unit-test"
+ xmlns:wns="http://ode/bpel/unit-test.wsdl">
+
+
+ <process name="pns:TestRestDeleteExtAct">
+ <active>true</active>
+ <provide partnerLink="helloPartnerLink">
+ <service name="wns:HelloService" port="HelloPort"/>
+ </provide>
+ </process>
+</deploy>
diff --git a/bpel-test/src/test/resources/bpel/2.0/TestRestDeleteExtAct/restApi.xsd b/bpel-test/src/test/resources/bpel/2.0/TestRestDeleteExtAct/restApi.xsd
new file mode 100644
index 0000000..7aa878b
--- /dev/null
+++ b/bpel-test/src/test/resources/bpel/2.0/TestRestDeleteExtAct/restApi.xsd
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/restApi"
+ xmlns:tns="http://www.example.org/restApi" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+
+ <xsd:complexType name="deleteResponseType">
+ <xsd:sequence>
+ <xsd:element name="result" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:element name="deleteResponse" type="tns:deleteResponseType"></xsd:element>
+</schema>
\ No newline at end of file
diff --git a/bpel-test/src/test/resources/bpel/2.0/TestRestDeleteExtAct/test.properties b/bpel-test/src/test/resources/bpel/2.0/TestRestDeleteExtAct/test.properties
new file mode 100644
index 0000000..9e9d8fe
--- /dev/null
+++ b/bpel-test/src/test/resources/bpel/2.0/TestRestDeleteExtAct/test.properties
@@ -0,0 +1,23 @@
+#
+# 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
+#
+# 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.
+#
+
+namespace=http://ode/bpel/unit-test.wsdl
+service=HelloService
+operation=hello
+request1=<message><TestPart>Hello</TestPart></message>
+response1=.*DELETE Method Test.*
+
diff --git a/bpel-test/src/test/resources/bpel/2.0/TestRestExtActComplexTypeVar/TestRestExtActComplexTypeVar.bpel b/bpel-test/src/test/resources/bpel/2.0/TestRestExtActComplexTypeVar/TestRestExtActComplexTypeVar.bpel
new file mode 100644
index 0000000..73ee1a9
--- /dev/null
+++ b/bpel-test/src/test/resources/bpel/2.0/TestRestExtActComplexTypeVar/TestRestExtActComplexTypeVar.bpel
@@ -0,0 +1,90 @@
+<!--
+ ~ 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
+ ~
+ ~ 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.
+ -->
+<process name="TestRestExtActComplexTypeVar"
+ targetNamespace="http://ode/bpel/unit-test"
+ xmlns:bpws="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
+ xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
+ xmlns:tns="http://ode/bpel/unit-test"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:test="http://ode/bpel/unit-test.wsdl"
+ xmlns:bpel4RestLight="http://www.apache.org/ode/bpel/extensions/bpel4restlight"
+ queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"
+ expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0">
+
+ <import location="TestRestExtActComplexTypeVar.wsdl"
+ namespace="http://ode/bpel/unit-test.wsdl"
+ importType="http://schemas.xmlsoap.org/wsdl/" />
+
+ <extensions>
+ <extension mustUnderstand="yes" namespace="http://www.apache.org/ode/bpel/extensions/bpel4restlight"/>
+ </extensions>
+
+ <partnerLinks>
+ <partnerLink name="helloPartnerLink"
+ partnerLinkType="test:HelloPartnerLinkType"
+ myRole="me" />
+ </partnerLinks>
+
+ <variables>
+ <variable name="myVar" messageType="test:HelloMessage"/>
+ <variable name="restRequest" type="xsd:anyType"/>
+ <variable name="restResponse" type="xsd:anyType"/>
+ <variable name="response" messageType="test:ResponseMessage"/>
+ </variables>
+
+ <sequence>
+ <receive
+ name="start"
+ partnerLink="helloPartnerLink"
+ portType="test:HelloPortType"
+ operation="hello"
+ variable="myVar"
+ createInstance="yes"/>
+
+ <assign name="assign1">
+ <copy>
+ <from>
+ <literal>
+ <service:postRequest xmlns:service="http://www.example.org/restApi">
+ <service:value>POST Method Test</service:value>
+ </service:postRequest>
+ </literal>
+ </from>
+ <to variable="restRequest"/>
+ </copy>
+ </assign>
+
+ <extensionActivity>
+ <bpel4RestLight:POST accept="application/xml" request="restRequest" response="restResponse" uri="http://localhost:8085/test"/>
+ </extensionActivity>
+
+ <assign name="assign2">
+ <copy>
+ <from variable="restResponse"></from>
+ <to part="TestPart" variable="response"></to>
+ </copy>
+ </assign>
+
+ <reply name="end"
+ partnerLink="helloPartnerLink"
+ portType="test:HelloPortType"
+ operation="hello"
+ variable="response"/>
+ </sequence>
+</process>
diff --git a/bpel-test/src/test/resources/bpel/2.0/TestRestExtActComplexTypeVar/TestRestExtActComplexTypeVar.wsdl b/bpel-test/src/test/resources/bpel/2.0/TestRestExtActComplexTypeVar/TestRestExtActComplexTypeVar.wsdl
new file mode 100644
index 0000000..2270a8b
--- /dev/null
+++ b/bpel-test/src/test/resources/bpel/2.0/TestRestExtActComplexTypeVar/TestRestExtActComplexTypeVar.wsdl
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!--
+ ~ 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
+ ~
+ ~ 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.
+ -->
+
+<wsdl:definitions
+ targetNamespace="http://ode/bpel/unit-test.wsdl"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:tns="http://ode/bpel/unit-test.wsdl"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:bpws="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
+ xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype">
+
+ <wsdl:message name="HelloMessage">
+ <wsdl:part name="TestPart" type="xsd:string"/>
+ </wsdl:message>
+
+ <wsdl:message name="ResponseMessage">
+ <wsdl:part name="TestPart" type="xsd:anyType"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloPortType">
+ <wsdl:operation name="hello">
+ <wsdl:input message="tns:HelloMessage" name="TestIn"/>
+ <wsdl:output message="tns:ResponseMessage" name="TestOut"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="HelloSoapBinding" type="tns:HelloPortType">
+ <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="hello">
+ <soap:operation soapAction="" style="rpc"/>
+ <wsdl:input>
+ <soap:body
+ namespace="http://ode/bpel/unit-test.wsdl"
+ use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body
+ namespace="http://ode/bpel/unit-test.wsdl"
+ use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="HelloService">
+ <wsdl:port name="HelloPort" binding="tns:HelloSoapBinding">
+ <soap:address location="http://localhost:8080/ode/processes/helloWorld"/>
+ </wsdl:port>
+ </wsdl:service>
+
+ <plnk:partnerLinkType name="HelloPartnerLinkType">
+ <plnk:role name="me" portType="tns:HelloPortType"/>
+ <plnk:role name="you" portType="tns:HelloPortType"/>
+ </plnk:partnerLinkType>
+</wsdl:definitions>
+
diff --git a/bpel-test/src/test/resources/bpel/2.0/TestRestExtActComplexTypeVar/deploy.xml b/bpel-test/src/test/resources/bpel/2.0/TestRestExtActComplexTypeVar/deploy.xml
new file mode 100644
index 0000000..f23f17a
--- /dev/null
+++ b/bpel-test/src/test/resources/bpel/2.0/TestRestExtActComplexTypeVar/deploy.xml
@@ -0,0 +1,30 @@
+<!--
+ ~ 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
+ ~
+ ~ 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.
+ -->
+<deploy xmlns="http://www.apache.org/ode/schemas/dd/2007/03"
+ xmlns:pns="http://ode/bpel/unit-test"
+ xmlns:wns="http://ode/bpel/unit-test.wsdl">
+
+
+ <process name="pns:TestRestExtActComplexTypeVar">
+ <active>true</active>
+ <provide partnerLink="helloPartnerLink">
+ <service name="wns:HelloService" port="HelloPort"/>
+ </provide>
+ </process>
+</deploy>
diff --git a/bpel-test/src/test/resources/bpel/2.0/TestRestExtActComplexTypeVar/test.properties b/bpel-test/src/test/resources/bpel/2.0/TestRestExtActComplexTypeVar/test.properties
new file mode 100644
index 0000000..1c966aa
--- /dev/null
+++ b/bpel-test/src/test/resources/bpel/2.0/TestRestExtActComplexTypeVar/test.properties
@@ -0,0 +1,23 @@
+#
+# 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
+#
+# 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.
+#
+
+namespace=http://ode/bpel/unit-test.wsdl
+service=HelloService
+operation=hello
+request1=<message><TestPart>Hello</TestPart></message>
+response1=.*POST Method Test Result.*
+
diff --git a/bpel-test/src/test/resources/bpel/2.0/TestRestExtActStatusCode/TestRestExtActStatusCode.bpel b/bpel-test/src/test/resources/bpel/2.0/TestRestExtActStatusCode/TestRestExtActStatusCode.bpel
new file mode 100644
index 0000000..997fe55
--- /dev/null
+++ b/bpel-test/src/test/resources/bpel/2.0/TestRestExtActStatusCode/TestRestExtActStatusCode.bpel
@@ -0,0 +1,90 @@
+<!--
+ ~ 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
+ ~
+ ~ 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.
+ -->
+<process name="TestRestExtActStatusCode"
+ targetNamespace="http://ode/bpel/unit-test"
+ xmlns:bpws="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
+ xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
+ xmlns:tns="http://ode/bpel/unit-test"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:test="http://ode/bpel/unit-test.wsdl"
+ xmlns:service="http://www.example.org/restApi"
+ xmlns:bpel4RestLight="http://www.apache.org/ode/bpel/extensions/bpel4restlight"
+ queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"
+ expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0">
+
+ <import location="TestRestExtActStatusCode.wsdl"
+ namespace="http://ode/bpel/unit-test.wsdl"
+ importType="http://schemas.xmlsoap.org/wsdl/" />
+
+ <import location="restApi.xsd"
+ namespace="http://www.example.org/restApi"
+ importType="http://www.w3.org/2001/XMLSchema"/>
+
+ <extensions>
+ <extension mustUnderstand="yes" namespace="http://www.apache.org/ode/bpel/extensions/bpel4restlight"/>
+ </extensions>
+
+ <partnerLinks>
+ <partnerLink name="helloPartnerLink"
+ partnerLinkType="test:HelloPartnerLinkType"
+ myRole="me" />
+ </partnerLinks>
+
+ <variables>
+ <variable name="myVar" messageType="test:HelloMessage"/>
+ <variable name="restUrl" type="xsd:string"/>
+ <variable name="statusCodeVar" type="xsd:int"/>
+ <variable name="restResponse" element="service:deleteResponse"/>
+ <variable name="response" messageType="test:ResponseMessage"></variable>
+ </variables>
+
+ <sequence>
+ <receive
+ name="start"
+ partnerLink="helloPartnerLink"
+ portType="test:HelloPortType"
+ operation="hello"
+ variable="myVar"
+ createInstance="yes"/>
+
+ <assign name="assign1">
+ <copy>
+ <from><literal>http://localhost:8085/test/resource</literal></from>
+ <to variable="restUrl"/>
+ </copy>
+ </assign>
+
+ <extensionActivity>
+ <bpel4RestLight:DELETE accept="application/xml" response="restResponse" statusCode="statusCodeVar" uri="$bpelvar[restUrl]"/>
+ </extensionActivity>
+
+ <assign name="assign2">
+ <copy>
+ <from variable="statusCodeVar"></from>
+ <to part="TestPart" variable="response"></to>
+ </copy>
+ </assign>
+
+ <reply name="end"
+ partnerLink="helloPartnerLink"
+ portType="test:HelloPortType"
+ operation="hello"
+ variable="response"/>
+ </sequence>
+</process>
diff --git a/bpel-test/src/test/resources/bpel/2.0/TestRestExtActStatusCode/TestRestExtActStatusCode.wsdl b/bpel-test/src/test/resources/bpel/2.0/TestRestExtActStatusCode/TestRestExtActStatusCode.wsdl
new file mode 100644
index 0000000..2270a8b
--- /dev/null
+++ b/bpel-test/src/test/resources/bpel/2.0/TestRestExtActStatusCode/TestRestExtActStatusCode.wsdl
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!--
+ ~ 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
+ ~
+ ~ 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.
+ -->
+
+<wsdl:definitions
+ targetNamespace="http://ode/bpel/unit-test.wsdl"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:tns="http://ode/bpel/unit-test.wsdl"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:bpws="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
+ xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype">
+
+ <wsdl:message name="HelloMessage">
+ <wsdl:part name="TestPart" type="xsd:string"/>
+ </wsdl:message>
+
+ <wsdl:message name="ResponseMessage">
+ <wsdl:part name="TestPart" type="xsd:anyType"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloPortType">
+ <wsdl:operation name="hello">
+ <wsdl:input message="tns:HelloMessage" name="TestIn"/>
+ <wsdl:output message="tns:ResponseMessage" name="TestOut"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="HelloSoapBinding" type="tns:HelloPortType">
+ <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="hello">
+ <soap:operation soapAction="" style="rpc"/>
+ <wsdl:input>
+ <soap:body
+ namespace="http://ode/bpel/unit-test.wsdl"
+ use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body
+ namespace="http://ode/bpel/unit-test.wsdl"
+ use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="HelloService">
+ <wsdl:port name="HelloPort" binding="tns:HelloSoapBinding">
+ <soap:address location="http://localhost:8080/ode/processes/helloWorld"/>
+ </wsdl:port>
+ </wsdl:service>
+
+ <plnk:partnerLinkType name="HelloPartnerLinkType">
+ <plnk:role name="me" portType="tns:HelloPortType"/>
+ <plnk:role name="you" portType="tns:HelloPortType"/>
+ </plnk:partnerLinkType>
+</wsdl:definitions>
+
diff --git a/bpel-test/src/test/resources/bpel/2.0/TestRestExtActStatusCode/deploy.xml b/bpel-test/src/test/resources/bpel/2.0/TestRestExtActStatusCode/deploy.xml
new file mode 100644
index 0000000..cdba052
--- /dev/null
+++ b/bpel-test/src/test/resources/bpel/2.0/TestRestExtActStatusCode/deploy.xml
@@ -0,0 +1,30 @@
+<!--
+ ~ 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
+ ~
+ ~ 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.
+ -->
+<deploy xmlns="http://www.apache.org/ode/schemas/dd/2007/03"
+ xmlns:pns="http://ode/bpel/unit-test"
+ xmlns:wns="http://ode/bpel/unit-test.wsdl">
+
+
+ <process name="pns:TestRestExtActStatusCode">
+ <active>true</active>
+ <provide partnerLink="helloPartnerLink">
+ <service name="wns:HelloService" port="HelloPort"/>
+ </provide>
+ </process>
+</deploy>
diff --git a/bpel-test/src/test/resources/bpel/2.0/TestRestExtActStatusCode/restApi.xsd b/bpel-test/src/test/resources/bpel/2.0/TestRestExtActStatusCode/restApi.xsd
new file mode 100644
index 0000000..7aa878b
--- /dev/null
+++ b/bpel-test/src/test/resources/bpel/2.0/TestRestExtActStatusCode/restApi.xsd
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/restApi"
+ xmlns:tns="http://www.example.org/restApi" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+
+ <xsd:complexType name="deleteResponseType">
+ <xsd:sequence>
+ <xsd:element name="result" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:element name="deleteResponse" type="tns:deleteResponseType"></xsd:element>
+</schema>
\ No newline at end of file
diff --git a/bpel-test/src/test/resources/bpel/2.0/TestRestExtActStatusCode/test.properties b/bpel-test/src/test/resources/bpel/2.0/TestRestExtActStatusCode/test.properties
new file mode 100644
index 0000000..b6b5750
--- /dev/null
+++ b/bpel-test/src/test/resources/bpel/2.0/TestRestExtActStatusCode/test.properties
@@ -0,0 +1,23 @@
+#
+# 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
+#
+# 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.
+#
+
+namespace=http://ode/bpel/unit-test.wsdl
+service=HelloService
+operation=hello
+request1=<message><TestPart>Hello</TestPart></message>
+response1=.*404.*
+
diff --git a/bpel-test/src/test/resources/bpel/2.0/TestRestGetExtAct/TestRestGetExtAct.bpel b/bpel-test/src/test/resources/bpel/2.0/TestRestGetExtAct/TestRestGetExtAct.bpel
new file mode 100644
index 0000000..9a4ee33
--- /dev/null
+++ b/bpel-test/src/test/resources/bpel/2.0/TestRestGetExtAct/TestRestGetExtAct.bpel
@@ -0,0 +1,84 @@
+<!--
+ ~ 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
+ ~
+ ~ 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.
+ -->
+<process name="TestRestGetExtAct"
+ targetNamespace="http://ode/bpel/unit-test"
+ xmlns:bpws="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
+ xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
+ xmlns:tns="http://ode/bpel/unit-test"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:test="http://ode/bpel/unit-test.wsdl"
+ xmlns:bpel4RestLight="http://www.apache.org/ode/bpel/extensions/bpel4restlight"
+ queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"
+ expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0">
+
+ <import location="TestRestGetExtAct.wsdl"
+ namespace="http://ode/bpel/unit-test.wsdl"
+ importType="http://schemas.xmlsoap.org/wsdl/" />
+
+ <extensions>
+ <extension mustUnderstand="yes" namespace="http://www.apache.org/ode/bpel/extensions/bpel4restlight"/>
+ </extensions>
+
+ <partnerLinks>
+ <partnerLink name="helloPartnerLink"
+ partnerLinkType="test:HelloPartnerLinkType"
+ myRole="me" />
+ </partnerLinks>
+
+ <variables>
+ <variable name="myVar" messageType="test:HelloMessage"/>
+ <variable name="restUrl" type="xsd:string"/>
+ <variable name="restResponse" type="xsd:anyType"/>
+ <variable name="response" messageType="test:ResponseMessage"></variable>
+ </variables>
+
+ <sequence>
+ <receive
+ name="start"
+ partnerLink="helloPartnerLink"
+ portType="test:HelloPortType"
+ operation="hello"
+ variable="myVar"
+ createInstance="yes"/>
+
+ <assign name="assign1">
+ <copy>
+ <from><literal>http://localhost:8085/test</literal></from>
+ <to variable="restUrl"/>
+ </copy>
+ </assign>
+
+ <extensionActivity>
+ <bpel4RestLight:GET accept="application/xml" response="restResponse" uri="$bpelvar[restUrl]"/>
+ </extensionActivity>
+
+ <assign name="assign2">
+ <copy>
+ <from variable="restResponse"></from>
+ <to part="TestPart" variable="response"></to>
+ </copy>
+ </assign>
+
+ <reply name="end"
+ partnerLink="helloPartnerLink"
+ portType="test:HelloPortType"
+ operation="hello"
+ variable="response"/>
+ </sequence>
+</process>
diff --git a/bpel-test/src/test/resources/bpel/2.0/TestRestGetExtAct/TestRestGetExtAct.wsdl b/bpel-test/src/test/resources/bpel/2.0/TestRestGetExtAct/TestRestGetExtAct.wsdl
new file mode 100644
index 0000000..3769221
--- /dev/null
+++ b/bpel-test/src/test/resources/bpel/2.0/TestRestGetExtAct/TestRestGetExtAct.wsdl
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!--
+ ~ 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
+ ~
+ ~ 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.
+ -->
+
+<wsdl:definitions
+ targetNamespace="http://ode/bpel/unit-test.wsdl"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:tns="http://ode/bpel/unit-test.wsdl"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:bpws="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
+ xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype">
+
+ <wsdl:message name="HelloMessage">
+ <wsdl:part name="TestPart" type="xsd:string"/>
+ </wsdl:message>
+
+ <wsdl:message name="ResponseMessage">
+ <wsdl:part name="TestPart" type="xsd:anyType"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloPortType">
+ <wsdl:operation name="hello">
+ <wsdl:input message="tns:HelloMessage" name="TestIn"/>
+ <wsdl:output message="tns:ResponseMessage" name="TestOut"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="HelloSoapBinding" type="tns:HelloPortType">
+ <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="hello">
+ <soap:operation soapAction="" style="rpc"/>
+ <wsdl:input>
+ <soap:body
+ namespace="http://ode/bpel/unit-test.wsdl"
+ use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body
+ namespace="http://ode/bpel/unit-test.wsdl"
+ use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="HelloService">
+ <wsdl:port name="HelloPort" binding="tns:HelloSoapBinding">
+ <soap:address location="http://localhost:8080/ode/processes/helloWorld"/>
+ </wsdl:port>
+ </wsdl:service>
+
+ <plnk:partnerLinkType name="HelloPartnerLinkType">
+ <plnk:role name="me" portType="tns:HelloPortType"/>
+ <plnk:role name="you" portType="tns:HelloPortType"/>
+ </plnk:partnerLinkType>
+</wsdl:definitions>
+
diff --git a/bpel-test/src/test/resources/bpel/2.0/TestRestGetExtAct/deploy.xml b/bpel-test/src/test/resources/bpel/2.0/TestRestGetExtAct/deploy.xml
new file mode 100644
index 0000000..541742a
--- /dev/null
+++ b/bpel-test/src/test/resources/bpel/2.0/TestRestGetExtAct/deploy.xml
@@ -0,0 +1,30 @@
+<!--
+ ~ 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
+ ~
+ ~ 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.
+ -->
+<deploy xmlns="http://www.apache.org/ode/schemas/dd/2007/03"
+ xmlns:pns="http://ode/bpel/unit-test"
+ xmlns:wns="http://ode/bpel/unit-test.wsdl">
+
+
+ <process name="pns:TestRestGetExtAct">
+ <active>true</active>
+ <provide partnerLink="helloPartnerLink">
+ <service name="wns:HelloService" port="HelloPort"/>
+ </provide>
+ </process>
+</deploy>
diff --git a/bpel-test/src/test/resources/bpel/2.0/TestRestGetExtAct/test.properties b/bpel-test/src/test/resources/bpel/2.0/TestRestGetExtAct/test.properties
new file mode 100644
index 0000000..558675c
--- /dev/null
+++ b/bpel-test/src/test/resources/bpel/2.0/TestRestGetExtAct/test.properties
@@ -0,0 +1,23 @@
+#
+# 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
+#
+# 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.
+#
+
+namespace=http://ode/bpel/unit-test.wsdl
+service=HelloService
+operation=hello
+request1=<message><TestPart>Hello</TestPart></message>
+response1=.*GET response data.*
+
diff --git a/bpel-test/src/test/resources/bpel/2.0/TestRestPostExtAct/TestRestPostExtAct.bpel b/bpel-test/src/test/resources/bpel/2.0/TestRestPostExtAct/TestRestPostExtAct.bpel
new file mode 100644
index 0000000..5a12cb3
--- /dev/null
+++ b/bpel-test/src/test/resources/bpel/2.0/TestRestPostExtAct/TestRestPostExtAct.bpel
@@ -0,0 +1,100 @@
+<!--
+ ~ 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
+ ~
+ ~ 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.
+ -->
+<process name="TestRestPostExtAct"
+ targetNamespace="http://ode/bpel/unit-test"
+ xmlns:bpws="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
+ xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
+ xmlns:tns="http://ode/bpel/unit-test"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:test="http://ode/bpel/unit-test.wsdl"
+ xmlns:service="http://www.example.org/restApi"
+ xmlns:bpel4RestLight="http://www.apache.org/ode/bpel/extensions/bpel4restlight"
+ queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"
+ expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0">
+
+ <import location="TestRestPostExtAct.wsdl"
+ namespace="http://ode/bpel/unit-test.wsdl"
+ importType="http://schemas.xmlsoap.org/wsdl/" />
+
+ <import location="restApi.xsd"
+ namespace="http://www.example.org/restApi"
+ importType="http://www.w3.org/2001/XMLSchema"/>
+
+ <extensions>
+ <extension mustUnderstand="yes" namespace="http://www.apache.org/ode/bpel/extensions/bpel4restlight"/>
+ </extensions>
+
+ <partnerLinks>
+ <partnerLink name="helloPartnerLink"
+ partnerLinkType="test:HelloPartnerLinkType"
+ myRole="me" />
+ </partnerLinks>
+
+ <variables>
+ <variable name="myVar" messageType="test:HelloMessage"/>
+ <variable name="restUrl" type="xsd:string"/>
+ <variable name="restRequest" element="service:postRequest"/>
+ <variable name="restResponse" element="service:postResponse"/>
+ <variable name="response" messageType="test:ResponseMessage"></variable>
+ </variables>
+
+ <sequence>
+ <receive
+ name="start"
+ partnerLink="helloPartnerLink"
+ portType="test:HelloPortType"
+ operation="hello"
+ variable="myVar"
+ createInstance="yes"/>
+
+ <assign name="assign1">
+ <copy>
+ <from><literal>http://localhost:8085/test</literal></from>
+ <to variable="restUrl"/>
+ </copy>
+ <copy>
+ <from>
+ <literal>
+ <service:postRequest xmlns:service="http://www.example.org/restApi">
+ <service:value>POST Method Test</service:value>
+ </service:postRequest>
+ </literal>
+ </from>
+ <to variable="restRequest"/>
+ </copy>
+ </assign>
+
+ <extensionActivity>
+ <bpel4RestLight:POST accept="application/xml" request="restRequest" response="restResponse" uri="$bpelvar[restUrl]"/>
+ </extensionActivity>
+
+ <assign name="assign2">
+ <copy>
+ <from variable="restResponse"></from>
+ <to part="TestPart" variable="response"></to>
+ </copy>
+ </assign>
+
+ <reply name="end"
+ partnerLink="helloPartnerLink"
+ portType="test:HelloPortType"
+ operation="hello"
+ variable="response"/>
+ </sequence>
+</process>
diff --git a/bpel-test/src/test/resources/bpel/2.0/TestRestPostExtAct/TestRestPostExtAct.wsdl b/bpel-test/src/test/resources/bpel/2.0/TestRestPostExtAct/TestRestPostExtAct.wsdl
new file mode 100644
index 0000000..2270a8b
--- /dev/null
+++ b/bpel-test/src/test/resources/bpel/2.0/TestRestPostExtAct/TestRestPostExtAct.wsdl
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!--
+ ~ 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
+ ~
+ ~ 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.
+ -->
+
+<wsdl:definitions
+ targetNamespace="http://ode/bpel/unit-test.wsdl"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:tns="http://ode/bpel/unit-test.wsdl"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:bpws="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
+ xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype">
+
+ <wsdl:message name="HelloMessage">
+ <wsdl:part name="TestPart" type="xsd:string"/>
+ </wsdl:message>
+
+ <wsdl:message name="ResponseMessage">
+ <wsdl:part name="TestPart" type="xsd:anyType"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloPortType">
+ <wsdl:operation name="hello">
+ <wsdl:input message="tns:HelloMessage" name="TestIn"/>
+ <wsdl:output message="tns:ResponseMessage" name="TestOut"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="HelloSoapBinding" type="tns:HelloPortType">
+ <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="hello">
+ <soap:operation soapAction="" style="rpc"/>
+ <wsdl:input>
+ <soap:body
+ namespace="http://ode/bpel/unit-test.wsdl"
+ use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body
+ namespace="http://ode/bpel/unit-test.wsdl"
+ use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="HelloService">
+ <wsdl:port name="HelloPort" binding="tns:HelloSoapBinding">
+ <soap:address location="http://localhost:8080/ode/processes/helloWorld"/>
+ </wsdl:port>
+ </wsdl:service>
+
+ <plnk:partnerLinkType name="HelloPartnerLinkType">
+ <plnk:role name="me" portType="tns:HelloPortType"/>
+ <plnk:role name="you" portType="tns:HelloPortType"/>
+ </plnk:partnerLinkType>
+</wsdl:definitions>
+
diff --git a/bpel-test/src/test/resources/bpel/2.0/TestRestPostExtAct/deploy.xml b/bpel-test/src/test/resources/bpel/2.0/TestRestPostExtAct/deploy.xml
new file mode 100644
index 0000000..08ace8f
--- /dev/null
+++ b/bpel-test/src/test/resources/bpel/2.0/TestRestPostExtAct/deploy.xml
@@ -0,0 +1,30 @@
+<!--
+ ~ 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
+ ~
+ ~ 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.
+ -->
+<deploy xmlns="http://www.apache.org/ode/schemas/dd/2007/03"
+ xmlns:pns="http://ode/bpel/unit-test"
+ xmlns:wns="http://ode/bpel/unit-test.wsdl">
+
+
+ <process name="pns:TestRestPostExtAct">
+ <active>true</active>
+ <provide partnerLink="helloPartnerLink">
+ <service name="wns:HelloService" port="HelloPort"/>
+ </provide>
+ </process>
+</deploy>
diff --git a/bpel-test/src/test/resources/bpel/2.0/TestRestPostExtAct/restApi.xsd b/bpel-test/src/test/resources/bpel/2.0/TestRestPostExtAct/restApi.xsd
new file mode 100644
index 0000000..b521dc7
--- /dev/null
+++ b/bpel-test/src/test/resources/bpel/2.0/TestRestPostExtAct/restApi.xsd
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/restApi"
+ xmlns:tns="http://www.example.org/restApi" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+
+ <xsd:complexType name="postRequestType">
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="postResponseType">
+ <xsd:sequence>
+ <xsd:element name="result" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:element name="postRequest" type="tns:postRequestType"></xsd:element>
+ <xsd:element name="postResponse" type="tns:postResponseType"></xsd:element>
+</schema>
\ No newline at end of file
diff --git a/bpel-test/src/test/resources/bpel/2.0/TestRestPostExtAct/test.properties b/bpel-test/src/test/resources/bpel/2.0/TestRestPostExtAct/test.properties
new file mode 100644
index 0000000..1c966aa
--- /dev/null
+++ b/bpel-test/src/test/resources/bpel/2.0/TestRestPostExtAct/test.properties
@@ -0,0 +1,23 @@
+#
+# 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
+#
+# 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.
+#
+
+namespace=http://ode/bpel/unit-test.wsdl
+service=HelloService
+operation=hello
+request1=<message><TestPart>Hello</TestPart></message>
+response1=.*POST Method Test Result.*
+
diff --git a/bpel-test/src/test/resources/bpel/2.0/TestRestPostExtAct2/TestRestPostExtAct.bpel b/bpel-test/src/test/resources/bpel/2.0/TestRestPostExtAct2/TestRestPostExtAct.bpel
new file mode 100644
index 0000000..2503543
--- /dev/null
+++ b/bpel-test/src/test/resources/bpel/2.0/TestRestPostExtAct2/TestRestPostExtAct.bpel
@@ -0,0 +1,94 @@
+<!--
+ ~ 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
+ ~
+ ~ 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.
+ -->
+<process name="TestRestPostExtAct"
+ targetNamespace="http://ode/bpel/unit-test"
+ xmlns:bpws="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
+ xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
+ xmlns:tns="http://ode/bpel/unit-test"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:test="http://ode/bpel/unit-test.wsdl"
+ xmlns:service="http://www.example.org/restApi"
+ xmlns:bpel4RestLight="http://www.apache.org/ode/bpel/extensions/bpel4restlight"
+ queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"
+ expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0">
+
+ <import location="TestRestPostExtAct.wsdl"
+ namespace="http://ode/bpel/unit-test.wsdl"
+ importType="http://schemas.xmlsoap.org/wsdl/" />
+
+ <import location="restApi.xsd"
+ namespace="http://www.example.org/restApi"
+ importType="http://www.w3.org/2001/XMLSchema"/>
+
+ <extensions>
+ <extension mustUnderstand="yes" namespace="http://www.apache.org/ode/bpel/extensions/bpel4restlight"/>
+ </extensions>
+
+ <partnerLinks>
+ <partnerLink name="helloPartnerLink"
+ partnerLinkType="test:HelloPartnerLinkType"
+ myRole="me" />
+ </partnerLinks>
+
+ <variables>
+ <variable name="myVar" messageType="test:HelloMessage"/>
+ <variable name="restUrl" type="xsd:string"/>
+ <variable name="restRequest" element="service:postRequest"/>
+ <variable name="restResponse" element="service:postResponse"/>
+ <variable name="response" messageType="test:ResponseMessage"></variable>
+ </variables>
+
+ <sequence>
+ <receive
+ name="start"
+ partnerLink="helloPartnerLink"
+ portType="test:HelloPortType"
+ operation="hello"
+ variable="myVar"
+ createInstance="yes"/>
+
+ <assign name="assign1">
+ <copy>
+ <from><literal>http://localhost:8085/test</literal></from>
+ <to variable="restUrl"/>
+ </copy>
+ </assign>
+
+ <extensionActivity>
+ <bpel4RestLight:POST accept="application/xml" request="restRequest" response="restResponse" uri="$bpelvar[restUrl]">
+ <service:postRequest xmlns:service="http://www.example.org/restApi">
+ <service:value>POST Method Test</service:value>
+ </service:postRequest>
+ </bpel4RestLight:POST>
+ </extensionActivity>
+
+ <assign name="assign2">
+ <copy>
+ <from variable="restResponse"></from>
+ <to part="TestPart" variable="response"></to>
+ </copy>
+ </assign>
+
+ <reply name="end"
+ partnerLink="helloPartnerLink"
+ portType="test:HelloPortType"
+ operation="hello"
+ variable="response"/>
+ </sequence>
+</process>
diff --git a/bpel-test/src/test/resources/bpel/2.0/TestRestPostExtAct2/TestRestPostExtAct.wsdl b/bpel-test/src/test/resources/bpel/2.0/TestRestPostExtAct2/TestRestPostExtAct.wsdl
new file mode 100644
index 0000000..2270a8b
--- /dev/null
+++ b/bpel-test/src/test/resources/bpel/2.0/TestRestPostExtAct2/TestRestPostExtAct.wsdl
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!--
+ ~ 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
+ ~
+ ~ 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.
+ -->
+
+<wsdl:definitions
+ targetNamespace="http://ode/bpel/unit-test.wsdl"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:tns="http://ode/bpel/unit-test.wsdl"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:bpws="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
+ xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype">
+
+ <wsdl:message name="HelloMessage">
+ <wsdl:part name="TestPart" type="xsd:string"/>
+ </wsdl:message>
+
+ <wsdl:message name="ResponseMessage">
+ <wsdl:part name="TestPart" type="xsd:anyType"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloPortType">
+ <wsdl:operation name="hello">
+ <wsdl:input message="tns:HelloMessage" name="TestIn"/>
+ <wsdl:output message="tns:ResponseMessage" name="TestOut"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="HelloSoapBinding" type="tns:HelloPortType">
+ <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="hello">
+ <soap:operation soapAction="" style="rpc"/>
+ <wsdl:input>
+ <soap:body
+ namespace="http://ode/bpel/unit-test.wsdl"
+ use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body
+ namespace="http://ode/bpel/unit-test.wsdl"
+ use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="HelloService">
+ <wsdl:port name="HelloPort" binding="tns:HelloSoapBinding">
+ <soap:address location="http://localhost:8080/ode/processes/helloWorld"/>
+ </wsdl:port>
+ </wsdl:service>
+
+ <plnk:partnerLinkType name="HelloPartnerLinkType">
+ <plnk:role name="me" portType="tns:HelloPortType"/>
+ <plnk:role name="you" portType="tns:HelloPortType"/>
+ </plnk:partnerLinkType>
+</wsdl:definitions>
+
diff --git a/bpel-test/src/test/resources/bpel/2.0/TestRestPostExtAct2/deploy.xml b/bpel-test/src/test/resources/bpel/2.0/TestRestPostExtAct2/deploy.xml
new file mode 100644
index 0000000..08ace8f
--- /dev/null
+++ b/bpel-test/src/test/resources/bpel/2.0/TestRestPostExtAct2/deploy.xml
@@ -0,0 +1,30 @@
+<!--
+ ~ 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
+ ~
+ ~ 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.
+ -->
+<deploy xmlns="http://www.apache.org/ode/schemas/dd/2007/03"
+ xmlns:pns="http://ode/bpel/unit-test"
+ xmlns:wns="http://ode/bpel/unit-test.wsdl">
+
+
+ <process name="pns:TestRestPostExtAct">
+ <active>true</active>
+ <provide partnerLink="helloPartnerLink">
+ <service name="wns:HelloService" port="HelloPort"/>
+ </provide>
+ </process>
+</deploy>
diff --git a/bpel-test/src/test/resources/bpel/2.0/TestRestPostExtAct2/restApi.xsd b/bpel-test/src/test/resources/bpel/2.0/TestRestPostExtAct2/restApi.xsd
new file mode 100644
index 0000000..b521dc7
--- /dev/null
+++ b/bpel-test/src/test/resources/bpel/2.0/TestRestPostExtAct2/restApi.xsd
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/restApi"
+ xmlns:tns="http://www.example.org/restApi" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+
+ <xsd:complexType name="postRequestType">
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="postResponseType">
+ <xsd:sequence>
+ <xsd:element name="result" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:element name="postRequest" type="tns:postRequestType"></xsd:element>
+ <xsd:element name="postResponse" type="tns:postResponseType"></xsd:element>
+</schema>
\ No newline at end of file
diff --git a/bpel-test/src/test/resources/bpel/2.0/TestRestPostExtAct2/test.properties b/bpel-test/src/test/resources/bpel/2.0/TestRestPostExtAct2/test.properties
new file mode 100644
index 0000000..1c966aa
--- /dev/null
+++ b/bpel-test/src/test/resources/bpel/2.0/TestRestPostExtAct2/test.properties
@@ -0,0 +1,23 @@
+#
+# 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
+#
+# 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.
+#
+
+namespace=http://ode/bpel/unit-test.wsdl
+service=HelloService
+operation=hello
+request1=<message><TestPart>Hello</TestPart></message>
+response1=.*POST Method Test Result.*
+
diff --git a/bpel-test/src/test/resources/bpel/2.0/TestRestPutExtAct/TestRestPutExtAct.bpel b/bpel-test/src/test/resources/bpel/2.0/TestRestPutExtAct/TestRestPutExtAct.bpel
new file mode 100644
index 0000000..02c24d9
--- /dev/null
+++ b/bpel-test/src/test/resources/bpel/2.0/TestRestPutExtAct/TestRestPutExtAct.bpel
@@ -0,0 +1,100 @@
+<!--
+ ~ 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
+ ~
+ ~ 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.
+ -->
+<process name="TestRestPutExtAct"
+ targetNamespace="http://ode/bpel/unit-test"
+ xmlns:bpws="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
+ xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
+ xmlns:tns="http://ode/bpel/unit-test"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:test="http://ode/bpel/unit-test.wsdl"
+ xmlns:service="http://www.example.org/restApi"
+ xmlns:bpel4RestLight="http://www.apache.org/ode/bpel/extensions/bpel4restlight"
+ queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"
+ expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0">
+
+ <import location="TestRestPutExtAct.wsdl"
+ namespace="http://ode/bpel/unit-test.wsdl"
+ importType="http://schemas.xmlsoap.org/wsdl/" />
+
+ <import location="restApi.xsd"
+ namespace="http://www.example.org/restApi"
+ importType="http://www.w3.org/2001/XMLSchema"/>
+
+ <extensions>
+ <extension mustUnderstand="yes" namespace="http://www.apache.org/ode/bpel/extensions/bpel4restlight"/>
+ </extensions>
+
+ <partnerLinks>
+ <partnerLink name="helloPartnerLink"
+ partnerLinkType="test:HelloPartnerLinkType"
+ myRole="me" />
+ </partnerLinks>
+
+ <variables>
+ <variable name="myVar" messageType="test:HelloMessage"/>
+ <variable name="restUrl" type="xsd:string"/>
+ <variable name="restRequest" element="service:putRequest"/>
+ <variable name="restResponse" element="service:putResponse"/>
+ <variable name="response" messageType="test:ResponseMessage"></variable>
+ </variables>
+
+ <sequence>
+ <receive
+ name="start"
+ partnerLink="helloPartnerLink"
+ portType="test:HelloPortType"
+ operation="hello"
+ variable="myVar"
+ createInstance="yes"/>
+
+ <assign name="assign1">
+ <copy>
+ <from><literal>http://localhost:8085/test</literal></from>
+ <to variable="restUrl"/>
+ </copy>
+ <copy>
+ <from>
+ <literal>
+ <service:putRequest xmlns:service="http://www.example.org/restApi">
+ <service:value>PUT Method Test</service:value>
+ </service:putRequest>
+ </literal>
+ </from>
+ <to variable="restRequest"/>
+ </copy>
+ </assign>
+
+ <extensionActivity>
+ <bpel4RestLight:PUT accept="application/xml" request="restRequest" response="restResponse" uri="$bpelvar[restUrl]"/>
+ </extensionActivity>
+
+ <assign name="assign2">
+ <copy>
+ <from variable="restResponse"></from>
+ <to part="TestPart" variable="response"></to>
+ </copy>
+ </assign>
+
+ <reply name="end"
+ partnerLink="helloPartnerLink"
+ portType="test:HelloPortType"
+ operation="hello"
+ variable="response"/>
+ </sequence>
+</process>
diff --git a/bpel-test/src/test/resources/bpel/2.0/TestRestPutExtAct/TestRestPutExtAct.wsdl b/bpel-test/src/test/resources/bpel/2.0/TestRestPutExtAct/TestRestPutExtAct.wsdl
new file mode 100644
index 0000000..2270a8b
--- /dev/null
+++ b/bpel-test/src/test/resources/bpel/2.0/TestRestPutExtAct/TestRestPutExtAct.wsdl
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!--
+ ~ 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
+ ~
+ ~ 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.
+ -->
+
+<wsdl:definitions
+ targetNamespace="http://ode/bpel/unit-test.wsdl"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:tns="http://ode/bpel/unit-test.wsdl"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:bpws="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
+ xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype">
+
+ <wsdl:message name="HelloMessage">
+ <wsdl:part name="TestPart" type="xsd:string"/>
+ </wsdl:message>
+
+ <wsdl:message name="ResponseMessage">
+ <wsdl:part name="TestPart" type="xsd:anyType"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloPortType">
+ <wsdl:operation name="hello">
+ <wsdl:input message="tns:HelloMessage" name="TestIn"/>
+ <wsdl:output message="tns:ResponseMessage" name="TestOut"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="HelloSoapBinding" type="tns:HelloPortType">
+ <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="hello">
+ <soap:operation soapAction="" style="rpc"/>
+ <wsdl:input>
+ <soap:body
+ namespace="http://ode/bpel/unit-test.wsdl"
+ use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body
+ namespace="http://ode/bpel/unit-test.wsdl"
+ use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="HelloService">
+ <wsdl:port name="HelloPort" binding="tns:HelloSoapBinding">
+ <soap:address location="http://localhost:8080/ode/processes/helloWorld"/>
+ </wsdl:port>
+ </wsdl:service>
+
+ <plnk:partnerLinkType name="HelloPartnerLinkType">
+ <plnk:role name="me" portType="tns:HelloPortType"/>
+ <plnk:role name="you" portType="tns:HelloPortType"/>
+ </plnk:partnerLinkType>
+</wsdl:definitions>
+
diff --git a/bpel-test/src/test/resources/bpel/2.0/TestRestPutExtAct/deploy.xml b/bpel-test/src/test/resources/bpel/2.0/TestRestPutExtAct/deploy.xml
new file mode 100644
index 0000000..914b8dc
--- /dev/null
+++ b/bpel-test/src/test/resources/bpel/2.0/TestRestPutExtAct/deploy.xml
@@ -0,0 +1,30 @@
+<!--
+ ~ 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
+ ~
+ ~ 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.
+ -->
+<deploy xmlns="http://www.apache.org/ode/schemas/dd/2007/03"
+ xmlns:pns="http://ode/bpel/unit-test"
+ xmlns:wns="http://ode/bpel/unit-test.wsdl">
+
+
+ <process name="pns:TestRestPutExtAct">
+ <active>true</active>
+ <provide partnerLink="helloPartnerLink">
+ <service name="wns:HelloService" port="HelloPort"/>
+ </provide>
+ </process>
+</deploy>
diff --git a/bpel-test/src/test/resources/bpel/2.0/TestRestPutExtAct/restApi.xsd b/bpel-test/src/test/resources/bpel/2.0/TestRestPutExtAct/restApi.xsd
new file mode 100644
index 0000000..752ea24
--- /dev/null
+++ b/bpel-test/src/test/resources/bpel/2.0/TestRestPutExtAct/restApi.xsd
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/restApi"
+ xmlns:tns="http://www.example.org/restApi" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+
+ <xsd:complexType name="putRequestType">
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="putResponseType">
+ <xsd:sequence>
+ <xsd:element name="result" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:element name="putRequest" type="tns:putRequestType"></xsd:element>
+ <xsd:element name="putResponse" type="tns:putResponseType"></xsd:element>
+</schema>
\ No newline at end of file
diff --git a/bpel-test/src/test/resources/bpel/2.0/TestRestPutExtAct/test.properties b/bpel-test/src/test/resources/bpel/2.0/TestRestPutExtAct/test.properties
new file mode 100644
index 0000000..ab2f52d
--- /dev/null
+++ b/bpel-test/src/test/resources/bpel/2.0/TestRestPutExtAct/test.properties
@@ -0,0 +1,23 @@
+#
+# 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
+#
+# 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.
+#
+
+namespace=http://ode/bpel/unit-test.wsdl
+service=HelloService
+operation=hello
+request1=<message><TestPart>Hello</TestPart></message>
+response1=.*PUT Method Test Result.*
+
diff --git a/jbi/src/main/java/org/apache/ode/jbi/OdeLifeCycle.java b/jbi/src/main/java/org/apache/ode/jbi/OdeLifeCycle.java
index 950d47e..6cf41cc 100644
--- a/jbi/src/main/java/org/apache/ode/jbi/OdeLifeCycle.java
+++ b/jbi/src/main/java/org/apache/ode/jbi/OdeLifeCycle.java
@@ -24,6 +24,7 @@
import org.apache.geronimo.transaction.manager.GeronimoTransactionManager;
import org.apache.ode.bpel.connector.BpelServerConnector;
import org.apache.ode.bpel.dao.BpelDAOConnectionFactoryJDBC;
+import org.apache.ode.bpel.eapi.AbstractExtensionBundle;
import org.apache.ode.bpel.engine.BpelServerImpl;
import org.apache.ode.bpel.engine.ProcessAndInstanceManagementMBean;
import org.apache.ode.bpel.extvar.jdbc.JdbcExternalVariableModule;
@@ -135,6 +136,8 @@
registerMexInterceptors();
+ registerExtensionActivityBundles();
+
registerMBean();
__log.debug("Starting JCA connector.");
@@ -367,6 +370,21 @@
}
}
}
+
+ private void registerExtensionActivityBundles() {
+ String listenersStr = _ode._config.getExtensionActivityBundles();
+ if (listenersStr != null) {
+ for (String bundleCN : listenersStr.split("\\s*(,|;)\\s*")) {
+ String bundleCN = tokenizer.nextToken();
+ try {
+ _ode._server.registerExtensionBundle((AbstractExtensionBundle) Class.forName(bundleCN).newInstance());
+ } catch (Exception e) {
+ __log.warn("Couldn't register the extension bundle " + bundleCN + ", the class couldn't be " +
+ "loaded properly.");
+ }
+ }
+ }
+ }
public synchronized void start() throws JBIException {
if (_started)
diff --git a/utils/src/main/java/org/apache/ode/utils/DOMUtils.java b/utils/src/main/java/org/apache/ode/utils/DOMUtils.java
index 854a8bc..dc91e6f 100644
--- a/utils/src/main/java/org/apache/ode/utils/DOMUtils.java
+++ b/utils/src/main/java/org/apache/ode/utils/DOMUtils.java
@@ -701,6 +701,10 @@
}
return true;
}
+
+ public static QName getElementQName(Element el) {
+ return new QName(el.getNamespaceURI(),el.getLocalName());
+ }
public static QName getNodeQName(Node el) {
String localName = el.getLocalName();