Author: assaf
Date: Mon Sep 11 12:47:03 2006
New Revision: 442305

URL: http://svn.apache.org/viewvc?view=rev&rev=442305
Log:
Added activity recovery events

Added:
    
incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/evt/ActivityFailureEvent.java
   (with props)
    
incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/evt/ActivityRecoveryEvent.java
   (with props)
Modified:
    
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/INVOKE.java

Added: 
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=auto&rev=442305
==============================================================================
--- 
incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/evt/ActivityFailureEvent.java
 (added)
+++ 
incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/evt/ActivityFailureEvent.java
 Mon Sep 11 12:47:03 2006
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.ode.bpel.evt;
+
+/**
+ * Event sent when the activity enters the failure state and requires recovery.
+ */
+public class ActivityFailureEvent extends ActivityEvent {
+
+       private static final long serialVersionUID = 1L;
+
+  private String _reason;
+
+  public ActivityFailureEvent() { 
+  }
+  
+  public ActivityFailureEvent(String reason) { 
+    _reason = reason;
+  }
+
+  public String getFailureReason() {
+    return _reason;
+  }
+
+  public void setFailureReason(String reason) {
+    _reason = reason;
+  }
+}

Propchange: 
incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/evt/ActivityFailureEvent.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/evt/ActivityFailureEvent.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: 
incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/evt/ActivityFailureEvent.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: 
incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/evt/ActivityRecoveryEvent.java
URL: 
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/evt/ActivityRecoveryEvent.java?view=auto&rev=442305
==============================================================================
--- 
incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/evt/ActivityRecoveryEvent.java
 (added)
+++ 
incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/evt/ActivityRecoveryEvent.java
 Mon Sep 11 12:47:03 2006
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.ode.bpel.evt;
+
+/**
+ * Event sent when the activity recovers with an action.
+ */
+public class ActivityRecoveryEvent extends ActivityEvent {
+
+       private static final long serialVersionUID = 1L;
+  
+  private String _action;
+
+  public ActivityRecoveryEvent () {
+    super();
+  }
+
+  public ActivityRecoveryEvent(String action) {
+    _action = action;
+  }
+
+       public String getRecoveryAction() {
+    return _action;
+  }
+
+  public void setRecoveryAction(String action) {
+    _action = action;
+  }
+}

Propchange: 
incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/evt/ActivityRecoveryEvent.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/evt/ActivityRecoveryEvent.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: 
incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/evt/ActivityRecoveryEvent.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

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=442305&r1=442304&r2=442305
==============================================================================
--- 
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
 Mon Sep 11 12:47:03 2006
@@ -18,6 +18,8 @@
  */
 package org.apache.ode.bpel.runtime;
 
+import org.apache.ode.bpel.evt.ActivityFailureEvent;
+import org.apache.ode.bpel.evt.ActivityRecoveryEvent;
 import org.apache.ode.bpel.common.FaultException;
 import org.apache.ode.bpel.o.OInvoke;
 import org.apache.ode.bpel.o.FailureHandling;
@@ -198,8 +200,6 @@
       _self.parent.completed(faultData, CompensationHandler.emptySet());
       return;
     }
-System.out.println("-- Invoked: " + _invoked);
-System.out.println("-- retryFor: " + _self.getFailureHandling().retryFor);
     // If maximum number of retries, enter activity recovery state.  
     if (_invoked > _self.getFailureHandling().retryFor) {
       requireRecovery();
@@ -228,20 +228,23 @@
   }
 
   private void requireRecovery() {
-System.out.println("-- Require recovery");
+    sendEvent(new ActivityFailureEvent(_failureReason));
     final ActivityRecoveryChannel recoveryChannel = 
newChannel(ActivityRecoveryChannel.class);
     getBpelRuntimeContext().registerActivityForRecovery(recoveryChannel, 
_self.aId, _failureReason, _lastFailure, null,
       new String[] { "retry", "cancel", "fault" });
     object(false, new ActivityRecoveryChannelListener(recoveryChannel) {
       public void retry() {
+        sendEvent(new ActivityRecoveryEvent("retry"));
         getBpelRuntimeContext().unregisterActivityForRecovery(recoveryChannel);
         instance(INVOKE.this);
       }
       public void cancel() {
+        sendEvent(new ActivityRecoveryEvent("cancel"));
         getBpelRuntimeContext().unregisterActivityForRecovery(recoveryChannel);
         _self.parent.completed(null, CompensationHandler.emptySet());
       }
       public void fault(FaultData faultData) {
+        sendEvent(new ActivityRecoveryEvent("fault"));
         getBpelRuntimeContext().unregisterActivityForRecovery(recoveryChannel);
         // TODO: real fault name.
         if (faultData == null)


Reply via email to