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/17 21:56:20 UTC

svn commit: r465021 - in /incubator/ode/trunk: bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ bpel-obj/src/main/java/org/apache/ode/bpel/o/ bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/

Author: assaf
Date: Tue Oct 17 12:56:19 2006
New Revision: 465021

URL: http://svn.apache.org/viewvc?view=rev&rev=465021
Log:
Using getParent() for failure handling inheritence

Modified:
    incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler.java
    incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/DefaultActivityGenerator.java
    incubator/ode/trunk/bpel-obj/src/main/java/org/apache/ode/bpel/o/OActivity.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/INVOKE.java

Modified: incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler.java?view=diff&rev=465021&r1=465020&r2=465021
==============================================================================
--- incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler.java (original)
+++ incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler.java Tue Oct 17 12:56:19 2006
@@ -694,7 +694,7 @@
         final OScope oscope = new OScope(_oprocess, getCurrent());
         oscope.name = createName(source);
         oscope.debugInfo = createDebugInfo(source, "suppress join failure scope for " + source);
-        DefaultActivityGenerator.defaultExtensibilityElements(oscope, source, _structureStack.topActivity());
+        DefaultActivityGenerator.defaultExtensibilityElements(oscope, source);
 
         compile(oscope, null, new Runnable() {
             public void run() {
@@ -902,7 +902,7 @@
 }
 
     public void compile(OActivity context, BpelObject source, Runnable run) {
-        DefaultActivityGenerator.defaultExtensibilityElements(context, source, _structureStack.topActivity());
+        DefaultActivityGenerator.defaultExtensibilityElements(context, source);
         _structureStack.push(context);
         try {
             run.run();

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=465021&r1=465020&r2=465021
==============================================================================
--- 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 Tue Oct 17 12:56:19 2006
@@ -41,53 +41,52 @@
         _context = context;
     }
 
-    static void defaultExtensibilityElements(OActivity output, BpelObject src, OActivity parent) {
-        failureHandlinExtensibilityElement(output, src, parent);
+    static void defaultExtensibilityElements(OActivity output, BpelObject src) {
+        if (src != null) {
+            failureHandlinExtensibilityElement(output, src);
+        }
     }
 
-    static private void failureHandlinExtensibilityElement(OActivity output, BpelObject src, OActivity parent) {
-        if (parent != null && parent.failureHandling != null)
-            output.failureHandling = parent.failureHandling;
-        if (src != null) {
-            // Failure handling extensibility element.
-            Element failure = (Element) src.getExtensibilityElements().get(FailureHandling.FAILURE_EXT_ELEMENT);
-            if (failure != null) {
-                output.failureHandling = new FailureHandling();
-                String textValue;
-                Element element = DOMUtils.findChildByName(failure, new QName(FailureHandling.EXTENSION_NS_URI, "retryFor"));
-                if (element != null) {
-                    textValue = DOMUtils.getTextContent(element);
-                    if (textValue != null) {
-                        try {
-                            output.failureHandling.retryFor = Integer.parseInt(textValue);
-                            if (output.failureHandling.retryFor < 0)
-                                throw new CompilationException(__cmsgs.errInvalidRetryForValue(textValue));
-                        } catch (NumberFormatException except) {
+    static private void failureHandlinExtensibilityElement(OActivity output, BpelObject src) {
+        // Failure handling extensibility element.
+        Element failure = (Element) src.getExtensibilityElements().get(FailureHandling.FAILURE_EXT_ELEMENT);
+        if (failure != null) {
+            FailureHandling failureHandling = new FailureHandling();
+            output.setFailureHandling(failureHandling);
+            String textValue;
+            Element element = DOMUtils.findChildByName(failure, new QName(FailureHandling.EXTENSION_NS_URI, "retryFor"));
+            if (element != null) {
+                textValue = DOMUtils.getTextContent(element);
+                if (textValue != null) {
+                    try {
+                        failureHandling.retryFor = Integer.parseInt(textValue);
+                        if (failureHandling.retryFor < 0)
                             throw new CompilationException(__cmsgs.errInvalidRetryForValue(textValue));
-                        }
+                    } catch (NumberFormatException except) {
+                        throw new CompilationException(__cmsgs.errInvalidRetryForValue(textValue));
                     }
                 }
-                element = DOMUtils.findChildByName(failure, new QName(FailureHandling.EXTENSION_NS_URI, "retryDelay"));
-                if (element != null) {
-                    textValue = DOMUtils.getTextContent(element);
-                    if (textValue != null) {
-                        try {
-                            output.failureHandling.retryDelay = Integer.parseInt(textValue);
-                            if (output.failureHandling.retryDelay < 0)
-                                throw new CompilationException(__cmsgs.errInvalidRetryDelayValue(textValue));
-                        } catch (NumberFormatException except) {
+            }
+            element = DOMUtils.findChildByName(failure, new QName(FailureHandling.EXTENSION_NS_URI, "retryDelay"));
+            if (element != null) {
+                textValue = DOMUtils.getTextContent(element);
+                if (textValue != null) {
+                    try {
+                        failureHandling.retryDelay = Integer.parseInt(textValue);
+                        if (failureHandling.retryDelay < 0)
                             throw new CompilationException(__cmsgs.errInvalidRetryDelayValue(textValue));
-                        }
+                    } catch (NumberFormatException except) {
+                        throw new CompilationException(__cmsgs.errInvalidRetryDelayValue(textValue));
                     }
                 }
-                element = DOMUtils.findChildByName(failure, new QName(FailureHandling.EXTENSION_NS_URI, "faultOnFailure"));
-                if (element != null) {
-                    textValue = DOMUtils.getTextContent(element);
-                    if (textValue != null)
-                        output.failureHandling.faultOnFailure = Boolean.valueOf(textValue).booleanValue();
-                }
             }
-        }  
+            element = DOMUtils.findChildByName(failure, new QName(FailureHandling.EXTENSION_NS_URI, "faultOnFailure"));
+            if (element != null) {
+                textValue = DOMUtils.getTextContent(element);
+                if (textValue != null)
+                    failureHandling.faultOnFailure = Boolean.valueOf(textValue).booleanValue();
+            }
+        }
     }
 
 }

Modified: incubator/ode/trunk/bpel-obj/src/main/java/org/apache/ode/bpel/o/OActivity.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-obj/src/main/java/org/apache/ode/bpel/o/OActivity.java?view=diff&rev=465021&r1=465020&r2=465021
==============================================================================
--- incubator/ode/trunk/bpel-obj/src/main/java/org/apache/ode/bpel/o/OActivity.java (original)
+++ incubator/ode/trunk/bpel-obj/src/main/java/org/apache/ode/bpel/o/OActivity.java Tue Oct 17 12:56:19 2006
@@ -34,8 +34,8 @@
     public final Set<OLink>sourceLinks = new HashSet<OLink>();
     public final Set<OLink>targetLinks = new HashSet<OLink>();
     public String name;
-    public FailureHandling failureHandling;
-    public OActivity parent;
+    private FailureHandling failureHandling;
+    private OActivity parent;
 
     public String getType() {
         return ObjectPrinter.getShortClassName(getClass());
@@ -47,7 +47,23 @@
     }
 
     public OActivity getParent() {
-      return parent;
+        return this.parent;
+    }
+
+    public FailureHandling getFailureHandling() {
+        FailureHandling handling = this.failureHandling;
+        if (handling == null) {
+            OActivity parent = this.parent;
+            while (parent != null && handling == null) {
+                handling = parent.failureHandling;
+                parent = parent.parent;
+            } 
+        }
+        return handling;
+    }
+
+    public void setFailureHandling(FailureHandling failureHandling) {
+        this.failureHandling = failureHandling;
     }
 
     public String toString() {

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=465021&r1=465020&r2=465021
==============================================================================
--- 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 Tue Oct 17 12:56:19 2006
@@ -62,10 +62,4 @@
         return (int)aId;
     }
 
-    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/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=465021&r1=465020&r2=465021
==============================================================================
--- 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 Tue Oct 17 12:56:19 2006
@@ -192,7 +192,9 @@
         _failureReason = reason;
         _failureData = data;
 
-        if (_self.getFailureHandling().faultOnFailure) {
+        FailureHandling failureHandling = _oinvoke.getFailureHandling();
+
+        if (failureHandling != null && failureHandling.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");
@@ -201,14 +203,15 @@
             return;
         }
         // If maximum number of retries, enter activity recovery state.  
-        if (_invoked > _self.getFailureHandling().retryFor) {
+        if (failureHandling == null || _invoked > failureHandling.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));
+        Date future = new Date(new Date().getTime() + 
+            (failureHandling == null ? 0L : failureHandling.retryDelay * 1000));
         final TimerResponseChannel timerChannel = newChannel(TimerResponseChannel.class);
         getBpelRuntimeContext().registerTimer(timerChannel, future);
         object(false, new TimerResponseChannelListener(timerChannel) {