Modified: 
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/PICK.java
URL: 
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/PICK.java?view=diff&rev=453057&r1=453056&r2=453057
==============================================================================
--- 
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/PICK.java
 (original)
+++ 
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/PICK.java
 Wed Oct  4 15:56:58 2006
@@ -42,203 +42,205 @@
  * Template for the BPEL <code>pick</code> activity.
  */
 class PICK extends ACTIVITY {
-  private static final long serialVersionUID = 1L;
+    private static final long serialVersionUID = 1L;
 
-  private static final Log __log = LogFactory.getLog(PICK.class);
+    private static final Log __log = LogFactory.getLog(PICK.class);
 
-  private OPickReceive _opick;
+    private OPickReceive _opick;
 
-  // if multiple alarms are set, this is the alarm the evaluates to
-  // the shortest absolute time until firing.
-  private OPickReceive.OnAlarm _alarm = null;
-
-  public PICK(ActivityInfo self, ScopeFrame scopeFrame, LinkFrame linkFrame) {
-    super(self, scopeFrame, linkFrame);
-    _opick= (OPickReceive) self.o;
-  }
-
-
-  /**
-   * @see org.apache.ode.jacob.JacobRunnable#run()
-   */
-  public void run() {
-    PickResponseChannel pickResponseChannel = 
newChannel(PickResponseChannel.class);
-    Date timeout;
-    Selector[] selectors;
-
-    try {
-      selectors = new Selector[_opick.onMessages.size()];
-      int idx = 0;
-      for (OPickReceive.OnMessage onMessage : _opick.onMessages) {
-        CorrelationKey key = null; //  this will be the case for the 
createInstance activity
-        
-        PartnerLinkInstance pLinkInstance = 
_scopeFrame.resolve(onMessage.partnerLink);
-        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);
-          key = new CorrelationKey(-1, new String[]{sessionId});
-        } else if (onMessage.matchCorrelation != null) {
-          if 
(!getBpelRuntimeContext().isCorrelationInitialized(_scopeFrame.resolve(onMessage.matchCorrelation)))
 {
-              // the following should really test if this is a "join" type 
correlation...
-              if (!_opick.createInstanceFlag)
-                  throw new 
FaultException(_opick.getOwner().constants.qnCorrelationViolation, "Correlation 
not initialized.");
-          } else {
-          
-              key = 
getBpelRuntimeContext().readCorrelation(_scopeFrame.resolve(onMessage.matchCorrelation));
-    
-              assert key != null;
-          }
-        }
+    // if multiple alarms are set, this is the alarm the evaluates to
+    // the shortest absolute time until firing.
+    private OPickReceive.OnAlarm _alarm = null;
 
-        selectors[idx] = new Selector(idx, pLinkInstance, 
onMessage.operation.getName(), onMessage.operation.getOutput() == null, 
onMessage.messageExchangeId, key);
-        idx++;
-      }
-
-      timeout = null;
-      for (OPickReceive.OnAlarm onAlarm : _opick.onAlarms) {
-        Date dt = onAlarm.forExpr != null
-                ? 
offsetFromNow(getBpelRuntimeContext().getExpLangRuntime().evaluateAsDuration(onAlarm.forExpr,
 getEvaluationContext()))
-                : 
getBpelRuntimeContext().getExpLangRuntime().evaluateAsDate(onAlarm.untilExpr, 
getEvaluationContext()).getTime();
-        if (timeout == null || timeout.compareTo(dt) > 0) {
-          timeout = dt;
-          _alarm = onAlarm;
-        }
-      }
-      getBpelRuntimeContext().select(pickResponseChannel, timeout, 
_opick.createInstanceFlag, selectors);
-    } catch(FaultException e){
-      FaultData fault = createFault(e.getQName(), _opick,e.getMessage());
-      dpe(_opick.outgoingLinks);
-      _self.parent.completed(fault, CompensationHandler.emptySet());
-      return;
-    } catch (EvaluationException e) {
-      String msg = "Unexpected evaluation error evaluating alarm.";
-      __log.error(msg, e);
-      throw new InvalidProcessException(msg, e);
+    public PICK(ActivityInfo self, ScopeFrame scopeFrame, LinkFrame linkFrame) 
{
+        super(self, scopeFrame, linkFrame);
+        _opick= (OPickReceive) self.o;
     }
 
-    // Dead path all the alarms that have no chace of coming first.
-    for (OPickReceive.OnAlarm oa : _opick.onAlarms) {
-      if (!oa.equals(_alarm)) {
-        dpe(oa.activity);
-      }
-    }
-
-    instance(new WAITING(pickResponseChannel));
-  }
-
-  /**
-   * Calculate a duration offset from right now.
-   * @param duration the offset
-   * @return the resulting date. 
-   */
-  private static Date offsetFromNow(Duration duration) {
-    Calendar cal = Calendar.getInstance();
-    duration.addTo(cal);
-    return cal.getTime();
-  }
-
-
-  private class WAITING extends BpelJacobRunnable {
-    private static final long serialVersionUID = 1L;
-
-    private PickResponseChannel _pickResponseChannel;
-
-    private WAITING(PickResponseChannel pickResponseChannel) {
-      this._pickResponseChannel = pickResponseChannel;
-    }
 
+    /**
+     * @see org.apache.ode.jacob.JacobRunnable#run()
+     */
     public void run() {
+        PickResponseChannel pickResponseChannel = 
newChannel(PickResponseChannel.class);
+        Date timeout;
+        Selector[] selectors;
+
+        try {
+            selectors = new Selector[_opick.onMessages.size()];
+            int idx = 0;
+            for (OPickReceive.OnMessage onMessage : _opick.onMessages) {
+                CorrelationKey key = null; //  this will be the case for the 
createInstance activity
+
+                PartnerLinkInstance pLinkInstance = 
_scopeFrame.resolve(onMessage.partnerLink);
+                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);
+                    key = new CorrelationKey(-1, new String[]{sessionId});
+                } else if (onMessage.matchCorrelation != null) {
+                    if 
(!getBpelRuntimeContext().isCorrelationInitialized(_scopeFrame.resolve(onMessage.matchCorrelation)))
 {
+                        // the following should really test if this is a 
"join" type correlation...
+                        if (!_opick.createInstanceFlag)
+                            throw new 
FaultException(_opick.getOwner().constants.qnCorrelationViolation, "Correlation 
not initialized.");
+                    } else {
+
+                        key = 
getBpelRuntimeContext().readCorrelation(_scopeFrame.resolve(onMessage.matchCorrelation));
+
+                        assert key != null;
+                    }
+                }
 
-      object(false, new PickResponseChannelListener(_pickResponseChannel) {
-        private static final long serialVersionUID = -8237296827418738011L;
-
-        public void onRequestRcvd(int selectorIdx, String mexId) {
-          OPickReceive.OnMessage onMessage = 
_opick.onMessages.get(selectorIdx);
-
-          // dead path the non-selected onMessage blocks.
-          for (OPickReceive.OnMessage onmsg : _opick.onMessages) {
-            if (!onmsg.equals(onMessage)) {
-              dpe(onmsg.activity);
+                selectors[idx] = new Selector(idx, pLinkInstance, 
onMessage.operation.getName(), onMessage.operation.getOutput() == null, 
onMessage.messageExchangeId, key);
+                idx++;
             }
-          }
 
-          // dead-path the alarm (if any)
-          if (_alarm != null) {
-            dpe(_alarm.activity);
-          }
-
-          FaultData fault;
-          Element msgEl = getBpelRuntimeContext().getMyRequest(mexId);
-          try {
-            
getBpelRuntimeContext().initializeVariable(_scopeFrame.resolve(onMessage.variable),msgEl);
-          } catch (Exception ex) {
-            __log.error(ex);
-            throw new RuntimeException(ex);
-          }
-          try {
-            for (OScope.CorrelationSet cset : onMessage.initCorrelations) {
-              initializeCorrelation(_scopeFrame.resolve(cset), 
_scopeFrame.resolve(onMessage.variable));
-            }
-            if (onMessage.partnerLink.hasPartnerRole()) {
-              // Trying to initialize partner epr based on a message-provided 
epr/session.
-                
-             if 
(!getBpelRuntimeContext().isPartnerRoleEndpointInitialized(_scopeFrame
-                     .resolve(onMessage.partnerLink))) {
-                
-              Node fromEpr = getBpelRuntimeContext().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(
-                        _scopeFrame.resolve(onMessage.partnerLink), (Element) 
fromEpr);
-              }
-             }
-             
-              String partnersSessionId = 
getBpelRuntimeContext().getSourceSessionId(mexId);
-              if (partnersSessionId != null)
-                  
getBpelRuntimeContext().initializePartnersSessionId(_scopeFrame.resolve(onMessage.partnerLink),
-                          partnersSessionId);
-              
+            timeout = null;
+            for (OPickReceive.OnAlarm onAlarm : _opick.onAlarms) {
+                Date dt = onAlarm.forExpr != null
+                        ? 
offsetFromNow(getBpelRuntimeContext().getExpLangRuntime().evaluateAsDuration(onAlarm.forExpr,
 getEvaluationContext()))
+                        : 
getBpelRuntimeContext().getExpLangRuntime().evaluateAsDate(onAlarm.untilExpr, 
getEvaluationContext()).getTime();
+                if (timeout == null || timeout.compareTo(dt) > 0) {
+                    timeout = dt;
+                    _alarm = onAlarm;
+                }
             }
-          } catch (FaultException e) {
-            fault = createFault(e.getQName(), onMessage);
+            getBpelRuntimeContext().select(pickResponseChannel, timeout, 
_opick.createInstanceFlag, selectors);
+        } catch(FaultException e){
+            __log.error(e);
+            FaultData fault = createFault(e.getQName(), _opick,e.getMessage());
+            dpe(_opick.outgoingLinks);
             _self.parent.completed(fault, CompensationHandler.emptySet());
-            dpe(onMessage.activity);
             return;
-          }
-
-          // activate 'onMessage' activity
-          // Because we are done with all the DPE, we can simply re-use our 
control
-          // channels for the child.
-          ActivityInfo child = new ActivityInfo(genMonotonic(), 
onMessage.activity, _self.self, _self.parent);
-          instance(createChild(child,_scopeFrame,_linkFrame));
+        } catch (EvaluationException e) {
+            String msg = "Unexpected evaluation error evaluating alarm.";
+            __log.error(msg, e);
+            throw new InvalidProcessException(msg, e);
         }
 
-        public void onTimeout() {
-          // Dead path all the onMessage activiites (the other alarms have 
already been DPE'ed)
-          for (OPickReceive.OnMessage onMessage : _opick.onMessages) {
-            dpe(onMessage.activity);
-          }
-
-          // Because we are done with all the DPE, we can simply re-use our 
control
-          // channels for the child.
-          ActivityInfo child = new ActivityInfo(genMonotonic(), 
_alarm.activity, _self.self, _self.parent);
-          instance(createChild(child,_scopeFrame,_linkFrame));
+        // Dead path all the alarms that have no chace of coming first.
+        for (OPickReceive.OnAlarm oa : _opick.onAlarms) {
+            if (!oa.equals(_alarm)) {
+                dpe(oa.activity);
+            }
         }
 
-        public void onCancel() {
-          _self.parent.completed(null, CompensationHandler.emptySet());
-        }
+        instance(new WAITING(pickResponseChannel));
+    }
 
-      }.or(new TerminationChannelListener(_self.self) {
-        private static final long serialVersionUID = 4399496341785922396L;
+    /**
+     * Calculate a duration offset from right now.
+     * @param duration the offset
+     * @return the resulting date.
+     */
+    private static Date offsetFromNow(Duration duration) {
+        Calendar cal = Calendar.getInstance();
+        duration.addTo(cal);
+        return cal.getTime();
+    }
+
+
+    private class WAITING extends BpelJacobRunnable {
+        private static final long serialVersionUID = 1L;
+
+        private PickResponseChannel _pickResponseChannel;
+
+        private WAITING(PickResponseChannel pickResponseChannel) {
+            this._pickResponseChannel = pickResponseChannel;
+        }
 
-        public void terminate() {
-          getBpelRuntimeContext().cancel(_pickResponseChannel);
-          instance(WAITING.this);
+        public void run() {
+
+            object(false, new 
PickResponseChannelListener(_pickResponseChannel) {
+                private static final long serialVersionUID = 
-8237296827418738011L;
+
+                public void onRequestRcvd(int selectorIdx, String mexId) {
+                    OPickReceive.OnMessage onMessage = 
_opick.onMessages.get(selectorIdx);
+
+                    // dead path the non-selected onMessage blocks.
+                    for (OPickReceive.OnMessage onmsg : _opick.onMessages) {
+                        if (!onmsg.equals(onMessage)) {
+                            dpe(onmsg.activity);
+                        }
+                    }
+
+                    // dead-path the alarm (if any)
+                    if (_alarm != null) {
+                        dpe(_alarm.activity);
+                    }
+
+                    FaultData fault;
+                    Element msgEl = 
getBpelRuntimeContext().getMyRequest(mexId);
+                    try {
+                        
getBpelRuntimeContext().initializeVariable(_scopeFrame.resolve(onMessage.variable),msgEl);
+                    } catch (Exception ex) {
+                        __log.error(ex);
+                        throw new RuntimeException(ex);
+                    }
+                    try {
+                        for (OScope.CorrelationSet cset : 
onMessage.initCorrelations) {
+                            initializeCorrelation(_scopeFrame.resolve(cset), 
_scopeFrame.resolve(onMessage.variable));
+                        }
+                        if (onMessage.partnerLink.hasPartnerRole()) {
+                            // Trying to initialize partner epr based on a 
message-provided epr/session.
+
+                            if 
(!getBpelRuntimeContext().isPartnerRoleEndpointInitialized(_scopeFrame
+                                    .resolve(onMessage.partnerLink))) {
+
+                                Node fromEpr = 
getBpelRuntimeContext().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(
+                                            
_scopeFrame.resolve(onMessage.partnerLink), (Element) fromEpr);
+                                }
+                            }
+
+                            String partnersSessionId = 
getBpelRuntimeContext().getSourceSessionId(mexId);
+                            if (partnersSessionId != null)
+                                
getBpelRuntimeContext().initializePartnersSessionId(_scopeFrame.resolve(onMessage.partnerLink),
+                                        partnersSessionId);
+
+                        }
+                    } catch (FaultException e) {
+                        __log.error(e);
+                        fault = createFault(e.getQName(), onMessage);
+                        _self.parent.completed(fault, 
CompensationHandler.emptySet());
+                        dpe(onMessage.activity);
+                        return;
+                    }
+
+                    // activate 'onMessage' activity
+                    // Because we are done with all the DPE, we can simply 
re-use our control
+                    // channels for the child.
+                    ActivityInfo child = new ActivityInfo(genMonotonic(), 
onMessage.activity, _self.self, _self.parent);
+                    instance(createChild(child,_scopeFrame,_linkFrame));
+                }
+
+                public void onTimeout() {
+                    // Dead path all the onMessage activiites (the other 
alarms have already been DPE'ed)
+                    for (OPickReceive.OnMessage onMessage : _opick.onMessages) 
{
+                        dpe(onMessage.activity);
+                    }
+
+                    // Because we are done with all the DPE, we can simply 
re-use our control
+                    // channels for the child.
+                    ActivityInfo child = new ActivityInfo(genMonotonic(), 
_alarm.activity, _self.self, _self.parent);
+                    instance(createChild(child,_scopeFrame,_linkFrame));
+                }
+
+                public void onCancel() {
+                    _self.parent.completed(null, 
CompensationHandler.emptySet());
+                }
+
+            }.or(new TerminationChannelListener(_self.self) {
+                private static final long serialVersionUID = 
4399496341785922396L;
+
+                public void terminate() {
+                    getBpelRuntimeContext().cancel(_pickResponseChannel);
+                    instance(WAITING.this);
+                }
+            }));
         }
-      }));
     }
-  }
 }

Modified: 
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/REPLY.java
URL: 
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/REPLY.java?view=diff&rev=453057&r1=453056&r2=453057
==============================================================================
--- 
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/REPLY.java
 (original)
+++ 
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/REPLY.java
 Wed Oct  4 15:56:58 2006
@@ -32,46 +32,47 @@
 
 class REPLY extends ACTIVITY {
     private static final long serialVersionUID = 3040651951885161304L;
-private static final Log __log = LogFactory.getLog(REPLY.class);
+    private static final Log __log = LogFactory.getLog(REPLY.class);
 
-  REPLY(ActivityInfo self, ScopeFrame scopeFrame, LinkFrame linkFrame) {
-    super(self, scopeFrame, linkFrame);
-  }
-
-  public void run() {
-    final OReply oreply = (OReply)_self.o;
-
-    if (__log.isDebugEnabled()) {
-      __log.debug("<reply>  partnerLink=" + oreply.partnerLink + ", 
operation=" + oreply.operation);
+    REPLY(ActivityInfo self, ScopeFrame scopeFrame, LinkFrame linkFrame) {
+        super(self, scopeFrame, linkFrame);
     }
-    FaultData fault = null;
 
-    // TODO: Check for fault without message.
+    public void run() {
+        final OReply oreply = (OReply)_self.o;
 
-    try {
-      Node msg = getBpelRuntimeContext()
-                   .fetchVariableData(_scopeFrame.resolve(oreply.variable), 
false);
-
-      assert msg instanceof Element;
-
-      for (Iterator i = oreply.initCorrelations.iterator(); i.hasNext(); ) {
-        OScope.CorrelationSet cset = (OScope.CorrelationSet) i.next();
-        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 != null)
-               ? oreply.fault.getName()
-               : null);
-    } catch (FaultException e) {
-      fault = createFault(e.getQName(), oreply);
-    }
+        if (__log.isDebugEnabled()) {
+            __log.debug("<reply>  partnerLink=" + oreply.partnerLink + ", 
operation=" + oreply.operation);
+        }
+        FaultData fault = null;
+
+        // TODO: Check for fault without message.
+
+        try {
+            Node msg = getBpelRuntimeContext()
+                    .fetchVariableData(_scopeFrame.resolve(oreply.variable), 
false);
+
+            assert msg instanceof Element;
+
+            for (Iterator i = oreply.initCorrelations.iterator(); i.hasNext(); 
) {
+                OScope.CorrelationSet cset = (OScope.CorrelationSet) i.next();
+                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 != null)
+                                    ? oreply.fault.getName()
+                                    : null);
+        } catch (FaultException e) {
+            __log.error(e);
+            fault = createFault(e.getQName(), oreply);
+        }
 
-    _self.parent.completed(fault, CompensationHandler.emptySet());
-  }
+        _self.parent.completed(fault, CompensationHandler.emptySet());
+    }
 }

Modified: 
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/THROW.java
URL: 
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/THROW.java?view=diff&rev=453057&r1=453056&r2=453057
==============================================================================
--- 
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/THROW.java
 (original)
+++ 
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/THROW.java
 Wed Oct  4 15:56:58 2006
@@ -21,6 +21,8 @@
 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.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
@@ -30,29 +32,31 @@
  * Throw BPEL fault activity.
  */
 class THROW extends ACTIVITY {
-       private static final long serialVersionUID = 1L;
+    private static final long serialVersionUID = 1L;
+    private static final Log __log = LogFactory.getLog(ACTIVITY.class);
 
-       private OThrow _othrow;
+    private OThrow _othrow;
 
-  public THROW(ActivityInfo self, ScopeFrame scopeFrame, LinkFrame linkFrame) {
-    super(self, scopeFrame, linkFrame);
-    _othrow = (OThrow) self.o;
-  }
-
-  public void run() {
-    FaultData fault = null;
-    if(_othrow.faultVariable != null){
-                       try {
-                               Node faultVariable = 
getBpelRuntimeContext().fetchVariableData(_scopeFrame.resolve(_othrow.faultVariable),
 false);
-        fault = createFault(_othrow.faultName, 
(Element)faultVariable,_othrow.faultVariable.type,_othrow);
-                       } catch (FaultException e) {
-        // deal with this as a fault (just not the one we hoped for)
-                               fault = createFault(e.getQName(), _othrow);
-                       }
-    }else{
-       fault = createFault(_othrow.faultName, _othrow);
+    public THROW(ActivityInfo self, ScopeFrame scopeFrame, LinkFrame 
linkFrame) {
+        super(self, scopeFrame, linkFrame);
+        _othrow = (OThrow) self.o;
     }
 
-    _self.parent.completed(fault, CompensationHandler.emptySet());
-  }
+    public void run() {
+        FaultData fault = null;
+        if(_othrow.faultVariable != null){
+            try {
+                Node faultVariable = 
getBpelRuntimeContext().fetchVariableData(_scopeFrame.resolve(_othrow.faultVariable),
 false);
+                fault = createFault(_othrow.faultName, 
(Element)faultVariable,_othrow.faultVariable.type,_othrow);
+            } catch (FaultException e) {
+                // deal with this as a fault (just not the one we hoped for)
+                __log.error(e);
+                fault = createFault(e.getQName(), _othrow);
+            }
+        }else{
+            fault = createFault(_othrow.faultName, _othrow);
+        }
+
+        _self.parent.completed(fault, CompensationHandler.emptySet());
+    }
 }

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=453057&r1=453056&r2=453057
==============================================================================
--- 
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
 Wed Oct  4 15:56:58 2006
@@ -38,104 +38,105 @@
  * BPEL &lt;while&gt; activity
  */
 class WHILE extends ACTIVITY {
-       private static final long serialVersionUID = 1L;
+    private static final long serialVersionUID = 1L;
 
-       private static final Log __log = LogFactory.getLog(WHILE.class);
+    private static final Log __log = LogFactory.getLog(WHILE.class);
 
-  private Set<CompensationHandler> _compHandlers = new 
HashSet<CompensationHandler>();
+    private Set<CompensationHandler> _compHandlers = new 
HashSet<CompensationHandler>();
 
-  public WHILE(ActivityInfo self, ScopeFrame scopeFrame, LinkFrame linkFrame) {
-    super(self, scopeFrame, linkFrame);
-  }
-
-  public void run() {
-
-    boolean condResult = false;
-
-    try {
-      condResult = checkCondition();
-    } catch (FaultException fe) {
-      _self.parent.completed(createFault(fe.getQName(), 
_self.o),_compHandlers);
-      return;
-    }
-
-    if (condResult) {
-      ActivityInfo child = new ActivityInfo(genMonotonic(),
-              getOWhile().activity,
-              newChannel(TerminationChannel.class), 
newChannel(ParentScopeChannel.class));
-      instance(createChild(child, _scopeFrame, _linkFrame));
-      instance(new WAITER(child));
-    } else /* stop. */ {
-      _self.parent.completed(null, _compHandlers);
-    }
-  }
-
-  /* (non-Javadoc)
-  * @see java.lang.Object#toString()
-  */
-  public String toString() {
-    return "<T:Act:While:" + _self.o + ">";
-  }
-
-  protected Log log() {
-    return __log;
-  }
-
-  private OWhile getOWhile() {
-    return (OWhile)_self.o;
-  }
-
-  /**
-   * Evaluates the while condition.
-   *
-   * @return <code>true</code> if the while condition is satisfied, 
<code>false</code> otherwise.
-   * @throws FaultException in case of standard expression fault (e.g. 
selection failure)
-   */
-  private boolean checkCondition()
-          throws FaultException {
-    try {
-      return 
getBpelRuntimeContext().getExpLangRuntime().evaluateAsBoolean(getOWhile().whileCondition,getEvaluationContext());
-    } catch (EvaluationException e) {
-      String msg = "Unexpected expression evaluation error checking while 
condition.";
-      __log.error(msg, e);
-      throw new InvalidProcessException(msg,e);
-    }
-  }
-
-  private class WAITER extends BpelJacobRunnable {
-    private static final long serialVersionUID = -7645042174027252066L;
-    private ActivityInfo _child;
-    private boolean _terminated;
-
-    WAITER(ActivityInfo child) {
-      _child = child;
+    public WHILE(ActivityInfo self, ScopeFrame scopeFrame, LinkFrame 
linkFrame) {
+        super(self, scopeFrame, linkFrame);
     }
 
     public void run() {
-      object(false, new TerminationChannelListener(_self.self) {
-        private static final long serialVersionUID = -5471984635653784051L;
 
-        public void terminate() {
-          _terminated = true;
-          replication(_child.self).terminate();
-          instance(WAITER.this);
+        boolean condResult = false;
+
+        try {
+            condResult = checkCondition();
+        } catch (FaultException fe) {
+            __log.error(fe);
+            _self.parent.completed(createFault(fe.getQName(), 
_self.o),_compHandlers);
+            return;
+        }
+
+        if (condResult) {
+            ActivityInfo child = new ActivityInfo(genMonotonic(),
+                    getOWhile().activity,
+                    newChannel(TerminationChannel.class), 
newChannel(ParentScopeChannel.class));
+            instance(createChild(child, _scopeFrame, _linkFrame));
+            instance(new WAITER(child));
+        } else /* stop. */ {
+            _self.parent.completed(null, _compHandlers);
         }
-      }.or(new ParentScopeChannelListener(_child.parent) {
-        private static final long serialVersionUID = 3907167240907524405L;
+    }
+
+    /* (non-Javadoc)
+    * @see java.lang.Object#toString()
+    */
+    public String toString() {
+        return "<T:Act:While:" + _self.o + ">";
+    }
+
+    protected Log log() {
+        return __log;
+    }
+
+    private OWhile getOWhile() {
+        return (OWhile)_self.o;
+    }
+
+    /**
+     * Evaluates the while condition.
+     *
+     * @return <code>true</code> if the while condition is satisfied, 
<code>false</code> otherwise.
+     * @throws FaultException in case of standard expression fault (e.g. 
selection failure)
+     */
+    private boolean checkCondition()
+            throws FaultException {
+        try {
+            return 
getBpelRuntimeContext().getExpLangRuntime().evaluateAsBoolean(getOWhile().whileCondition,getEvaluationContext());
+        } catch (EvaluationException e) {
+            String msg = "Unexpected expression evaluation error checking 
while condition.";
+            __log.error(msg, e);
+            throw new InvalidProcessException(msg,e);
+        }
+    }
+
+    private class WAITER extends BpelJacobRunnable {
+        private static final long serialVersionUID = -7645042174027252066L;
+        private ActivityInfo _child;
+        private boolean _terminated;
 
-        public void compensate(OScope scope, SynchChannel ret) {
-          _self.parent.compensate(scope,ret);
-          instance(WAITER.this);
+        WAITER(ActivityInfo child) {
+            _child = child;
         }
 
-        public void completed(FaultData faultData, Set<CompensationHandler> 
compensations) {
-          _compHandlers.addAll(compensations);
-          if (_terminated || faultData != null)
-            _self.parent.completed(faultData, compensations);
-          else
-            instance(WHILE.this);
+        public void run() {
+            object(false, new TerminationChannelListener(_self.self) {
+                private static final long serialVersionUID = 
-5471984635653784051L;
+
+                public void terminate() {
+                    _terminated = true;
+                    replication(_child.self).terminate();
+                    instance(WAITER.this);
+                }
+            }.or(new ParentScopeChannelListener(_child.parent) {
+                private static final long serialVersionUID = 
3907167240907524405L;
+
+                public void compensate(OScope scope, SynchChannel ret) {
+                    _self.parent.compensate(scope,ret);
+                    instance(WAITER.this);
+                }
+
+                public void completed(FaultData faultData, 
Set<CompensationHandler> compensations) {
+                    _compHandlers.addAll(compensations);
+                    if (_terminated || faultData != null)
+                        _self.parent.completed(faultData, compensations);
+                    else
+                        instance(WHILE.this);
+                }
+            }));
         }
-      }));
     }
-  }
 }


Reply via email to