You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by as...@apache.org on 2006/10/06 01:00:29 UTC

svn commit: r453417 - in /incubator/ode/trunk: bpel-api/src/main/java/org/apache/ode/bpel/evt/ bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ bpel-dao/src/main/java/org/apache/ode/bpel/dao/ bpel-runtime/src/main/java/org/apache/ode/bpel/engi...

Author: assaf
Date: Thu Oct  5 16:00:28 2006
New Revision: 453417

URL: http://svn.apache.org/viewvc?view=rev&rev=453417
Log:
Added logging messages and fixed indentation

Modified:
    incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/evt/ActivityFailureEvent.java
    incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/evt/ProcessMessageExchangeEvent.java
    incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/DefaultActivityGenerator.java
    incubator/ode/trunk/bpel-dao/src/main/java/org/apache/ode/bpel/dao/ActivityRecoveryDAO.java
    incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java
    incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java
    incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/ProcessAndInstanceManagementImpl.java
    incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ActivityInfo.java
    incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/BpelRuntimeContext.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/channels/ActivityRecovery.java
    incubator/ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/ActivityRecoveryTest.java
    incubator/ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/CoreBpelTest.java
    incubator/ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/MockBpelServer.java
    incubator/ode/trunk/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/ActivityRecoveryDaoImpl.java

Modified: incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/evt/ActivityFailureEvent.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/evt/ActivityFailureEvent.java?view=diff&rev=453417&r1=453416&r2=453417
==============================================================================
--- incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/evt/ActivityFailureEvent.java (original)
+++ incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/evt/ActivityFailureEvent.java Thu Oct  5 16:00:28 2006
@@ -23,22 +23,22 @@
  */
 public class ActivityFailureEvent extends ActivityEvent {
 
-	private static final long serialVersionUID = 1L;
+    private static final long serialVersionUID = 1L;
 
-  private String _reason;
+    private String _reason;
 
-  public ActivityFailureEvent() { 
-  }
-  
-  public ActivityFailureEvent(String reason) { 
-    _reason = reason;
-  }
+    public ActivityFailureEvent() { 
+    }
+    
+    public ActivityFailureEvent(String reason) { 
+      _reason = reason;
+    }
 
-  public String getFailureReason() {
-    return _reason;
-  }
+    public String getFailureReason() {
+      return _reason;
+    }
 
-  public void setFailureReason(String reason) {
-    _reason = reason;
-  }
+    public void setFailureReason(String reason) {
+      _reason = reason;
+    }
 }

Modified: incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/evt/ProcessMessageExchangeEvent.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/evt/ProcessMessageExchangeEvent.java?view=diff&rev=453417&r1=453416&r2=453417
==============================================================================
--- incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/evt/ProcessMessageExchangeEvent.java (original)
+++ incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/evt/ProcessMessageExchangeEvent.java Thu Oct  5 16:00:28 2006
@@ -25,64 +25,64 @@
  */
 public class ProcessMessageExchangeEvent extends ProcessInstanceEvent {
   
-  private static final long serialVersionUID = 1L;
-  
-  public static final short PROCESS_INPUT = 0;
-  public static final short PROCESS_OUTPUT = 1;
-  public static final short PROCESS_FAULT = 2;
-  public static final short PARTNER_INPUT = 3;
-  public static final short PARTNER_OUTPUT = 4;
-  public static final short PARTNER_FAULT = 5;
-  public static final short PARTNER_FAILURE = 6;
-  
-  
-  private QName _portType;
-  private String _operation;
-  private String _mexId;
-  private short _aspect;
-
-  public ProcessMessageExchangeEvent() {}
-
-  public ProcessMessageExchangeEvent(short aspect,
-    QName processName,
-    QName processId, Long processInstanceId) {
-    super(processInstanceId);
-    setProcessName(processName);
-    setProcessId(processId);
-    _aspect = aspect;
-  }
-  
-  public short getAspect() {
-    return _aspect;
-  }
-  
-  /** Message exchange port type*/
-	public QName getPortType() {
-    return _portType;
-  }
-
-	/** Message exchange operation */
-	public String getOperation() {
-    return _operation;
-  }
-
-  /** Message exchange id */
-	public String getMessageExchangeId() {
-    return _mexId;
-  }
-  
-  public void setAspect(short aspect) {
-    _aspect = aspect;
-  }
-
-  public void setMexId(String mexId) {
-    _mexId = mexId;
-  }
-
-  public void setOperation(String operation) {
-    _operation = operation;
-  }
-
-  public void setPortType(QName portType) {
-    _portType = portType;
-  }}
+    private static final long serialVersionUID = 1L;
+    
+    public static final short PROCESS_INPUT = 0;
+    public static final short PROCESS_OUTPUT = 1;
+    public static final short PROCESS_FAULT = 2;
+    public static final short PARTNER_INPUT = 3;
+    public static final short PARTNER_OUTPUT = 4;
+    public static final short PARTNER_FAULT = 5;
+    public static final short PARTNER_FAILURE = 6;
+    
+    private QName _portType;
+    private String _operation;
+    private String _mexId;
+    private short _aspect;
+
+    public ProcessMessageExchangeEvent() {}
+
+    public ProcessMessageExchangeEvent(short aspect,
+        QName processName,
+        QName processId, Long processInstanceId) {
+        super(processInstanceId);
+        setProcessName(processName);
+        setProcessId(processId);
+        _aspect = aspect;
+    }
+    
+    public short getAspect() {
+        return _aspect;
+    }
+    
+    /** Message exchange port type*/
+    public QName getPortType() {
+        return _portType;
+    }
+
+    /** Message exchange operation */
+    public String getOperation() {
+        return _operation;
+    }
+
+    /** Message exchange id */
+    public String getMessageExchangeId() {
+        return _mexId;
+    }
+    
+    public void setAspect(short aspect) {
+        _aspect = aspect;
+    }
+
+    public void setMexId(String mexId) {
+        _mexId = mexId;
+    }
+
+    public void setOperation(String operation) {
+        _operation = operation;
+    }
+
+    public void setPortType(QName portType) {
+        _portType = portType;
+    }
+}

Modified: incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/DefaultActivityGenerator.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/DefaultActivityGenerator.java?view=diff&rev=453417&r1=453416&r2=453417
==============================================================================
--- incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/DefaultActivityGenerator.java (original)
+++ incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/DefaultActivityGenerator.java Thu Oct  5 16:00:28 2006
@@ -55,7 +55,7 @@
         textValue = DOMUtils.getTextContent(element);
         if (textValue != null) {
           try {
-            output.failureHandling.retryFor = Integer.valueOf(textValue);
+            output.failureHandling.retryFor = Integer.parseInt(textValue);
             if (output.failureHandling.retryFor < 0)
               throw new CompilationException(__cmsgs.errInvalidRetryForValue(textValue));
           } catch (NumberFormatException except) {
@@ -68,7 +68,7 @@
         textValue = DOMUtils.getTextContent(element);
         if (textValue != null) {
           try {
-            output.failureHandling.retryDelay = Integer.valueOf(textValue);
+            output.failureHandling.retryDelay = Integer.parseInt(textValue);
             if (output.failureHandling.retryDelay < 0)
               throw new CompilationException(__cmsgs.errInvalidRetryDelayValue(textValue));
           } catch (NumberFormatException except) {
@@ -80,7 +80,7 @@
       if (element != null) {
         textValue = DOMUtils.getTextContent(element);
         if (textValue != null)
-          output.failureHandling.faultOnFailure = Boolean.valueOf(textValue);
+          output.failureHandling.faultOnFailure = Boolean.valueOf(textValue).booleanValue();
       }
     } else {
       for (OActivity parent : _context.getActivityStack()) {

Modified: incubator/ode/trunk/bpel-dao/src/main/java/org/apache/ode/bpel/dao/ActivityRecoveryDAO.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-dao/src/main/java/org/apache/ode/bpel/dao/ActivityRecoveryDAO.java?view=diff&rev=453417&r1=453416&r2=453417
==============================================================================
--- incubator/ode/trunk/bpel-dao/src/main/java/org/apache/ode/bpel/dao/ActivityRecoveryDAO.java (original)
+++ incubator/ode/trunk/bpel-dao/src/main/java/org/apache/ode/bpel/dao/ActivityRecoveryDAO.java Thu Oct  5 16:00:28 2006
@@ -27,20 +27,20 @@
  */
 public interface ActivityRecoveryDAO {
 
-  long getActivityId();
+    long getActivityId();
 
-  String getChannel();
+    String getChannel();
 
-  String getReason();
+    String getReason();
 
-  Element getDetails();
+    Element getDetails();
 
-  Date getDateTime();
+    Date getDateTime();
 
-  String getActions();
+    String getActions();
 
-  String[] getActionsList();
+    String[] getActionsList();
 
-  int getRetries();
+    int getRetries();
 
 }

Modified: incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java?view=diff&rev=453417&r1=453416&r2=453417
==============================================================================
--- incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java (original)
+++ incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java Thu Oct  5 16:00:28 2006
@@ -149,12 +149,12 @@
         return "BpelProcess[" + _pid + " in " + _du + "]";
     }
 
-    public void recoverActivity(ProcessInstanceDAO instanceDAO, String channel, String action, FaultData fault) {
-      if (__log.isDebugEnabled())
-        __log.debug("Recovering activity in process " + instanceDAO.getInstanceId() + " with action " + action );
+    public void recoverActivity(ProcessInstanceDAO instanceDAO, String channel, long activityId, String action, FaultData fault) {
+        if (__log.isDebugEnabled())
+          __log.debug("Recovering activity in process " + instanceDAO.getInstanceId() + " with action " + action );
 
-      BpelRuntimeContextImpl processInstance = createRuntimeContext(instanceDAO, null, null);
-      processInstance.recoverActivity(channel, action, fault);
+        BpelRuntimeContextImpl processInstance = createRuntimeContext(instanceDAO, null, null);
+        processInstance.recoverActivity(channel, activityId, action, fault);
     }
 
     static String generateMessageExchangeIdentifier(String partnerlinkName, String operationName) {

Modified: incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java?view=diff&rev=453417&r1=453416&r2=453417
==============================================================================
--- incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java (original)
+++ incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java Thu Oct  5 16:00:28 2006
@@ -905,6 +905,7 @@
             responseChannel.onResponse();
             break;
         case FAILURE:
+            evt.setAspect(ProcessMessageExchangeEvent.PARTNER_FAILURE);
             responseChannel.onFailure();
             break;
         }
@@ -1149,6 +1150,7 @@
             reason = "Unspecified";
         if (dateTime == null)
             dateTime = new Date();
+        __log.info("ActivityRecovery: Registering activity " + activityId + ", failure reason: " + reason);
         _dao.createActivityRecovery(channel.export(), (int) activityId, reason, dateTime, details, actions, retries);
     }
 
@@ -1156,18 +1158,21 @@
         _dao.deleteActivityRecovery(channel.export());
     }
 
-    public void recoverActivity(final String channel, final String action, final FaultData fault) {
+    public void recoverActivity(final String channel, final long activityId, final String action, final FaultData fault) {
         vpu.inject(new JacobRunnable() {
             private static final long serialVersionUID = 3168964409165899533L;
 
             public void run() {
                 ActivityRecoveryChannel recovery = importChannel(channel, ActivityRecoveryChannel.class);
-                if ("cancel".equals(action))
-                    recovery.cancel();
-                else if ("retry".equals(action))
-                    recovery.retry();
-                else if ("fault".equals(action))
-                    recovery.fault(fault);
+                __log.info("ActivityRecovery: Recovering activity " + activityId + " with action " + action);
+                if (recovery != null) {
+                    if ("cancel".equals(action))
+                        recovery.cancel();
+                    else if ("retry".equals(action))
+                        recovery.retry();
+                    else if ("fault".equals(action))
+                        recovery.fault(fault);
+                }
             }
         });
         //_dao.deleteActivityRecovery(channel);

Modified: incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/ProcessAndInstanceManagementImpl.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/ProcessAndInstanceManagementImpl.java?view=diff&rev=453417&r1=453416&r2=453417
==============================================================================
--- incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/ProcessAndInstanceManagementImpl.java (original)
+++ incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/ProcessAndInstanceManagementImpl.java Thu Oct  5 16:00:28 2006
@@ -314,29 +314,29 @@
     }
 
     public InstanceInfoDocument recoverActivity(final Long iid, final Long aid, final String action) {
-      try {
-        QName processId = _db.exec(new BpelDatabase.Callable<QName>() {
-          public QName run(BpelDAOConnection conn) throws Exception {
-            ProcessInstanceDAO instance = conn.getInstance(iid);
-            if (instance == null)
-              return null;
-            for (ActivityRecoveryDAO recovery: instance.getActivityRecoveries()) {
-              if (recovery.getActivityId() == aid) {
-                BpelProcess process = _engine._activeProcesses.get(instance.getProcess().getProcessId());
-                if (process != null) {
-                  process.recoverActivity(instance, recovery.getChannel(), action, null);
-                  break;
+        try {
+            QName processId = _db.exec(new BpelDatabase.Callable<QName>() {
+                public QName run(BpelDAOConnection conn) throws Exception {
+                    ProcessInstanceDAO instance = conn.getInstance(iid);
+                    if (instance == null)
+                        return null;
+                    for (ActivityRecoveryDAO recovery: instance.getActivityRecoveries()) {
+                        if (recovery.getActivityId() == aid) {
+                            BpelProcess process = _engine._activeProcesses.get(instance.getProcess().getProcessId());
+                            if (process != null) {
+                                process.recoverActivity(instance, recovery.getChannel(), aid, action, null);
+                                break;
+                            }
+                        }
+                    }
+                    return instance.getProcess().getProcessId();
                 }
-              }
-            }
-            return instance.getProcess().getProcessId();
-          }
-        });
-      } catch (Exception e) {
-        __log.error("DbError",e);
-        throw new ProcessingException("DbError", e);
-      }
-      return genInstanceInfoDocument(iid);
+            });
+        } catch (Exception e) {
+            __log.error("DbError",e);
+            throw new ProcessingException("DbError", e);
+        }
+        return genInstanceInfoDocument(iid);
     }
 
     public Collection<Long> delete(String filter) {

Modified: incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ActivityInfo.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ActivityInfo.java?view=diff&rev=453417&r1=453416&r2=453417
==============================================================================
--- incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ActivityInfo.java (original)
+++ incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ActivityInfo.java Thu Oct  5 16:00:28 2006
@@ -27,52 +27,45 @@
 
 class ActivityInfo implements Serializable {
 
-	private static final long serialVersionUID = 1L;
-  /** Activity instance identifier */
-  long aId;
-  
-  /** Activity definition. */
-	OActivity o;
-  TerminationChannel self;
-  ParentScopeChannel parent;
-  
-  ActivityInfo(long aid, OActivity o, TerminationChannel self, ParentScopeChannel parent) {
-    assert o != null;
-    assert self != null;
-    assert parent != null;
+    private static final long serialVersionUID = 1L;
+    /** Activity instance identifier */
+    long aId;
     
-    this.o = o;
-    this.self = self;
-    this.parent = parent;
-    this.aId = aid;
-  }
+    /** Activity definition. */
+    OActivity o;
+    TerminationChannel self;
+    ParentScopeChannel parent;
+    
+    ActivityInfo(long aid, OActivity o, TerminationChannel self, ParentScopeChannel parent) {
+        assert o != null;
+        assert self != null;
+        assert parent != null;
+        
+        this.o = o;
+        this.self = self;
+        this.parent = parent;
+        this.aId = aid;
+    }
 
-  public String toString() {
-    StringBuffer buf = new StringBuffer("(");
-    buf.append(o);
-    buf.append(',');
-    buf.append(self);
-    buf.append(',');
-    buf.append(parent);
-    buf.append(')');
-    return buf.toString();
-  }
-  
-  public int hashCode() {
-    return (int)aId;
-  }
+    public String toString() {
+        StringBuffer buf = new StringBuffer("(");
+        buf.append(o);
+        buf.append(',');
+        buf.append(self);
+        buf.append(',');
+        buf.append(parent);
+        buf.append(')');
+        return buf.toString();
+    }
+    
+    public int hashCode() {
+        return (int)aId;
+    }
 
-  public FailureHandling getFailureHandling() {
-    FailureHandling failure = o.failureHandling;
-    // TODO: Need inheritance mechanism.
-    if (failure == null)
-      failure = new FailureHandling();
-    if (failure.retryFor == null)
-      failure.retryFor = new Integer(0);
-    if (failure.retryDelay == null)
-      failure.retryDelay = new Integer(0);
-    if (failure.faultOnFailure == null)
-      failure.faultOnFailure = Boolean.FALSE;
-    return failure;
-  }
+    public FailureHandling getFailureHandling() {
+        FailureHandling failure = o.failureHandling;
+        if (failure == null)
+            failure = new FailureHandling();
+        return failure;
+    }
 }

Modified: incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/BpelRuntimeContext.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/BpelRuntimeContext.java?view=diff&rev=453417&r1=453416&r2=453417
==============================================================================
--- incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/BpelRuntimeContext.java (original)
+++ incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/BpelRuntimeContext.java Thu Oct  5 16:00:28 2006
@@ -250,7 +250,7 @@
 
   void unregisterActivityForRecovery(ActivityRecoveryChannel channel);
 
-  void recoverActivity(final String channel, final String action, final FaultData fault);
+  void recoverActivity(String channel, long activityId, String action, FaultData fault);
 
   String getSourceSessionId(String mexId);
 }

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=453417&r1=453416&r2=453417
==============================================================================
--- 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 Oct  5 16:00:28 2006
@@ -23,6 +23,8 @@
 
 import javax.xml.namespace.QName;
 
+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.ActivityFailureEvent;
 import org.apache.ode.bpel.evt.ActivityRecoveryEvent;
@@ -37,8 +39,6 @@
 import org.apache.ode.bpel.runtime.channels.TerminationChannelListener;
 import org.apache.ode.bpel.runtime.channels.TimerResponseChannel;
 import org.apache.ode.bpel.runtime.channels.TimerResponseChannelListener;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 
@@ -47,7 +47,6 @@
  */
 public class INVOKE extends ACTIVITY {
     private static final long serialVersionUID = 992248281026821783L;
-
     private static final Log __log = LogFactory.getLog(INVOKE.class);
 
     private OInvoke _oinvoke;
@@ -60,7 +59,6 @@
     // Data associated with failure.
     private Element _failureData;
 
-
     public INVOKE(ActivityInfo self, ScopeFrame scopeFrame, LinkFrame linkFrame) {
         super(self, scopeFrame, linkFrame);
         _oinvoke = (OInvoke) _self.o;
@@ -86,22 +84,17 @@
             if (!isTwoWay) {
                 FaultData faultData = null;
                 getBpelRuntimeContext().invoke(
-                        _scopeFrame.resolve(_oinvoke.partnerLink),
-                        _oinvoke.operation,
-                        outboundMsg,
-                        null);
-
+                    _scopeFrame.resolve(_oinvoke.partnerLink),
+                    _oinvoke.operation, outboundMsg, null);
                 _self.parent.completed(faultData, CompensationHandler.emptySet());
 
             } else /* two-way */{
-                final VariableInstance outputVar = _scopeFrame
-                        .resolve(_oinvoke.outputVar);
+                final VariableInstance outputVar = _scopeFrame.resolve(_oinvoke.outputVar);
                 InvokeResponseChannel invokeResponseChannel = newChannel(InvokeResponseChannel.class);
 
                 final String mexId = getBpelRuntimeContext().invoke(
-                        _scopeFrame.resolve(_oinvoke.partnerLink), _oinvoke.operation,
-                        outboundMsg,
-                        invokeResponseChannel);
+                    _scopeFrame.resolve(_oinvoke.partnerLink), _oinvoke.operation,
+                    outboundMsg, invokeResponseChannel);
 
                 object(new InvokeResponseChannelListener(invokeResponseChannel) {
                     private static final long serialVersionUID = 4496880438819196765L;
@@ -114,11 +107,12 @@
                         Element response;
                         try {
                             response = getBpelRuntimeContext().getPartnerResponse(mexId);
-                        } catch (Exception ex) {
+                        } catch (Exception e) {
+                            __log.error(e);
                             // TODO: Better error handling
-                            throw new RuntimeException(ex);
+                            throw new RuntimeException(e);
                         }
-
+                       
                         getBpelRuntimeContext().initializeVariable(outputVar, response);
 
                         try {
@@ -129,22 +123,21 @@
                                 // Trying to initialize partner epr based on a message-provided epr/session.
                                 if (!getBpelRuntimeContext().isPartnerRoleEndpointInitialized(_scopeFrame
                                         .resolve(_oinvoke.partnerLink))) {
-
+                    
                                     Node fromEpr = getBpelRuntimeContext().getSourceEPR(mexId);
                                     if (fromEpr != null) {
                                         getBpelRuntimeContext().writeEndpointReference(
-                                                _scopeFrame.resolve(_oinvoke.partnerLink), (Element) fromEpr);
+                                            _scopeFrame.resolve(_oinvoke.partnerLink), (Element) fromEpr);
                                     }
-                                }
-
+                                }                    
+                                
                                 String partnersSessionId = getBpelRuntimeContext().getSourceSessionId(mexId);
                                 if (partnersSessionId != null)
                                     getBpelRuntimeContext().initializePartnersSessionId(_scopeFrame.resolve(_oinvoke.partnerLink),
-                                            partnersSessionId);
-
+                                        partnersSessionId);
+                                
                             }
                         } catch (FaultException e) {
-                            __log.error(e);
                             fault = createFault(e.getQName(), _oinvoke);
                         }
 
@@ -156,10 +149,9 @@
                     public void onFault() {
                         QName faultName = getBpelRuntimeContext().getPartnerFault(mexId);
                         Element msg = getBpelRuntimeContext().getPartnerResponse(mexId);
-                        QName msgType = getBpelRuntimeContext().getPartnerResponseType(
-                                mexId);
+                        QName msgType = getBpelRuntimeContext().getPartnerResponseType(mexId);
                         FaultData fault = createFault(faultName, msg,
-                                _oinvoke.getOwner().messageTypes.get(msgType), _self.o);
+                            _oinvoke.getOwner().messageTypes.get(msgType), _self.o);
                         _self.parent.completed(fault, CompensationHandler.emptySet());
                     }
 
@@ -174,15 +166,13 @@
             }
         } catch (FaultException fault) {
             __log.error(fault);
-            FaultData faultData = createFault(fault.getQName(), _oinvoke, fault
-                    .getMessage());
+            FaultData faultData = createFault(fault.getQName(), _oinvoke, fault.getMessage());
             _self.parent.completed(faultData, CompensationHandler.emptySet());
         }
     }
 
-    private Element setupOutbound(OInvoke oinvoke,
-                                  Collection<OScope.CorrelationSet> outboundInitiations)
-            throws FaultException {
+    private Element setupOutbound(OInvoke oinvoke, Collection<OScope.CorrelationSet> outboundInitiations)
+        throws FaultException {
         if (outboundInitiations.size() > 0) {
             for (OScope.CorrelationSet c : outboundInitiations) {
                 initializeCorrelation(_scopeFrame.resolve(c), _scopeFrame.resolve(oinvoke.inputVar));
@@ -190,12 +180,10 @@
         }
 
         Node outboundMsg = getBpelRuntimeContext().fetchVariableData(
-                _scopeFrame.resolve(oinvoke.inputVar), false);
+            _scopeFrame.resolve(oinvoke.inputVar), false);
 
-        // TODO outbound message should be updated with non-initiate correlation
-        // sets
+        // TODO outbound message should be updated with non-initiate correlation sets
         assert outboundMsg instanceof Element;
-
         return (Element) outboundMsg;
     }
 
@@ -206,16 +194,20 @@
 
         if (_self.getFailureHandling().faultOnFailure) {
             // No attempt to retry or enter activity recovery state, simply fault.
+            if (__log.isDebugEnabled())
+                __log.debug("ActivityRecovery: Invoke activity " + _self.aId + " faulting on failure");
             FaultData faultData = createFault(FailureHandling.FAILURE_FAULT_NAME, _oinvoke, reason);
             _self.parent.completed(faultData, CompensationHandler.emptySet());
             return;
         }
-        // If maximum number of retries, enter activity recovery state.
+        // If maximum number of retries, enter activity recovery state.  
         if (_invoked > _self.getFailureHandling().retryFor) {
             requireRecovery();
             return;
         }
-
+        
+        if (__log.isDebugEnabled())
+            __log.debug("ActivityRecovery: Retrying invoke activity " + _self.aId);
         Date future = new Date(new Date().getTime() + (_self.getFailureHandling().retryDelay * 1000));
         final TimerResponseChannel timerChannel = newChannel(TimerResponseChannel.class);
         getBpelRuntimeContext().registerTimer(timerChannel, future);
@@ -238,31 +230,40 @@
     }
 
     private void requireRecovery() {
+        if (__log.isDebugEnabled())
+            __log.debug("ActivityRecovery: Invoke activity " + _self.aId + " requires recovery");
         sendEvent(new ActivityFailureEvent(_failureReason));
         final ActivityRecoveryChannel recoveryChannel = newChannel(ActivityRecoveryChannel.class);
         getBpelRuntimeContext().registerActivityForRecovery(recoveryChannel, _self.aId, _failureReason, _lastFailure, _failureData,
-                new String[] { "retry", "cancel", "fault" }, _invoked - 1);
+            new String[] { "retry", "cancel", "fault" }, _invoked - 1);
         object(false, new ActivityRecoveryChannelListener(recoveryChannel) {
             public void retry() {
+                if (__log.isDebugEnabled())
+                    __log.debug("ActivityRecovery: Retrying invoke activity " + _self.aId + " (user initiated)");
                 sendEvent(new ActivityRecoveryEvent("retry"));
                 getBpelRuntimeContext().unregisterActivityForRecovery(recoveryChannel);
                 instance(INVOKE.this);
             }
             public void cancel() {
+                if (__log.isDebugEnabled())
+                    __log.debug("ActivityRecovery: Cancelling invoke activity " + _self.aId + " (user initiated)");
                 sendEvent(new ActivityRecoveryEvent("cancel"));
                 getBpelRuntimeContext().unregisterActivityForRecovery(recoveryChannel);
                 _self.parent.completed(null, CompensationHandler.emptySet());
             }
             public void fault(FaultData faultData) {
+                if (__log.isDebugEnabled())
+                    __log.debug("ActivityRecovery: Faulting invoke activity " + _self.aId + " (user initiated)");
                 sendEvent(new ActivityRecoveryEvent("fault"));
                 getBpelRuntimeContext().unregisterActivityForRecovery(recoveryChannel);
-                // TODO: real fault name.
                 if (faultData == null)
-                    faultData = createFault(FailureHandling.FAILURE_FAULT_NAME, _self.o, _failureReason);
+                  faultData = createFault(FailureHandling.FAILURE_FAULT_NAME, _self.o, _failureReason);
                 _self.parent.completed(faultData, CompensationHandler.emptySet());
             }
         }.or(new TerminationChannelListener(_self.self) {
             public void terminate() {
+                if (__log.isDebugEnabled())
+                    __log.debug("ActivityRecovery: Cancelling invoke activity " + _self.aId + " (terminated by scope)");
                 getBpelRuntimeContext().unregisterActivityForRecovery(recoveryChannel);
                 _self.parent.completed(null, CompensationHandler.emptySet());
             }

Modified: incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/channels/ActivityRecovery.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/channels/ActivityRecovery.java?view=diff&rev=453417&r1=453416&r2=453417
==============================================================================
--- incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/channels/ActivityRecovery.java (original)
+++ incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/channels/ActivityRecovery.java Thu Oct  5 16:00:28 2006
@@ -24,19 +24,19 @@
  */
 public interface ActivityRecovery  {
 
-  /**
-   * Retry the activity.
-   */
-  void retry();
+    /**
+     * Retry the activity.
+     */
+    void retry();
 
-  /**
-   * Cancel (skip) the activity.
-   */
-  void cancel();
+    /**
+     * Cancel the activity (unsuccessful completion).
+     */
+    void cancel();
 
-  /**
-   * Fault the activity.
-   */
-  void fault(FaultData faultData);
+    /**
+     * Fault the activity. Fault data is optional.
+     */
+    void fault(FaultData faultData);
 
 }

Modified: incubator/ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/ActivityRecoveryTest.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/ActivityRecoveryTest.java?view=diff&rev=453417&r1=453416&r2=453417
==============================================================================
--- incubator/ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/ActivityRecoveryTest.java (original)
+++ incubator/ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/ActivityRecoveryTest.java Thu Oct  5 16:00:28 2006
@@ -53,187 +53,187 @@
  */
 public class ActivityRecoveryTest extends TestCase {
 
-  static final String   NAMESPACE = "http://ode.apache.org/bpel/unit-test";
-  static final String[] ACTIONS = new String[]{ "retry", "cancel", "fault" };
-  int                   _invoked;
-  int                   _failFor;
-  MockBpelServer        _server;
-  BpelManagementFacade  _management;
-
-  public void testSuccessfulInvoke() throws Exception { 
-    execute("FailureToRecovery", 0);
-    assertCompleted(true, 1, null);
-  }
-
-  public void testInvokeAndRetry() throws Exception {
-    execute("FailureToRecovery", 2);
-    assertCompleted(true, 3, null);
-  }
-
-  public void testRetryRecoveryAction() throws Exception {
-    execute("FailureToRecovery", 4);
-    assertRecovery(3, ACTIONS);
-    recover("retry");
-    assertRecovery(4, ACTIONS);
-    recover("retry");
-    assertCompleted(true, 5, null);
-  }
-
-  public void testCancelRecoveryAction() throws Exception {
-    execute("FailureToRecovery", 4);
-    assertRecovery(3, ACTIONS);
-    recover("retry");
-    assertRecovery(4, ACTIONS);
-    recover("cancel");
-    assertCompleted(true, 4, null);
-  }
-
-  public void testFaultRecoveryAction() throws Exception {
-    execute("FailureToRecovery", 4);
-    assertRecovery(3, ACTIONS);
-    recover("retry");
-    assertRecovery(4, ACTIONS);
-    recover("fault");
-    assertCompleted(false, 4, FailureHandling.FAILURE_FAULT_NAME);
-  }
-
-  public void testImmediateFailure() throws Exception {
-    execute("FailureNoRetry", 1);
-    assertRecovery(1, ACTIONS);
-  }
-
-  public void testImmediateFault() throws Exception {
-    execute("FailureToFault", 2);
-    assertCompleted(false, 1, FailureHandling.FAILURE_FAULT_NAME);
-  }
-
-  public void testInheritence() throws Exception {
-    execute("FailureInheritence", 2);
-    assertCompleted(true, 3, null);
-  }
-
-  protected void setUp() throws Exception {
-    _server = new MockBpelServer() {
-      protected MessageExchangeContext createMessageExchangeContext() {
-        return new MessageExchangeContext() {
-
-          public void invokePartner(final PartnerRoleMessageExchange mex) throws ContextException {
-            ++_invoked;
-            if (_invoked > _failFor) {
-              Message response = mex.createMessage(mex.getOperation().getOutput().getMessage().getQName());
-              response.setMessage(DOMUtils.newDocument().createElementNS(NAMESPACE, "tns:ResponseElement"));
-              mex.reply(response);
-            } else
-              mex.replyWithFailure(MessageExchange.FailureType.COMMUNICATION_ERROR, "Bang", null);
-              //mex.replyWithFailure(FailureType, String, Element);
-          }
+    static final String   NAMESPACE = "http://ode.apache.org/bpel/unit-test";
+    static final String[] ACTIONS = new String[]{ "retry", "cancel", "fault" };
+    int                   _invoked;
+    int                   _failFor;
+    MockBpelServer        _server;
+    BpelManagementFacade  _management;
+
+    public void testSuccessfulInvoke() throws Exception { 
+        execute("FailureToRecovery", 0);
+        assertCompleted(true, 1, null);
+    }
+
+    public void testInvokeAndRetry() throws Exception {
+        execute("FailureToRecovery", 2);
+        assertCompleted(true, 3, null);
+    }
+
+    public void testRetryRecoveryAction() throws Exception {
+        execute("FailureToRecovery", 4);
+        assertRecovery(3, ACTIONS);
+        recover("retry");
+        assertRecovery(4, ACTIONS);
+        recover("retry");
+        assertCompleted(true, 5, null);
+    }
+
+    public void testCancelRecoveryAction() throws Exception {
+        execute("FailureToRecovery", 4);
+        assertRecovery(3, ACTIONS);
+        recover("retry");
+        assertRecovery(4, ACTIONS);
+        recover("cancel");
+        assertCompleted(true, 4, null);
+    }
 
-          public void onAsyncReply(MyRoleMessageExchange myRoleMex) { }
+    public void testFaultRecoveryAction() throws Exception {
+        execute("FailureToRecovery", 4);
+        assertRecovery(3, ACTIONS);
+        recover("retry");
+        assertRecovery(4, ACTIONS);
+        recover("fault");
+        assertCompleted(false, 4, FailureHandling.FAILURE_FAULT_NAME);
+    }
+
+    public void testImmediateFailure() throws Exception {
+        execute("FailureNoRetry", 1);
+        assertRecovery(1, ACTIONS);
+    }
+
+    public void testImmediateFault() throws Exception {
+        execute("FailureToFault", 2);
+        assertCompleted(false, 1, FailureHandling.FAILURE_FAULT_NAME);
+    }
+
+    public void testInheritence() throws Exception {
+        execute("FailureInheritence", 2);
+        assertCompleted(true, 3, null);
+    }
+
+    protected void setUp() throws Exception {
+        _server = new MockBpelServer() {
+            protected MessageExchangeContext createMessageExchangeContext() {
+                return new MessageExchangeContext() {
+
+                    public void invokePartner(final PartnerRoleMessageExchange mex) throws ContextException {
+                        ++_invoked;
+                        if (_invoked > _failFor) {
+                            Message response = mex.createMessage(mex.getOperation().getOutput().getMessage().getQName());
+                            response.setMessage(DOMUtils.newDocument().createElementNS(NAMESPACE, "tns:ResponseElement"));
+                            mex.reply(response);
+                        } else
+                            mex.replyWithFailure(MessageExchange.FailureType.COMMUNICATION_ERROR, "BangGoesInvoke", null);
+                            //mex.replyWithFailure(FailureType, String, Element);
+                    }
+
+                    public void onAsyncReply(MyRoleMessageExchange myRoleMex) { }
+                };
+            }
         };
-      }
-    };
-    _server.deploy(new File(new URI(this.getClass().getResource("/recovery").toString())));
-    _management = _server.getBpelManagementFacade();
-  }
-
-  protected void tearDown() throws Exception {
-    _server.getBpelManagementFacade().delete(null);
-    _server.shutdown();
-  }
-
-  /**
-   * Call this to execute the process so it fails the specified number of times.
-   * Returns when the process has either completed, or waiting for recovery to happen.
-   */
-  protected void execute(String process, int failFor) throws Exception {
-    _failFor = failFor;
-    _server.getBpelManagementFacade().delete(null);
-    _server.invoke(new QName(NAMESPACE, process), "instantiate",
-                   DOMUtils.newDocument().createElementNS(NAMESPACE, "tns:RequestElement"));
-    _server.waitForBlocking();
-  }
-
-  /**
-   * Asserts that the process has completed, successfully or not. If not,
-   * it is either terminated, or faulted with the specified fault name.
-   * This method also checks how many time the process invoked the service.
-   */
-  protected void assertCompleted(boolean successful, int invoked, QName faultName) {
-    assertTrue(_invoked == invoked);
-    TInstanceInfo instance = _management.listAllInstances().getInstanceInfoList().getInstanceInfoArray(0);
-    TInstanceInfo.Failures failures = instance.getFailures();
-    assertTrue(failures == null || failures.getCount() == 0);
-    if (successful) {
-      assertTrue(instance.getStatus() == TInstanceStatus.COMPLETED);
-    } else if (faultName == null) {
-      assertTrue(instance.getStatus() == TInstanceStatus.TERMINATED);
-    } else {
-      assertTrue(instance.getStatus() == TInstanceStatus.FAILED);
-      TFaultInfo faultInfo = instance.getFaultInfo();
-      assertTrue(faultInfo != null && faultInfo.getName().equals(faultName));
-    }
-  }
-
-  /**
-   * Asserts that the process has one activity in the recovery state.
-   */
-  protected void assertRecovery(int invoked, String[] actions) {
-    // Test in aggregate to see how many activities we have in this state.
-    TInstanceInfo instance = _management.listAllInstances().getInstanceInfoList().getInstanceInfoArray(0);
-    TInstanceInfo.Failures failures = instance.getFailures();
-    assertTrue(failures != null && failures.getCount() == 1);
-    // Look for individual activities inside the process instance.
-    TScopeInfo rootScope = _management.getScopeInfoWithActivity(instance.getRootScope().getSiid(), true).getScopeInfo();
-    ArrayList<TActivityInfo> recoveries = getRecoveriesInScope(instance, null, null);
-    assertTrue(recoveries.size() == 1);
-    TActivityInfo.Failure failure = recoveries.get(0).getFailure();
-    assertTrue(failure.getRetries() == invoked - 1);
-    assertTrue(failure.getReason().equals("Bang"));
-    assertTrue(failure.getDtFailure().getTime().getTime() / 100000 == System.currentTimeMillis() / 100000);
-    java.util.HashSet<String> actionSet = new java.util.HashSet<String>();
-    for (String action : failure.getActions().split(" "))
-      actionSet.add(action);
-    for (String action : actions)
-      assertTrue(actionSet.remove(action));
-  }
-
-  /**
-   * Performs the specified recovery action. Also asserts that there is one
-   * recovery channel for the activity in question.
-   */
-  protected void recover(String action) {
-    TInstanceInfo instance = _management.listAllInstances().getInstanceInfoList().getInstanceInfoArray(0);
-    ArrayList<TActivityInfo> recoveries = getRecoveriesInScope(instance, null, null);
-    assertTrue(recoveries.size() == 1);
-    TActivityInfo activity = recoveries.get(0);
-    assertNotNull(activity);
-    _management.recoverActivity(Long.valueOf(instance.getIid()), Long.valueOf(activity.getAiid()), action);
-    _server.waitForBlocking();
-  }
-
-  protected ArrayList<TActivityInfo> getRecoveriesInScope(TInstanceInfo instance, TScopeInfo scope,
-                                                          ArrayList<TActivityInfo> recoveries) {
-    if (instance == null)
-      instance = _management.listAllInstances().getInstanceInfoList().getInstanceInfoArray(0);
-    if (scope == null)
-      scope = _management.getScopeInfoWithActivity(instance.getRootScope().getSiid(), true).getScopeInfo();
-    if (recoveries == null)
-      recoveries = new ArrayList<TActivityInfo>();
-    TScopeInfo.Activities activities = scope.getActivities();
-    for (int i = 0; i < activities.sizeOfActivityInfoArray(); ++i) {
-      TActivityInfo activity = activities.getActivityInfoArray(i);
-      if (activity.getStatus() == TActivityStatus.FAILURE) {
-        assertNotNull(activity.getFailure());
-        recoveries.add(activity);
-      } else
-        assertNull(activity.getFailure());
-    }
-    for (TScopeRef ref : scope.getChildren().getChildRefList()) {
-      TScopeInfo child = _server.getBpelManagementFacade().getScopeInfoWithActivity(ref.getSiid(), true).getScopeInfo();
-      if (child != null)
-        getRecoveriesInScope(instance, child, recoveries);
+        _server.deploy(new File(new URI(this.getClass().getResource("/recovery").toString())));
+        _management = _server.getBpelManagementFacade();
+    }
+
+    protected void tearDown() throws Exception {
+        _server.getBpelManagementFacade().delete(null);
+        _server.shutdown();
+    }
+
+    /**
+     * Call this to execute the process so it fails the specified number of times.
+     * Returns when the process has either completed, or waiting for recovery to happen.
+     */
+    protected void execute(String process, int failFor) throws Exception {
+        _failFor = failFor;
+        _server.getBpelManagementFacade().delete(null);
+        _server.invoke(new QName(NAMESPACE, process), "instantiate",
+                       DOMUtils.newDocument().createElementNS(NAMESPACE, "tns:RequestElement"));
+        _server.waitForBlocking();
+    }
+
+    /**
+     * Asserts that the process has completed, successfully or not. If not,
+     * it is either terminated, or faulted with the specified fault name.
+     * This method also checks how many time the process invoked the service.
+     */
+    protected void assertCompleted(boolean successful, int invoked, QName faultName) {
+        assertTrue(_invoked == invoked);
+        TInstanceInfo instance = _management.listAllInstances().getInstanceInfoList().getInstanceInfoArray(0);
+        TInstanceInfo.Failures failures = instance.getFailures();
+        assertTrue(failures == null || failures.getCount() == 0);
+        if (successful) {
+            assertTrue(instance.getStatus() == TInstanceStatus.COMPLETED);
+        } else if (faultName == null) {
+            assertTrue(instance.getStatus() == TInstanceStatus.TERMINATED);
+        } else {
+            assertTrue(instance.getStatus() == TInstanceStatus.FAILED);
+            TFaultInfo faultInfo = instance.getFaultInfo();
+            assertTrue(faultInfo != null && faultInfo.getName().equals(faultName));
+        }
+    }
+
+    /**
+     * Asserts that the process has one activity in the recovery state.
+     */
+    protected void assertRecovery(int invoked, String[] actions) {
+        // Test in aggregate to see how many activities we have in this state.
+        TInstanceInfo instance = _management.listAllInstances().getInstanceInfoList().getInstanceInfoArray(0);
+        TInstanceInfo.Failures failures = instance.getFailures();
+        assertTrue(failures != null && failures.getCount() == 1);
+        // Look for individual activities inside the process instance.
+        TScopeInfo rootScope = _management.getScopeInfoWithActivity(instance.getRootScope().getSiid(), true).getScopeInfo();
+        ArrayList<TActivityInfo> recoveries = getRecoveriesInScope(instance, null, null);
+        assertTrue(recoveries.size() == 1);
+        TActivityInfo.Failure failure = recoveries.get(0).getFailure();
+        assertTrue(failure.getRetries() == invoked - 1);
+        assertTrue(failure.getReason().equals("BangGoesInvoke"));
+        assertTrue(failure.getDtFailure().getTime().getTime() / 100000 == System.currentTimeMillis() / 100000);
+        java.util.HashSet<String> actionSet = new java.util.HashSet<String>();
+        for (String action : failure.getActions().split(" "))
+            actionSet.add(action);
+        for (String action : actions)
+            assertTrue(actionSet.remove(action));
+    }
+
+    /**
+     * Performs the specified recovery action. Also asserts that there is one
+     * recovery channel for the activity in question.
+     */
+    protected void recover(String action) {
+        TInstanceInfo instance = _management.listAllInstances().getInstanceInfoList().getInstanceInfoArray(0);
+        ArrayList<TActivityInfo> recoveries = getRecoveriesInScope(instance, null, null);
+        assertTrue(recoveries.size() == 1);
+        TActivityInfo activity = recoveries.get(0);
+        assertNotNull(activity);
+        _management.recoverActivity(Long.valueOf(instance.getIid()), Long.valueOf(activity.getAiid()), action);
+        _server.waitForBlocking();
+    }
+
+    protected ArrayList<TActivityInfo> getRecoveriesInScope(TInstanceInfo instance, TScopeInfo scope,
+                                                            ArrayList<TActivityInfo> recoveries) {
+        if (instance == null)
+            instance = _management.listAllInstances().getInstanceInfoList().getInstanceInfoArray(0);
+        if (scope == null)
+            scope = _management.getScopeInfoWithActivity(instance.getRootScope().getSiid(), true).getScopeInfo();
+        if (recoveries == null)
+            recoveries = new ArrayList<TActivityInfo>();
+        TScopeInfo.Activities activities = scope.getActivities();
+        for (int i = 0; i < activities.sizeOfActivityInfoArray(); ++i) {
+            TActivityInfo activity = activities.getActivityInfoArray(i);
+            if (activity.getStatus() == TActivityStatus.FAILURE) {
+                assertNotNull(activity.getFailure());
+                recoveries.add(activity);
+            } else
+                assertNull(activity.getFailure());
+        }
+        for (TScopeRef ref : scope.getChildren().getChildRefList()) {
+            TScopeInfo child = _server.getBpelManagementFacade().getScopeInfoWithActivity(ref.getSiid(), true).getScopeInfo();
+            if (child != null)
+                getRecoveriesInScope(instance, child, recoveries);
+        }
+        return recoveries;
     }
-    return recoveries;
-  }
 
 }

Modified: incubator/ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/CoreBpelTest.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/CoreBpelTest.java?view=diff&rev=453417&r1=453416&r2=453417
==============================================================================
--- incubator/ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/CoreBpelTest.java (original)
+++ incubator/ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/CoreBpelTest.java Thu Oct  5 16:00:28 2006
@@ -397,7 +397,7 @@
     public void unregisterActivityForRecovery(ActivityRecoveryChannel channel) {
     }
 
-    public void recoverActivity(final String channel, final String action, final FaultData fault) {
+    public void recoverActivity(String channel, long activityId, String action, FaultData fault) {
     }
 
     public String getPartnerFaultExplanation(String mexid) {

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=453417&r1=453416&r2=453417
==============================================================================
--- 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 Oct  5 16:00:28 2006
@@ -76,326 +76,289 @@
 
 class MockBpelServer {
 
-  BpelServerImpl            _server;
-  TransactionManager        _txManager;
-  Jotm                      _jotm;
-  MinervaPool               _minervaPool;
-  DataSource                _dataSource;
-  SchedulerWrapper          _scheduler;
-  BpelDAOConnectionFactory  _daoCF;
-  EndpointReferenceContext  _eprContext;
-  MessageExchangeContext    _mexContext;
-  BindingContext            _bindContext;
-  HashMap<String, QName>    _activated = new HashMap();
-  HashMap                   _endpoints = new HashMap();
-
-
-  public MockBpelServer() {
-    try {
-      _server = new BpelServerImpl();
-      createTransactionManager();
-      createDataSource();
-      createDAOConnection();
-      createScheduler();
-
-      if (_daoCF == null)
-        throw new RuntimeException("No DAO");
-      _server.setDaoConnectionFactory(_daoCF);
-      if (_scheduler == null)
-        throw new RuntimeException("No scheduler");
-      _server.setScheduler(_scheduler);
-      _server.setEndpointReferenceContext(createEndpointReferenceContext());
-      _server.setMessageExchangeContext(createMessageExchangeContext());
-      _server.setBindingContext(createBindingContext());
-      _server.setDeployDir("processes");
-      _server.init();
-      _server.start();
-    } catch (Exception except) {
-      System.err.println(except.getMessage());
-      except.printStackTrace(System.err);
-      throw new RuntimeException(except);
-    }
-  }
-
-  public Collection<QName> deploy(File deploymentUnitDirectory) {
-    Collection<QName> pids = _server.deploy(deploymentUnitDirectory);
-    for (QName pid: pids)
-      _server.activate(pid, true);
-    return pids;
-  }
-
-  public void invoke(QName serviceName, String opName, Element body) throws Exception {
-    try {
-      String messageId = new GUID().toString();
-      MyRoleMessageExchange mex;
-
-      _txManager.begin();
-      mex = _server.getEngine().createMessageExchange("" + messageId, serviceName, opName);
-      if (mex.getOperation() == null)
-        throw new Exception("Did not find operation " + opName + " on service " + serviceName);
-      Message request = mex.createMessage(mex.getOperation().getInput().getMessage().getQName());
-      request.setMessage(body);
-      mex.invoke(request);
-      mex.complete();
-      _txManager.commit();
-    } catch (Exception except) {
-      _txManager.rollback();
-      throw except;
-    }
-/*
-        // Preparing a callback just in case we would need one.
-        if (odeMex.getOperation().getOutput() != null) {
-          callback = new ResponseCallback();
-          _waitingCallbacks.put(odeMex.getClientId(), callback);
+    BpelServerImpl            _server;
+    TransactionManager        _txManager;
+    Jotm                      _jotm;
+    MinervaPool               _minervaPool;
+    DataSource                _dataSource;
+    SchedulerWrapper          _scheduler;
+    BpelDAOConnectionFactory  _daoCF;
+    EndpointReferenceContext  _eprContext;
+    MessageExchangeContext    _mexContext;
+    BindingContext            _bindContext;
+    HashMap<String, QName>    _activated = new HashMap();
+    HashMap                   _endpoints = new HashMap();
+
+    public MockBpelServer() {
+        try {
+            _server = new BpelServerImpl();
+            createTransactionManager();
+            createDataSource();
+            createDAOConnection();
+            createScheduler();
+
+            if (_daoCF == null)
+                throw new RuntimeException("No DAO");
+            _server.setDaoConnectionFactory(_daoCF);
+            if (_scheduler == null)
+                throw new RuntimeException("No scheduler");
+            _server.setScheduler(_scheduler);
+            _server.setEndpointReferenceContext(createEndpointReferenceContext());
+            _server.setMessageExchangeContext(createMessageExchangeContext());
+            _server.setBindingContext(createBindingContext());
+            _server.setDeployDir("processes");
+            _server.init();
+            _server.start();
+        } catch (Exception except) {
+            System.err.println(except.getMessage());
+            except.printStackTrace(System.err);
+            throw new RuntimeException(except);
         }
+    }
 
-        if (__log.isDebugEnabled()) {
-          __log.debug("Invoking ODE using MEX " + odeMex);
-          __log.debug("Message content:  " + DOMUtils.domToString(odeRequest.getMessage()));
+    public Collection<QName> deploy(File deploymentUnitDirectory) {
+        Collection<QName> pids = _server.deploy(deploymentUnitDirectory);
+        for (QName pid: pids)
+            _server.activate(pid, true);
+        return pids;
+    }
+
+    public void invoke(QName serviceName, String opName, Element body) throws Exception {
+        try {
+            String messageId = new GUID().toString();
+            MyRoleMessageExchange mex;
+
+            _txManager.begin();
+            mex = _server.getEngine().createMessageExchange("" + messageId, serviceName, opName);
+            if (mex.getOperation() == null)
+                throw new Exception("Did not find operation " + opName + " on service " + serviceName);
+            Message request = mex.createMessage(mex.getOperation().getInput().getMessage().getQName());
+            request.setMessage(body);
+            mex.invoke(request);
+            mex.complete();
+            _txManager.commit();
+        } catch (Exception except) {
+              _txManager.rollback();
+              throw except;
         }
-        // Invoking ODE
-        odeMex.invoke(odeRequest);
-      } else {
-        success = false;
-      }
-*/
-  }
-
-  public BpelManagementFacade getBpelManagementFacade() {
-    return _server.getBpelManagementFacade();
-  }
-
-  public TransactionManager getTransactionManager() {
-    return _txManager;
-  }
-
-  public void waitForBlocking() {
-    try {
-      long delay = 1000;
-      while (true) {
-        // Be warned: ugly hack and not safe for slow CPUs.
-        long cutoff = System.currentTimeMillis() - delay;
-        if (_scheduler._nextSchedule < cutoff)
-          break;
-        Thread.sleep(delay);
-      }
-    } catch (InterruptedException except) { }
-  }
-
-  public void shutdown() throws Exception {
-    _server.stop();
-    _scheduler.stop();
-    _scheduler.shutdown();
-    _jotm.stop();
-  }
-
-  protected TransactionManager createTransactionManager() throws Exception {
-    _jotm = new Jotm(true, false);
-    _txManager = _jotm.getTransactionManager();
-    _txManager.setTransactionTimeout(30);
-    Reference txm = new Reference("javax.transaction.TransactionManager",
-                                  JotmTransactionManagerFactory.class.getName(), null);
-    System.setProperty(Context.INITIAL_CONTEXT_FACTORY,
-                       InMemoryContextFactory.class.getName());
-    System.setProperty(Context.PROVIDER_URL, "pxe");
-    InitialContext ctx = new InitialContext();
-    ctx.rebind("TransactionManager", txm);
-    ctx.close();
-    return _txManager;
-  }
-
-  protected DataSource createDataSource() throws Exception {
-    if (_txManager == null)
-      throw new RuntimeException("No transaction manager");
-    String url = "jdbc:derby:target/test-classes/derby-db/data";
-    _minervaPool = new MinervaPool();
-    _minervaPool.setTransactionManager(_txManager);
-    _minervaPool.getConnectionFactory().setConnectionURL(url);
-    _minervaPool.getConnectionFactory().setUserName("sa");
-    _minervaPool.getConnectionFactory().setDriver(org.apache.derby.jdbc.EmbeddedDriver.class.getName());
-    _minervaPool.getPoolParams().minSize = 0;
-    _minervaPool.getPoolParams().maxSize = 10;
-    _minervaPool.setType(MinervaPool.PoolType.MANAGED);
-    _minervaPool.start();
-    _dataSource = _minervaPool.createDataSource();
-    return _dataSource;
-  }
-
-  protected Scheduler createScheduler() throws Exception {
-    if (_server == null)
-      throw new RuntimeException("No BPEL server");
-    if (_txManager == null)
-      throw new RuntimeException("No transaction manager");
-    if (_dataSource == null)
-      throw new RuntimeException("No data source");
-    _scheduler = new SchedulerWrapper(_server, _txManager, _dataSource);
-    return _scheduler;
-  }
-
-  protected BpelDAOConnectionFactory createDAOConnection() throws Exception {
-    if (_txManager == null)
-      throw new RuntimeException("No transaction manager");
-    if (_dataSource == null)
-      throw new RuntimeException("No data source");
-    Properties properties = new Properties();
-    properties.put(Environment.CONNECTION_PROVIDER,
-                   DataSourceConnectionProvider.class.getName());
-    properties.put(Environment.TRANSACTION_MANAGER_STRATEGY,
-                   HibernateTransactionManagerLookup.class.getName());
-    properties.put(Environment.SESSION_FACTORY_NAME, "jta");
-    properties.put(Environment.DIALECT, "org.hibernate.dialect.DerbyDialect");
-    SessionManager sm = new SessionManager(properties, _dataSource, _txManager);
-    _daoCF = new BpelDAOConnectionFactoryImpl(sm);
-    Reference bpelSscfRef = new Reference(BpelDAOConnectionFactory.class.getName(),
-                                          HibernateDaoObjectFactory.class.getName(), null);
-    InitialContext ctx = new InitialContext();
-    ctx.rebind("bpelSSCF", bpelSscfRef);
-    ctx.close();
-    return _daoCF;
-  }
-
-  protected EndpointReferenceContext createEndpointReferenceContext() {
-    _eprContext = new EndpointReferenceContext() {
-      public EndpointReference resolveEndpointReference(Element element) { 
-        String service = DOMUtils.getChildCharacterData(element);
-        return (EndpointReference)_endpoints.get(service);
-      }
-      public EndpointReference convertEndpoint(QName qName, Element element) { return null; }
-    };
-    return _eprContext;
-  }
-
-  protected MessageExchangeContext createMessageExchangeContext() {
-   _mexContext =  new MessageExchangeContext() {
-      public void invokePartner(PartnerRoleMessageExchange mex) { }
-      public void onAsyncReply(MyRoleMessageExchange myRoleMex) { }
-    };
-    return _mexContext;
-  }
-
-  protected BindingContext createBindingContext() {
-    _bindContext = new BindingContext() {
-      public EndpointReference activateMyRoleEndpoint(QName processId, DeploymentUnit deploymentUnit, Endpoint myRoleEndpoint, PortType portType) {
-        final Document doc = DOMUtils.newDocument();
-        Element serviceRef = doc.createElementNS(EndpointReference.SERVICE_REF_QNAME.getNamespaceURI(),
-          EndpointReference.SERVICE_REF_QNAME.getLocalPart());
-        serviceRef.appendChild(doc.createTextNode(myRoleEndpoint.serviceName.toString()));
-        doc.appendChild(serviceRef);
-        _activated.put(myRoleEndpoint.toString(), processId);
-        return new EndpointReference() {
-          public Document toXML() {
-            return doc;
-          }
+    }
+
+    public BpelManagementFacade getBpelManagementFacade() {
+        return _server.getBpelManagementFacade();
+    }
+
+    public TransactionManager getTransactionManager() {
+        return _txManager;
+    }
+
+    public void waitForBlocking() {
+        try {
+            long delay = 1000;
+            while (true) {
+                // Be warned: ugly hack and not safe for slow CPUs.
+                long cutoff = System.currentTimeMillis() - delay;
+                if (_scheduler._nextSchedule < cutoff)
+                    break;
+                Thread.sleep(delay);
+            }
+        } catch (InterruptedException except) { }
+    }
+
+    public void shutdown() throws Exception {
+        _server.stop();
+        _scheduler.stop();
+        _scheduler.shutdown();
+        _jotm.stop();
+    }
+
+    protected TransactionManager createTransactionManager() throws Exception {
+        _jotm = new Jotm(true, false);
+        _txManager = _jotm.getTransactionManager();
+        _txManager.setTransactionTimeout(30);
+        Reference txm = new Reference("javax.transaction.TransactionManager",
+                                      JotmTransactionManagerFactory.class.getName(), null);
+        System.setProperty(Context.INITIAL_CONTEXT_FACTORY,
+                           InMemoryContextFactory.class.getName());
+        System.setProperty(Context.PROVIDER_URL, "pxe");
+        InitialContext ctx = new InitialContext();
+        ctx.rebind("TransactionManager", txm);
+        ctx.close();
+        return _txManager;
+    }
+
+    protected DataSource createDataSource() throws Exception {
+        if (_txManager == null)
+            throw new RuntimeException("No transaction manager");
+        String url = "jdbc:derby:target/test-classes/derby-db/data";
+        _minervaPool = new MinervaPool();
+        _minervaPool.setTransactionManager(_txManager);
+        _minervaPool.getConnectionFactory().setConnectionURL(url);
+        _minervaPool.getConnectionFactory().setUserName("sa");
+        _minervaPool.getConnectionFactory().setDriver(org.apache.derby.jdbc.EmbeddedDriver.class.getName());
+        _minervaPool.getPoolParams().minSize = 0;
+        _minervaPool.getPoolParams().maxSize = 10;
+        _minervaPool.setType(MinervaPool.PoolType.MANAGED);
+        _minervaPool.start();
+        _dataSource = _minervaPool.createDataSource();
+        return _dataSource;
+    }
+
+    protected Scheduler createScheduler() throws Exception {
+        if (_server == null)
+            throw new RuntimeException("No BPEL server");
+        if (_txManager == null)
+            throw new RuntimeException("No transaction manager");
+        if (_dataSource == null)
+            throw new RuntimeException("No data source");
+        _scheduler = new SchedulerWrapper(_server, _txManager, _dataSource);
+        return _scheduler;
+    }
+
+    protected BpelDAOConnectionFactory createDAOConnection() throws Exception {
+        if (_txManager == null)
+            throw new RuntimeException("No transaction manager");
+        if (_dataSource == null)
+            throw new RuntimeException("No data source");
+        Properties properties = new Properties();
+        properties.put(Environment.CONNECTION_PROVIDER,
+                       DataSourceConnectionProvider.class.getName());
+        properties.put(Environment.TRANSACTION_MANAGER_STRATEGY,
+                       HibernateTransactionManagerLookup.class.getName());
+        properties.put(Environment.SESSION_FACTORY_NAME, "jta");
+        properties.put(Environment.DIALECT, "org.hibernate.dialect.DerbyDialect");
+        SessionManager sm = new SessionManager(properties, _dataSource, _txManager);
+        _daoCF = new BpelDAOConnectionFactoryImpl(sm);
+        Reference bpelSscfRef = new Reference(BpelDAOConnectionFactory.class.getName(),
+                                              HibernateDaoObjectFactory.class.getName(), null);
+        InitialContext ctx = new InitialContext();
+        ctx.rebind("bpelSSCF", bpelSscfRef);
+        ctx.close();
+        return _daoCF;
+    }
+
+    protected EndpointReferenceContext createEndpointReferenceContext() {
+        _eprContext = new EndpointReferenceContext() {
+            public EndpointReference resolveEndpointReference(Element element) { 
+                String service = DOMUtils.getChildCharacterData(element);
+                return (EndpointReference)_endpoints.get(service);
+            }
+            public EndpointReference convertEndpoint(QName qName, Element element) { return null; }
         };
-      }
+        return _eprContext;
+    }
 
-      public void deactivateMyRoleEndpoint(Endpoint myRoleEndpoint) {
-        _activated.remove(myRoleEndpoint);
-      }
-
-      public PartnerRoleChannel createPartnerRoleChannel(QName processId, DeploymentUnit deploymentUnit, PortType portType, 
-                                                         final Endpoint initialPartnerEndpoint) {
-        final EndpointReference epr = new EndpointReference() {
-          public Document toXML() {
-            Document doc = DOMUtils.newDocument();
-            Element serviceRef = doc.createElementNS(EndpointReference.SERVICE_REF_QNAME.getNamespaceURI(),
-              EndpointReference.SERVICE_REF_QNAME.getLocalPart());
-            serviceRef.appendChild(doc.createTextNode(initialPartnerEndpoint.serviceName.toString()));
-            doc.appendChild(serviceRef);
-            return doc;
-          }
+    protected MessageExchangeContext createMessageExchangeContext() {
+       _mexContext =  new MessageExchangeContext() {
+            public void invokePartner(PartnerRoleMessageExchange mex) { }
+            public void onAsyncReply(MyRoleMessageExchange myRoleMex) { }
         };
-        _endpoints.put(initialPartnerEndpoint.serviceName.toString(), epr);
-        return new PartnerRoleChannel() {
-          public EndpointReference getInitialEndpointReference() {
-            return epr;
-          }
-          public void close() { };
-        }; 
-      }
-    };
-    return _bindContext;
-  }
-
-  /**
-   * An {@link javax.naming.spi.ObjectFactory} implementation that can be used to bind the
-   * JOTM {@link javax.transaction.TransactionManager} implementation in JNDI.
-   */
-  private class JotmTransactionManagerFactory implements ObjectFactory {
-    public Object getObjectInstance(Object objref, Name name, Context ctx, Hashtable env) throws Exception {
-      Reference ref = (Reference) objref;
-      if (ref.getClassName().equals(TransactionManager.class.getName())) {
-        return _jotm.getTransactionManager();
-      }
-      throw new RuntimeException("The reference class name \"" + ref.getClassName() + "\" is unknown.");
-    }
-  }
-
-  /**
-   * JNDI {@link ObjectFactory} implementation for Hibernate-based
-   * connection factory objects.
-   */
-  private class HibernateDaoObjectFactory implements ObjectFactory {
-    public Object getObjectInstance(Object objref, Name name, Context ctx, Hashtable env) throws Exception {
-      Reference ref = (Reference) objref;
-      if (ref.getClassName().equals(BpelDAOConnectionFactory.class.getName())) {
-        return _daoCF;
-      }
-      throw new RuntimeException("The reference class name \"" + ref.getClassName() + "\" is unknown.");
+        return _mexContext;
+    }
+
+    protected BindingContext createBindingContext() {
+        _bindContext = new BindingContext() {
+            public EndpointReference activateMyRoleEndpoint(QName processId, DeploymentUnit deploymentUnit, Endpoint myRoleEndpoint, PortType portType) {
+                final Document doc = DOMUtils.newDocument();
+                Element serviceRef = doc.createElementNS(EndpointReference.SERVICE_REF_QNAME.getNamespaceURI(),
+                    EndpointReference.SERVICE_REF_QNAME.getLocalPart());
+                serviceRef.appendChild(doc.createTextNode(myRoleEndpoint.serviceName.toString()));
+                doc.appendChild(serviceRef);
+                _activated.put(myRoleEndpoint.toString(), processId);
+                return new EndpointReference() {
+                    public Document toXML() { return doc; }
+                };
+            }
+
+            public void deactivateMyRoleEndpoint(Endpoint myRoleEndpoint) {
+                _activated.remove(myRoleEndpoint);
+            }
+
+            public PartnerRoleChannel createPartnerRoleChannel(QName processId, DeploymentUnit deploymentUnit, PortType portType, 
+                                                               final Endpoint initialPartnerEndpoint) {
+                final EndpointReference epr = new EndpointReference() {
+                    public Document toXML() {
+                        Document doc = DOMUtils.newDocument();
+                        Element serviceRef = doc.createElementNS(EndpointReference.SERVICE_REF_QNAME.getNamespaceURI(),
+                            EndpointReference.SERVICE_REF_QNAME.getLocalPart());
+                        serviceRef.appendChild(doc.createTextNode(initialPartnerEndpoint.serviceName.toString()));
+                        doc.appendChild(serviceRef);
+                        return doc;
+                    }
+                };
+                _endpoints.put(initialPartnerEndpoint.serviceName.toString(), epr);
+                return new PartnerRoleChannel() {
+                    public EndpointReference getInitialEndpointReference() { return epr; }
+                    public void close() { };
+                }; 
+            }
+        };
+        return _bindContext;
     }
-  }
 
-  private class SchedulerWrapper implements Scheduler {
+    /**
+     * An {@link javax.naming.spi.ObjectFactory} implementation that can be used to bind the
+     * JOTM {@link javax.transaction.TransactionManager} implementation in JNDI.
+     */
+    private class JotmTransactionManagerFactory implements ObjectFactory {
+        public Object getObjectInstance(Object objref, Name name, Context ctx, Hashtable env) throws Exception {
+            Reference ref = (Reference) objref;
+            if (ref.getClassName().equals(TransactionManager.class.getName()))
+                return _jotm.getTransactionManager();
+            throw new RuntimeException("The reference class name \"" + ref.getClassName() + "\" is unknown.");
+        }
+    }
+
+    /**
+     * JNDI {@link ObjectFactory} implementation for Hibernate-based
+     * connection factory objects.
+     */
+    private class HibernateDaoObjectFactory implements ObjectFactory {
+        public Object getObjectInstance(Object objref, Name name, Context ctx, Hashtable env) throws Exception {
+            Reference ref = (Reference) objref;
+            if (ref.getClassName().equals(BpelDAOConnectionFactory.class.getName()))
+                return _daoCF;
+            throw new RuntimeException("The reference class name \"" + ref.getClassName() + "\" is unknown.");
+        }
+    }
+
+    private class SchedulerWrapper implements Scheduler {
 
-    QuartzSchedulerImpl _quartz;
-    long                _nextSchedule;
-
-    SchedulerWrapper(BpelServer server, TransactionManager txManager, DataSource dataSource) {
-      ExecutorService executorService = new ExecutorServiceWrapper();
-      _quartz = new QuartzSchedulerImpl();
-      _quartz.setBpelServer(server);
-      _quartz.setExecutorService(executorService, 20);
-      _quartz.setTransactionManager(txManager);
-      _quartz.setDataSource(dataSource);
-      _quartz.init();
-    }
-
-    public String schedulePersistedJob(Map<String,Object>jobDetail,Date when) throws ContextException {
-      String jobId = _quartz.schedulePersistedJob(jobDetail, when);
-      _nextSchedule = when == null ?  System.currentTimeMillis() : when.getTime();
-      return jobId;
-    }
-  
-    public String scheduleVolatileJob(boolean transacted, Map<String,Object> jobDetail, Date when) throws ContextException {
-      String jobId = _quartz.scheduleVolatileJob(transacted, jobDetail, when);
-      _nextSchedule = when == null ?  System.currentTimeMillis() : when.getTime();
-      return jobId;
-    }
-  
-    public void cancelJob(String jobId) throws ContextException {
-      _quartz.cancelJob(jobId);
-    }
-  
-    public <T> T execTransaction(Callable<T> transaction) throws Exception, ContextException {
-      return _quartz.execTransaction(transaction);
-    }
-    public void start() { _quartz.start(); }
-    public void stop() { _quartz.stop(); }
-    public void shutdown() { _quartz.shutdown(); }
-  }
-
-  private class ExecutorServiceWrapper extends AbstractExecutorService {
-    private ExecutorService _service = Executors.newCachedThreadPool();
-    public void execute(Runnable command) {
-      _service.execute(command);
-    }
-    public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException {
-      return _service.awaitTermination(timeout, unit);
-    }
-    public void shutdown() { _service.shutdown(); }
-    public List<Runnable> shutdownNow() { return _service.shutdownNow(); }
-    public boolean isShutdown() { return _service.isShutdown(); }
-    public boolean isTerminated() { return _service.isTerminated(); }
-  }
+        QuartzSchedulerImpl _quartz;
+        long                _nextSchedule;
+
+        SchedulerWrapper(BpelServer server, TransactionManager txManager, DataSource dataSource) {
+            ExecutorService executorService = Executors.newCachedThreadPool();
+            _quartz = new QuartzSchedulerImpl();
+            _quartz.setBpelServer(server);
+            _quartz.setExecutorService(executorService, 20);
+            _quartz.setTransactionManager(txManager);
+            _quartz.setDataSource(dataSource);
+            _quartz.init();
+        }
+
+        public String schedulePersistedJob(Map<String,Object>jobDetail,Date when) throws ContextException {
+            String jobId = _quartz.schedulePersistedJob(jobDetail, when);
+            _nextSchedule = when == null ?  System.currentTimeMillis() : when.getTime();
+            return jobId;
+        }
+      
+        public String scheduleVolatileJob(boolean transacted, Map<String,Object> jobDetail, Date when) throws ContextException {
+            String jobId = _quartz.scheduleVolatileJob(transacted, jobDetail, when);
+            _nextSchedule = when == null ?  System.currentTimeMillis() : when.getTime();
+            return jobId;
+        }
+      
+        public void cancelJob(String jobId) throws ContextException {
+            _quartz.cancelJob(jobId);
+        }
+      
+        public <T> T execTransaction(Callable<T> transaction) throws Exception, ContextException {
+            return _quartz.execTransaction(transaction);
+        }
+
+        public void start() { _quartz.start(); }
+        public void stop() { _quartz.stop(); }
+        public void shutdown() { _quartz.shutdown(); }
+    }
 
 }

Modified: incubator/ode/trunk/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/ActivityRecoveryDaoImpl.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/ActivityRecoveryDaoImpl.java?view=diff&rev=453417&r1=453416&r2=453417
==============================================================================
--- incubator/ode/trunk/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/ActivityRecoveryDaoImpl.java (original)
+++ incubator/ode/trunk/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/ActivityRecoveryDaoImpl.java Thu Oct  5 16:00:28 2006
@@ -34,50 +34,50 @@
  */
 public class ActivityRecoveryDaoImpl extends HibernateDao implements ActivityRecoveryDAO {
 
-  HActivityRecovery _self;
+    HActivityRecovery _self;
 
-  public ActivityRecoveryDaoImpl(SessionManager sm, HActivityRecovery recovery) {
-    super(sm, recovery);
-    _self = recovery;
-  }
-
-  public long getActivityId() {
-    return _self.getActivityId();
-  }
-
-  public String getChannel() {
-    return _self.getChannel();
-  }
-
-  public String getReason() {
-    return _self.getReason();
-  }
-
-  public Date getDateTime() {
-    return _self.getDateTime();
-  }
-
-  public Element getDetails() {
-    if (_self.getDetails() == null) return null;
-    try {
-      return DOMUtils.stringToDOM(_self.getDetails().getText());
-    } catch (SAXException e) {
-      throw new RuntimeException(e);
-    } catch (IOException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  public String getActions() {
-    return _self.getActions();
-  }
-
-  public String[] getActionsList() {
-    return _self.getActions().split(" ");
-  }
-
-  public int getRetries() {
-    return _self.getRetries();
-  }
+    public ActivityRecoveryDaoImpl(SessionManager sm, HActivityRecovery recovery) {
+        super(sm, recovery);
+        _self = recovery;
+    }
+
+    public long getActivityId() {
+        return _self.getActivityId();
+    }
+
+    public String getChannel() {
+        return _self.getChannel();
+    }
+
+    public String getReason() {
+        return _self.getReason();
+    }
+
+    public Date getDateTime() {
+        return _self.getDateTime();
+    }
+
+    public Element getDetails() {
+        if (_self.getDetails() == null) return null;
+        try {
+            return DOMUtils.stringToDOM(_self.getDetails().getText());
+        } catch (SAXException e) {
+            throw new RuntimeException(e);
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    public String getActions() {
+        return _self.getActions();
+    }
+
+    public String[] getActionsList() {
+        return _self.getActions().split(" ");
+    }
+
+    public int getRetries() {
+        return _self.getRetries();
+    }
 
 }