You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by mr...@apache.org on 2008/08/01 02:29:45 UTC
svn commit: r681565 [4/5] - in /ode/branches/rtver: ./
bpel-api/src/main/java/org/apache/ode/bpel/common/
bpel-api/src/main/java/org/apache/ode/bpel/explang/
bpel-api/src/main/java/org/apache/ode/bpel/pmapi/
bpel-compiler/src/main/java/org/apache/ode/b...
Modified: ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/PICK.java
URL: http://svn.apache.org/viewvc/ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/PICK.java?rev=681565&r1=681564&r2=681565&view=diff
==============================================================================
--- ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/PICK.java (original)
+++ ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/PICK.java Thu Jul 31 17:29:41 2008
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.ode.bpel.runtime;
+package org.apache.ode.bpel.rtrep.v2;
import java.util.Calendar;
import java.util.Collection;
@@ -29,15 +29,11 @@
import org.apache.ode.bpel.common.CorrelationKey;
import org.apache.ode.bpel.common.FaultException;
import org.apache.ode.bpel.evt.VariableModificationEvent;
-import org.apache.ode.bpel.o.OElementVarType;
-import org.apache.ode.bpel.o.OMessageVarType;
-import org.apache.ode.bpel.o.OPickReceive;
-import org.apache.ode.bpel.o.OScope;
-import org.apache.ode.bpel.o.OMessageVarType.Part;
-import org.apache.ode.bpel.runtime.channels.FaultData;
-import org.apache.ode.bpel.runtime.channels.PickResponseChannel;
-import org.apache.ode.bpel.runtime.channels.PickResponseChannelListener;
-import org.apache.ode.bpel.runtime.channels.TerminationChannelListener;
+import org.apache.ode.bpel.rtrep.v2.channels.FaultData;
+import org.apache.ode.bpel.rtrep.v2.channels.PickResponseChannel;
+import org.apache.ode.bpel.rtrep.v2.channels.PickResponseChannelListener;
+import org.apache.ode.bpel.rtrep.v2.channels.TerminationChannelListener;
+import org.apache.ode.bpel.rtrep.rapi.InvalidProcessException;
import org.apache.ode.utils.DOMUtils;
import org.apache.ode.utils.xsd.Duration;
import org.apache.ode.bpel.evar.ExternalVariableModuleException;
@@ -83,10 +79,10 @@
if (onMessage.matchCorrelation == null && !_opick.createInstanceFlag) {
// Adding a route for opaque correlation. In this case,
// correlation is on "out-of-band" session-id
- String sessionId = getBpelRuntimeContext().fetchMySessionId(pLinkInstance);
+ String sessionId = getBpelRuntime().fetchMySessionId(pLinkInstance);
key = new CorrelationKey(-1, new String[] { sessionId });
} else if (onMessage.matchCorrelation != null) {
- if (!getBpelRuntimeContext().isCorrelationInitialized(
+ if (!getBpelRuntime().isCorrelationInitialized(
_scopeFrame.resolve(onMessage.matchCorrelation))) {
// the following should really test if this is a "join"
// type correlation...
@@ -95,7 +91,7 @@
"Correlation not initialized.");
} else {
- key = getBpelRuntimeContext().readCorrelation(_scopeFrame.resolve(onMessage.matchCorrelation));
+ key = getBpelRuntime().readCorrelation(_scopeFrame.resolve(onMessage.matchCorrelation));
assert key != null;
}
@@ -108,15 +104,15 @@
timeout = null;
for (OPickReceive.OnAlarm onAlarm : _opick.onAlarms) {
- Date dt = onAlarm.forExpr != null ? offsetFromNow(getBpelRuntimeContext().getExpLangRuntime()
- .evaluateAsDuration(onAlarm.forExpr, getEvaluationContext())) : getBpelRuntimeContext()
+ Date dt = onAlarm.forExpr != null ? offsetFromNow(getBpelRuntime().getExpLangRuntime()
+ .evaluateAsDuration(onAlarm.forExpr, getEvaluationContext())) : getBpelRuntime()
.getExpLangRuntime().evaluateAsDate(onAlarm.untilExpr, getEvaluationContext()).getTime();
if (timeout == null || timeout.compareTo(dt) > 0) {
timeout = dt;
_alarm = onAlarm;
}
}
- getBpelRuntimeContext().select(pickResponseChannel, timeout, _opick.createInstanceFlag, selectors);
+ getBpelRuntime().select(pickResponseChannel, timeout, _opick.createInstanceFlag, selectors);
} catch (FaultException e) {
__log.error(e);
FaultData fault = createFault(e.getQName(), _opick, e.getMessage());
@@ -157,7 +153,7 @@
try {
// At this point, not being able to get the request is most probably
// a mex that hasn't properly replied to (process issue).
- msgEl = getBpelRuntimeContext().getMyRequest(mexId);
+ msgEl = getBpelRuntime().getMyRequest(mexId);
} catch (BpelEngineException e) {
__log.error("The message exchange seems to be in an unconsistent state, you're " +
"probably missing a reply on a request/response interaction.");
@@ -182,7 +178,7 @@
for (String pName : partNames) {
QName partName = new QName(null, pName);
Element msgPart = DOMUtils.findChildByName(msgEl, partName);
- Part part = vartype.parts.get(pName);
+ OMessageVarType.Part part = vartype.parts.get(pName);
if (part == null) {
String errmsg = "Inconsistent WSDL, part " + pName + " not found in message type " + vartype.messageType;
__log.fatal(errmsg);
@@ -220,7 +216,7 @@
VariableInstance vinst = _scopeFrame.resolve(onMessage.variable);
try {
- initializeVariable(vinst, msgEl);
+ getBpelRuntime().initializeVariable(vinst, msgEl);
} catch (ExternalVariableModuleException e) {
__log.error("Exception while initializing external variable", e);
_self.parent.failure(e.toString(), null);
@@ -274,23 +270,23 @@
// Trying to initialize partner epr based on a
// message-provided epr/session.
- if (!getBpelRuntimeContext().isPartnerRoleEndpointInitialized(
+ if (!getBpelRuntime().isPartnerRoleEndpointInitialized(
_scopeFrame.resolve(onMessage.partnerLink))
|| !onMessage.partnerLink.initializePartnerRole) {
- Node fromEpr = getBpelRuntimeContext().getSourceEPR(mexId);
+ Node fromEpr = getBpelRuntime().getSourceEPR(mexId);
if (fromEpr != null) {
if (__log.isDebugEnabled())
__log.debug("Received callback EPR " + DOMUtils.domToString(fromEpr)
+ " saving it on partner link " + onMessage.partnerLink.getName());
- getBpelRuntimeContext().writeEndpointReference(
+ getBpelRuntime().writeEndpointReference(
_scopeFrame.resolve(onMessage.partnerLink), (Element) fromEpr);
}
}
- String partnersSessionId = getBpelRuntimeContext().getSourceSessionId(mexId);
+ String partnersSessionId = getBpelRuntime().getSourceSessionId(mexId);
if (partnersSessionId != null)
- getBpelRuntimeContext().initializePartnersSessionId(
+ getBpelRuntime().initializePartnersSessionId(
_scopeFrame.resolve(onMessage.partnerLink), partnersSessionId);
}
@@ -332,7 +328,7 @@
private static final long serialVersionUID = 4399496341785922396L;
public void terminate() {
- getBpelRuntimeContext().cancel(_pickResponseChannel);
+ getBpelRuntime().cancel(_pickResponseChannel);
instance(WAITING.this);
}
}));
Modified: ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/PROCESS.java
URL: http://svn.apache.org/viewvc/ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/PROCESS.java?rev=681565&r1=681564&r2=681565&view=diff
==============================================================================
--- ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/PROCESS.java (original)
+++ ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/PROCESS.java Thu Jul 31 17:29:41 2008
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.ode.bpel.runtime;
+package org.apache.ode.bpel.rtrep.v2;
import org.apache.ode.bpel.evt.ProcessInstanceStartedEvent;
import org.apache.ode.bpel.o.OBase;
@@ -24,11 +24,11 @@
import org.apache.ode.bpel.o.OScope;
import org.apache.ode.bpel.o.OFailureHandling;
import org.apache.ode.bpel.o.OScope.Variable;
-import org.apache.ode.bpel.runtime.channels.FaultData;
-import org.apache.ode.bpel.runtime.channels.ParentScopeChannel;
-import org.apache.ode.bpel.runtime.channels.ParentScopeChannelListener;
-import org.apache.ode.bpel.runtime.channels.ReadWriteLockChannel;
-import org.apache.ode.bpel.runtime.channels.TerminationChannel;
+import org.apache.ode.bpel.rtrep.v2.channels.FaultData;
+import org.apache.ode.bpel.rtrep.v2.channels.ParentScopeChannel;
+import org.apache.ode.bpel.rtrep.v2.channels.ParentScopeChannelListener;
+import org.apache.ode.bpel.rtrep.v2.channels.ReadWriteLockChannel;
+import org.apache.ode.bpel.rtrep.v2.channels.TerminationChannel;
import org.apache.ode.jacob.SynchChannel;
import java.util.Set;
@@ -44,7 +44,7 @@
}
public void run() {
- BpelRuntimeContext ntive = getBpelRuntimeContext();
+ RuntimeInstanceImpl ntive = getBpelRuntime();
Long scopeInstanceId = ntive.createScopeInstance(null, _oprocess.procesScope);
createGlobals();
@@ -67,7 +67,7 @@
}
public void completed(FaultData fault, Set<CompensationHandler> compensations) {
- BpelRuntimeContext nativeAPI = (BpelRuntimeContext)getExtension(BpelRuntimeContext.class);
+ RuntimeInstanceImpl nativeAPI = (RuntimeInstanceImpl) getExtension(RuntimeInstanceImpl.class);
if (fault == null) {
nativeAPI.completedOk();
} else {
@@ -92,7 +92,7 @@
// For each variable, we create a lock.
for (OBase child : _oprocess.getChildren())
if (child instanceof OScope.Variable) {
- OScope.Variable var = (Variable) child;
+ OScope.Variable var = (OScope.Variable) child;
ReadWriteLockChannel vlock = newChannel(ReadWriteLockChannel.class);
instance(new READWRITELOCK(vlock));
_globals._varLocks.put(var, vlock);
Modified: ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/PartnerLinkInstance.java
URL: http://svn.apache.org/viewvc/ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/PartnerLinkInstance.java?rev=681565&r1=681564&r2=681565&view=diff
==============================================================================
--- ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/PartnerLinkInstance.java (original)
+++ ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/PartnerLinkInstance.java Thu Jul 31 17:29:41 2008
@@ -16,9 +16,10 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.ode.bpel.runtime;
+package org.apache.ode.bpel.rtrep.v2;
-import org.apache.ode.bpel.o.OPartnerLink;
+import org.apache.ode.bpel.rtrep.rapi.PartnerLink;
+import org.apache.ode.bpel.rtrep.rapi.PartnerLinkModel;
import org.apache.ode.utils.ObjectPrinter;
import java.io.Serializable;
@@ -28,7 +29,7 @@
* @author Maciej Szefler - m s z e f l e r @ g m a i l . c o m
*
*/
-public class PartnerLinkInstance implements Serializable {
+public class PartnerLinkInstance implements Serializable, PartnerLink {
private static final long serialVersionUID = 1L;
public OPartnerLink partnerLink;
@@ -40,6 +41,18 @@
this.scopeInstanceId = scopeInstanceId;
}
+ public String getName() {
+ return partnerLink.name;
+ }
+
+ public PartnerLinkModel getModel() {
+ return partnerLink;
+ }
+
+ public long getScopeId() {
+ return scopeInstanceId;
+ }
+
public boolean equals(Object obj) {
PartnerLinkInstance other = (PartnerLinkInstance) obj;
return partnerLink.equals(other.partnerLink) && scopeInstanceId.equals(other.scopeInstanceId);
Modified: ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/PropertyAliasEvaluationContext.java
URL: http://svn.apache.org/viewvc/ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/PropertyAliasEvaluationContext.java?rev=681565&r1=681564&r2=681565&view=diff
==============================================================================
--- ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/PropertyAliasEvaluationContext.java (original)
+++ ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/PropertyAliasEvaluationContext.java Thu Jul 31 17:29:41 2008
@@ -16,19 +16,12 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.ode.bpel.runtime;
+package org.apache.ode.bpel.rtrep.v2;
import java.net.URI;
import org.apache.ode.bpel.common.FaultException;
-import org.apache.ode.bpel.explang.EvaluationContext;
-import org.apache.ode.bpel.o.OElementVarType;
-import org.apache.ode.bpel.o.OExpression;
-import org.apache.ode.bpel.o.OLink;
-import org.apache.ode.bpel.o.OMessageVarType;
-import org.apache.ode.bpel.o.OMessageVarType.Part;
-import org.apache.ode.bpel.o.OProcess;
-import org.apache.ode.bpel.o.OScope;
+import org.apache.ode.bpel.rtrep.rapi.InvalidProcessException;
import org.apache.ode.utils.DOMUtils;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -81,7 +74,7 @@
throw new InvalidProcessException("Process execution information not available in this context.");
}
- public Node getPartData(Element message, Part part) throws FaultException {
+ public Node getPartData(Element message, OMessageVarType.Part part) throws FaultException {
// TODO Auto-generated method stub
return null;
}
Modified: ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/READWRITELOCK.java
URL: http://svn.apache.org/viewvc/ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/READWRITELOCK.java?rev=681565&r1=681564&r2=681565&view=diff
==============================================================================
--- ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/READWRITELOCK.java (original)
+++ ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/READWRITELOCK.java Thu Jul 31 17:29:41 2008
@@ -1,11 +1,11 @@
-package org.apache.ode.bpel.runtime;
+package org.apache.ode.bpel.rtrep.v2;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
-import org.apache.ode.bpel.runtime.channels.ReadWriteLockChannel;
-import org.apache.ode.bpel.runtime.channels.ReadWriteLockChannelListener;
+import org.apache.ode.bpel.rtrep.v2.channels.ReadWriteLockChannel;
+import org.apache.ode.bpel.rtrep.v2.channels.ReadWriteLockChannelListener;
import org.apache.ode.jacob.JacobRunnable;
import org.apache.ode.jacob.SynchChannel;
Modified: ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/REPEATUNTIL.java
URL: http://svn.apache.org/viewvc/ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/REPEATUNTIL.java?rev=681565&r1=681564&r2=681565&view=diff
==============================================================================
--- ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/REPEATUNTIL.java (original)
+++ ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/REPEATUNTIL.java Thu Jul 31 17:29:41 2008
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.ode.bpel.runtime;
+package org.apache.ode.bpel.rtrep.v2;
import java.util.HashSet;
import java.util.Set;
@@ -24,13 +24,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.o.ORepeatUntil;
-import org.apache.ode.bpel.o.OScope;
-import org.apache.ode.bpel.runtime.channels.FaultData;
-import org.apache.ode.bpel.runtime.channels.ParentScopeChannel;
-import org.apache.ode.bpel.runtime.channels.ParentScopeChannelListener;
-import org.apache.ode.bpel.runtime.channels.TerminationChannel;
-import org.apache.ode.bpel.runtime.channels.TerminationChannelListener;
+import org.apache.ode.bpel.rtrep.v2.channels.FaultData;
+import org.apache.ode.bpel.rtrep.v2.channels.ParentScopeChannel;
+import org.apache.ode.bpel.rtrep.v2.channels.ParentScopeChannelListener;
+import org.apache.ode.bpel.rtrep.v2.channels.TerminationChannel;
+import org.apache.ode.bpel.rtrep.v2.channels.TerminationChannelListener;
import org.apache.ode.jacob.SynchChannel;
import org.w3c.dom.Element;
@@ -75,7 +73,7 @@
* @throws FaultException in case of standard expression fault (e.g. selection failure)
*/
private boolean checkCondition() throws FaultException {
- return getBpelRuntimeContext().getExpLangRuntime().evaluateAsBoolean(getORepeatUntil().untilCondition,getEvaluationContext());
+ return getBpelRuntime().getExpLangRuntime().evaluateAsBoolean(getORepeatUntil().untilCondition,getEvaluationContext());
}
private class WAITER extends BpelJacobRunnable {
@@ -110,8 +108,7 @@
_self.parent.completed(faultData, _compHandlers);
else {
- boolean condResult = false;
-
+ boolean condResult;
try {
condResult = checkCondition();
} catch (FaultException fe) {
Copied: ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/REPLY.java (from r680846, ode/branches/rtver/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/REPLY.java)
URL: http://svn.apache.org/viewvc/ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/REPLY.java?p2=ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/REPLY.java&p1=ode/branches/rtver/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/REPLY.java&r1=680846&r2=681565&rev=681565&view=diff
==============================================================================
--- ode/branches/rtver/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/REPLY.java (original)
+++ ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/REPLY.java Thu Jul 31 17:29:41 2008
@@ -16,12 +16,10 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.ode.bpel.runtime;
+package org.apache.ode.bpel.rtrep.v2;
import org.apache.ode.bpel.common.FaultException;
-import org.apache.ode.bpel.o.OReply;
-import org.apache.ode.bpel.o.OScope;
-import org.apache.ode.bpel.runtime.channels.FaultData;
+import org.apache.ode.bpel.rtrep.v2.channels.FaultData;
import java.util.Iterator;
@@ -40,32 +38,26 @@
public void run() {
final OReply oreply = (OReply)_self.o;
-
if (__log.isDebugEnabled()) {
__log.debug("<reply> partnerLink=" + oreply.partnerLink + ", operation=" + oreply.operation);
}
- FaultData fault = null;
-
+ FaultData fault = null;
try {
if (oreply.variable != null)
- sendVariableReadEvent(_scopeFrame.resolve(oreply.variable));
+ sendVariableReadEvent(_scopeFrame.resolve(oreply.variable));
- Node msg = oreply.variable == null ? null : fetchVariableData(_scopeFrame.resolve(oreply.variable), false);
+ Node msg = oreply.variable == null ? null :
+ fetchVariableData(_scopeFrame.resolve(oreply.variable), false);
assert msg == null || msg instanceof Element; // note msg can be null for faults
- for (Iterator<OScope.CorrelationSet> i = oreply.initCorrelations.iterator(); i.hasNext(); ) {
- OScope.CorrelationSet cset = i.next();
- initializeCorrelation(_scopeFrame.resolve(cset),
- _scopeFrame.resolve(oreply.variable));
- }
+ for (OScope.CorrelationSet cset : oreply.initCorrelations)
+ initializeCorrelation(_scopeFrame.resolve(cset), _scopeFrame.resolve(oreply.variable));
// send reply
- getBpelRuntimeContext()
- .reply(_scopeFrame.resolve(oreply.partnerLink), oreply.operation.getName(),
- oreply.messageExchangeId, (Element)msg,
- oreply.fault);
+ getBpelRuntime().reply(_scopeFrame.resolve(oreply.partnerLink), oreply.operation.getName(),
+ oreply.messageExchangeId, (Element)msg, oreply.fault);
} catch (FaultException e) {
__log.error(e);
fault = createFault(e.getQName(), oreply);
Modified: ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/RETHROW.java
URL: http://svn.apache.org/viewvc/ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/RETHROW.java?rev=681565&r1=681564&r2=681565&view=diff
==============================================================================
--- ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/RETHROW.java (original)
+++ ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/RETHROW.java Thu Jul 31 17:29:41 2008
@@ -16,11 +16,12 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.ode.bpel.runtime;
+package org.apache.ode.bpel.rtrep.v2;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.ode.bpel.runtime.channels.FaultData;
+import org.apache.ode.bpel.rtrep.v2.channels.FaultData;
+import org.apache.ode.bpel.rtrep.rapi.InvalidProcessException;
/**
@@ -40,7 +41,7 @@
if(fault == null){
String msg = "Attempting to execute 'rethrow' activity with no visible fault in scope.";
__log.error(msg);
- throw new InvalidProcessException(msg);
+ throw new InvalidProcessException(msg);
}
_self.parent.completed(fault,CompensationHandler.emptySet());
Modified: ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/ReplacementMapImpl.java
URL: http://svn.apache.org/viewvc/ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/ReplacementMapImpl.java?rev=681565&r1=681564&r2=681565&view=diff
==============================================================================
--- ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/ReplacementMapImpl.java (original)
+++ ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/ReplacementMapImpl.java Thu Jul 31 17:29:41 2008
@@ -16,10 +16,8 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.ode.bpel.engine;
+package org.apache.ode.bpel.rtrep.v2;
-import org.apache.ode.bpel.o.OBase;
-import org.apache.ode.bpel.o.OProcess;
import org.apache.ode.jacob.soup.ReplacementMap;
import java.io.Externalizable;
Modified: ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/ResumeWork.java
URL: http://svn.apache.org/viewvc/ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/ResumeWork.java?rev=681565&r1=681564&r2=681565&view=diff
==============================================================================
--- ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/ResumeWork.java (original)
+++ ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/ResumeWork.java Thu Jul 31 17:29:41 2008
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.ode.bpel.runtime;
+package org.apache.ode.bpel.rtrep.v2;
import org.apache.ode.utils.ObjectPrinter;
Added: ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/RuntimeInstanceImpl.java
URL: http://svn.apache.org/viewvc/ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/RuntimeInstanceImpl.java?rev=681565&view=auto
==============================================================================
--- ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/RuntimeInstanceImpl.java (added)
+++ ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/RuntimeInstanceImpl.java Thu Jul 31 17:29:41 2008
@@ -0,0 +1,754 @@
+package org.apache.ode.bpel.rtrep.v2;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Collection;
+import java.util.Date;
+
+import javax.wsdl.Operation;
+import javax.xml.namespace.QName;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ode.bpel.common.CorrelationKey;
+import org.apache.ode.bpel.common.FaultException;
+import org.apache.ode.bpel.evt.ProcessInstanceStartedEvent;
+import org.apache.ode.bpel.evt.ScopeEvent;
+import org.apache.ode.bpel.rtrep.rapi.*;
+import org.apache.ode.bpel.rtrep.v2.channels.*;
+import org.apache.ode.bpel.rtrep.common.extension.ExtensionOperation;
+import org.apache.ode.bpel.rtrep.common.extension.AbstractExtensionBundle;
+import org.apache.ode.bpel.rtrep.common.extension.ExtensionContext;
+import org.apache.ode.bpel.evar.ExternalVariableModuleException;
+import org.apache.ode.bpel.evar.IncompleteKeyException;
+import org.apache.ode.bpel.iapi.BpelEngineException;
+import org.apache.ode.jacob.JacobRunnable;
+import org.apache.ode.jacob.vpu.ExecutionQueueImpl;
+import org.apache.ode.jacob.vpu.JacobVPU;
+import org.apache.ode.utils.DOMUtils;
+import org.apache.ode.utils.msg.MessageBundle;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.Text;
+
+/**
+ * Implementation of {@link OdeRTInstance} for the "modern" runtime. This class also serves as a repository for kitchen sink type
+ * methods that the activities all use. A lot of these methods are simply deferals to similar methods on
+ * {@link OdeRTInstanceContext}; however here these methods use representation-specific classes (e.g.
+ * {@link OPartnerLink) while the {@link OdeRTInstanceContext} methods use only the general (non-representation specific) interfaces
+ * (e.g. {@link PartnerLink}.
+ *
+ * @author Maciej Szefler
+ *
+ */
+public class RuntimeInstanceImpl implements OdeRTInstance {
+ private static final Log __log = LogFactory.getLog(RuntimeInstanceImpl.class);
+
+ private static final Messages __msgs = MessageBundle.getMessages(Messages.class);
+
+ private OdeRTInstanceContext _brc;
+
+ /** JACOB VPU */
+ protected JacobVPU _vpu;
+
+ /** JACOB ExecutionQueue (state) */
+ protected ExecutionQueueImpl _soup;
+
+ private RuntimeImpl _runtime;
+
+ public RuntimeInstanceImpl(RuntimeImpl runtime, ExecutionQueueImpl soup) {
+ _runtime = runtime;
+ _vpu = new JacobVPU();
+ _vpu.registerExtension(OdeRTInstanceContext.class, this);
+ if (soup == null) {
+ _soup = new ExecutionQueueImpl(getClass().getClassLoader());
+ _soup.setGlobalData(new OutstandingRequestManager());
+ } else {
+ _soup = soup;
+ }
+
+ _soup.setReplacementMap(_runtime._replacementMap);
+ _vpu.setContext(_soup);
+ }
+
+ public ProcessModel getProcessModel() {
+ return _runtime._oprocess;
+ }
+
+ public boolean isCorrelationInitialized(CorrelationSetInstance correlationSet) {
+ return _brc.isCorrelationInitialized(correlationSet);
+ }
+
+ public boolean isVariableInitialized(VariableInstance var) {
+ return _brc.isVariableInitialized(var);
+ }
+
+ public boolean isPartnerRoleEndpointInitialized(PartnerLinkInstance pLink) {
+ return _brc.isPartnerRoleEndpointInitialized(pLink);
+ }
+
+ public void completedFault(FaultData faultData) {
+ cleanupOutstandingMyRoleExchanges(faultData);
+ _brc.completedFault(faultData);
+ }
+
+ public void completedOk() {
+ cleanupOutstandingMyRoleExchanges(null);
+ _brc.completedOk();
+ }
+
+ public Long createScopeInstance(Long parentScopeId, String name, int modelId) {
+ return _brc.createScopeInstance(parentScopeId, name, modelId);
+ }
+
+ public void initializePartnerLinks(Long parentScopeId, Collection<OPartnerLink> partnerLinks) {
+ _brc.initializePartnerLinks(parentScopeId, partnerLinks);
+
+ }
+
+ public void select(PickResponseChannel pickResponseChannel, Date timeout, boolean createInstance, Selector[] selectors)
+ throws FaultException {
+
+ final String pickResponseChannelStr = pickResponseChannel.export();
+
+ int conflict = getORM().findConflict(selectors);
+ if (conflict != -1)
+ throw new FaultException(_runtime._oprocess.constants.qnConflictingReceive, selectors[conflict].toString());
+
+ getORM().register(pickResponseChannelStr, selectors);
+
+ _brc.select(pickResponseChannelStr, timeout, selectors);
+ }
+
+ public CorrelationKey readCorrelation(CorrelationSetInstance cset) {
+ return _brc.readCorrelation(cset);
+ }
+
+ public Node fetchVariableData(VariableInstance variable, boolean forWriting) throws FaultException {
+
+ if (variable.declaration.extVar != null) {
+ // Note, that when using external variables, the database will not contain the value of the
+ // variable, instead we need to go the external variable subsystems.
+ Element reference = (Element) _brc.fetchVariableData(variable, false);
+ try {
+ Node ret = _brc.readExtVar(variable, reference);
+ if (ret == null) {
+ throw new FaultException(_runtime._oprocess.constants.qnUninitializedVariable,
+ "The external variable \"" + variable.declaration.name + "\" has not been initialized.");
+ }
+ return ret;
+ } catch (IncompleteKeyException ike) {
+ // This indicates that the external variable needed to be written do, put has not been.
+ __log.error("External variable could not be read due to incomplete key; the following key " +
+ "components were missing: " + ike.getMissing());
+ throw new FaultException(_runtime._oprocess.constants.qnUninitializedVariable,
+ "The extenral variable \"" + variable.declaration.name + "\" has not been properly initialized;" +
+ "the following key compoenents were missing:" + ike.getMissing());
+ } catch (ExternalVariableModuleException e) {
+ throw new BpelEngineException(e);
+ }
+ } else /* not external */ {
+ Node data = _brc.fetchVariableData(variable, forWriting);
+ if (data == null) {
+ // Special case of messageType variables with no part
+ if (variable.declaration.type instanceof OMessageVarType) {
+ OMessageVarType msgType = (OMessageVarType) variable.declaration.type;
+ if (msgType.parts.size() == 0) {
+ Document doc = DOMUtils.newDocument();
+ Element root = doc.createElement("message");
+ doc.appendChild(root);
+ return root;
+ }
+ }
+ throw new FaultException(_runtime._oprocess.constants.qnUninitializedVariable,
+ "The variable " + variable.declaration.name + " isn't properly initialized.");
+ }
+ return data;
+ }
+ }
+
+ public Node fetchVariableData(VariableInstance var, OMessageVarType.Part part, boolean forWriting) throws FaultException {
+ Node val = _brc.fetchVariableData(var, forWriting);
+ if (part != null) return getPartData((Element) val, part);
+ return val;
+ }
+
+ public void writeCorrelation(CorrelationSetInstance cset, CorrelationKey ckeyVal) {
+ OScope.CorrelationSet csetdef = cset.declaration;
+ QName[] propNames = new QName[csetdef.properties.size()];
+ for (int m = 0; m < csetdef.properties.size(); m++) {
+ OProcess.OProperty oProperty = csetdef.properties.get(m);
+ propNames[m] = oProperty.name;
+ }
+
+ _brc.writeCorrelation(cset, propNames, ckeyVal);
+
+ }
+
+ /**
+ * Proxy to {@link OdeRTInstanceContext#sendEvent(org.apache.ode.bpel.evt.ProcessInstanceEvent)}.
+ *
+ * @param event
+ */
+ public void sendEvent(ScopeEvent event) {
+ _brc.sendEvent(event);
+ }
+
+ public void unregisterActivityForRecovery(ActivityRecoveryChannel recoveryChannel) {
+ _brc.unregisterActivityForRecovery(recoveryChannel.export());
+ }
+
+ /**
+ * Proxy to {@link RecoveryContext#registerActivityForRecovery(String, long, String, Date, Element, String[], int)}.
+ */
+ public void registerActivityForRecovery(ActivityRecoveryChannel recoveryChannel, long id, String reason, Date dateTime,
+ Element details, String[] actions, int retryCount) {
+ _brc.registerActivityForRecovery(recoveryChannel.export(), id, reason, dateTime, details, actions, retryCount);
+ }
+
+ /**
+ * Proxy to {@link IOContext#registerTimer(String, Date)} .
+ */
+ public void registerTimer(TimerResponseChannel timerChannel, Date future) {
+ _brc.registerTimer(timerChannel.export(), future);
+ }
+
+ /**
+ * Proxy to {@link VariableContext#readVariableProperty(Variable, QName)}.
+ */
+ public String readProperty(VariableInstance variable, OProcess.OProperty property) throws FaultException {
+
+ try {
+ return _brc.readVariableProperty(variable, property.name);
+ } catch (UninitializedVariableException e) {
+ throw new FaultException(_runtime._oprocess.constants.qnUninitializedVariable);
+ }
+ }
+
+ /**
+ * Proxy to {@link OdeRTInstanceContext#genId() }.
+ */
+ public long genId() {
+ return _brc.genId();
+ }
+
+ /**
+ * Proxy to {@link OdeRTInstanceContext#initializeVariable(Variable, Node)} then write properties.
+ */
+ public Node initializeVariable(VariableInstance var, Node val) throws ExternalVariableModuleException {
+ try {
+ return _brc.initializeVariable(var, val);
+ } finally {
+ writeProperties(var, val);
+ }
+ }
+
+ /**
+ * Proxy to {@link VariableContext#fetchMyRoleEndpointReferenceData(PartnerLink)}.
+ */
+ public Node fetchMyRoleEndpointReferenceData(PartnerLinkInstance link) {
+ return _brc.fetchMyRoleEndpointReferenceData(link);
+ }
+
+ public Node fetchPartnerRoleEndpointReferenceData(PartnerLinkInstance link) throws FaultException {
+ Element epr = _brc.fetchPartnerRoleEndpointReferenceData(link);
+ if (epr == null) {
+ throw new FaultException(_runtime._oprocess.constants.qnUninitializedPartnerRole);
+ }
+
+ return epr;
+
+ }
+
+ /**
+ * Proxy to {@link OdeRTInstanceContext#convertEndpointReference(Element, Node) }.
+ */
+ public Node convertEndpointReference(Element epr, Node lvaluePtr) {
+ return _brc.convertEndpointReference(epr, lvaluePtr);
+ }
+
+ /**
+ * Proxy to {@link OdeRTInstanceContext#commitChanges(Variable, Node) }, then write variable properties.
+ */
+ public void commitChanges(VariableInstance lval, Node lvalue) {
+ _brc.commitChanges(lval, lvalue);
+ writeProperties(lval, lvalue);
+ }
+
+ /**
+ * Proxy to {@link BpelRuntimeContext# }.
+ */
+ public void writeEndpointReference(PartnerLinkInstance plval, Element element) {
+ _brc.writeEndpointReference(plval, element);
+ }
+
+ /**
+ * Proxy to {@link OdeRTInstanceContext#createScopeInstance(Long, String, int)}.
+ */
+ public Long createScopeInstance(Long scopeInstanceId, OScope scopedef) {
+ return _brc.createScopeInstance(scopeInstanceId, scopedef.name, scopedef.getId());
+ }
+
+ /**
+ * Proxy to {@link BpelRuntimeContext# }.
+ */
+ public String fetchMySessionId(PartnerLinkInstance linkInstance) {
+ return _brc.fetchMySessionId(linkInstance);
+ }
+
+ /**
+ * Proxy to {@link BpelRuntimeContext# }.
+ */
+ public void cancel(PickResponseChannel responseChannel) {
+ final String id = responseChannel.export();
+ _brc.cancelSelect(id);
+
+ getORM().cancel(id);
+
+ _vpu.inject(new JacobRunnable() {
+ private static final long serialVersionUID = 6157913683737696396L;
+
+ public void run() {
+ TimerResponseChannel responseChannel = importChannel(id, TimerResponseChannel.class);
+ responseChannel.onCancel();
+ }
+ });
+ }
+
+ /**
+ * Proxy to {@link BpelRuntimeContext# }.
+ */
+ public Element getMyRequest(String mexId) {
+ return _brc.getMyRequest(mexId);
+ }
+
+ /**
+ * Proxy to {@link BpelRuntimeContext# }.
+ */
+ public void initializePartnersSessionId(PartnerLinkInstance instance, String partnersSessionId) {
+ _brc.initializePartnersSessionId(instance, partnersSessionId);
+ }
+
+ /**
+ * Proxy to {@link IOContext#getSourceSessionId(String) }.
+ */
+ public String getSourceSessionId(String mexId) {
+ return _brc.getSourceSessionId(mexId);
+ }
+
+ public Node getSourceEPR(String mexId) {
+ return _brc.getSourceEPR(mexId);
+ }
+
+ public void executeExtension(QName extensionId, ExtensionContext context, Element element,
+ ExtensionResponseChannel extResponseChannel) throws FaultException {
+ __log.debug("Execute extension activity");
+ final String channelId = extResponseChannel.export();
+ ExtensionOperation ea = createExtensionActivityImplementation(extensionId);
+ if (ea == null) {
+ if (_runtime._mustUnderstandExtensions.contains(extensionId.getNamespaceURI())) {
+ __log.warn("Lookup of extension activity " + extensionId + " failed.");
+ throw new FaultException(new QName("urn:bpel20", "extlookup-failed"), "Lookup of extension activity " + extensionId
+ + " failed.");
+ } else {
+ // act like <empty> - do nothing
+ completeExtensionExecution(channelId, null);
+ return;
+ }
+ }
+
+ try {
+ ea.run(context, element);
+ completeExtensionExecution(channelId, null);
+ } catch (RuntimeException e) {
+ __log.error("Error during execution of extension activity.", e);
+ completeExtensionExecution(channelId, 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, ExtensionResponseChannel.class).onFailure(t);
+ }
+ });
+ } else {
+ _vpu.inject(new BpelJacobRunnable() {
+ private static final long serialVersionUID = -1L;
+
+ public void run() {
+ importChannel(channelId, ExtensionResponseChannel.class).onCompleted();
+ }
+ });
+ }
+ }
+
+ private ExtensionOperation createExtensionActivityImplementation(QName name) {
+ if (name == null) {
+ return null;
+ }
+ AbstractExtensionBundle bundle = _runtime._extensionRegistry.get(name.getNamespaceURI());
+ if (bundle == null) {
+ return null;
+ } else {
+ try {
+ return (ExtensionOperation) bundle.getExtensionOperationInstance(name.getLocalPart());
+ } catch (Exception e) {
+ return null;
+ }
+ }
+ }
+
+ /**
+ * Proxy to {@link ProcessControlContext# }.
+ */
+ public Long getPid() {
+ return _brc.getPid();
+ }
+
+ /**
+ * Proxy to {@link IOContext#getPartnerResponse(String)}.
+ */
+ public Element getPartnerResponse(String mexId) {
+ return _brc.getPartnerResponse(mexId);
+ }
+
+ /**
+ * Proxy to {@link IOContext#releasePartnerMex(String) }.
+ */
+ public void releasePartnerMex(String mexId) {
+ _brc.releasePartnerMex(mexId);
+ }
+
+ /**
+ * Proxy to {@link IOContext#getPartnerFault(String) }.
+ */
+ public QName getPartnerFault(String mexId) {
+ return _brc.getPartnerFault(mexId);
+ }
+
+ /**
+ * Proxy to {@link IOContext#getPartnerResponseType(String) }.
+ */
+ public QName getPartnerResponseType(String mexId) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /**
+ * Proxy to {@link IOContext#getPartnerFaultExplanation(String) }.
+ */
+ public String getPartnerFaultExplanation(String mexId) {
+ return _brc.getPartnerFaultExplanation(mexId);
+ }
+
+ /**
+ * Proxy to {@link OdeRTInstanceContext#sendEvent(org.apache.ode.bpel.evt.ProcessInstanceEvent) }.
+ */
+ public void sendEvent(ProcessInstanceStartedEvent evt) {
+ _brc.sendEvent(evt);
+ }
+
+ /**
+ * Proxy to {@link IOContext#reply(PartnerLink, String, String, Element, QName) }.
+ */
+ public void reply(PartnerLinkInstance plink, String opName, String bpelmex, Element element, QName fault) throws FaultException {
+ String mexid = getORM().release(plink, opName, bpelmex);
+ if (mexid == null)
+ throw new FaultException(_runtime._oprocess.constants.qnMissingRequest);
+
+ try {
+ _brc.reply(mexid, plink, opName, element, fault);
+ } catch (NoSuchOperationException e) {
+ // reply to operation that is either not defined or one-way. Perhaps this should be detected at compile time?
+ throw new FaultException(_runtime._oprocess.constants.qnMissingRequest,
+ "Undefined two-way operation \"" + opName + "\".");
+ }
+ }
+
+ /**
+ * Proxy to {@link ProcessControlContext#forceFlush() }.
+ */
+ public void forceFlush() {
+ _brc.forceFlush();
+ }
+
+ /**
+ * Proxy to {@link ProcessControlContext#terminate()}.
+ */
+ public void terminate() {
+ cleanupOutstandingMyRoleExchanges(null);
+ _brc.terminate();
+ }
+
+ /**
+ * Record all values of properties of a 'MessageType' variable for efficient lookup.
+ */
+ private void writeProperties(VariableInstance variable, Node value) {
+ if (variable.declaration.type instanceof OMessageVarType) {
+ for (OProcess.OProperty property : variable.declaration.getOwner().properties) {
+ OProcess.OPropertyAlias alias = property.getAlias(variable.declaration.type);
+ if (alias != null) {
+ try {
+ String val = extractProperty((Element) value, alias, variable.declaration.getDescription());
+ if (val != null)
+ _brc.writeVariableProperty(variable, property.name, val);
+ } catch (UninitializedVariableException uve) {
+ // This really should not happen, since we are writing to a variable that we just modified.
+ __log.fatal("Couldn't extract property '" + property.toString() + "' in property pre-extraction: " + uve);
+ throw new RuntimeException(uve);
+ } catch (FaultException e) {
+ // This will fail as we're basically trying to extract properties on all received messages
+ // for optimization purposes.
+ if (__log.isDebugEnabled())
+ __log.debug("Couldn't extract property '" + property.toString() + "' in property pre-extraction: "
+ + e.toString());
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Extract the value of a BPEL property from a BPEL messsage variable.
+ *
+ * @param msgData
+ * message variable data
+ * @param alias
+ * alias to apply
+ * @param target
+ * description of the data (for error logging only)
+ * @return value of the property
+ * @throws FaultException
+ */
+ String extractProperty(Element msgData, OProcess.OPropertyAlias alias, String target) throws FaultException {
+ PropertyAliasEvaluationContext ectx = new PropertyAliasEvaluationContext(msgData, alias);
+ Node lValue = ectx.getRootNode();
+
+ if (alias.location != null)
+ lValue = _runtime._expLangRuntimeRegistry.evaluateNode(alias.location, ectx);
+
+ if (lValue == null) {
+ String errmsg = __msgs.msgPropertyAliasReturnedNullSet(alias.getDescription(), target);
+ if (__log.isErrorEnabled()) {
+ __log.error(errmsg);
+ }
+ throw new FaultException(_runtime._oprocess.constants.qnSelectionFailure, errmsg);
+ }
+
+ if (lValue.getNodeType() == Node.ELEMENT_NODE) {
+ // This is a bit hokey, we concatenate all the children's values; we really should be checking
+ // to make sure that we are only dealing with text and attribute nodes.
+ StringBuffer val = new StringBuffer();
+ NodeList nl = lValue.getChildNodes();
+ for (int i = 0; i < nl.getLength(); ++i) {
+ Node n = nl.item(i);
+ val.append(n.getNodeValue());
+ }
+ return val.toString();
+ } else if (lValue.getNodeType() == Node.TEXT_NODE) {
+ return ((Text) lValue).getWholeText();
+ } else
+ return null;
+ }
+
+ public Node getPartData(Element message, OMessageVarType.Part part) {
+ // borrowed from ASSIGN.evalQuery()
+ Node ret = DOMUtils.findChildByName(message, new QName(null, part.name));
+ if (part.type instanceof OElementVarType) {
+ QName elName = ((OElementVarType) part.type).elementType;
+ ret = DOMUtils.findChildByName((Element) ret, elName);
+ } else if (part.type == null) {
+ // Special case of header parts never referenced in the WSDL def
+ if (ret != null && ret.getNodeType() == Node.ELEMENT_NODE
+ && ((Element)ret).getAttribute("headerPart") != null
+ && DOMUtils.getTextContent(ret) == null)
+ ret = DOMUtils.getFirstChildElement((Element) ret);
+ // The needed part isn't there, dynamically creating it
+ if (ret == null) {
+ ret = message.getOwnerDocument().createElementNS(null, part.name);
+ ((Element)ret).setAttribute("headerPart", "true");
+ message.appendChild(ret);
+ }
+ }
+
+ return ret;
+ }
+
+ /**
+ * @param instance
+ * @param operation
+ * @param outboundMsg
+ * @param object
+ */
+ public String invoke(String invokeId, PartnerLinkInstance instance, Operation operation, Element outboundMsg, Object object)
+ throws FaultException {
+ try {
+ return _brc.invoke(invokeId, instance, operation, outboundMsg);
+ } catch (UninitializedPartnerEPR e) {
+ throw new FaultException(_runtime._oprocess.constants.qnUninitializedPartnerRole);
+ }
+ }
+
+ /**
+ * @return
+ */
+ public ExpressionLanguageRuntimeRegistry getExpLangRuntime() {
+ return _runtime._expLangRuntimeRegistry;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.ode.bpel.engine.rapi.OdeRTInstance#onMyRoleMessageExchange(java.lang.String, java.lang.String)
+ */
+ public void onSelectEvent(final String selectId, final String messageExchangeId, final int selectorIdx) {
+ getORM().associate(selectId, messageExchangeId);
+
+ _vpu.inject(new JacobRunnable() {
+ private static final long serialVersionUID = 3168964409165899533L;
+
+ public void run() {
+ // NOTE: we chose the selectId to be the exported representation of the pick response channel!
+ PickResponseChannel responseChannel = importChannel(selectId, PickResponseChannel.class);
+ responseChannel.onRequestRcvd(selectorIdx, messageExchangeId);
+ }
+ });
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.ode.bpel.engine.rapi.OdeRTInstance#onTimerEvent(java.lang.String)
+ */
+ public void onTimerEvent(final String timerId) {
+ getORM().cancel(timerId);
+
+ _vpu.inject(new JacobRunnable() {
+ private static final long serialVersionUID = -7767141033611036745L;
+
+ public void run() {
+ // NOTE: note short cut, we chose timer id to be the same as the exported channel representation.
+ TimerResponseChannel responseChannel = importChannel(timerId, TimerResponseChannel.class);
+ responseChannel.onTimeout();
+ }
+ });
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.ode.bpel.engine.rapi.OdeRTInstance#execute()
+ */
+ public boolean execute() {
+ return _vpu.execute();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.ode.bpel.engine.rapi.OdeRTInstance#onInvokeResponse(java.lang.String, java.lang.String)
+ */
+ public void onInvokeResponse(final String invokeId, InvokeResponseType irt, final String mexid) {
+ // NOTE: do the switch outside the inject, since we don't want to end up serializing InvokeResponseType objects!
+ switch (irt) {
+ case REPLY:
+ _vpu.inject(new BpelJacobRunnable() {
+ private static final long serialVersionUID = -1095444335740879981L;
+
+ public void run() {
+ importChannel(invokeId, InvokeResponseChannel.class).onResponse();
+ }
+ });
+ case FAULT:
+ _vpu.inject(new BpelJacobRunnable() {
+ private static final long serialVersionUID = -1095444335740879981L;
+
+ public void run() {
+ importChannel(invokeId, InvokeResponseChannel.class).onFault();
+ }
+ });
+ case FAILURE:
+ _vpu.inject(new BpelJacobRunnable() {
+ private static final long serialVersionUID = -1095444335740879981L;
+
+ public void run() {
+ importChannel(invokeId, InvokeResponseChannel.class).onFailure();
+ }
+ });
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.ode.bpel.engine.rapi.OdeRTInstance#recoverActivity(java.lang.String, long, java.lang.String)
+ */
+ public void recoverActivity(final String channel, final long activityId, final String action, FaultInfo fault) {
+ // TODO: better translation here?
+ final FaultData fdata = (fault != null) ? new FaultData(fault.getFaultName(), null, fault.getExplanation()) : null;
+
+ _vpu.inject(new JacobRunnable() {
+ private static final long serialVersionUID = 3168964409165899533L;
+
+ public void run() {
+ ActivityRecoveryChannel recovery = importChannel(channel, ActivityRecoveryChannel.class);
+ __log.info("ActivityRecovery: Recovering activity " + activityId + " with action " + action + " on channel "
+ + recovery);
+ if (recovery != null) {
+ if ("cancel".equals(action))
+ recovery.cancel();
+ else if ("retry".equals(action))
+ recovery.retry();
+ else if ("fault".equals(action))
+ recovery.fault(fdata);
+ }
+ }
+ });
+ }
+
+ private OutstandingRequestManager getORM() {
+ return (OutstandingRequestManager) _soup.getGlobalData();
+ }
+
+ /**
+ * Called when the process completes to clean up any outstanding message exchanges.
+ *
+ */
+ private void cleanupOutstandingMyRoleExchanges(FaultInfo optionalFaultData) {
+ // TODO: all this should be moved into the engine. We don't really need the ORM to find these mexs, we can just scan
+ // the database -mszefler 20feb08
+ String[] mexRefs = getORM().releaseAll();
+ for (String mexId : mexRefs) {
+ _brc.noreply(mexId, optionalFaultData);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.ode.bpel.engine.rapi.OdeRTInstance#saveState()
+ */
+ public Object saveState(OutputStream bos) throws IOException {
+ _soup.write(bos);
+ return _soup;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.ode.bpel.engine.rapi.OdeRTInstance#createInstance(java.lang.String)
+ */
+ public void onCreateInstance(String messageExchangeId) {
+ _vpu.inject(new PROCESS(_runtime._oprocess));
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.ode.bpel.engine.rapi.OdeRTInstance#setContext(org.apache.ode.bpel.engine.rapi.OdeRTInstanceContext)
+ */
+ public void setContext(OdeRTInstanceContext ctx) {
+ _brc = ctx;
+ }
+
+}
Modified: ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/SCOPE.java
URL: http://svn.apache.org/viewvc/ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/SCOPE.java?rev=681565&r1=681564&r2=681565&view=diff
==============================================================================
--- ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/SCOPE.java (original)
+++ ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/SCOPE.java Thu Jul 31 17:29:41 2008
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.ode.bpel.runtime;
+package org.apache.ode.bpel.rtrep.v2;
import java.io.Serializable;
import java.util.ArrayList;
@@ -33,23 +33,14 @@
import org.apache.ode.bpel.evt.ScopeFaultEvent;
import org.apache.ode.bpel.evt.ScopeStartEvent;
import org.apache.ode.bpel.evt.VariableModificationEvent;
-import org.apache.ode.bpel.o.OBase;
-import org.apache.ode.bpel.o.OCatch;
-import org.apache.ode.bpel.o.OElementVarType;
-import org.apache.ode.bpel.o.OEventHandler;
-import org.apache.ode.bpel.o.OFailureHandling;
-import org.apache.ode.bpel.o.OFaultHandler;
-import org.apache.ode.bpel.o.OLink;
-import org.apache.ode.bpel.o.OMessageVarType;
-import org.apache.ode.bpel.o.OScope;
-import org.apache.ode.bpel.o.OVarType;
-import org.apache.ode.bpel.runtime.channels.CompensationChannel;
-import org.apache.ode.bpel.runtime.channels.EventHandlerControlChannel;
-import org.apache.ode.bpel.runtime.channels.FaultData;
-import org.apache.ode.bpel.runtime.channels.ParentScopeChannel;
-import org.apache.ode.bpel.runtime.channels.ParentScopeChannelListener;
-import org.apache.ode.bpel.runtime.channels.TerminationChannel;
-import org.apache.ode.bpel.runtime.channels.TerminationChannelListener;
+import org.apache.ode.bpel.rtrep.v2.channels.CompensationChannel;
+import org.apache.ode.bpel.rtrep.v2.channels.EventHandlerControlChannel;
+import org.apache.ode.bpel.rtrep.v2.channels.FaultData;
+import org.apache.ode.bpel.rtrep.v2.channels.ParentScopeChannel;
+import org.apache.ode.bpel.rtrep.v2.channels.ParentScopeChannelListener;
+import org.apache.ode.bpel.rtrep.v2.channels.TerminationChannel;
+import org.apache.ode.bpel.rtrep.v2.channels.TerminationChannelListener;
+import org.apache.ode.bpel.rtrep.rapi.InvalidProcessException;
import org.apache.ode.jacob.ChannelListener;
import org.apache.ode.jacob.SynchChannel;
import org.w3c.dom.Element;
@@ -103,7 +94,7 @@
}
}
- getBpelRuntimeContext().initializePartnerLinks(_scopeFrame.scopeInstanceId,
+ getBpelRuntime().initializePartnerLinks(_scopeFrame.scopeInstanceId,
_oscope.partnerLinks.values());
sendEvent(new ScopeStartEvent());
@@ -112,8 +103,7 @@
private List<CompensationHandler> findCompensationData(OScope scope) {
List<CompensationHandler> out = new ArrayList<CompensationHandler>();
- for (Iterator<CompensationHandler> i = _scopeFrame.availableCompensations.iterator(); i.hasNext(); ) {
- CompensationHandler ch = i.next();
+ for (CompensationHandler ch : _scopeFrame.availableCompensations) {
if (null == scope || ch.compensated.oscope.equals(scope))
out.add(ch);
}
@@ -213,9 +203,7 @@
// Similarly, handle messages from the event handler, if one exists
// and if it has not completed.
- for (Iterator<EventHandlerInfo> i = _eventHandlers.iterator();i.hasNext();) {
- final EventHandlerInfo ehi = i.next();
-
+ for (final EventHandlerInfo ehi : _eventHandlers) {
mlSet.add(new ParentScopeChannelListener(ehi.psc) {
private static final long serialVersionUID = -4694721357537858221L;
@@ -246,8 +234,13 @@
instance(ACTIVE.this);
}
- public void cancelled() { completed(null, CompensationHandler.emptySet()); }
- public void failure(String reason, Element data) { completed(null, CompensationHandler.emptySet()); }
+ public void cancelled() {
+ completed(null, CompensationHandler.emptySet());
+ }
+
+ public void failure(String reason, Element data) {
+ completed(null, CompensationHandler.emptySet());
+ }
});
}
object(false, mlSet);
@@ -255,8 +248,7 @@
// Any compensation handlers that were available but not activated will be forgotten.
Set<CompensationHandler> unreachableCompensationHandlers = _scopeFrame.availableCompensations;
if (unreachableCompensationHandlers != null)
- for (Iterator<CompensationHandler> i = unreachableCompensationHandlers.iterator(); i.hasNext(); ) {
- CompensationHandler ch = i.next();
+ for (CompensationHandler ch : unreachableCompensationHandlers) {
ch.compChannel.forget();
}
_scopeFrame.availableCompensations = null;
@@ -301,7 +293,7 @@
linksNeedingDPE.removeAll(catchBlock.outgoingLinks);
// We have to create a scope for the catch block.
- BpelRuntimeContext ntive = getBpelRuntimeContext();
+ RuntimeInstanceImpl ntive = getBpelRuntime();
ActivityInfo faultHandlerActivity = new ActivityInfo(genMonotonic(), catchBlock,
newChannel(TerminationChannel.class,"FH"), newChannel(ParentScopeChannel.class,"FH"));
@@ -312,7 +304,7 @@
if (catchBlock.faultVariable != null) {
try {
VariableInstance vinst = faultHandlerScopeFrame.resolve(catchBlock.faultVariable);
- initializeVariable(vinst, _fault.getFaultMessage());
+ getBpelRuntime().initializeVariable(vinst, _fault.getFaultMessage());
// Generating event
VariableModificationEvent se = new VariableModificationEvent(vinst.declaration.name);
@@ -370,8 +362,7 @@
}
private void terminateEventHandlers() {
- for (Iterator<EventHandlerInfo> i = _eventHandlers.iterator();i.hasNext(); ) {
- EventHandlerInfo ehi = i.next();
+ for (EventHandlerInfo ehi : _eventHandlers) {
if (!ehi.terminateRequested && !ehi.stopRequested) {
replication(ehi.tc).terminate();
ehi.terminateRequested = true;
@@ -380,18 +371,15 @@
}
private void stopEventHandlers() {
- for (Iterator<EventHandlerInfo> i = _eventHandlers.iterator();i.hasNext();) {
- EventHandlerInfo ehi = i.next();
+ for (EventHandlerInfo ehi : _eventHandlers) {
if (!ehi.stopRequested && !ehi.terminateRequested) {
ehi.cc.stop();
ehi.stopRequested = true;
}
}
}
-
}
-
private static OCatch findCatch(OFaultHandler fh, QName faultName, OVarType faultType) {
OCatch bestMatch = null;
for (OCatch c : fh.catchBlocks) {
@@ -408,8 +396,7 @@
if (faultType == null)
continue;
else if (c.faultVariable.type instanceof OMessageVarType) {
- if (faultType instanceof OMessageVarType
- && ((OMessageVarType) faultType).equals(c.faultVariable.type)) {
+ if (faultType instanceof OMessageVarType && faultType.equals(c.faultVariable.type)) {
// Don't eliminate.
} else if (faultType instanceof OElementVarType
&& ((OMessageVarType) c.faultVariable.type).docLitType != null
Modified: ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/SCOPEACT.java
URL: http://svn.apache.org/viewvc/ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/SCOPEACT.java?rev=681565&r1=681564&r2=681565&view=diff
==============================================================================
--- ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/SCOPEACT.java (original)
+++ ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/SCOPEACT.java Thu Jul 31 17:29:41 2008
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.ode.bpel.runtime;
+package org.apache.ode.bpel.rtrep.v2;
import java.io.Serializable;
import java.util.Collections;
@@ -29,15 +29,12 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.ode.bpel.o.OLink;
-import org.apache.ode.bpel.o.OScope;
-import org.apache.ode.bpel.o.OScope.Variable;
-import org.apache.ode.bpel.runtime.channels.FaultData;
-import org.apache.ode.bpel.runtime.channels.LinkStatusChannel;
-import org.apache.ode.bpel.runtime.channels.LinkStatusChannelListener;
-import org.apache.ode.bpel.runtime.channels.ParentScopeChannel;
-import org.apache.ode.bpel.runtime.channels.ParentScopeChannelListener;
-import org.apache.ode.bpel.runtime.channels.ReadWriteLockChannel;
+import org.apache.ode.bpel.rtrep.v2.channels.FaultData;
+import org.apache.ode.bpel.rtrep.v2.channels.LinkStatusChannel;
+import org.apache.ode.bpel.rtrep.v2.channels.LinkStatusChannelListener;
+import org.apache.ode.bpel.rtrep.v2.channels.ParentScopeChannel;
+import org.apache.ode.bpel.rtrep.v2.channels.ParentScopeChannelListener;
+import org.apache.ode.bpel.rtrep.v2.channels.ReadWriteLockChannel;
import org.apache.ode.jacob.ChannelListener;
import org.apache.ode.jacob.SynchChannel;
import org.apache.ode.jacob.SynchChannelListener;
@@ -65,7 +62,7 @@
instance(new ISOLATEDGUARD(createLockList(), newChannel(SynchChannel.class)));
} else {
- ScopeFrame newFrame = new ScopeFrame((OScope) _self.o, getBpelRuntimeContext().createScopeInstance(
+ ScopeFrame newFrame = new ScopeFrame((OScope) _self.o, getBpelRuntime().createScopeInstance(
_scopeFrame.scopeInstanceId, (OScope) _self.o), _scopeFrame, null);
// Depending on whether we are ATOMIC or not, we'll need to create outgoing link status interceptors
@@ -95,10 +92,10 @@
LinkedList<IsolationLock> requiredLocks = new LinkedList<IsolationLock>();
OScope o = ((OScope) _self.o);
- Set<Variable> vrs = new HashSet<Variable>(o.variableRd);
+ Set<OScope.Variable> vrs = new HashSet<OScope.Variable>(o.variableRd);
vrs.addAll(o.variableWr);
- for (Variable v : vrs)
+ for (OScope.Variable v : vrs)
requiredLocks.add(new IsolationLock(v, o.variableWr.contains(v), _scopeFrame.globals._varLocks.get(v)));
// Very important, we must sort the locks to prevent deadlocks.
@@ -238,7 +235,7 @@
// acquired all locks.
__log.debug("ISOLATIONGUARD: got all required locks: " + _locksAcquired);
- ScopeFrame newFrame = new ScopeFrame((OScope) _self.o, getBpelRuntimeContext().createScopeInstance(
+ ScopeFrame newFrame = new ScopeFrame((OScope) _self.o, getBpelRuntime().createScopeInstance(
_scopeFrame.scopeInstanceId, (OScope) _self.o), _scopeFrame, null);
@@ -351,7 +348,7 @@
__log.debug("UNLOCKER: unlockAll: " + _locks);
if (((OScope)SCOPEACT.this._self.o).atomicScope)
- getBpelRuntimeContext().forceFlush();
+ getBpelRuntime().forceFlush();
for (IsolationLock il : _locks)
il.lockChannel.unlock(_synchChannel);
Modified: ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/SEQUENCE.java
URL: http://svn.apache.org/viewvc/ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/SEQUENCE.java?rev=681565&r1=681564&r2=681565&view=diff
==============================================================================
--- ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/SEQUENCE.java (original)
+++ ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/SEQUENCE.java Thu Jul 31 17:29:41 2008
@@ -16,16 +16,13 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.ode.bpel.runtime;
+package org.apache.ode.bpel.rtrep.v2;
-import org.apache.ode.bpel.o.OActivity;
-import org.apache.ode.bpel.o.OScope;
-import org.apache.ode.bpel.o.OSequence;
-import org.apache.ode.bpel.runtime.channels.FaultData;
-import org.apache.ode.bpel.runtime.channels.ParentScopeChannel;
-import org.apache.ode.bpel.runtime.channels.ParentScopeChannelListener;
-import org.apache.ode.bpel.runtime.channels.TerminationChannel;
-import org.apache.ode.bpel.runtime.channels.TerminationChannelListener;
+import org.apache.ode.bpel.rtrep.v2.channels.FaultData;
+import org.apache.ode.bpel.rtrep.v2.channels.ParentScopeChannel;
+import org.apache.ode.bpel.rtrep.v2.channels.ParentScopeChannelListener;
+import org.apache.ode.bpel.rtrep.v2.channels.TerminationChannel;
+import org.apache.ode.bpel.rtrep.v2.channels.TerminationChannelListener;
import org.apache.ode.jacob.SynchChannel;
import java.util.ArrayList;
Modified: ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/SWITCH.java
URL: http://svn.apache.org/viewvc/ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/SWITCH.java?rev=681565&r1=681564&r2=681565&view=diff
==============================================================================
--- ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/SWITCH.java (original)
+++ ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/SWITCH.java Thu Jul 31 17:29:41 2008
@@ -16,12 +16,10 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.ode.bpel.runtime;
+package org.apache.ode.bpel.rtrep.v2;
import org.apache.ode.bpel.common.FaultException;
-import org.apache.ode.bpel.explang.EvaluationContext;
-import org.apache.ode.bpel.o.OSwitch;
-import org.apache.ode.bpel.runtime.channels.FaultData;
+import org.apache.ode.bpel.rtrep.v2.channels.FaultData;
import java.util.Iterator;
@@ -46,31 +44,29 @@
FaultData faultData = null;
EvaluationContext evalCtx = getEvaluationContext();
- for (Iterator i = oswitch.getCases().iterator(); i.hasNext();) {
- OSwitch.OCase ocase = (OSwitch.OCase) i.next();
- try{
- if(getBpelRuntimeContext().getExpLangRuntime().evaluateAsBoolean(ocase.expression, evalCtx)){
- matchedOCase = ocase;
- break;
- }
- }catch(FaultException e){
- __log.error(e.getMessage(),e);
- faultData = createFault(e.getQName(), ocase);
- _self.parent.completed(faultData, CompensationHandler.emptySet());
-
- // Dead path all the child activiites:
- for (Iterator<OSwitch.OCase> j = oswitch.getCases().iterator(); j.hasNext(); )
- dpe(j.next().activity);
- return;
+ for (OSwitch.OCase oCase1 : oswitch.getCases()) {
+ OSwitch.OCase ocase = oCase1;
+ try {
+ if (getBpelRuntime().getExpLangRuntime().evaluateAsBoolean(ocase.expression, evalCtx)) {
+ matchedOCase = ocase;
+ break;
+ }
+ } catch (FaultException e) {
+ __log.error(e.getMessage(), e);
+ faultData = createFault(e.getQName(), ocase);
+ _self.parent.completed(faultData, CompensationHandler.emptySet());
+
+ // Dead path all the child activiites:
+ for (OSwitch.OCase oCase : oswitch.getCases()) dpe(oCase.activity);
+ return;
+ }
}
- }
- // Dead path cases not chosen
- for (Iterator<OSwitch.OCase> i = oswitch.getCases().iterator(); i.hasNext(); ) {
- OSwitch.OCase cs = i.next();
- if (cs != matchedOCase)
- dpe(cs.activity);
- }
+ // Dead path cases not chosen
+ for (OSwitch.OCase cs : oswitch.getCases()) {
+ if (cs != matchedOCase)
+ dpe(cs.activity);
+ }
// no conditions satisfied, we're done.
if (matchedOCase == null) {
Modified: ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/ScopeFrame.java
URL: http://svn.apache.org/viewvc/ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/ScopeFrame.java?rev=681565&r1=681564&r2=681565&view=diff
==============================================================================
--- ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/ScopeFrame.java (original)
+++ ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/ScopeFrame.java Thu Jul 31 17:29:41 2008
@@ -16,34 +16,17 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.ode.bpel.runtime;
+package org.apache.ode.bpel.rtrep.v2;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.ode.bpel.common.FaultException;
import org.apache.ode.bpel.evt.ScopeEvent;
-import org.apache.ode.bpel.iapi.BpelEngineException;
-import org.apache.ode.bpel.o.OElementVarType;
-import org.apache.ode.bpel.o.OMessageVarType;
-import org.apache.ode.bpel.o.OPartnerLink;
-import org.apache.ode.bpel.o.OScope;
-import org.apache.ode.bpel.o.OMessageVarType.Part;
-import org.apache.ode.bpel.runtime.BpelRuntimeContext.ValueReferencePair;
-import org.apache.ode.bpel.runtime.channels.FaultData;
-import org.apache.ode.utils.DOMUtils;
-import org.apache.ode.bpel.evar.ExternalVariableModuleException;
-import org.apache.ode.bpel.evar.IncompleteKeyException;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
+import org.apache.ode.bpel.rtrep.v2.channels.FaultData;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Set;
-import javax.xml.namespace.QName;
-
-
/**
* N-tuple representing a scope "frame" (as in stack frame).
*/
@@ -98,13 +81,8 @@
public ScopeFrame find(OScope scope) {
- if (oscope.name.equals(scope.name)) {
- return this;
- }
-
- return (parent != null)
- ? parent.find(scope)
- : null;
+ if (oscope.name.equals(scope.name)) return this;
+ return (parent != null) ? parent.find(scope) : null;
}
public VariableInstance resolve(OScope.Variable variable) {
@@ -162,145 +140,4 @@
if (event.getLineNo() == -1 && oscope.debugInfo != null)
event.setLineNo(oscope.debugInfo.startLine);
}
-
-
- //
- // Move all the external variable stuff in here so that it can be used by the expr-lang evaluation
- // context.
- //
-
- Node fetchVariableData(BpelRuntimeContext brc, VariableInstance variable, boolean forWriting)
- throws FaultException {
- if (variable.declaration.extVar != null) {
- // Note, that when using external variables, the database will not contain the value of the
- // variable, instead we need to go the external variable subsystems.
- Element reference = (Element) fetchVariableData(brc, resolve(variable.declaration.extVar.related), false);
- try {
- Node ret = brc.readExtVar(variable.declaration, reference );
- if (ret == null) {
- throw new FaultException(oscope.getOwner().constants.qnUninitializedVariable,
- "The external variable \"" + variable.declaration.name + "\" has not been initialized.");
- }
- return ret;
- } catch (IncompleteKeyException ike) {
- // This indicates that the external variable needed to be written do, put has not been.
- __log.error("External variable could not be read due to incomplete key; the following key " +
- "components were missing: " + ike.getMissing());
- throw new FaultException(oscope.getOwner().constants.qnUninitializedVariable,
- "The extenral variable \"" + variable.declaration.name + "\" has not been properly initialized;" +
- "the following key compoenents were missing:" + ike.getMissing());
- } catch (ExternalVariableModuleException e) {
- throw new BpelEngineException(e);
- }
- } else /* not external */ {
- Node data = brc.readVariable(variable.scopeInstance,variable.declaration.name, forWriting);
- if (data == null) {
- // Special case of messageType variables with no part
- if (variable.declaration.type instanceof OMessageVarType) {
- OMessageVarType msgType = (OMessageVarType) variable.declaration.type;
- if (msgType.parts.size() == 0) {
- Document doc = DOMUtils.newDocument();
- Element root = doc.createElement("message");
- doc.appendChild(root);
- return root;
- }
- }
- throw new FaultException(oscope.getOwner().constants.qnUninitializedVariable,
- "The variable " + variable.declaration.name + " isn't properly initialized.");
- }
- return data;
- }
- }
-
-
- Node fetchVariableData(BpelRuntimeContext brc, VariableInstance var, OMessageVarType.Part part, boolean forWriting)
- throws FaultException
- {
- Node container = fetchVariableData(brc, var, forWriting);
-
- // If we want a specific part, we will need to navigate through the
- // message/part structure
- if (var.declaration.type instanceof OMessageVarType && part != null) {
- container = getPartData((Element) container, part);
- }
- return container;
- }
-
-
- Node initializeVariable(BpelRuntimeContext context, VariableInstance var, Node value)
- throws ExternalVariableModuleException
- {
- if (var.declaration.extVar != null) /* external variable */ {
- if (__log.isDebugEnabled())
- __log.debug("Initialize external variable:"
- + " name="+var.declaration
- + " value="+DOMUtils.domToString(value));
- VariableInstance related = resolve(var.declaration.extVar.related);
- Node reference = null;
- try {
- reference = fetchVariableData(context, related, true);
- } catch (FaultException fe) {
- // In this context this is not necessarily a problem, since the assignment may re-init the related var
- }
-
- if (reference != null)
- value = context.readExtVar(var.declaration, reference);
-
- return value;
- } else /* normal variable */ {
- if (__log.isDebugEnabled())
- if (__log.isDebugEnabled())
- __log.debug("Initialize variable:"
- + " name="+var.declaration
- + " value="+DOMUtils.domToString(value));
- return context.writeVariable(var, value);
- }
- }
-
-
- Node commitChanges(BpelRuntimeContext context, VariableInstance var, Node value)
- throws ExternalVariableModuleException
- {
- return writeVariable(context, var, value);
- }
-
-
- Node writeVariable(BpelRuntimeContext context, VariableInstance var, Node value)
- throws ExternalVariableModuleException
- {
- if (var.declaration.extVar != null) /* external variable */ {
- __log.debug("Write external variable:"
- + " name="+var.declaration
- + " value="+DOMUtils.domToString(value));
- VariableInstance related = resolve(var.declaration.extVar.related);
- Node reference = null;
- try {
- reference = fetchVariableData(context, related, true);
- } catch (FaultException fe) {
- // In this context this is not necessarily a problem, since the assignment may re-init the related var
- }
-
- ValueReferencePair vrp = context.writeExtVar(var.declaration, reference, value);
- writeVariable(context, related, vrp.reference);
- return vrp.value;
- } else /* normal variable */ {
- __log.debug("Write variable:"
- + " name="+var.declaration
- + " value="+DOMUtils.domToString(value));
- return context.writeVariable(var, value);
- }
- }
-
-
- Node getPartData(Element message, Part part) {
- // borrowed from ASSIGN.evalQuery()
- QName partName = new QName(null, part.name);
- Node ret = DOMUtils.findChildByName((Element) message, partName);
- if (part.type instanceof OElementVarType) {
- QName elName = ((OElementVarType) part.type).elementType;
- ret = DOMUtils.findChildByName((Element) ret, elName);
- }
- return ret;
- }
-
}
Modified: ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/Selector.java
URL: http://svn.apache.org/viewvc/ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/Selector.java?rev=681565&r1=681564&r2=681565&view=diff
==============================================================================
--- ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/Selector.java (original)
+++ ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/Selector.java Thu Jul 31 17:29:41 2008
@@ -16,40 +16,61 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.ode.bpel.runtime;
+package org.apache.ode.bpel.rtrep.v2;
import org.apache.ode.bpel.common.CorrelationKey;
+import org.apache.ode.bpel.rtrep.rapi.PartnerLink;
import org.apache.ode.utils.ObjectPrinter;
import java.io.Serializable;
-public class Selector implements Serializable {
- private static final long serialVersionUID = 1L;
+public class Selector implements Serializable, org.apache.ode.bpel.rtrep.rapi.Selector {
+ private static final long serialVersionUID = 1L;
- public final PartnerLinkInstance plinkInstance;
- public final CorrelationKey correlationKey;
- public final String opName;
- public final String messageExchangeId;
- public final int idx;
- public final boolean oneWay;
-
- Selector(int idx, PartnerLinkInstance plinkInstance, String opName, boolean oneWay, String mexId, CorrelationKey ckey) {
- this.idx = idx;
- this.plinkInstance = plinkInstance;
- this.correlationKey = ckey;
- this.opName = opName;
- this.messageExchangeId = mexId;
- this.oneWay = oneWay;
- }
-
- public String toString() {
- return ObjectPrinter.toString(this, new Object[] {
- "plinkInstnace", plinkInstance,
- "ckey", correlationKey,
- "opName" ,opName,
- "oneWay", oneWay ? "yes" : "no",
- "mexId", messageExchangeId,
- "idx", Integer.valueOf(idx)
- });
- }
+ public final PartnerLinkInstance plinkInstance;
+ public final CorrelationKey correlationKey;
+ public final String opName;
+ public final String messageExchangeId;
+ public final int idx;
+ public final boolean oneWay;
+
+ Selector(int idx, PartnerLinkInstance plinkInstance, String opName, boolean oneWay, String mexId, CorrelationKey ckey) {
+ this.idx = idx;
+ this.plinkInstance = plinkInstance;
+ this.correlationKey = ckey;
+ this.opName = opName;
+ this.messageExchangeId = mexId;
+ this.oneWay = oneWay;
+ }
+
+ public String toString() {
+ return ObjectPrinter.toString(this, new Object[] {
+ "plinkInstnace", plinkInstance,
+ "ckey", correlationKey,
+ "opName" ,opName,
+ "oneWay", oneWay ? "yes" : "no",
+ "mexId", messageExchangeId,
+ "idx", Integer.valueOf(idx)
+ });
+ }
+
+ public CorrelationKey getCorrelationKey() {
+ return correlationKey;
+ }
+
+ public String getMesageExchangeId() {
+ return messageExchangeId;
+ }
+
+ public String getOperation() {
+ return opName;
+ }
+
+ public PartnerLink getPartnerLink() {
+ return plinkInstance;
+ }
+
+ public boolean isOneWay() {
+ return oneWay;
+ }
}
Modified: ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/Serializer.java
URL: http://svn.apache.org/viewvc/ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/Serializer.java?rev=681565&r1=681564&r2=681565&view=diff
==============================================================================
--- ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/Serializer.java (original)
+++ ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/Serializer.java Thu Jul 31 17:29:41 2008
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.ode.bpel.o;
+package org.apache.ode.bpel.rtrep.v2;
import javax.xml.namespace.QName;
import java.io.*;
Modified: ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/SystemException.java
URL: http://svn.apache.org/viewvc/ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/SystemException.java?rev=681565&r1=681564&r2=681565&view=diff
==============================================================================
--- ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/SystemException.java (original)
+++ ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/SystemException.java Thu Jul 31 17:29:41 2008
@@ -16,16 +16,16 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.ode.bpel.runtime;
+package org.apache.ode.bpel.rtrep.v2;
/**
* Run-time exception indicating an infrastructure problem.
*/
class SystemException extends RuntimeException {
- private static final long serialVersionUID = 3194250610255026706L;
+ private static final long serialVersionUID = 3194250610255026706L;
- SystemException(Throwable cause) {
- super(cause);
- }
+ SystemException(Throwable cause) {
+ super(cause);
+ }
}
Modified: ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/TERMINATE.java
URL: http://svn.apache.org/viewvc/ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/TERMINATE.java?rev=681565&r1=681564&r2=681565&view=diff
==============================================================================
--- ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/TERMINATE.java (original)
+++ ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/TERMINATE.java Thu Jul 31 17:29:41 2008
@@ -16,22 +16,22 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.ode.bpel.runtime;
+package org.apache.ode.bpel.rtrep.v2;
/**
* JacobRunnable that performs the work of the <code>empty</code> activity.
*/
class TERMINATE extends ACTIVITY {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 1L;
- public TERMINATE(ActivityInfo self, ScopeFrame scopeFrame, LinkFrame linkFrame) {
- super(self, scopeFrame, linkFrame);
- }
+ public TERMINATE(ActivityInfo self, ScopeFrame scopeFrame, LinkFrame linkFrame) {
+ super(self, scopeFrame, linkFrame);
+ }
- public final void run() {
- getBpelRuntimeContext().terminate();
- _self.parent.completed(null, CompensationHandler.emptySet());
- }
+ public final void run() {
+ getBpelRuntime().terminate();
+ _self.parent.completed(null, CompensationHandler.emptySet());
+ }
}
Modified: ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/THROW.java
URL: http://svn.apache.org/viewvc/ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/THROW.java?rev=681565&r1=681564&r2=681565&view=diff
==============================================================================
--- ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/THROW.java (original)
+++ ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/THROW.java Thu Jul 31 17:29:41 2008
@@ -16,11 +16,10 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.ode.bpel.runtime;
+package org.apache.ode.bpel.rtrep.v2;
import org.apache.ode.bpel.common.FaultException;
-import org.apache.ode.bpel.o.OThrow;
-import org.apache.ode.bpel.runtime.channels.FaultData;
+import org.apache.ode.bpel.rtrep.v2.channels.FaultData;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
Modified: ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/TimerWork.java
URL: http://svn.apache.org/viewvc/ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/TimerWork.java?rev=681565&r1=681564&r2=681565&view=diff
==============================================================================
--- ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/TimerWork.java (original)
+++ ode/branches/rtver/runtime-repo/src/main/java/org/apache/ode/bpel/rtrep/v2/TimerWork.java Thu Jul 31 17:29:41 2008
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.ode.bpel.runtime;
+package org.apache.ode.bpel.rtrep.v2;
import org.apache.ode.utils.ObjectPrinter;