You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by sa...@apache.org on 2018/01/30 10:20:49 UTC
[03/14] ode git commit: Apply latest improvements on extension bundle
support based on commit 1d5fa185a77c944e8d4a708b451611fa74d5c2dc
http://git-wip-us.apache.org/repos/asf/ode/blob/cf630ce4/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/EXTENSIONACTIVITY.java
----------------------------------------------------------------------
diff --git a/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/EXTENSIONACTIVITY.java b/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/EXTENSIONACTIVITY.java
index 7c61035..9182c38 100644
--- a/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/EXTENSIONACTIVITY.java
+++ b/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/EXTENSIONACTIVITY.java
@@ -19,14 +19,16 @@
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.extension.ExtensionOperation;
+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.obj.OProcess;
-import org.apache.ode.bpel.runtime.common.extension.AbstractSyncExtensionOperation;
-import org.apache.ode.bpel.runtime.common.extension.ExtensibilityQNames;
-import org.apache.ode.bpel.runtime.common.extension.ExtensionContext;
+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;
@@ -43,56 +45,52 @@ public class EXTENSIONACTIVITY extends ACTIVITY {
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() {
- final ExtensionContext context = new ExtensionContextImpl(this,
- getBpelRuntimeContext());
- final OExtensionActivity oea = (OExtensionActivity) _self.o;
+ 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;
- try {
- ExtensionOperation ea = getBpelRuntimeContext()
- .createExtensionActivityImplementation(oea.getExtensionName());
- if (ea == null) {
- for (OProcess.OExtension oe : oea.getOwner().getMustUnderstandExtensions()) {
- if (oea.getExtensionName().getNamespaceURI().equals(
- oe.getNamespace())) {
- __log.warn("Lookup of extension activity "
- + oea.getExtensionName() + " failed.");
- throw new FaultException(
- ExtensibilityQNames.UNKNOWN_EA_FAULT_NAME,
- "Lookup of extension activity "
- + oea.getExtensionName()
- + " failed. No implementation found.");
+ public void onCompleted() {
+ _self.parent.completed(null, CompensationHandler.emptySet());
}
- }
- // act like <empty> - do nothing
- context.complete();
- return;
- }
- ea.run(context, DOMUtils.stringToDOM(oea.getNestedElement()));
+ 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());
+ };
+ }));
- // Complete the context for sync extension operations. Asynchronous
- // operations have to control their completion themselves.
- if (ea instanceof AbstractSyncExtensionOperation) {
- context.complete();
- }
} catch (FaultException fault) {
- __log.error("Execution of extension activity caused an exception.",
- fault);
- context.completeWithFault(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) {
- FaultException fault = new FaultException(ExtensibilityQNames.INVALID_EXTENSION_ELEMENT, "The nested element of extension activity '" + oea.getName() + "' for extension '" + oea.getExtensionName() + "' is no valid XML.");
- context.completeWithFault(fault);
+ __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) {
- FaultException fault = new FaultException(ExtensibilityQNames.INVALID_EXTENSION_ELEMENT, "The nested element of extension activity '" + oea.getName() + "' for extension '" + oea.getExtensionName() + "' is no valid XML.");
- context.completeWithFault(fault);
+ __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());
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ode/blob/cf630ce4/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ExtensionContextImpl.java
----------------------------------------------------------------------
diff --git a/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ExtensionContextImpl.java b/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ExtensionContextImpl.java
index 4117c7e..f51b449 100644
--- a/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ExtensionContextImpl.java
+++ b/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ExtensionContextImpl.java
@@ -18,48 +18,37 @@
*/
package org.apache.ode.bpel.runtime;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.net.URI;
import java.util.HashMap;
+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.evar.ExternalVariableModuleException;
-import org.apache.ode.bpel.evt.ScopeEvent;
-import org.apache.ode.bpel.evt.VariableModificationEvent;
+import org.apache.ode.bpel.eapi.ExtensionContext;
import org.apache.ode.bpel.obj.OActivity;
-import org.apache.ode.bpel.obj.OPartnerLink;
-import org.apache.ode.bpel.obj.OProcess;
+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.runtime.channels.FaultData;
-import org.apache.ode.bpel.runtime.common.extension.ExtensionContext;
-import org.apache.ode.utils.Namespaces;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+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 static final Logger __log = LoggerFactory.getLogger(ExtensionContextImpl.class);
-
private BpelRuntimeContext _context;
- private ACTIVITY _activity;
- private ActivityInfo _activityInfo;
-
- private boolean hasCompleted = false;
-
- //@hahnml: Changed to ACTIVITY to get the whole stuff with one parameter
- public ExtensionContextImpl(ACTIVITY activity, BpelRuntimeContext context) {
- _activityInfo = activity._self;
+ private ScopeFrame _scopeFrame;
+
+ public ExtensionContextImpl(ScopeFrame scopeFrame,
+ BpelRuntimeContext context) {
_context = context;
- _activity = activity;
+ _scopeFrame = scopeFrame;
}
-
+
+ public List<OLink> getLinks() throws FaultException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
public Long getProcessId() {
return _context.getPid();
}
@@ -68,13 +57,14 @@ public class ExtensionContextImpl implements ExtensionContext {
throws FaultException {
Map<String, OScope.Variable> visVars = new HashMap<String, OScope.Variable>();
- OActivity current = _activity._scopeFrame.oscope;
+ OActivity current = _scopeFrame.oscope;
while (current != null) {
if (current instanceof OScope) {
- for (String varName : ((OScope) current).getVariables().keySet()) {
+ for (String varName : ((OScope) current).getVariables()
+ .keySet()) {
if (!visVars.containsKey(varName)) {
- visVars.put(varName,
- ((OScope) current).getVariables().get(varName));
+ visVars.put(varName, ((OScope) current).getVariables()
+ .get(varName));
}
}
}
@@ -84,135 +74,44 @@ public class ExtensionContextImpl implements ExtensionContext {
return visVars;
}
- public String readMessageProperty(OScope.Variable variable,
- OProcess.OProperty property) throws FaultException {
- VariableInstance vi = _activity._scopeFrame.resolve(variable);
+ 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 = _activity._scopeFrame.resolve(variable);
-
- return _activity._scopeFrame.fetchVariableData(_context, vi, false);
+ VariableInstance vi = _scopeFrame.resolve(variable);
+ return _context.readVariable(vi.scopeInstance,
+ vi.declaration.getName(), true);
}
public void writeVariable(String variableName, Node value)
- throws FaultException, ExternalVariableModuleException {
- OScope.Variable var = getVisibleVariable(variableName);
- if (var == null) {
- throw new RuntimeException("Variable '" + variableName
- + "' not visible.");
- }
- writeVariable(var, value);
+ throws FaultException {
+ VariableInstance vi = _scopeFrame
+ .resolve(getVisibleVariable(variableName));
+ _context.writeVariable(vi, value);
}
public Node readVariable(String variableName) throws FaultException {
- OScope.Variable var = getVisibleVariable(variableName);
- if (var == null) {
- throw new RuntimeException("Variable '" + variableName
- + "' not visible.");
- }
-
- return readVariable(var);
- }
-
- public void writeVariable(OScope.Variable variable, Node value)
- throws FaultException, ExternalVariableModuleException {
- VariableInstance vi = _activity._scopeFrame.resolve(variable);
- _activity._scopeFrame.initializeVariable(_context, vi, value);
- VariableModificationEvent vme = new VariableModificationEvent(
- variable.getName());
- vme.setNewValue(value);
- sendEvent(vme);
- }
-
- public OScope.Variable getVisibleVariable(String varName) {
- return _activity._scopeFrame.oscope.getVisibleVariable(varName);
+ VariableInstance vi = _scopeFrame
+ .resolve(getVisibleVariable(variableName));
+ return _context.readVariable(vi.scopeInstance,
+ vi.declaration.getName(), true);
}
- public boolean isVariableVisible(String varName) {
- return _activity._scopeFrame.oscope.getVisibleVariable(varName) != null;
- }
-
- public String getActivityName() {
- return _activityInfo.o.getName();
- }
-
- public OActivity getOActivity() {
- return _activityInfo.o;
- }
-
- public void sendEvent(ScopeEvent event) {
- if (event.getLineNo() == -1 && _activityInfo.o.getDebugInfo() != null) {
- event.setLineNo(_activityInfo.o.getDebugInfo().getStartLine());
- }
- _activity._scopeFrame.fillEventInfo(event);
-
- _context.sendEvent(event);
- }
-
- public void complete() {
- if (!hasCompleted) {
-
- _activityInfo.parent
- .completed(null, CompensationHandler.emptySet());
- hasCompleted = true;
- } else {
- if (__log.isWarnEnabled()) {
- __log.warn("Activity '" + _activityInfo.o.getName()
- + "' has already been completed.");
- }
- }
- }
-
- public void completeWithFault(Throwable t) {
- if (!hasCompleted) {
- StringWriter sw = new StringWriter();
- t.printStackTrace(new PrintWriter(sw));
- FaultData fault = new FaultData(new QName(
- Namespaces.WSBPEL2_0_FINAL_EXEC,
- "subLanguageExecutionFault"), _activityInfo.o, sw
- .getBuffer().toString());
- _activityInfo.parent.completed(fault,
- CompensationHandler.emptySet());
- hasCompleted = true;
- } else {
- if (__log.isWarnEnabled()) {
- __log.warn("Activity '" + _activityInfo.o.getName()
- + "' has already been completed.");
- }
- }
- }
-
- public void completeWithFault(FaultException ex) {
- if (!hasCompleted) {
- FaultData fault = new FaultData(ex.getQName(), _activityInfo.o,
- ex.getMessage());
- _activityInfo.parent.completed(fault,
- CompensationHandler.emptySet());
- hasCompleted = true;
- } else {
- if (__log.isWarnEnabled()) {
- __log.warn("Activity '" + _activityInfo.o.getName()
- + "' has already been completed.");
- }
- }
-
- }
-
- public BpelRuntimeContext getRuntimeInstance() {
- return _context;
- }
-
- public URI getDUDir() {
- return _context.getBaseResourceURI();
- }
-
- public void printToConsole(String msg) {
- LoggerFactory.getLogger("org.apache.ode.extension.Console").info(msg);
+ public void writeVariable(Variable variable, Node value)
+ throws FaultException {
+ VariableInstance vi = _scopeFrame.resolve(variable);
+ _context.writeVariable(vi, value);
}
- public PartnerLinkInstance resolvePartnerLinkInstance(OPartnerLink pl) {
- return _activity._scopeFrame.resolve(pl);
+ private Variable getVisibleVariable(String varName) {
+ return _scopeFrame.oscope.getVisibleVariable(varName);
}
}
http://git-wip-us.apache.org/repos/asf/ode/blob/cf630ce4/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/channels/ExtensionResponse.java
----------------------------------------------------------------------
diff --git a/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/channels/ExtensionResponse.java b/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/channels/ExtensionResponse.java
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);
+
+}
http://git-wip-us.apache.org/repos/asf/ode/blob/cf630ce4/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/common/extension/AbstractAsyncExtensionOperation.java
----------------------------------------------------------------------
diff --git a/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/common/extension/AbstractAsyncExtensionOperation.java b/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/common/extension/AbstractAsyncExtensionOperation.java
deleted file mode 100644
index a3c61df..0000000
--- a/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/common/extension/AbstractAsyncExtensionOperation.java
+++ /dev/null
@@ -1,36 +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.runtime.common.extension;
-
-import org.apache.ode.bpel.common.FaultException;
-import org.apache.ode.bpel.extension.ExtensionOperation;
-import org.w3c.dom.Element;
-
-/**
- * Base class for creating new asynchronous extension implementations.
- *
- * @author Tammo van Lessen (University of Stuttgart)
- */
-public abstract class AbstractAsyncExtensionOperation implements
- ExtensionOperation {
-
- public abstract void run(Object context, Element element)
- throws FaultException;
-
-}
http://git-wip-us.apache.org/repos/asf/ode/blob/cf630ce4/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/common/extension/AbstractExtensionBundle.java
----------------------------------------------------------------------
diff --git a/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/common/extension/AbstractExtensionBundle.java b/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/common/extension/AbstractExtensionBundle.java
deleted file mode 100644
index e4e1857..0000000
--- a/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/common/extension/AbstractExtensionBundle.java
+++ /dev/null
@@ -1,109 +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.runtime.common.extension;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-import javax.xml.namespace.QName;
-
-import org.apache.ode.bpel.extension.ExtensionBundleRuntime;
-import org.apache.ode.bpel.extension.ExtensionBundleValidation;
-import org.apache.ode.bpel.extension.ExtensionOperation;
-import org.apache.ode.bpel.extension.ExtensionValidator;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * 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 implements
- ExtensionBundleRuntime, ExtensionBundleValidation {
-
- private static Logger __log = LoggerFactory.getLogger(AbstractExtensionBundle.class);
- 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 org.apache.ode.bpel.extension.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();
- }
-
- public final Map<QName, ExtensionValidator> getExtensionValidators() {
- Map<QName, ExtensionValidator> result = new HashMap<QName, ExtensionValidator>();
- String ns = getNamespaceURI();
- for (String localName : extensionsByName.keySet()) {
- if (ExtensionValidator.class.isAssignableFrom(extensionsByName
- .get(localName))) {
- try {
- result.put(
- new QName(ns, localName),
- (ExtensionValidator) getExtensionOperationInstance(localName));
- } catch (Exception e) {
- __log.warn("Could not instantiate extension validator for '{"
- + ns + "}" + localName);
- }
- }
- }
- return result;
- }
-}
http://git-wip-us.apache.org/repos/asf/ode/blob/cf630ce4/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/common/extension/AbstractSyncExtensionOperation.java
----------------------------------------------------------------------
diff --git a/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/common/extension/AbstractSyncExtensionOperation.java b/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/common/extension/AbstractSyncExtensionOperation.java
deleted file mode 100644
index 65420c4..0000000
--- a/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/common/extension/AbstractSyncExtensionOperation.java
+++ /dev/null
@@ -1,45 +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.runtime.common.extension;
-
-import org.apache.ode.bpel.common.FaultException;
-import org.apache.ode.bpel.extension.ExtensionOperation;
-import org.w3c.dom.Element;
-
-/**
- * Base class for creating new extension implementations.
- *
- * @author Tammo van Lessen (University of Stuttgart)
- */
-public abstract class AbstractSyncExtensionOperation implements
- ExtensionOperation {
-
- protected abstract void runSync(ExtensionContext context, Element element)
- throws FaultException;
-
- public void run(Object contexto, Element element) throws FaultException {
- ExtensionContext context = (ExtensionContext) contexto;
- try {
- runSync(context, element);
- } catch (FaultException f) {
- throw f;
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/ode/blob/cf630ce4/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/common/extension/ExtensibilityQNames.java
----------------------------------------------------------------------
diff --git a/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/common/extension/ExtensibilityQNames.java b/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/common/extension/ExtensibilityQNames.java
deleted file mode 100644
index ed238ad..0000000
--- a/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/common/extension/ExtensibilityQNames.java
+++ /dev/null
@@ -1,58 +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.runtime.common.extension;
-
-import javax.xml.namespace.QName;
-
-public abstract class ExtensibilityQNames {
- /*
- * Activity Recovery extensibility elements.
- */
- public static final String NS_ACTIVITY_RECOVERY = "http://ode.apache.org/activityRecovery";
- public static final QName FAILURE_HANDLING = new QName(
- NS_ACTIVITY_RECOVERY, "failureHandling");
- public static final QName FAILURE_HANDLING_RETRY_FOR = new QName(
- NS_ACTIVITY_RECOVERY, "retryFor");
- 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");
-
- public static final String NS_BPEL_EXTENSIBILITY = "http://ode.apache.org/bpelExtensibility";
-
- public static final QName UNKNOWN_EA_FAULT_NAME = new QName(
- NS_BPEL_EXTENSIBILITY, "unknownExtensionImplementation");
-
- public static final QName INVALID_EXTENSION_ELEMENT = new QName(
- NS_BPEL_EXTENSIBILITY, "invalidExtensionElement");
-
- //
- // External variables
- //
- /** Namespace for external variables. */
- private static final String EXTVAR_NS = "http://ode.apache.org/externalVariables";
-
- /** Attribute name for external variable id. */
- public static final QName EXTVAR_ATTR = new QName(EXTVAR_NS, "id");
-
- /** Attribute holding the name of the "related" variable. */
- public static final QName EXTVAR_RELATED = new QName(EXTVAR_NS,
- "relates-to");
-
-}
http://git-wip-us.apache.org/repos/asf/ode/blob/cf630ce4/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/common/extension/ExtensionContext.java
----------------------------------------------------------------------
diff --git a/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/common/extension/ExtensionContext.java b/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/common/extension/ExtensionContext.java
deleted file mode 100644
index 61da3aa..0000000
--- a/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/common/extension/ExtensionContext.java
+++ /dev/null
@@ -1,190 +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.runtime.common.extension;
-
-import java.net.URI;
-import java.util.Map;
-
-import org.apache.ode.bpel.common.FaultException;
-import org.apache.ode.bpel.evar.ExternalVariableModuleException;
-import org.apache.ode.bpel.obj.OActivity;
-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.runtime.BpelRuntimeContext;
-import org.apache.ode.bpel.runtime.PartnerLinkInstance;
-import org.w3c.dom.Node;
-
-/**
- * Context for executing extension activities or extension assign operations.
- * Implementations of the
- * {@link org.apache.ode.bpel.extension.ExtensionOperation} class use this
- * interface to access BPEL variables, property sets and link status.
- *
- * All <code>ExtensionOperation</code> implementations must complete with
- * <code>complete()</code>, <code>completeWithFault(...)</code>.
- *
- * @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 whether a variable is visible in the current scope or not.
- *
- * @param variableName
- * name of the variable.
- * @return true if the variable is visible.
- * @throws FaultException
- */
- boolean isVariableVisible(String variableName);
-
- /**
- * Read the value of a BPEL variable.
- *
- * @param variable
- * variable to read
- * @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
- * @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, ExternalVariableModuleException;
-
- /**
- * 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,
- ExternalVariableModuleException;
-
- /**
- * 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;
-
- /**
- * Reads the current process instance id.
- *
- * @return instance id
- */
- Long getProcessId();
-
- /**
- * Returns the name of the invoking activity.
- *
- * @return activity name
- */
- String getActivityName();
-
- /**
- * Returns the location of the deployment bundle of the executed process.
- *
- * @return URI of the deployment bundle.
- */
- URI getDUDir();
-
- /**
- * Allows printing debug output to the console. Output will be redirected to
- * the logger associated with <code>org.apache.ode.extension.Console</code>.
- * The target log level is INFO.
- */
- void printToConsole(String msg);
-
- /**
- * Marks the currently executed activity as successfully completed.
- */
- void complete();
-
- /**
- * Marks the currently executed activity as faulted.
- *
- * @param t
- * an exception to be reported as the fault cause.
- */
- void completeWithFault(Throwable t);
-
- /**
- * Marks the currently executed activity as faulted.
- *
- * @param fault
- * a fault.
- */
- void completeWithFault(FaultException fault);
-
- /*
- * Low-level-methods
- */
-
- /**
- * Returns the OActivity object.
- */
- OActivity getOActivity();
-
- /**
- * Returns ODE's runtime instance.
- */
- BpelRuntimeContext getRuntimeInstance();
-
- /**
- * Returns an instance of the given OPartnerLink object
- *
- * @param pl
- * the partner link model object
- * @return the related partner link instance
- */
- PartnerLinkInstance resolvePartnerLinkInstance(OPartnerLink pl);
-}
http://git-wip-us.apache.org/repos/asf/ode/blob/cf630ce4/bpel-runtime/src/test/java/org/apache/ode/bpel/elang/xpath20/runtime/MockCompilerContext.java
----------------------------------------------------------------------
diff --git a/bpel-runtime/src/test/java/org/apache/ode/bpel/elang/xpath20/runtime/MockCompilerContext.java b/bpel-runtime/src/test/java/org/apache/ode/bpel/elang/xpath20/runtime/MockCompilerContext.java
index 348ba28..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
@@ -35,7 +35,6 @@ import org.apache.ode.bpel.compiler.bom.Activity;
import org.apache.ode.bpel.compiler.bom.BpelObject;
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.OElementVarType;
import org.apache.ode.bpel.obj.OExpression;
@@ -255,10 +254,4 @@ public class MockCompilerContext implements CompilerContext {
// TODO Auto-generated method stub
return false;
}
-
- @Override
- public ExtensionValidator getExtensionValidator(QName extensionElementName) {
- // TODO Auto-generated method stub
- return null;
- }
}
http://git-wip-us.apache.org/repos/asf/ode/blob/cf630ce4/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/CoreBpelTest.java
----------------------------------------------------------------------
diff --git a/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/CoreBpelTest.java b/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/CoreBpelTest.java
index 3ae8f6f..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,7 +34,7 @@ import org.apache.ode.bpel.common.CorrelationKey;
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.extension.ExtensionOperation;
+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;
@@ -49,6 +49,7 @@ import org.apache.ode.bpel.obj.OScope.Variable;
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;
@@ -481,20 +482,10 @@ public class CoreBpelTest extends TestCase implements BpelRuntimeContext {
public void checkInvokeExternalPermission() {}
- public Node initializeVariable(VariableInstance var, ScopeFrame scopeFrame,
- Node val) throws ExternalVariableModuleException {
+ public void executeExtension(QName extensionId, ExtensionContext context,
+ Element element,
+ ExtensionResponse extResponseChannel) throws FaultException {
// TODO Auto-generated method stub
- return null;
- }
-
- public Node fetchVariableData(VariableInstance variable,
- ScopeFrame scopeFrame, boolean forWriting) throws FaultException {
- // TODO Auto-generated method stub
- return null;
- }
-
- public ExtensionOperation createExtensionActivityImplementation(QName name) {
- // TODO Auto-generated method stub
- return null;
+
}
}
http://git-wip-us.apache.org/repos/asf/ode/blob/cf630ce4/bpel-store/src/main/java/org/apache/ode/store/DeploymentUnitDir.java
----------------------------------------------------------------------
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 c36d4b1..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 @@ package org.apache.ode.store;
import java.io.File;
import java.io.FileFilter;
-import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
@@ -49,12 +48,8 @@ import org.apache.ode.bpel.compiler.wsdl.WSDLFactoryBPEL20;
import org.apache.ode.bpel.dd.DeployDocument;
import org.apache.ode.bpel.dd.TDeployment;
import org.apache.ode.bpel.dd.TDeployment.Process;
-import org.apache.ode.bpel.extension.ExtensionValidator;
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;
@@ -85,8 +80,6 @@ class DeploymentUnitDir {
private volatile DeployDocument _dd;
private volatile DocumentRegistry _docRegistry;
- private Map<QName, ExtensionValidator> _extensionValidators;
-
private long _version = -1;
private static final FileFilter _wsdlFilter = new FileFilter() {
@@ -202,7 +195,6 @@ class DeploymentUnitDir {
bpelc.setProcessWSDL(bpel11wsdl.toURI());
bpelc.setCompileProperties(prepareCompileProperties(bpelFile));
- bpelc.setExtensionValidators(_extensionValidators);
bpelc.setBaseDirectory(_duDirectory);
// Create process such that immutable objects are intern'ed.
InternPool.runBlock(new InternableBlock() {
@@ -352,10 +344,6 @@ class DeploymentUnitDir {
return result;
}
- public void setExtensionValidators(Map<QName, ExtensionValidator> extensionValidators) {
- _extensionValidators = extensionValidators;
- }
-
public final class CBPInfo {
final QName processName;
final String guid;
http://git-wip-us.apache.org/repos/asf/ode/blob/cf630ce4/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java
----------------------------------------------------------------------
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 87927fe..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
@@ -23,7 +23,6 @@ import org.slf4j.LoggerFactory;
import org.apache.ode.bpel.compiler.api.CompilationException;
import org.apache.ode.bpel.dd.DeployDocument;
import org.apache.ode.bpel.dd.TDeployment;
-import org.apache.ode.bpel.extension.ExtensionValidator;
import org.apache.ode.bpel.iapi.*;
import org.apache.ode.il.config.OdeConfigProperties;
import org.apache.ode.store.DeploymentUnitDir.CBPInfo;
@@ -89,8 +88,6 @@ public class ProcessStoreImpl implements ProcessStore {
protected File _configDir;
- private Map<QName, ExtensionValidator> _extensionValidators = new HashMap<QName, ExtensionValidator>();
-
/**
* 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
@@ -190,7 +187,6 @@ public class ProcessStoreImpl implements ProcessStore {
// Create the DU and compile/scan it before acquiring lock.
final DeploymentUnitDir du = new DeploymentUnitDir(deploymentUnitDirectory);
- du.setExtensionValidators(_extensionValidators);
if( duName != null ) {
// Override the package name if given from the parameter
du.setName(duName);
@@ -929,13 +925,4 @@ public class ProcessStoreImpl implements ProcessStore {
}
return undeployed;
}
-
- public void setExtensionValidators(
- Map<QName, ExtensionValidator> extensionValidators) {
- _extensionValidators = extensionValidators;
- }
-
- public Map<QName, ExtensionValidator> getExtensionValidators() {
- return _extensionValidators;
- }
}
http://git-wip-us.apache.org/repos/asf/ode/blob/cf630ce4/jbi/src/main/java/org/apache/ode/jbi/OdeLifeCycle.java
----------------------------------------------------------------------
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 3a789a1..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,11 +24,9 @@ import org.slf4j.LoggerFactory;
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.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.BpelEventListener;
import org.apache.ode.bpel.intercept.MessageExchangeInterceptor;
@@ -373,58 +371,18 @@ public class OdeLifeCycle implements ComponentLifeCycle {
}
}
- // @hahnml: Added support for extension bundles based on ODE 2.0 alpha branch
private void registerExtensionActivityBundles() {
- String extensionsRTStr = _ode._config.getExtensionActivityBundlesRT();
- String extensionsValStr = _ode._config
- .getExtensionActivityBundlesValidation();
- if (extensionsRTStr != 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(" ", "");
-
- try {
- // instantiate bundle
- ExtensionBundleRuntime bundleRT = (ExtensionBundleRuntime) Class
- .forName(bundleCN).newInstance();
- // register extension bundle (BPEL server)
- _ode._server.registerExtensionBundle(bundleRT);
- } catch (Exception e) {
- __log.warn("Couldn't register the extension bundle runtime "
- + bundleCN
- + ", the class couldn't be "
- + "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)
- _ode._store.setExtensionValidators(validators);
+ 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.");
+ }
+ }
}
}