Author: assaf
Date: Thu Nov 9 14:36:55 2006
New Revision: 473106
URL: http://svn.apache.org/viewvc?view=rev&rev=473106
Log:
Moved activity recovery and failure handling from INVOKE to ACTIVITYGUARD
Modified:
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ACTIVITY.java
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ACTIVITYGUARD.java
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/BpelJacobRunnable.java
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/COMPENSATIONHANDLER_.java
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/EH_ALARM.java
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/EH_EVENT.java
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/FLOW.java
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/FOREACH.java
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/INVOKE.java
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/PROCESS.java
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/SCOPE.java
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/SEQUENCE.java
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/WHILE.java
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/channels/ParentScope.java
incubator/ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/MockBpelServer.java
Modified:
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ACTIVITY.java
URL:
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ACTIVITY.java?view=diff&rev=473106&r1=473105&r2=473106
==============================================================================
---
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ACTIVITY.java
(original)
+++
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ACTIVITY.java
Thu Nov 9 14:36:55 2006
@@ -29,6 +29,8 @@
import org.apache.ode.bpel.o.OLink;
import org.apache.ode.jacob.IndexedObject;
+import org.w3c.dom.Element;
+
/**
* Base template for activities.
*/
@@ -98,6 +100,14 @@
protected EvaluationContext getEvaluationContext() {
return new ExprEvaluationContextImpl(_scopeFrame,
getBpelRuntimeContext());
+ }
+
+ protected void cancelledFromChild() {
+ _self.parent.cancelled();
+ }
+
+ protected void failureFromChild(String reason, Element data) {
+ _self.parent.failure(reason, data);
}
private int getLineNo() {
Modified:
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ACTIVITYGUARD.java
URL:
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ACTIVITYGUARD.java?view=diff&rev=473106&r1=473105&r2=473106
==============================================================================
---
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ACTIVITYGUARD.java
(original)
+++
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ACTIVITYGUARD.java
Thu Nov 9 14:36:55 2006
@@ -24,19 +24,29 @@
import org.apache.ode.bpel.evt.ActivityEnabledEvent;
import org.apache.ode.bpel.evt.ActivityExecEndEvent;
import org.apache.ode.bpel.evt.ActivityExecStartEvent;
+import org.apache.ode.bpel.evt.ActivityFailureEvent;
+import org.apache.ode.bpel.evt.ActivityRecoveryEvent;
import org.apache.ode.bpel.explang.EvaluationException;
import org.apache.ode.bpel.o.OActivity;
import org.apache.ode.bpel.o.OExpression;
import org.apache.ode.bpel.o.OLink;
import org.apache.ode.bpel.o.OScope;
+import org.apache.ode.bpel.o.OFailureHandling;
import org.apache.ode.bpel.runtime.channels.FaultData;
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.TerminationChannelListener;
+import org.apache.ode.bpel.runtime.channels.ActivityRecoveryChannel;
+import org.apache.ode.bpel.runtime.channels.ActivityRecoveryChannelListener;
+import org.apache.ode.bpel.runtime.channels.TimerResponseChannel;
+import org.apache.ode.bpel.runtime.channels.TimerResponseChannelListener;
import org.apache.ode.jacob.ChannelListener;
import org.apache.ode.jacob.SynchChannel;
+import org.w3c.dom.Element;
+import java.io.Serializable;
+import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@@ -57,6 +67,8 @@
/** Flag to prevent duplicate ActivityEnabledEvents */
private boolean _firstTime = true;
+ private ActivityFailure _failure;
+
public ACTIVITYGUARD(ActivityInfo self, ScopeFrame scopeFrame, LinkFrame
linkFrame) {
super(self, scopeFrame, linkFrame);
_oactivity = self.o;
@@ -162,6 +174,12 @@
return createActivity(activity,_scopeFrame, _linkFrame);
}
+ private void startGuardedActivity() {
+ ActivityInfo activity = new
ActivityInfo(genMonotonic(),_self.o,_self.self,
newChannel(ParentScopeChannel.class));
+ instance(createActivity(activity));
+ instance(new TCONDINTERCEPT(activity.parent));
+ }
+
/**
* Intercepts the
@@ -214,8 +232,105 @@
dpe(_oactivity.sourceLinks);
_self.parent.completed(null,
CompensationHandler.emptySet());
}
+
+
+ public void failure(String reason, Element data) {
+ if (_failure == null)
+ _failure = new ActivityFailure();
+ _failure.dateTime = new Date();
+ _failure.reason = reason;
+ _failure.data = data;
+
+ OFailureHandling failureHandling =
_oactivity.getFailureHandling();
+ if (failureHandling != null &&
failureHandling.faultOnFailure) {
+ // No attempt to retry or enter activity recovery state,
simply fault.
+ if (__log.isDebugEnabled())
+ __log.debug("ActivityRecovery: Activity " +
_self.aId + " faulting on failure");
+ FaultData faultData =
createFault(OFailureHandling.FAILURE_FAULT_NAME, _oactivity, reason);
+ completed(faultData, CompensationHandler.emptySet());
+ return;
+ }
+ // If maximum number of retries, enter activity recovery
state.
+ if (failureHandling == null || _failure.retryCount >=
failureHandling.retryFor) {
+ requireRecovery();
+ return;
+ }
+
+ if (__log.isDebugEnabled())
+ __log.debug("ActivityRecovery: Retrying activity " +
_self.aId);
+ Date future = new Date(new Date().getTime() +
+ (failureHandling == null ? 0L :
failureHandling.retryDelay * 1000));
+ final TimerResponseChannel timerChannel =
newChannel(TimerResponseChannel.class);
+ getBpelRuntimeContext().registerTimer(timerChannel,
future);
+ object(false, new
TimerResponseChannelListener(timerChannel) {
+ private static final long serialVersionUID =
-261911108068231376L;
+ public void onTimeout() {
+ ++_failure.retryCount;
+ startGuardedActivity();
+ }
+ public void onCancel() {
+ requireRecovery();
+ }
+ });
+ }
+
+ private void requireRecovery() {
+ if (__log.isDebugEnabled())
+ __log.debug("ActivityRecovery: Activity " + _self.aId
+ " requires recovery");
+ sendEvent(new ActivityFailureEvent(_failure.reason));
+ final ActivityRecoveryChannel recoveryChannel =
newChannel(ActivityRecoveryChannel.class);
+ getBpelRuntimeContext().registerActivityForRecovery(
+ recoveryChannel, _self.aId, _failure.reason,
_failure.dateTime, _failure.data,
+ new String[] { "retry", "cancel", "fault" },
_failure.retryCount);
+ object(false, new
ActivityRecoveryChannelListener(recoveryChannel) {
+ private static final long serialVersionUID =
8397883882810521685L;
+ public void retry() {
+ if (__log.isDebugEnabled())
+ __log.debug("ActivityRecovery: Retrying
activity " + _self.aId + " (user initiated)");
+ sendEvent(new ActivityRecoveryEvent("retry"));
+
getBpelRuntimeContext().unregisterActivityForRecovery(recoveryChannel);
+ ++_failure.retryCount;
+ startGuardedActivity();
+ }
+ public void cancel() {
+ if (__log.isDebugEnabled())
+ __log.debug("ActivityRecovery: Cancelling
activity " + _self.aId + " (user initiated)");
+ sendEvent(new ActivityRecoveryEvent("cancel"));
+
getBpelRuntimeContext().unregisterActivityForRecovery(recoveryChannel);
+ cancelled();
+ }
+ public void fault(FaultData faultData) {
+ if (__log.isDebugEnabled())
+ __log.debug("ActivityRecovery: Faulting
activity " + _self.aId + " (user initiated)");
+ sendEvent(new ActivityRecoveryEvent("fault"));
+
getBpelRuntimeContext().unregisterActivityForRecovery(recoveryChannel);
+ if (faultData == null)
+ faultData =
createFault(OFailureHandling.FAILURE_FAULT_NAME, _self.o, _failure.reason);
+ completed(faultData,
CompensationHandler.emptySet());
+ }
+ }.or(new TerminationChannelListener(_self.self) {
+ private static final long serialVersionUID =
2148587381204858397L;
+
+ public void terminate() {
+ if (__log.isDebugEnabled())
+ __log.debug("ActivityRecovery: Cancelling
activity " + _self.aId + " (terminated by scope)");
+
getBpelRuntimeContext().unregisterActivityForRecovery(recoveryChannel);
+ cancelled();
+ }
+ }));
+ }
});
}
}
+
+ static class ActivityFailure implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ Date dateTime;
+ String reason;
+ Element data;
+ int retryCount;
+ }
+
}
Modified:
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/BpelJacobRunnable.java
URL:
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/BpelJacobRunnable.java?view=diff&rev=473106&r1=473105&r2=473106
==============================================================================
---
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/BpelJacobRunnable.java
(original)
+++
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/BpelJacobRunnable.java
Thu Nov 9 14:36:55 2006
@@ -41,65 +41,66 @@
* @author Maciej Szefler
*/
public abstract class BpelJacobRunnable extends JacobRunnable {
- private static final Log __log = LogFactory.getLog(BpelJacobRunnable.class);
+ private static final Log __log =
LogFactory.getLog(BpelJacobRunnable.class);
+
+ protected BpelRuntimeContext getBpelRuntimeContext() {
+ BpelRuntimeContext nativeApi = (BpelRuntimeContext)
JacobVPU.activeJacobThread().getExtension(BpelRuntimeContext.class);
+ assert nativeApi != null;
+ return nativeApi;
+ }
+
+ protected Log log() {
+ return __log;
+ }
+
+ protected final FaultData createFault(QName fault, Element faultMsg,
OVarType faultType, OBase location){
+ return new FaultData(fault, faultMsg, faultType, location);
+ }
+
+ protected final FaultData createFault(QName fault, OBase location, String
faultExplanation) {
+ return new FaultData(fault, location,faultExplanation);
+ }
+
+ protected final FaultData createFault(QName fault, OBase location){
+ return createFault(fault, location, null);
+ }
+
+
+ protected JacobRunnable createChild(ActivityInfo childInfo, ScopeFrame
scopeFrame, LinkFrame linkFrame) {
+ return new ACTIVITYGUARD(childInfo, scopeFrame, linkFrame);
+ }
+
+ protected void initializeCorrelation(CorrelationSetInstance cset,
VariableInstance variable)
+ throws FaultException {
+ if (__log.isDebugEnabled()) {
+ __log.debug("Initializing correlation set " + cset.declaration.name);
+ }
+ // if correlation set is already initialized,
+ // then skip
+ if (getBpelRuntimeContext().isCorrelationInitialized(cset)) {
+ // if already set, we ignore
+ if (__log.isDebugEnabled()) {
+ __log.debug("OCorrelation set " + cset + " is already set:
ignoring");
+ }
+
+ return;
+ }
+
+ String[] propNames = new String[cset.declaration.properties.size()];
+ String[] propValues = new String[cset.declaration.properties.size()];
+
+ for (int i = 0; i < cset.declaration.properties.size(); ++i) {
+ OProcess.OProperty property = cset.declaration.properties.get(i);
+ propValues[i] = getBpelRuntimeContext().readProperty(variable,
property);
+ propNames[i] = property.name.toString();
+ }
+
+ CorrelationKey ckeyVal = new CorrelationKey(cset.declaration.getId(),
propValues);
+ getBpelRuntimeContext().writeCorrelation(cset,ckeyVal);
+ }
+
+ protected long genMonotonic() {
+ return getBpelRuntimeContext().genId();
+ }
- protected BpelRuntimeContext getBpelRuntimeContext() {
- BpelRuntimeContext nativeApi = (BpelRuntimeContext)
JacobVPU.activeJacobThread().getExtension(BpelRuntimeContext.class);
- assert nativeApi != null;
- return nativeApi;
- }
-
- protected Log log() {
- return __log;
- }
-
- protected final FaultData createFault(QName fault, Element faultMsg,
OVarType faultType, OBase location){
- return new FaultData(fault, faultMsg, faultType, location);
- }
-
- protected final FaultData createFault(QName fault, OBase location,
String faultExplanation) {
- return new FaultData(fault, location,faultExplanation);
- }
-
- protected final FaultData createFault(QName fault, OBase location){
- return createFault(fault, location, null);
- }
-
-
- protected JacobRunnable createChild(ActivityInfo childInfo, ScopeFrame
scopeFrame, LinkFrame linkFrame) {
- return new ACTIVITYGUARD(childInfo, scopeFrame, linkFrame);
- }
-
- protected void initializeCorrelation(CorrelationSetInstance cset,
VariableInstance variable)
- throws FaultException {
- if (__log.isDebugEnabled()) {
- __log.debug("Initializing correlation set " + cset.declaration.name);
- }
- // if correlation set is already initialized,
- // then skip
- if (getBpelRuntimeContext().isCorrelationInitialized(cset)) {
- // if already set, we ignore
- if (__log.isDebugEnabled()) {
- __log.debug("OCorrelation set " + cset + " is already set: ignoring");
- }
-
- return;
- }
-
- String[] propNames = new String[cset.declaration.properties.size()];
- String[] propValues = new String[cset.declaration.properties.size()];
-
- for (int i = 0; i < cset.declaration.properties.size(); ++i) {
- OProcess.OProperty property = cset.declaration.properties.get(i);
- propValues[i] = getBpelRuntimeContext().readProperty(variable, property);
- propNames[i] = property.name.toString();
- }
-
- CorrelationKey ckeyVal = new CorrelationKey(cset.declaration.getId(),
propValues);
- getBpelRuntimeContext().writeCorrelation(cset,ckeyVal);
- }
-
- protected long genMonotonic() {
- return getBpelRuntimeContext().genId();
- }
}
Modified:
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/COMPENSATIONHANDLER_.java
URL:
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/COMPENSATIONHANDLER_.java?view=diff&rev=473106&r1=473105&r2=473106
==============================================================================
---
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/COMPENSATIONHANDLER_.java
(original)
+++
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/COMPENSATIONHANDLER_.java
Thu Nov 9 14:36:55 2006
@@ -30,6 +30,7 @@
import java.util.Iterator;
import java.util.Set;
+import org.w3c.dom.Element;
/**
* A scope that has completed succesfully, and may possibly have a
compensation handler.
@@ -93,7 +94,11 @@
}
public void cancelled() {
- this.completed(null, CompensationHandler.emptySet());
+ getChannel().cancelled();
+ }
+
+ public void failure(String reason, Element data) {
+ getChannel().failure(reason, data);
}
});
}
Modified:
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/EH_ALARM.java
URL:
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/EH_ALARM.java?view=diff&rev=473106&r1=473105&r2=473106
==============================================================================
---
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/EH_ALARM.java
(original)
+++
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/EH_ALARM.java
Thu Nov 9 14:36:55 2006
@@ -39,6 +39,7 @@
import java.util.Calendar;
import java.util.HashSet;
import java.util.Set;
+import org.w3c.dom.Element;
/**
* Alarm event handler. This process template manages a single alarm event
handler.
@@ -224,7 +225,11 @@
}
public void cancelled() {
- this.completed(null, CompensationHandler.emptySet());
+ getChannel().cancelled();
+ }
+
+ public void failure(String reason, Element data) {
+ getChannel().failure(reason, data);
}
}.or(new EventHandlerControlChannelListener(_cc) {
private static final long serialVersionUID =
-3873619538789039424L;
Modified:
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/EH_EVENT.java
URL:
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/EH_EVENT.java?view=diff&rev=473106&r1=473105&r2=473106
==============================================================================
---
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/EH_EVENT.java
(original)
+++
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/EH_EVENT.java
Thu Nov 9 14:36:55 2006
@@ -32,6 +32,7 @@
import java.util.HashSet;
import java.util.Set;
+import org.w3c.dom.Element;
/**
* Message event handler.
@@ -198,7 +199,11 @@
}
public void cancelled() {
- this.completed(null,
CompensationHandler.emptySet());
+ getChannel().cancelled();
+ }
+
+ public void failure(String reason, Element data) {
+ getChannel().failure(reason, data);
}
});
}
Modified:
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/FLOW.java
URL:
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/FLOW.java?view=diff&rev=473106&r1=473105&r2=473106
==============================================================================
---
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/FLOW.java
(original)
+++
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/FLOW.java
Thu Nov 9 14:36:55 2006
@@ -36,6 +36,7 @@
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
+import org.w3c.dom.Element;
class FLOW extends ACTIVITY {
private static final long serialVersionUID = 1L;
@@ -113,7 +114,11 @@
}
public void cancelled() {
- this.completed(null,
CompensationHandler.emptySet());
+ cancelledFromChild();
+ }
+
+ public void failure(String reason, Element data) {
+ failureFromChild(reason, data);
}
});
}
Modified:
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/FOREACH.java
URL:
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/FOREACH.java?view=diff&rev=473106&r1=473105&r2=473106
==============================================================================
---
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/FOREACH.java
(original)
+++
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/FOREACH.java
Thu Nov 9 14:36:55 2006
@@ -42,6 +42,7 @@
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
+import org.w3c.dom.Element;
public class FOREACH extends ACTIVITY {
@@ -158,7 +159,11 @@
}
public void cancelled() {
- completed(null, CompensationHandler.emptySet());
+ cancelledFromChild();
+ }
+
+ public void failure(String reason, Element data) {
+ failureFromChild(reason, data);
}
});
}
Modified:
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/INVOKE.java
URL:
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/INVOKE.java?view=diff&rev=473106&r1=473105&r2=473106
==============================================================================
---
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/INVOKE.java
(original)
+++
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/INVOKE.java
Thu Nov 9 14:36:55 2006
@@ -160,7 +160,7 @@
// because there is no fault, instead we'll
re-incarnate the invoke
// and either retry or indicate failure condition.
// admin to resume the process.
-
INVOKE.this.retryOrFailure(getBpelRuntimeContext().getPartnerFaultExplanation(mexId),
null);
+
_self.parent.failure(getBpelRuntimeContext().getPartnerFaultExplanation(mexId),
null);
}
});
}
Modified:
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/PROCESS.java
URL:
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/PROCESS.java?view=diff&rev=473106&r1=473105&r2=473106
==============================================================================
---
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/PROCESS.java
(original)
+++
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/PROCESS.java
Thu Nov 9 14:36:55 2006
@@ -21,6 +21,7 @@
import org.apache.ode.bpel.evt.ProcessInstanceStartedEvent;
import org.apache.ode.bpel.o.OProcess;
import org.apache.ode.bpel.o.OScope;
+import org.apache.ode.bpel.o.OFailureHandling;
import org.apache.ode.bpel.runtime.channels.FaultData;
import org.apache.ode.bpel.runtime.channels.ParentScopeChannel;
import org.apache.ode.bpel.runtime.channels.ParentScopeChannelListener;
@@ -28,28 +29,29 @@
import org.apache.ode.jacob.SynchChannel;
import java.util.Set;
+import org.w3c.dom.Element;
public class PROCESS extends BpelJacobRunnable {
private static final long serialVersionUID = 1L;
- private OProcess _process;
+ private OProcess _oprocess;
public PROCESS(OProcess process) {
- _process = process;
+ _oprocess = process;
}
public void run() {
BpelRuntimeContext ntive = getBpelRuntimeContext();
- Long scopeInstanceId = ntive.createScopeInstance(null,
_process.procesScope);
+ Long scopeInstanceId = ntive.createScopeInstance(null,
_oprocess.procesScope);
ProcessInstanceStartedEvent evt = new ProcessInstanceStartedEvent();
evt.setRootScopeId(scopeInstanceId);
- evt.setScopeDeclarationId(_process.procesScope.getId());
+ evt.setScopeDeclarationId(_oprocess.procesScope.getId());
ntive.sendEvent(evt);
ActivityInfo child = new ActivityInfo(genMonotonic(),
- _process.procesScope,
+ _oprocess.procesScope,
newChannel(TerminationChannel.class),
newChannel(ParentScopeChannel.class));
- ScopeFrame processFrame = new ScopeFrame(_process.procesScope,
scopeInstanceId, null, null);
+ ScopeFrame processFrame = new ScopeFrame(_oprocess.procesScope,
scopeInstanceId, null, null);
instance(new SCOPE(child, processFrame, new LinkFrame(null)));
object(new ParentScopeChannelListener(child.parent) {
@@ -70,6 +72,11 @@
public void cancelled() {
this.completed(null, CompensationHandler.emptySet());
+ }
+
+ public void failure(String reason, Element data) {
+ FaultData faultData =
createFault(OFailureHandling.FAILURE_FAULT_NAME, _oprocess, reason);
+ this.completed(faultData, CompensationHandler.emptySet());
}
});
}
Modified:
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/SCOPE.java
URL:
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/SCOPE.java?view=diff&rev=473106&r1=473105&r2=473106
==============================================================================
---
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/SCOPE.java
(original)
+++
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/SCOPE.java
Thu Nov 9 14:36:55 2006
@@ -30,6 +30,7 @@
import javax.xml.namespace.QName;
import java.io.Serializable;
import java.util.*;
+import org.w3c.dom.Element;
/**
* An active scope.
@@ -154,7 +155,6 @@
instance(ACTIVE.this);
}
-
public void completed(FaultData flt,
Set<CompensationHandler> compenstations) {
// Set the fault to the activity's choice, if
and only if no previous fault
// has been detected (first fault wins).
@@ -172,7 +172,11 @@
}
public void cancelled() {
- this.completed(null,
CompensationHandler.emptySet());
+ cancelledFromChild();
+ }
+
+ public void failure(String reason, Element data) {
+ failureFromChild(reason, data);
}
});
}
@@ -213,7 +217,11 @@
}
public void cancelled() {
- this.completed(null,
CompensationHandler.emptySet());
+ cancelledFromChild();
+ }
+
+ public void failure(String reason, Element data) {
+ failureFromChild(reason, data);
}
});
}
@@ -311,7 +319,11 @@
}
public void cancelled() {
- this.completed(null,
CompensationHandler.emptySet());
+ cancelledFromChild();
+ }
+
+ public void failure(String reason, Element data) {
+ failureFromChild(reason, data);
}
});
}
Modified:
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/SEQUENCE.java
URL:
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/SEQUENCE.java?view=diff&rev=473106&r1=473105&r2=473106
==============================================================================
---
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/SEQUENCE.java
(original)
+++
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/SEQUENCE.java
Thu Nov 9 14:36:55 2006
@@ -34,6 +34,7 @@
import java.util.Iterator;
import java.util.List;
import java.util.Set;
+import org.w3c.dom.Element;
/**
* Implementation of the BPEL <sequence> activity.
@@ -104,12 +105,16 @@
ArrayList<OActivity> remaining = new
ArrayList<OActivity>(_remaining);
remaining.remove(0);
instance(new SEQUENCE(_self, _scopeFrame, _linkFrame,
remaining, comps));
- }
- }
+ }
+ }
+
+ public void cancelled() {
+ cancelledFromChild();
+ }
- public void cancelled() {
- this.completed(null, CompensationHandler.emptySet());
- }
+ public void failure(String reason, Element data) {
+ failureFromChild(reason, data);
+ }
}));
}
Modified:
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/WHILE.java
URL:
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/WHILE.java?view=diff&rev=473106&r1=473105&r2=473106
==============================================================================
---
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/WHILE.java
(original)
+++
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/WHILE.java
Thu Nov 9 14:36:55 2006
@@ -33,6 +33,7 @@
import java.util.HashSet;
import java.util.Set;
+import org.w3c.dom.Element;
/**
* BPEL <while> activity
@@ -137,7 +138,11 @@
}
public void cancelled() {
- this.completed(null, CompensationHandler.emptySet());
+ cancelledFromChild();
+ }
+
+ public void failure(String reason, Element data) {
+ failureFromChild(reason, data);
}
}));
}
Modified:
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/channels/ParentScope.java
URL:
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/channels/ParentScope.java?view=diff&rev=473106&r1=473105&r2=473106
==============================================================================
---
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/channels/ParentScope.java
(original)
+++
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/channels/ParentScope.java
Thu Nov 9 14:36:55 2006
@@ -22,6 +22,7 @@
import org.apache.ode.bpel.o.OScope;
import org.apache.ode.bpel.runtime.CompensationHandler;
+import org.w3c.dom.Element;
import java.util.Set;
/**
@@ -35,5 +36,7 @@
void completed(FaultData faultData, Set<CompensationHandler> compensations);
void cancelled();
+
+ void failure(String reason, Element data);
}
Modified:
incubator/ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/MockBpelServer.java
URL:
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/MockBpelServer.java?view=diff&rev=473106&r1=473105&r2=473106
==============================================================================
---
incubator/ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/MockBpelServer.java
(original)
+++
incubator/ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/MockBpelServer.java
Thu Nov 9 14:36:55 2006
@@ -134,7 +134,7 @@
public void waitForBlocking() {
try {
- long delay = 1000;
+ long delay = 3000;
while (true) {
// Be warned: ugly hack and not safe for slow CPUs.
long cutoff = System.currentTimeMillis() - delay;