Apply latest improvements on extension bundle support based on commit 1d5fa185a77c944e8d4a708b451611fa74d5c2dc
Project: http://git-wip-us.apache.org/repos/asf/ode/repo Commit: http://git-wip-us.apache.org/repos/asf/ode/commit/cf630ce4 Tree: http://git-wip-us.apache.org/repos/asf/ode/tree/cf630ce4 Diff: http://git-wip-us.apache.org/repos/asf/ode/diff/cf630ce4 Branch: refs/heads/master Commit: cf630ce49e72cbd31a170ee5886f2a39069e824d Parents: acb7e8e Author: hahnml <[email protected]> Authored: Wed Nov 29 17:58:32 2017 +0100 Committer: hahnml <[email protected]> Committed: Wed Nov 29 17:58:32 2017 +0100 ---------------------------------------------------------------------- .../webapp/WEB-INF/conf/ode-axis2.properties | 3 +- .../java/org/apache/ode/axis2/ODEServer.java | 133 +++++-------- .../ode/bpel/eapi/AbstractExtensionBundle.java | 71 +++++++ .../apache/ode/bpel/eapi/ExtensionContext.java | 128 ++++++++++++ .../ode/bpel/eapi/ExtensionOperation.java | 39 ++++ .../ode/bpel/extension/ExtensibleElement.java | 32 --- .../bpel/extension/ExtensionBundleRuntime.java | 12 -- .../extension/ExtensionBundleValidation.java | 13 -- .../ode/bpel/extension/ExtensionOperation.java | 54 ------ .../ode/bpel/extension/ExtensionValidator.java | 38 ---- .../ode/bpel/compiler/AssignGenerator.java | 7 +- .../org/apache/ode/bpel/compiler/BpelC.java | 15 -- .../apache/ode/bpel/compiler/BpelCompiler.java | 14 -- .../compiler/ExtensionActivtityGenerator.java | 9 +- .../ode/bpel/compiler/api/CompilerContext.java | 5 +- .../ode/bpel/compiler/bom/AssignActivity.java | 3 + .../ode/bpel/compiler/bom/BpelObject.java | 2 +- .../bpel/compiler/bom/ExtensibilityQNames.java | 7 +- .../bpel/compiler/bom/ExtensionActivity.java | 12 +- .../compiler/bom/ExtensionAssignOperation.java | 11 +- .../org/apache/ode/bpel/compiler/XPathTest.java | 7 +- .../ode/il/config/OdeConfigProperties.java | 12 +- .../java/org/apache/ode/bpel/obj/OProcess.java | 17 -- .../java/org/apache/ode/bpel/o/OAssign.java | 60 +----- .../java/org/apache/ode/bpel/o/OProcess.java | 24 +-- .../org/apache/ode/bpel/engine/BpelProcess.java | 14 +- .../ode/bpel/engine/BpelRuntimeContextImpl.java | 80 ++++++-- .../apache/ode/bpel/engine/BpelServerImpl.java | 11 +- .../org/apache/ode/bpel/engine/Contexts.java | 6 +- .../org/apache/ode/bpel/runtime/ASSIGN.java | 129 +++++++------ .../ode/bpel/runtime/BpelRuntimeContext.java | 18 +- .../ode/bpel/runtime/EXTENSIONACTIVITY.java | 80 ++++---- .../ode/bpel/runtime/ExtensionContextImpl.java | 193 +++++-------------- .../runtime/channels/ExtensionResponse.java | 34 ++++ .../AbstractAsyncExtensionOperation.java | 36 ---- .../extension/AbstractExtensionBundle.java | 109 ----------- .../AbstractSyncExtensionOperation.java | 45 ----- .../common/extension/ExtensibilityQNames.java | 58 ------ .../common/extension/ExtensionContext.java | 190 ------------------ .../xpath20/runtime/MockCompilerContext.java | 7 - .../apache/ode/bpel/runtime/CoreBpelTest.java | 21 +- .../org/apache/ode/store/DeploymentUnitDir.java | 12 -- .../org/apache/ode/store/ProcessStoreImpl.java | 13 -- .../java/org/apache/ode/jbi/OdeLifeCycle.java | 66 ++----- 44 files changed, 607 insertions(+), 1243 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ode/blob/cf630ce4/axis2-war/src/main/webapp/WEB-INF/conf/ode-axis2.properties ---------------------------------------------------------------------- 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 3c61926..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 @@ -104,5 +104,4 @@ ode-axis2.db.emb.name=derby-jpadb ## Extension Bundles ## FQCNs, comma separated. -#ode-axis2.extension.bundles.runtime=[packageName].[bundleClassName] -#ode-axis2.extension.bundles.validation=[packageName].[bundleClassName] +#ode-axis2.extension.bundles=[packageName].[bundleClassName] http://git-wip-us.apache.org/repos/asf/ode/blob/cf630ce4/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java ---------------------------------------------------------------------- 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 347f44c..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,19 +60,21 @@ import org.apache.ode.bpel.clapi.ClusterMemberListener; 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.extension.ExtensionBundleRuntime; -import org.apache.ode.bpel.extension.ExtensionBundleValidation; -import org.apache.ode.bpel.extension.ExtensionValidator; 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; import org.apache.ode.bpel.pmapi.ProcessManagement; -import org.apache.ode.bpel.runtime.common.extension.AbstractExtensionBundle; import org.apache.ode.il.config.OdeConfigProperties; import org.apache.ode.il.dbutil.Database; import org.apache.ode.scheduler.simple.JdbcDelegate; @@ -56,22 +83,8 @@ import org.apache.ode.store.ClusterProcessStoreImpl; 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 javax.xml.namespace.QName; - -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. @@ -700,38 +713,18 @@ public class ODEServer { // Add support for extension bundles based on ODE 2.0 alpha branch private void registerExtensionActivityBundles() { - String extensionsRTStr = _odeConfig.getExtensionActivityBundlesRT(); - String extensionsValStr = _odeConfig - .getExtensionActivityBundlesValidation(); - if (extensionsRTStr != null) { + String extensionsStr = _odeConfig.getExtensionActivityBundles(); + + if (extensionsStr != null) { // TODO replace StringTokenizer by regex - for (StringTokenizer tokenizer = new StringTokenizer( - extensionsRTStr, ",;"); tokenizer.hasMoreTokens();) { - String bundleCN = tokenizer.nextToken(); - - //@hahnml: Remove any whitespaces - bundleCN = bundleCN.replaceAll(" ", ""); - + for (String bundleCN : extensionsStr.split("\\s*(,|;)\\s*")) { try { // instantiate bundle - ExtensionBundleRuntime bundleRT = (ExtensionBundleRuntime) Class + AbstractExtensionBundle bundle = (AbstractExtensionBundle) Class .forName(bundleCN).newInstance(); // register extension bundle (BPEL server) - _bpelServer.registerExtensionBundle(bundleRT); - - if (bundleRT instanceof AbstractExtensionBundle) { - AbstractExtensionBundle bundle = (AbstractExtensionBundle) bundleRT; - - //@hahnml: Get the registered validators from the process store - Map<QName, ExtensionValidator> validators = _store.getExtensionValidators(); - - //Add the validators of this bundle to the existing validators - validators.putAll(bundle.getExtensionValidators()); - - // register extension bundle (BPEL store) - _store.setExtensionValidators(validators); - } + _bpelServer.registerExtensionBundle(bundle); } catch (Exception e) { __log.warn("Couldn't register the extension bundle runtime " + bundleCN @@ -739,45 +732,9 @@ public class ODEServer { + "loaded properly."); } } - } - if (extensionsValStr != null) { - Map<QName, ExtensionValidator> validators = new HashMap<QName, ExtensionValidator>(); - for (StringTokenizer tokenizer = new StringTokenizer( - extensionsValStr, ",;"); tokenizer.hasMoreTokens();) { - String bundleCN = tokenizer.nextToken(); - - //@hahnml: Remove any whitespaces - bundleCN = bundleCN.replaceAll(" ", ""); - - try { - // instantiate bundle - ExtensionBundleValidation bundleVal = (ExtensionBundleValidation) Class - .forName(bundleCN).newInstance(); - // add validators - validators.putAll(bundleVal.getExtensionValidators()); - } catch (Exception e) { - __log.warn("Couldn't register the extension bundle validator " - + bundleCN - + ", the class couldn't be " - + "loaded properly."); - } - } - // register extension bundle (BPEL store) - //@hahnml: Check if validators are registered already - if (_store.getExtensionValidators().isEmpty()) { - _store.setExtensionValidators(validators); - } else { - //@hahnml: Get the registered validators from the process store - Map<QName, ExtensionValidator> allValidators = _store.getExtensionValidators(); - - //Add the registered validators to the existing validators - allValidators.putAll(validators); - - // register extension bundle (BPEL store) - _store.setExtensionValidators(allValidators); - } - } - } + } + } + private class ProcessStoreListenerImpl implements ProcessStoreListener { public void onProcessStoreEvent(ProcessStoreEvent event) { http://git-wip-us.apache.org/repos/asf/ode/blob/cf630ce4/bpel-api/src/main/java/org/apache/ode/bpel/eapi/AbstractExtensionBundle.java ---------------------------------------------------------------------- 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(); + } + +} http://git-wip-us.apache.org/repos/asf/ode/blob/cf630ce4/bpel-api/src/main/java/org/apache/ode/bpel/eapi/ExtensionContext.java ---------------------------------------------------------------------- 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(); + +} http://git-wip-us.apache.org/repos/asf/ode/blob/cf630ce4/bpel-api/src/main/java/org/apache/ode/bpel/eapi/ExtensionOperation.java ---------------------------------------------------------------------- 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; +} http://git-wip-us.apache.org/repos/asf/ode/blob/cf630ce4/bpel-api/src/main/java/org/apache/ode/bpel/extension/ExtensibleElement.java ---------------------------------------------------------------------- diff --git a/bpel-api/src/main/java/org/apache/ode/bpel/extension/ExtensibleElement.java b/bpel-api/src/main/java/org/apache/ode/bpel/extension/ExtensibleElement.java deleted file mode 100644 index f7922d4..0000000 --- a/bpel-api/src/main/java/org/apache/ode/bpel/extension/ExtensibleElement.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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; - -import org.w3c.dom.Element; - -/** - * Common interface for ExtensionActivity and AssignExtensionOperation. - * - * @author Tammo van Lessen (University of Stuttgart) - */ -public interface ExtensibleElement { - - Element getNestedElement(); - -} http://git-wip-us.apache.org/repos/asf/ode/blob/cf630ce4/bpel-api/src/main/java/org/apache/ode/bpel/extension/ExtensionBundleRuntime.java ---------------------------------------------------------------------- diff --git a/bpel-api/src/main/java/org/apache/ode/bpel/extension/ExtensionBundleRuntime.java b/bpel-api/src/main/java/org/apache/ode/bpel/extension/ExtensionBundleRuntime.java deleted file mode 100644 index 2ddf3ac..0000000 --- a/bpel-api/src/main/java/org/apache/ode/bpel/extension/ExtensionBundleRuntime.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.apache.ode.bpel.extension; - -public interface ExtensionBundleRuntime { - - String getNamespaceURI(); - - void registerExtensionActivities(); - - ExtensionOperation getExtensionOperationInstance(String localName) - throws InstantiationException, IllegalAccessException; - -} http://git-wip-us.apache.org/repos/asf/ode/blob/cf630ce4/bpel-api/src/main/java/org/apache/ode/bpel/extension/ExtensionBundleValidation.java ---------------------------------------------------------------------- diff --git a/bpel-api/src/main/java/org/apache/ode/bpel/extension/ExtensionBundleValidation.java b/bpel-api/src/main/java/org/apache/ode/bpel/extension/ExtensionBundleValidation.java deleted file mode 100644 index f12cf14..0000000 --- a/bpel-api/src/main/java/org/apache/ode/bpel/extension/ExtensionBundleValidation.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.apache.ode.bpel.extension; - -import javax.xml.namespace.QName; -import java.util.Map; - -/** - * Compile-time validation of extensions implemented by your bundle. - */ -public interface ExtensionBundleValidation { - - Map<QName, ExtensionValidator> getExtensionValidators(); - -} http://git-wip-us.apache.org/repos/asf/ode/blob/cf630ce4/bpel-api/src/main/java/org/apache/ode/bpel/extension/ExtensionOperation.java ---------------------------------------------------------------------- diff --git a/bpel-api/src/main/java/org/apache/ode/bpel/extension/ExtensionOperation.java b/bpel-api/src/main/java/org/apache/ode/bpel/extension/ExtensionOperation.java deleted file mode 100644 index da1c930..0000000 --- a/bpel-api/src/main/java/org/apache/ode/bpel/extension/ExtensionOperation.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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; - -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 { - - /** - * Provides the runtime implementation. - * - * <strong>Note:</strong> This method MAY run concurrently. Since Xerces' - * DOM implementation is not thread-safe, please make sure to synchronize - * the access to <code>element</code> if necessary. - * - * @param context - * injected ExtensionContext - * @param element - * the extension element (child of <code>extensionActivity</code> - * or <code>extensionAssignOperation</code> - * @throws FaultException - */ - void run(Object context, Element element) throws FaultException; - -} http://git-wip-us.apache.org/repos/asf/ode/blob/cf630ce4/bpel-api/src/main/java/org/apache/ode/bpel/extension/ExtensionValidator.java ---------------------------------------------------------------------- diff --git a/bpel-api/src/main/java/org/apache/ode/bpel/extension/ExtensionValidator.java b/bpel-api/src/main/java/org/apache/ode/bpel/extension/ExtensionValidator.java deleted file mode 100644 index 5159c1b..0000000 --- a/bpel-api/src/main/java/org/apache/ode/bpel/extension/ExtensionValidator.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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; - -import org.apache.ode.bpel.extension.ExtensibleElement; - -/** - * Interface that allows Ode extensions to validate an extension element's - * content during compilation. - * - * @author Tammo van Lessen (University of Stuttgart) - */ -public interface ExtensionValidator { - - /** - * - * @param compilerContext - * @param element - */ - void validate(Object compilerContext, ExtensibleElement element); - -} http://git-wip-us.apache.org/repos/asf/ode/blob/cf630ce4/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/AssignGenerator.java ---------------------------------------------------------------------- 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 91a6384..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 @@ -33,7 +33,6 @@ import org.apache.ode.bpel.compiler.bom.PartnerLinkVal; import org.apache.ode.bpel.compiler.bom.PropertyVal; import org.apache.ode.bpel.compiler.bom.To; import org.apache.ode.bpel.compiler.bom.VariableVal; -import org.apache.ode.bpel.extension.ExtensionValidator; import org.apache.ode.bpel.obj.DebugInfo; import org.apache.ode.bpel.obj.OActivity; import org.apache.ode.bpel.obj.OAssign; @@ -51,6 +50,7 @@ import javax.xml.namespace.QName; * 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); @@ -113,11 +113,6 @@ class AssignGenerator extends DefaultActivityGenerator { .errUndeclaredExtensionAssignOperation() .setSource(sop)); } - ExtensionValidator validator = _context - .getExtensionValidator(DOMUtils.getElementQName(el)); - if (validator != null) { - validator.validate(_context, sop); - } oext.setExtensionName(DOMUtils.getElementQName(el)); oext.setNestedElement(DOMUtils.domToString(el)); oassign.getOperations().add(oext); http://git-wip-us.apache.org/repos/asf/ode/blob/cf630ce4/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelC.java ---------------------------------------------------------------------- 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 71cb107..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 @@ -38,7 +38,6 @@ import org.apache.ode.bpel.compiler.api.CompileListener; import org.apache.ode.bpel.compiler.api.SourceLocation; import org.apache.ode.bpel.compiler.bom.BpelObjectFactory; import org.apache.ode.bpel.compiler.bom.Process; -import org.apache.ode.bpel.extension.ExtensionValidator; import org.apache.ode.bpel.obj.OProcess; import org.apache.ode.bpel.obj.OProcessWrapper; import org.apache.ode.bpel.obj.serde.DeSerializer; @@ -73,8 +72,6 @@ public class BpelC { private Map<String,Object> _compileProperties; private boolean _dryRun = false; - private Map<QName, ExtensionValidator> _extensionValidators; - public static BpelC newBpelCompiler() { return new BpelC(); } @@ -255,9 +252,6 @@ public class BpelC { if (_compileProperties.get(PROCESS_CUSTOM_PROPERTIES) != null) compiler.setCustomProperties((Map<QName, Node>) _compileProperties.get(PROCESS_CUSTOM_PROPERTIES)); } - if (_extensionValidators != null) { - compiler.setExtensionValidators(_extensionValidators); - } } catch (CompilationException ce) { this.invalidate(); throw ce; @@ -528,13 +522,4 @@ public class BpelC { } } } - - /** - * Registers extension validators to eventually validate the content of extensibility - * elements. - * @param extensionValidators - */ - public void setExtensionValidators(Map<QName, ExtensionValidator> extensionValidators) { - _extensionValidators = extensionValidators; - } } http://git-wip-us.apache.org/repos/asf/ode/blob/cf630ce4/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler.java ---------------------------------------------------------------------- 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 a1545ee..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 @@ -82,7 +82,6 @@ import org.apache.ode.bpel.compiler.bom.TerminationHandler; import org.apache.ode.bpel.compiler.bom.Variable; import org.apache.ode.bpel.compiler.wsdl.Definition4BPEL; import org.apache.ode.bpel.compiler.wsdl.WSDLFactory4BPEL; -import org.apache.ode.bpel.extension.ExtensionValidator; import org.apache.ode.bpel.obj.DebugInfo; import org.apache.ode.bpel.obj.OActivity; import org.apache.ode.bpel.obj.OAssign; @@ -185,7 +184,6 @@ public abstract class BpelCompiler implements CompilerContext { private URI _processURI; private final Set<String> _declaredExtensionNS = new HashSet<String>(); - private Map<QName, ExtensionValidator> _extensionValidators = new HashMap<QName, ExtensionValidator>(); BpelCompiler(WSDLFactory4BPEL wsdlFactory) { _wsdlFactory = wsdlFactory; @@ -1668,9 +1666,6 @@ public abstract class BpelCompiler implements CompilerContext { _declaredExtensionNS.add(ext.getNamespaceURI()); _oprocess.getDeclaredExtensions().add(oextension); - if (ext.isMustUnderstand()) { - _oprocess.getMustUnderstandExtensions().add(oextension); - } if (__log.isDebugEnabled()) __log.debug("Compiled extension " + oextension); @@ -1752,19 +1747,10 @@ public abstract class BpelCompiler implements CompilerContext { registerExpressionLanguage(expLangUri, (ExpressionCompiler) cls.newInstance()); } - public void setExtensionValidators( - Map<QName, ExtensionValidator> extensionValidators) { - _extensionValidators = extensionValidators; - } - public boolean isExtensionDeclared(String namespace) { return _declaredExtensionNS.contains(namespace); } - public ExtensionValidator getExtensionValidator(QName extensionElementName) { - return _extensionValidators.get(extensionElementName); - } - public List<OActivity> getActivityStack() { ArrayList<OActivity> rval = new ArrayList<OActivity>(_structureStack._stack); Collections.reverse(rval); http://git-wip-us.apache.org/repos/asf/ode/blob/cf630ce4/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ExtensionActivtityGenerator.java ---------------------------------------------------------------------- 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 index 22d949b..25b298a 100644 --- 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 @@ -22,7 +22,6 @@ 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.extension.ExtensionValidator; import org.apache.ode.bpel.obj.OActivity; import org.apache.ode.bpel.obj.OExtensionActivity; import org.apache.ode.utils.DOMUtils; @@ -41,7 +40,7 @@ public class ExtensionActivtityGenerator extends DefaultActivityGenerator { public void compile(OActivity output, Activity srcx) { ExtensionActivity src = (ExtensionActivity) srcx; OExtensionActivity oactivity = (OExtensionActivity) output; - Element child = src.getFirstExtensibilityElementElement(); + Element child = src.getFirstExtensibilityElement(); try { if (child == null) { throw new CompilationException( @@ -51,11 +50,7 @@ public class ExtensionActivtityGenerator extends DefaultActivityGenerator { throw new CompilationException(__cmsgs .errUndeclaredExtensionActivity().setSource(src)); } - ExtensionValidator validator = _context - .getExtensionValidator(DOMUtils.getElementQName(child)); - if (validator != null) { - validator.validate(_context, src); - } + oactivity.setExtensionName(DOMUtils.getElementQName(child)); oactivity.setNestedElement(DOMUtils.domToString(child)); http://git-wip-us.apache.org/repos/asf/ode/blob/cf630ce4/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/api/CompilerContext.java ---------------------------------------------------------------------- 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 83467df..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 @@ -29,7 +29,6 @@ import javax.xml.transform.Source; import org.apache.ode.bpel.compiler.bom.Activity; import org.apache.ode.bpel.compiler.bom.Expression; import org.apache.ode.bpel.compiler.bom.ScopeLikeActivity; -import org.apache.ode.bpel.extension.ExtensionValidator; import org.apache.ode.bpel.obj.OActivity; import org.apache.ode.bpel.obj.OExpression; import org.apache.ode.bpel.obj.OLValueExpression; @@ -147,9 +146,7 @@ public interface CompilerContext { Map<URI, Source> getSchemaSources(); - boolean isExtensionDeclared(String namespace); - - ExtensionValidator getExtensionValidator(QName extensionElementName); + boolean isExtensionDeclared(String namespace); /** * Retrieves the base URI that the BPEL Process execution contextis running relative to. http://git-wip-us.apache.org/repos/asf/ode/blob/cf630ce4/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/AssignActivity.java ---------------------------------------------------------------------- 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 1c890aa..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 @@ -27,6 +27,9 @@ import org.w3c.dom.Element; * 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 { http://git-wip-us.apache.org/repos/asf/ode/blob/cf630ce4/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/BpelObject.java ---------------------------------------------------------------------- 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 @@ public class BpelObject implements SourceLocation { return e.getElement(); } - public Element getFirstExtensibilityElementElement() { + public Element getFirstExtensibilityElement() { Element child = null; NodeList nl = getElement().getChildNodes(); for (int i = 0; i < nl.getLength(); ++i) { http://git-wip-us.apache.org/repos/asf/ode/blob/cf630ce4/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/ExtensibilityQNames.java ---------------------------------------------------------------------- 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 abstract class ExtensibilityQNames { 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 @@ public abstract class ExtensibilityQNames { /** 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"); } http://git-wip-us.apache.org/repos/asf/ode/blob/cf630ce4/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/ExtensionActivity.java ---------------------------------------------------------------------- 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 index 78c5d87..575f401 100644 --- 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 @@ -22,7 +22,6 @@ import java.util.Collections; import java.util.List; import org.w3c.dom.Element; -import org.apache.ode.bpel.extension.ExtensibleElement; /** * BOM representation of the BPEL <code><extensionActivity></code> @@ -35,16 +34,15 @@ import org.apache.ode.bpel.extension.ExtensibleElement; * * @author Tammo van Lessen (University of Stuttgart) */ -public class ExtensionActivity extends CompositeActivity implements - ExtensibleElement { +public class ExtensionActivity extends CompositeActivity { private Activity _childActivity; public ExtensionActivity(Element el) { super(el); _childActivity = null; - Element child = getFirstExtensibilityElementElement(); + Element child = getFirstExtensibilityElement(); if (child != null) { - _childActivity = new Activity(getFirstExtensibilityElementElement()); + _childActivity = new Activity(getFirstExtensibilityElement()); } } @@ -97,8 +95,4 @@ public class ExtensionActivity extends CompositeActivity implements return _childActivity.getChildren(Activity.class); } - public Element getNestedElement() { - return getFirstExtensibilityElementElement(); - } - } http://git-wip-us.apache.org/repos/asf/ode/blob/cf630ce4/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/ExtensionAssignOperation.java ---------------------------------------------------------------------- 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 index 6a18cdf..9356618 100644 --- 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 @@ -19,7 +19,6 @@ package org.apache.ode.bpel.compiler.bom; import org.apache.ode.bpel.compiler.bom.AssignActivity.AssignOperation; -import org.apache.ode.bpel.extension.ExtensibleElement; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; @@ -29,8 +28,7 @@ import org.w3c.dom.NodeList; * * @author Tammo van Lessen (University of Stuttgart) */ -public class ExtensionAssignOperation extends BpelObject implements - AssignOperation, ExtensibleElement { +public class ExtensionAssignOperation extends BpelObject implements AssignOperation { private Element _childElement; public ExtensionAssignOperation(Element el) { @@ -38,15 +36,12 @@ public class ExtensionAssignOperation extends BpelObject implements } public Element getNestedElement() { - // XXX - // return getFirstExtensibilityElement(); 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())) { + if (node.getNodeType() == Node.ELEMENT_NODE && + !Bpel20QNames.NS_WSBPEL2_0.equals(node.getNamespaceURI())) { _childElement = (Element) node; break; } http://git-wip-us.apache.org/repos/asf/ode/blob/cf630ce4/bpel-compiler/src/test/java/org/apache/ode/bpel/compiler/XPathTest.java ---------------------------------------------------------------------- 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 df00dac..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 @@ -44,7 +44,6 @@ import org.apache.ode.bpel.elang.xpath10.compiler.XPath10ExpressionCompilerBPEL2 import org.apache.ode.bpel.elang.xpath10.compiler.XPath10ExpressionCompilerBPEL20Draft; import org.apache.ode.bpel.elang.xpath20.compiler.XPath20ExpressionCompilerBPEL20; import org.apache.ode.bpel.elang.xpath20.compiler.XPath20ExpressionCompilerBPEL20Draft; -import org.apache.ode.bpel.extension.ExtensionValidator; import org.apache.ode.bpel.obj.OActivity; import org.apache.ode.bpel.obj.OElementVarType; import org.apache.ode.bpel.obj.OExpression; @@ -305,9 +304,5 @@ class MockCompilerContext implements CompilerContext { public boolean isExtensionDeclared(String namespace) { return false; - } - - public ExtensionValidator getExtensionValidator(QName extensionElementName) { - return null; - } + } } http://git-wip-us.apache.org/repos/asf/ode/blob/cf630ce4/bpel-epr/src/main/java/org/apache/ode/il/config/OdeConfigProperties.java ---------------------------------------------------------------------- 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 abfc50f..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,10 +112,8 @@ public class OdeConfigProperties { public static final String DEFAULT_CLUSTERING_IMPL_CLASS_NAME = "org.apache.ode.clustering.hazelcast.HazelcastClusterImpl"; - public static final String PROP_EXTENSION_BUNDLES_RT = "extension.bundles.runtime"; + public static final String PROP_EXTENSION_BUNDLES = "extension.bundles"; - public static final String PROP_EXTENSION_BUNDLES_VAL = "extension.bundles.validation"; - private File _cfgFile; private String _prefix; @@ -388,11 +386,7 @@ public class OdeConfigProperties { return Integer.valueOf(getProperty(PROP_MIGRATION_TRANSACTION_TIMEOUT, String.valueOf(0))); } - public String getExtensionActivityBundlesRT() { - return getProperty(PROP_EXTENSION_BUNDLES_RT); - } - - public String getExtensionActivityBundlesValidation() { - return getProperty(PROP_EXTENSION_BUNDLES_VAL); + public String getExtensionActivityBundles() { + return getProperty(PROP_EXTENSION_BUNDLES); } } http://git-wip-us.apache.org/repos/asf/ode/blob/cf630ce4/bpel-nobj/src/main/java/org/apache/ode/bpel/obj/OProcess.java ---------------------------------------------------------------------- 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 d8f0e67..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 @@ -94,8 +94,6 @@ public class OProcess extends OBase implements Serializable{ /** All declared extensions in the process. **/ private static final String DECLAREDEXTENSIONS = "declaredExtensions"; - /** All must-understand extensions in the process. **/ - private static final String MUSTUNDERSTANDEXTENSIONS = "mustUnderstandExtensions"; /** * This constructor should only be used by Jackson when deserialize. @@ -119,7 +117,6 @@ public class OProcess extends OBase implements Serializable{ setXslSheets(new HashMap<URI, OXslSheet>()); setDeclaredExtensions(new HashSet<OExtension>()); - setMustUnderstandExtensions(new HashSet<OExtension>()); setChildIdCounter(0); } @@ -138,7 +135,6 @@ public class OProcess extends OBase implements Serializable{ getXsdTypes().clear(); getXslSheets().clear(); getDeclaredExtensions().clear(); - getMustUnderstandExtensions().clear(); } @Override @@ -329,13 +325,6 @@ public class OProcess extends OBase implements Serializable{ .get(DECLAREDEXTENSIONS); } - @SuppressWarnings("unchecked") - @JsonIgnore - public Set<OExtension> getMustUnderstandExtensions() { - return (Set<OExtension>) fieldContainer - .get(MUSTUNDERSTANDEXTENSIONS); - } - public void setAllPartnerLinks(Set<OPartnerLink> allPartnerLinks) { if (getAllPartnerLinks() == null) { fieldContainer.put(ALLPARTNERLINKS, allPartnerLinks); @@ -429,12 +418,6 @@ public class OProcess extends OBase implements Serializable{ } } - public void setMustUnderstandExtensions(Set<OExtension> extensions) { - if (getMustUnderstandExtensions() == null) { - fieldContainer.put(MUSTUNDERSTANDEXTENSIONS, extensions); - } - } - private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException{ ois.defaultReadObject(); fieldContainer.remove(NAMESPACECONTEXT); http://git-wip-us.apache.org/repos/asf/ode/blob/cf630ce4/bpel-obj/src/main/java/org/apache/ode/bpel/o/OAssign.java ---------------------------------------------------------------------- diff --git a/bpel-obj/src/main/java/org/apache/ode/bpel/o/OAssign.java b/bpel-obj/src/main/java/org/apache/ode/bpel/o/OAssign.java index 5212a13..64248a3 100644 --- a/bpel-obj/src/main/java/org/apache/ode/bpel/o/OAssign.java +++ b/bpel-obj/src/main/java/org/apache/ode/bpel/o/OAssign.java @@ -26,13 +26,12 @@ import javax.xml.namespace.QName; import org.apache.ode.bpel.o.OScope.Variable; import org.apache.ode.utils.DOMUtils; -import org.apache.ode.utils.SerializableElement; import org.w3c.dom.Document; public class OAssign extends OActivity { static final long serialVersionUID = -1L ; - public final List<OAssignOperation> operations = new ArrayList<OAssignOperation>(); + public final List<Copy> copy = new ArrayList<Copy>(); public OAssign(OProcess owner, OActivity parent) { super(owner, parent); @@ -42,26 +41,11 @@ public class OAssign extends OActivity { public String toString() { return "{OAssign : " + name + ", joinCondition=" + joinCondition + "}"; } - - /** - * Base class for assign operations. - */ - public static abstract class OAssignOperation extends OBase { - private static final long serialVersionUID = -3042873658302758854L; - - public enum Type { Copy, ExtensionOperation } - - public OAssignOperation(OProcess owner) { - super(owner); - } - - public abstract Type getType(); - } /** * Assignmenet copy entry, i.e. what the assignment consits of. */ - public static class Copy extends OAssignOperation { + public static class Copy extends OBase { private static final long serialVersionUID = 1L; public LValue to; public RValue from; @@ -84,38 +68,6 @@ public class OAssign extends OActivity { to = null; from = null; } - - 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; - public SerializableElement nestedElement; - public QName extensionName; - - public ExtensionAssignOperation(OProcess owner) { - super(owner); - } - - public String toString() { - return "{OExtensionAssignOperation; " + nestedElement.getElement().getTagName() + "}"; - } - - @Override - public void dehydrate() { - super.dehydrate(); - nestedElement = null; - extensionName = null; - } - - public Type getType() { - return Type.ExtensionOperation; - } } public interface LValue { @@ -303,12 +255,8 @@ public class OAssign extends OActivity { @Override public void dehydrate() { super.dehydrate(); - for (OAssignOperation operation : this.operations) { - if (operation.getType().equals(OAssignOperation.Type.Copy)) { - ((Copy)operation).dehydrate(); - } else if (operation.getType().equals(OAssignOperation.Type.ExtensionOperation)) { - ((ExtensionAssignOperation)operation).dehydrate(); - } + for (Copy copy : this.copy) { + copy.dehydrate(); } } } http://git-wip-us.apache.org/repos/asf/ode/blob/cf630ce4/bpel-obj/src/main/java/org/apache/ode/bpel/o/OProcess.java ---------------------------------------------------------------------- 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 7b95919..717b9e2 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 @@ -76,12 +76,6 @@ public class OProcess extends OBase { public final HashMap<URI, OXslSheet> xslSheets = new HashMap<URI, OXslSheet>(); - /** All declared extensions in the process. **/ - public final Set<OExtension> declaredExtensions = new HashSet<OExtension>(); - - /** All must-understand extensions in the process. **/ - public final Set<OExtension> mustUnderstandExtensions = new HashSet<OExtension>(); - public OProcess(String bpelVersion) { super(null); this.version = bpelVersion; @@ -120,12 +114,12 @@ public class OProcess extends OBase { return processName; } - @SuppressWarnings("rawtypes") - public Collection getExpressionLanguages() { + @SuppressWarnings("unchecked") + public Collection getExpressionLanguages() { throw new UnsupportedOperationException(); // TODO: implement me! } - @SuppressWarnings("rawtypes") + @SuppressWarnings("unchecked") public List<String> getCorrelators() { // MOVED from ProcessSchemaGenerator List<String> correlators = new ArrayList<String>(); @@ -192,18 +186,6 @@ public class OProcess extends OBase { } } - - public static class OExtension extends OBase { - static final long serialVersionUID = -1L ; - public String namespaceURI; - public boolean mustUnderstand; - - public OExtension(OProcess process) { super(process); } - - public String toString() { - return "{OExtension " + namespaceURI + (mustUnderstand ? " mustUnderstand" : "") + "}"; - } - } public QName getQName() { return new QName(targetNamespace, processName); http://git-wip-us.apache.org/repos/asf/ode/blob/cf630ce4/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java ---------------------------------------------------------------------- diff --git a/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java b/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java index 9208136..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 @@ -51,7 +51,6 @@ import org.apache.ode.bpel.engine.extvar.ExternalVariableManager; import org.apache.ode.bpel.evt.ProcessInstanceEvent; import org.apache.ode.bpel.explang.ConfigurationException; import org.apache.ode.bpel.explang.EvaluationException; -import org.apache.ode.bpel.extension.ExtensionBundleRuntime; import org.apache.ode.bpel.iapi.BpelEngineException; import org.apache.ode.bpel.iapi.Endpoint; import org.apache.ode.bpel.iapi.EndpointReference; @@ -131,8 +130,7 @@ public class BpelProcess { private ReplacementMap _replacementMap; final ProcessConf _pconf; - Set<String> _mustUnderstandExtensions; - Map<String, ExtensionBundleRuntime> _extensionRegistry; + Set<String> _mustUnderstandExtensions; /** {@link MessageExchangeInterceptor}s registered for this process. */ private final List<MessageExchangeInterceptor> _mexInterceptors = new ArrayList<MessageExchangeInterceptor>(); @@ -591,10 +589,6 @@ public class BpelProcess { return routed; } - public void setExtensionRegistry(Map<String, ExtensionBundleRuntime> extensionRegistry) { - _extensionRegistry = extensionRegistry; - } - private void setRoles(OProcess oprocess) { _partnerRoles = new HashMap<OPartnerLink, PartnerLinkPartnerRoleImpl>(); _myRoles = new HashMap<OPartnerLink, PartnerLinkMyRoleImpl>(); @@ -966,7 +960,7 @@ public class BpelProcess { // } _replacementMap = null; _expLangRuntimeRegistry = null; - _extensionRegistry = null; + _mustUnderstandExtensions = null; } private void doHydrate() { @@ -1013,8 +1007,8 @@ public class BpelProcess { _mustUnderstandExtensions = new HashSet<String>(); for (OProcess.OExtension extension : _oprocess.getDeclaredExtensions()) { if (extension.isMustUnderstand()) { - if (_extensionRegistry.get(extension.getNamespace()) == null) { - String msg = __msgs.msgExtensionMustUnderstandError(_pconf.getProcessId(), + if (_engine._contexts.extensionRegistry.get(extension.getNamespace()) == null) { + String msg = __msgs.msgExtensionMustUnderstandError(_pid, extension.getNamespace()); __log.error(msg); throw new BpelEngineException(msg); http://git-wip-us.apache.org/repos/asf/ode/blob/cf630ce4/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java ---------------------------------------------------------------------- diff --git a/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java b/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java index 1457a80..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.CorrelationKey; 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.ProcessInstanceDAO; 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; @@ -60,8 +64,6 @@ import org.apache.ode.bpel.evt.ScopeCompletionEvent; import org.apache.ode.bpel.evt.ScopeEvent; import org.apache.ode.bpel.evt.ScopeFaultEvent; import org.apache.ode.bpel.evt.ScopeStartEvent; -import org.apache.ode.bpel.extension.ExtensionBundleRuntime; -import org.apache.ode.bpel.extension.ExtensionOperation; import org.apache.ode.bpel.iapi.BpelEngineException; import org.apache.ode.bpel.iapi.ContextException; import org.apache.ode.bpel.iapi.Endpoint; @@ -91,6 +93,7 @@ import org.apache.ode.bpel.runtime.PartnerLinkInstance; 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; @@ -1534,17 +1537,66 @@ public class BpelRuntimeContextImpl implements BpelRuntimeContext { _forceFlush = true; } - public ExtensionOperation createExtensionActivityImplementation(QName name) { - if (name == null) return null; - ExtensionBundleRuntime bundle = _bpelProcess._extensionRegistry.get(name.getNamespaceURI()); - if (bundle == null) { - return null; - } else { - try { - return bundle.getExtensionOperationInstance(name.getLocalPart()); - } catch (Exception e) { - return null; - } - } + 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; + } + } + } } http://git-wip-us.apache.org/repos/asf/ode/blob/cf630ce4/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelServerImpl.java ---------------------------------------------------------------------- diff --git a/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelServerImpl.java b/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelServerImpl.java index ffb805c..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,11 +40,11 @@ import org.apache.ode.bpel.dao.BpelDAOConnection; 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; import org.apache.ode.bpel.evt.BpelEvent; -import org.apache.ode.bpel.extension.ExtensionBundleRuntime; import org.apache.ode.bpel.iapi.BindingContext; import org.apache.ode.bpel.iapi.BpelEngine; import org.apache.ode.bpel.iapi.BpelEngineException; @@ -176,13 +176,13 @@ public class BpelServerImpl implements BpelServer, Scheduler.JobProcessor { } } - public void registerExtensionBundle(ExtensionBundleRuntime bundle) { - _contexts.extensionRegistry.put(bundle.getNamespaceURI(), bundle); - bundle.registerExtensionActivities(); + public void registerExtensionBundle(AbstractExtensionBundle bundle) { + _contexts.extensionRegistry.put(bundle.getNamespaceURI(), bundle); + bundle.registerExtensionActivities(); } public void unregisterExtensionBundle(String nsURI) { - _contexts.extensionRegistry.remove(nsURI); + _contexts.extensionRegistry.remove(nsURI); } public void registerExternalVariableEngine(ExternalVariableModule eve) { @@ -328,7 +328,6 @@ public class BpelServerImpl implements BpelServer, Scheduler.JobProcessor { BpelProcess process = createBpelProcess(conf); - process.setExtensionRegistry(_contexts.extensionRegistry); process._classLoader = Thread.currentThread().getContextClassLoader(); _engine.registerProcess(process); http://git-wip-us.apache.org/repos/asf/ode/blob/cf630ce4/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/Contexts.java ---------------------------------------------------------------------- diff --git a/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/Contexts.java b/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/Contexts.java index ce4edd9..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 @@ package org.apache.ode.bpel.engine; 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; @@ -29,7 +30,6 @@ import org.apache.ode.bpel.iapi.Scheduler; import org.apache.ode.bpel.intercept.MessageExchangeInterceptor; import org.apache.ode.bpel.engine.cron.CronScheduler; import org.apache.ode.bpel.evar.ExternalVariableModule; -import org.apache.ode.bpel.extension.ExtensionBundleRuntime; import java.util.HashMap; import java.util.List; @@ -70,7 +70,7 @@ public class Contexts { public CustomProcessProperties customProcessProperties = new CustomProcessProperties(); - /** Global extension bundle registry **/ - final Map<String, ExtensionBundleRuntime> extensionRegistry = new ConcurrentHashMap<String, ExtensionBundleRuntime>(); + /** Global extension bundle registry **/ + final Map<String, AbstractExtensionBundle> extensionRegistry = new ConcurrentHashMap<String, AbstractExtensionBundle>(); } http://git-wip-us.apache.org/repos/asf/ode/blob/cf630ce4/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ASSIGN.java ---------------------------------------------------------------------- diff --git a/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ASSIGN.java b/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ASSIGN.java index ca442a0..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,15 +18,26 @@ */ 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; import org.apache.ode.bpel.explang.EvaluationContext; import org.apache.ode.bpel.explang.EvaluationException; -import org.apache.ode.bpel.extension.ExtensionOperation; import org.apache.ode.bpel.obj.OAssign; import org.apache.ode.bpel.obj.OAssign.DirectRef; import org.apache.ode.bpel.obj.OAssign.LValueExpression; @@ -37,17 +48,17 @@ import org.apache.ode.bpel.obj.OExpression; import org.apache.ode.bpel.obj.OLink; import org.apache.ode.bpel.obj.OMessageVarType; import org.apache.ode.bpel.obj.OMessageVarType.Part; -import org.apache.ode.bpel.obj.OProcess; 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.bpel.runtime.common.extension.ExtensibilityQNames; -import org.apache.ode.bpel.runtime.common.extension.ExtensionContext; +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; @@ -57,17 +68,11 @@ import org.w3c.dom.NodeList; 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; @@ -82,7 +87,7 @@ class ASSIGN extends ACTIVITY { } public void run() { - OAssign oassign = getOAsssign(); + OAssign oassign = getOAssign(); FaultData faultData = null; @@ -98,7 +103,7 @@ class ASSIGN extends ACTIVITY { if (((OAssign.Copy) operation).isIgnoreMissingFromData()) { if (fault .getQName() - .equals(getOAsssign().getOwner().getConstants().getQnSelectionFailure()) + .equals(getOAssign().getOwner().getConstants().getQnSelectionFailure()) && (fault.getCause() != null && "ignoreMissingFromData" .equals(fault.getCause().getMessage()))) { continue; @@ -107,7 +112,7 @@ class ASSIGN extends ACTIVITY { if (((OAssign.Copy) operation).isIgnoreUninitializedFromVariable()) { if (fault .getQName() - .equals(getOAsssign().getOwner().getConstants().getQnUninitializedVariable()) + .equals(getOAssign().getOwner().getConstants().getQnUninitializedVariable()) && (fault.getCause() == null || !"throwUninitializedToVariable" .equals(fault.getCause().getMessage()))) { continue; @@ -139,7 +144,7 @@ class ASSIGN extends ACTIVITY { return __log; } - private OAssign getOAsssign() { + private OAssign getOAssign() { return (OAssign) _self.o; } @@ -152,12 +157,12 @@ class ASSIGN extends ACTIVITY { 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(); @@ -260,16 +265,16 @@ class ASSIGN extends ACTIVITY { 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) { @@ -305,7 +310,7 @@ class ASSIGN extends ACTIVITY { if (__log.isDebugEnabled()) __log.debug(from + ": " + msg); throw new FaultException( - getOAsssign().getOwner().getConstants().getQnSelectionFailure(), + getOAssign().getOwner().getConstants().getQnSelectionFailure(), msg); } @@ -320,7 +325,7 @@ class ASSIGN extends ACTIVITY { if (__log.isDebugEnabled()) __log.debug(from + ": " + msg); throw new FaultException( - getOAsssign().getOwner().getConstants().getQnSelectionFailure(), + getOAssign().getOwner().getConstants().getQnSelectionFailure(), msg); } @@ -334,7 +339,7 @@ class ASSIGN extends ACTIVITY { if (__log.isDebugEnabled()) __log.debug(from + ": " + msg); throw new FaultException( - getOAsssign().getOwner().getConstants().getQnSelectionFailure(), + getOAssign().getOwner().getConstants().getQnSelectionFailure(), msg); } } else { @@ -343,7 +348,7 @@ class ASSIGN extends ACTIVITY { 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. @@ -352,7 +357,7 @@ class ASSIGN extends ACTIVITY { 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. @@ -368,7 +373,7 @@ class ASSIGN extends ACTIVITY { __log.debug(from + ": " + msg); throw new FaultException( - getOAsssign().getOwner().getConstants().getQnSelectionFailure(), msg); + getOAssign().getOwner().getConstants().getQnSelectionFailure(), msg); } @@ -625,7 +630,7 @@ class ASSIGN extends ACTIVITY { if (__log.isDebugEnabled()) __log.debug(lvaluePtr + ": " + msg); throw new FaultException( - getOAsssign().getOwner().getConstants().getQnSelectionFailure(), msg); + getOAssign().getOwner().getConstants().getQnSelectionFailure(), msg); } return lvalue; @@ -665,7 +670,7 @@ class ASSIGN extends ACTIVITY { 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); } } @@ -673,31 +678,41 @@ class ASSIGN extends ACTIVITY { } private void invokeExtensionAssignOperation(OAssign.ExtensionAssignOperation eao) throws FaultException { - final ExtensionContext context = new ExtensionContextImpl(this, getBpelRuntimeContext()); - - try { - ExtensionOperation ea = getBpelRuntimeContext().createExtensionActivityImplementation(eao.getExtensionName()); - if (ea == null) { - for (OProcess.OExtension oe : eao.getOwner().getMustUnderstandExtensions()) { - if (eao.getExtensionName().getNamespaceURI().equals(oe.getNamespace())) { - __log.warn("Lookup of extension assign operation " + eao.getExtensionName() + " failed."); - throw new FaultException(ExtensibilityQNames.UNKNOWN_EA_FAULT_NAME, "Lookup of extension assign operation " + eao.getExtensionName() + " failed. No implementation found."); - } - } - // act like <empty> - do nothing - context.complete(); - return; - } - - ea.run(context, DOMUtils.stringToDOM(eao.getNestedElement())); - } catch (FaultException fault) { - context.completeWithFault(fault); - } catch (SAXException e) { - FaultException fault = new FaultException(ExtensibilityQNames.INVALID_EXTENSION_ELEMENT, "The nested element of extension assign operation '" + eao.getExtensionName() + "' is no valid XML."); - context.completeWithFault(fault); + 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) { - FaultException fault = new FaultException(ExtensibilityQNames.INVALID_EXTENSION_ELEMENT, "The nested element of extension assign operation '" + eao.getExtensionName() + "' is no valid XML."); - context.completeWithFault(fault); + __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()); } } http://git-wip-us.apache.org/repos/asf/ode/blob/cf630ce4/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/BpelRuntimeContext.java ---------------------------------------------------------------------- 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 8aad3ec..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,28 +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.extension.ExtensionOperation; +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; @@ -313,12 +314,5 @@ public interface BpelRuntimeContext { void checkInvokeExternalPermission(); - /** - * Create a new extension operation based on the given qualified name. - * - * @param name The qualified name for which a corresponding extension operation should be created. - * - * @return The created extension operation or NULL if no extension bundle registered a corresponding extension operation for the given qualified name. - */ - ExtensionOperation createExtensionActivityImplementation(QName name); + void executeExtension(QName extensionId, ExtensionContext context, Element element, ExtensionResponse extResponseChannel) throws FaultException; }
