ode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mr...@apache.org
Subject svn commit: r547754 - /incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/WAIT.java
Date Fri, 15 Jun 2007 18:22:08 GMT
Author: mriou
Date: Fri Jun 15 11:22:07 2007
New Revision: 547754

URL: http://svn.apache.org/viewvc?view=rev&rev=547754
Log:
Making it pretty.

Modified:
    incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/WAIT.java

Modified: incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/WAIT.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/WAIT.java?view=diff&rev=547754&r1=547753&r2=547754
==============================================================================
--- incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/WAIT.java (original)
+++ incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/WAIT.java Fri
Jun 15 11:22:07 2007
@@ -37,97 +37,96 @@
  * JacobRunnable that performs the work of the <code>&lt;wait&gt;</code>
activity.
  */
 class WAIT extends ACTIVITY {
-	private static final long serialVersionUID = 1L;
-	private static final Log __log = LogFactory.getLog(WAIT.class);
+    private static final long serialVersionUID = 1L;
+    private static final Log __log = LogFactory.getLog(WAIT.class);
 
-  WAIT(ActivityInfo self, ScopeFrame scopeFrame, LinkFrame linkFrame) {
-    super(self, scopeFrame, linkFrame);
-  }
-
-  public final void run() {
-    
-  	Date dueDate = null;
-  	try{
-  		dueDate = getDueDate();
-  	}catch(FaultException e){
-  		__log.error("Fault while calculating due date: " 
-  				+ e.getQName() 
-  				+ "; Reason: " + e.getMessage());
-  		_self.parent.completed(createFault(e.getQName(), _self.o), CompensationHandler.emptySet());
-  		return;
-  	} catch (EvaluationException ee) {
-      String msg = "Unexpected error evaluating wait condition.";
-      __log.error(msg, ee);
-      throw new InvalidProcessException(msg,ee);
+    WAIT(ActivityInfo self, ScopeFrame scopeFrame, LinkFrame linkFrame) {
+        super(self, scopeFrame, linkFrame);
     }
-  	
 
-  	if(dueDate.getTime() > System.currentTimeMillis()){
-	    final TimerResponseChannel timerChannel = newChannel(TimerResponseChannel.class);
-	    getBpelRuntimeContext().registerTimer(timerChannel, dueDate);
-	    
-	    object(false, new TimerResponseChannelListener(timerChannel){
-         private static final long serialVersionUID = 3120518305645437327L;
-
-         public void onTimeout() {
-           _self.parent.completed(null, CompensationHandler.emptySet());
-         }
-
-        public void onCancel() {
-          _self.parent.completed(null, CompensationHandler.emptySet());
+    public final void run() {
+        Date dueDate = null;
+        try{
+            dueDate = getDueDate();
+        } catch(FaultException e){
+            __log.error("Fault while calculating due date: "
+                    + e.getQName()
+                    + "; Reason: " + e.getMessage());
+            _self.parent.completed(createFault(e.getQName(), _self.o), CompensationHandler.emptySet());
+            return;
+        } catch (EvaluationException ee) {
+            String msg = "Unexpected error evaluating wait condition.";
+            __log.error(msg, ee);
+            throw new InvalidProcessException(msg,ee);
         }
-      }.or(new TerminationChannelListener(_self.self) {
-        private static final long serialVersionUID = -2791243270691333946L;
 
-        public void terminate() {
-          _self.parent.completed(null, CompensationHandler.emptySet());
-          object(new TimerResponseChannelListener(timerChannel) {
-            private static final long serialVersionUID = 677746737897792929L;
-
-            public void onTimeout() {
-              //ignore
-            }
-
-            public void onCancel() {
-              //ingore
-            }
-          });
+
+        if(dueDate.getTime() > System.currentTimeMillis()){
+            final TimerResponseChannel timerChannel = newChannel(TimerResponseChannel.class);
+            getBpelRuntimeContext().registerTimer(timerChannel, dueDate);
+
+            object(false, new TimerResponseChannelListener(timerChannel){
+                private static final long serialVersionUID = 3120518305645437327L;
+
+                public void onTimeout() {
+                    _self.parent.completed(null, CompensationHandler.emptySet());
+                }
+
+                public void onCancel() {
+                    _self.parent.completed(null, CompensationHandler.emptySet());
+                }
+            }.or(new TerminationChannelListener(_self.self) {
+                private static final long serialVersionUID = -2791243270691333946L;
+
+                public void terminate() {
+                    _self.parent.completed(null, CompensationHandler.emptySet());
+                    object(new TimerResponseChannelListener(timerChannel) {
+                        private static final long serialVersionUID = 677746737897792929L;
+
+                        public void onTimeout() {
+                            //ignore
+                        }
+
+                        public void onCancel() {
+                            //ingore
+                        }
+                    });
+                }
+            }));
+        }else{
+            _self.parent.completed(null, null);
         }
-      }));
-    }else{
-      _self.parent.completed(null, null);
     }
-  }
 
 
-  protected Date getDueDate() throws FaultException, EvaluationException {
+    protected Date getDueDate() throws FaultException, EvaluationException {
 
-    OWait wait = (OWait)_self.o;
+        OWait wait = (OWait)_self.o;
 
-    // Assume the data was well formed (we have a deadline or a duration)
-    assert wait.hasFor() || wait.hasUntil();
+        // Assume the data was well formed (we have a deadline or a duration)
+        assert wait.hasFor() || wait.hasUntil();
 
-    EvaluationContext evalCtx = getEvaluationContext();
+        EvaluationContext evalCtx = getEvaluationContext();
 
-    Date dueDate = null;
-    if (wait.hasFor()) {
-      Calendar cal = Calendar.getInstance();
-      Duration duration = getBpelRuntimeContext().getExpLangRuntime().evaluateAsDuration(wait.forExpression,
evalCtx);
-      duration.addTo(cal);
-      dueDate = cal.getTime();
-    } else if (wait.hasUntil()) {
-      Calendar cal = getBpelRuntimeContext().getExpLangRuntime().evaluateAsDate(wait.untilExpression,
evalCtx);
-      dueDate = cal.getTime();
-    } else {
-      throw new AssertionError("Static checks failed to find bad WaitActivity!");
-    }
+        Date dueDate = null;
+        if (wait.hasFor()) {
+            Calendar cal = Calendar.getInstance();
+            Duration duration = getBpelRuntimeContext().getExpLangRuntime().evaluateAsDuration(wait.forExpression,
evalCtx);
+            duration.addTo(cal);
+            dueDate = cal.getTime();
+        } else if (wait.hasUntil()) {
+            Calendar cal = getBpelRuntimeContext().getExpLangRuntime().evaluateAsDate(wait.untilExpression,
evalCtx);
+            dueDate = cal.getTime();
+        } else {
+            throw new AssertionError("Static checks failed to find bad WaitActivity!");
+        }
 
-    // For now if we cannot evaluate a due date, we assume it is due now.
-    // TODO: BPEL-ISSUE: verify BPEL spec for proper handling of these errors
-    if (dueDate == null)
-      dueDate = new Date();
+        // For now if we cannot evaluate a due date, we assume it is due now.
+        // TODO: BPEL-ISSUE: verify BPEL spec for proper handling of these errors
+        if (dueDate == null)
+            dueDate = new Date();
 
-    return dueDate;
-  }
+        return dueDate;
+    }
 
 }



Mime
View raw message