You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by va...@apache.org on 2008/10/22 00:00:47 UTC
svn commit: r706793 - in /ode/trunk:
axis2-war/src/main/webapp/WEB-INF/classes/
bpel-test/src/main/java/org/apache/ode/test/
runtimes/src/main/java/org/apache/ode/bpel/rtrep/common/extension/
runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/
Author: vanto
Date: Tue Oct 21 15:00:46 2008
New Revision: 706793
URL: http://svn.apache.org/viewvc?rev=706793&view=rev
Log:
More comfort in ExtensionContext.
Modified:
ode/trunk/axis2-war/src/main/webapp/WEB-INF/classes/log4j.properties
ode/trunk/bpel-test/src/main/java/org/apache/ode/test/MockExtensionContext.java
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/common/extension/ExtensionContext.java
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/ExtensionContextImpl.java
Modified: ode/trunk/axis2-war/src/main/webapp/WEB-INF/classes/log4j.properties
URL: http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/main/webapp/WEB-INF/classes/log4j.properties?rev=706793&r1=706792&r2=706793&view=diff
==============================================================================
--- ode/trunk/axis2-war/src/main/webapp/WEB-INF/classes/log4j.properties (original)
+++ ode/trunk/axis2-war/src/main/webapp/WEB-INF/classes/log4j.properties Tue Oct 21 15:00:46 2008
@@ -27,6 +27,7 @@
log4j.category.org.apache.ode.bpel.engine=DEBUG
log4j.category.org.apache.ode.daohib.bpel.CorrelatorDaoImpl=DEBUG
log4j.category.org.apache.ode.bpel.epr=INFO
+log4j.category.org.apache.ode.extension.Console=INFO
# Console appender
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
Modified: ode/trunk/bpel-test/src/main/java/org/apache/ode/test/MockExtensionContext.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-test/src/main/java/org/apache/ode/test/MockExtensionContext.java?rev=706793&r1=706792&r2=706793&view=diff
==============================================================================
--- ode/trunk/bpel-test/src/main/java/org/apache/ode/test/MockExtensionContext.java (original)
+++ ode/trunk/bpel-test/src/main/java/org/apache/ode/test/MockExtensionContext.java Tue Oct 21 15:00:46 2008
@@ -18,15 +18,19 @@
*/
package org.apache.ode.test;
+import java.net.URI;
+import java.util.ArrayList;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import org.apache.ode.bpel.common.FaultException;
-import org.apache.ode.bpel.rtrep.v2.OScope;
-import org.apache.ode.bpel.rtrep.v2.OProcess;
+import org.apache.ode.bpel.rtrep.common.extension.ExtensionContext;
import org.apache.ode.bpel.rtrep.v2.OActivity;
import org.apache.ode.bpel.rtrep.v2.OLink;
-import org.apache.ode.bpel.rtrep.common.extension.ExtensionContext;
+import org.apache.ode.bpel.rtrep.v2.OProcess;
+import org.apache.ode.bpel.rtrep.v2.OScope;
+import org.apache.ode.bpel.rtrep.v2.OdeInternalInstance;
import org.apache.ode.utils.DOMUtils;
import org.w3c.dom.Node;
@@ -39,13 +43,15 @@
private Map<String, Node> variables = new HashMap<String, Node>();
public boolean completed;
public boolean faulted;
+ public URI duDir;
+ public List<String> msgs = new ArrayList<String>();
public Map<String, Node> getVariables() {
return variables;
}
public Long getProcessId() {
- return 0L;
+ return 4711L;
}
public Node readVariable(String variableName) throws FaultException {
@@ -59,6 +65,10 @@
System.out.println("Storing in " + variableName + ": " + DOMUtils.domToString(value));
}
+ public boolean isVariableVisible(String varName) {
+ return variables.containsKey(varName);
+ }
+
public String getActivityName() {
return "mockActivity";
}
@@ -102,5 +112,18 @@
this.completed = true;
this.faulted = true;
}
+
+ public OdeInternalInstance getInternalInstance() {
+ throw new UnsupportedOperationException("This method is not available in this mock implementation.");
+ }
+
+ public URI getDUDir() {
+ return duDir;
+ }
+
+ public void printToConsole(String msg) {
+ System.out.println(msg);
+ msgs.add(msg);
+ }
}
\ No newline at end of file
Modified: ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/common/extension/ExtensionContext.java
URL: http://svn.apache.org/viewvc/ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/common/extension/ExtensionContext.java?rev=706793&r1=706792&r2=706793&view=diff
==============================================================================
--- ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/common/extension/ExtensionContext.java (original)
+++ ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/common/extension/ExtensionContext.java Tue Oct 21 15:00:46 2008
@@ -18,20 +18,25 @@
*/
package org.apache.ode.bpel.rtrep.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.rtrep.v2.OScope;
-import org.apache.ode.bpel.rtrep.v2.OProcess;
import org.apache.ode.bpel.rtrep.v2.OActivity;
+import org.apache.ode.bpel.rtrep.v2.OProcess;
+import org.apache.ode.bpel.rtrep.v2.OScope;
+import org.apache.ode.bpel.rtrep.v2.OdeInternalInstance;
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.
+ * 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)
*/
@@ -46,12 +51,19 @@
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
- * @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;
@@ -61,8 +73,6 @@
*
* @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;
@@ -114,13 +124,47 @@
String getActivityName();
/**
- * Low-level-method
+ * Returns the location of the deployment bundle of the executed process.
+ * @return URI of the deployment bundle.
*/
- OActivity getOActivity();
+ URI getDUDir();
- //ScopeFrame getScopeFrame();
+ /**
+ * 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 internal runtime instance.
+ */
+ OdeInternalInstance getInternalInstance();
+
}
Modified: ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/ExtensionContextImpl.java
URL: http://svn.apache.org/viewvc/ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/ExtensionContextImpl.java?rev=706793&r1=706792&r2=706793&view=diff
==============================================================================
--- ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/ExtensionContextImpl.java (original)
+++ ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/ExtensionContextImpl.java Tue Oct 21 15:00:46 2008
@@ -20,6 +20,7 @@
import java.io.PrintWriter;
import java.io.StringWriter;
+import java.net.URI;
import java.util.HashMap;
import java.util.Map;
@@ -28,11 +29,11 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
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.evar.ExternalVariableModuleException;
-import org.apache.ode.bpel.rtrep.v2.channels.FaultData;
import org.apache.ode.bpel.rtrep.common.extension.ExtensionContext;
+import org.apache.ode.bpel.rtrep.v2.channels.FaultData;
import org.apache.ode.utils.Namespaces;
import org.w3c.dom.Node;
@@ -91,27 +92,39 @@
public void writeVariable(String variableName, Node value)
throws FaultException, ExternalVariableModuleException {
- VariableInstance vi = _scopeFrame.resolve(getVisibleVariable(variableName));
- _context.commitChanges(vi, _scopeFrame, value);
+ OScope.Variable var = getVisibleVariable(variableName);
+ if (var == null) {
+ throw new RuntimeException("Variable '" + variableName + "' not visible.");
+ }
+ writeVariable(var, value);
}
public Node readVariable(String variableName) throws FaultException {
- VariableInstance vi = _scopeFrame.resolve(getVisibleVariable(variableName));
- return _context.fetchVariableData(vi, _scopeFrame, true);
+ 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 = _scopeFrame.resolve(variable);
- _context.commitChanges(vi, _scopeFrame, value);
+ //_context.commitChanges(vi, _scopeFrame, value);
+ _context.initializeVariable(vi, _scopeFrame, value);
VariableModificationEvent vme = new VariableModificationEvent(variable.name);
vme.setNewValue(value);
sendEvent(vme);
}
- private OScope.Variable getVisibleVariable(String varName) {
+ public OScope.Variable getVisibleVariable(String varName) {
return _scopeFrame.oscope.getVisibleVariable(varName);
}
+
+ public boolean isVariableVisible(String varName) {
+ return _scopeFrame.oscope.getVisibleVariable(varName) != null;
+ }
public String getActivityName() {
return _activityInfo.o.name;
@@ -167,4 +180,16 @@
}
}
+
+ public OdeInternalInstance getInternalInstance() {
+ return _context;
+ }
+
+ public URI getDUDir() {
+ return _context.getBaseResourceURI();
+ }
+
+ public void printToConsole(String msg) {
+ LogFactory.getLog("org.apache.ode.extension.Console").info(msg);
+ }
}