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 09:03:03 UTC
svn commit: r453516 - in /incubator/ode/trunk:
bpel-api/src/main/java/org/apache/ode/bpel/capi/
bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/
bpel-runtime/src/test/resources/recovery/
Author: assaf
Date: Fri Oct 6 00:03:02 2006
New Revision: 453516
URL: http://svn.apache.org/viewvc?view=rev&rev=453516
Log:
Changed compiler to support default handling of extensibility elements across all activities, including scope and process
Modified:
incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/capi/CompilerContext.java
incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ActivityGenerator.java
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-compiler/src/main/java/org/apache/ode/bpel/compiler/FlowGenerator.java
incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ForEachGenerator.java
incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/InvokeGenerator.java
incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/SequenceGenerator.java
incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/WhileGenerator.java
incubator/ode/trunk/bpel-runtime/src/test/resources/recovery/failure-inheritence.bpel
Modified: incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/capi/CompilerContext.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/capi/CompilerContext.java?view=diff&rev=453516&r1=453515&r2=453516
==============================================================================
--- incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/capi/CompilerContext.java (original)
+++ incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/capi/CompilerContext.java Fri Oct 6 00:03:02 2006
@@ -19,6 +19,7 @@
package org.apache.ode.bpel.capi;
import org.apache.ode.bom.api.Activity;
+import org.apache.ode.bom.api.BpelObject;
import org.apache.ode.bom.api.Expression;
import org.apache.ode.bpel.o.OActivity;
import org.apache.ode.bpel.o.OExpression;
@@ -111,7 +112,7 @@
String getSourceLocation();
- void compile(OActivity context, Runnable run);
+ void compile(OActivity context, BpelObject activity, Runnable run);
public boolean isPartnerLinkAssigned(String plink);
Modified: incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ActivityGenerator.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ActivityGenerator.java?view=diff&rev=453516&r1=453515&r2=453516
==============================================================================
--- incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ActivityGenerator.java (original)
+++ incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ActivityGenerator.java Fri Oct 6 00:03:02 2006
@@ -30,14 +30,14 @@
* into a <em>compiled</em> BPEL representation.
*/
public interface ActivityGenerator {
- public void setContext(CompilerContext context);
+ public void setContext(CompilerContext context);
- /**
- * Generate compiled representation for the given activity definition.
- *
- * @param src activity definition
- */
- public void compile(OActivity output, Activity src);
+ /**
+ * Generate compiled representation for the given activity definition.
+ *
+ * @param src activity definition
+ */
+ public void compile(OActivity output, Activity src);
- public OActivity newInstance(Activity src);
+ public OActivity newInstance(Activity src);
}
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=453516&r1=453515&r2=453516
==============================================================================
--- 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 Fri Oct 6 00:03:02 2006
@@ -553,7 +553,7 @@
OScope procesScope = new OScope(_oprocess);
procesScope.name = "__PROCESS_SCOPE:" + process.getName();
procesScope.debugInfo = createDebugInfo(process, null);
- _oprocess.procesScope = compile(procesScope, process, new Runnable() {
+ _oprocess.procesScope = compileScope(procesScope, process, new Runnable() {
public void run() {
_structureStack.topScope().activity = compile(process.getRootActivity());
}
@@ -694,14 +694,15 @@
final OScope oscope = new OScope(_oprocess);
oscope.name = createName(source);
oscope.debugInfo = createDebugInfo(source, "suppress join failure scope for " + source);
+ DefaultActivityGenerator.defaultExtensibilityElements(oscope, source, _structureStack.topActivity());
- compile(oscope, new Runnable() {
+ compileScope(oscope, null, new Runnable() {
public void run() {
oscope.activity = compileSLC(source);
final OCatch joinFailureCatch = new OCatch(_oprocess);
joinFailureCatch.name = "__suppressJoinFailureCatch:" + oscope.name;
joinFailureCatch.debugInfo = createDebugInfo(source, "suppress join failure catch for " + source);
- compile(joinFailureCatch, new Runnable() {
+ compile(joinFailureCatch, null, new Runnable() {
public void run() {
joinFailureCatch.faultName = _oprocess.constants.qnJoinFailure;
joinFailureCatch.faultVariable = null;
@@ -730,7 +731,7 @@
final OScope implicitScope = new OScope(_oprocess);
implicitScope.name = createName(source);
implicitScope.debugInfo = createDebugInfo(source, "Scope-like construct " + source);
- compile(implicitScope, slcsrc, new Runnable() {
+ compileScope(implicitScope, slcsrc, new Runnable() {
public void run() {
compileLinks(source);
if (source instanceof ScopeActivity)
@@ -753,7 +754,7 @@
oact.name = createName(source);
oact.debugInfo = createDebugInfo(source,"Activity body for " + source);
_compiledActivities.add(oact);
- compile(oact, new Runnable() {
+ compile(oact, source, new Runnable() {
public void run() {
if (doLinks)
compileLinks(source);
@@ -896,7 +897,8 @@
oscope.addCorrelationSet(ocset);
}
- public void compile(OActivity context, Runnable run) {
+ public void compile(OActivity context, BpelObject source, Runnable run) {
+ DefaultActivityGenerator.defaultExtensibilityElements(context, source, _structureStack.topActivity());
_structureStack.push(context);
try {
run.run();
@@ -927,13 +929,13 @@
}
}
- private OScope compile(final OScope oscope, final Scope src, final Runnable init) {
+ private OScope compileScope(final OScope oscope, final Scope src, final Runnable init) {
if (oscope.name == null)
throw new IllegalArgumentException("Unnamed scope:" + src);
oscope.debugInfo = createDebugInfo(src, src.toString());
- compile(oscope, new Runnable() {
+ compile(oscope, src, new Runnable() {
public void run() {
for (Iterator<Variable> i = src.getVariables().iterator();i.hasNext(); ) {
Variable var = i.next();
@@ -1068,7 +1070,7 @@
final OEventHandler.OEvent oevent = new OEventHandler.OEvent(_oprocess);
oevent.name = "__eventHandler:";
oevent.debugInfo = createDebugInfo(onEvent,null);
- compile(oevent, new Runnable() {
+ compile(oevent, onEvent, new Runnable() {
public void run() {
switch (_processDef.getBpelVersion()) {
case Process.BPEL_V110:
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=453516&r1=453515&r2=453516
==============================================================================
--- 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 Fri Oct 6 00:03:02 2006
@@ -19,6 +19,7 @@
package org.apache.ode.bpel.compiler;
import org.apache.ode.bom.api.Activity;
+import org.apache.ode.bom.api.BpelObject;
import org.apache.ode.bpel.o.OActivity;
import org.apache.ode.bpel.o.FailureHandling;
import org.apache.ode.bpel.capi.CompilationException;
@@ -33,63 +34,108 @@
* Base implementation of the {@link ActivityGenerator} interface.
*/
abstract class DefaultActivityGenerator implements ActivityGenerator {
- protected CompilerContext _context;
- private static final CommonCompilationMessages __cmsgs = MessageBundle.getMessages(CommonCompilationMessages.class);
+ protected CompilerContext _context;
+ private static final CommonCompilationMessages __cmsgs = MessageBundle.getMessages(CommonCompilationMessages.class);
- public void setContext(CompilerContext context) {
- _context = context;
- }
-
- protected void handleDefaultExtensibility(OActivity output, Activity srcx) {
- handleFailureExtensibility(output, srcx);
- }
-
- private void handleFailureExtensibility(OActivity output, Activity srcx) {
- // Failure handling extensibility element.
- Element failure = (Element) srcx.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) {
- 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) {
- 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();
- }
- } else {
- for (OActivity parent : _context.getActivityStack()) {
- if (parent.failureHandling != null) {
- output.failureHandling = parent.failureHandling;
- break;
- }
- }
- }
- }
+ public void setContext(CompilerContext context) {
+ _context = context;
+ }
+
+ static void defaultExtensibilityElements(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) {
+ 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) {
+ 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();
+ }
+ }
+ }
+ }
+
+ protected void defaultExtensibilityElements(OActivity output, Activity srcx) {
+ handleFailureExtensibility(output, srcx);
+ }
+
+ private void handleFailureExtensibility(OActivity output, Activity srcx) {
+ // Failure handling extensibility element.
+ Element failure = (Element) srcx.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) {
+ 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) {
+ 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();
+ }
+ } else {
+ for (OActivity parent : _context.getActivityStack()) {
+ if (parent.failureHandling != null) {
+ output.failureHandling = parent.failureHandling;
+ break;
+ }
+ }
+ }
+ }
}
Modified: incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/FlowGenerator.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/FlowGenerator.java?view=diff&rev=453516&r1=453515&r2=453516
==============================================================================
--- incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/FlowGenerator.java (original)
+++ incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/FlowGenerator.java Fri Oct 6 00:03:02 2006
@@ -37,71 +37,69 @@
* Generates code for <code><flow></code> activities.
*/
class FlowGenerator extends DefaultActivityGenerator {
- private static final FlowGeneratorMessages __cmsgs = MessageBundle.getMessages(FlowGeneratorMessages.class);
+ private static final FlowGeneratorMessages __cmsgs = MessageBundle.getMessages(FlowGeneratorMessages.class);
- public void compile(OActivity output, Activity src) {
- handleDefaultExtensibility(output, src);
- FlowActivity flowAct = (FlowActivity)src;
- OFlow oflow = (OFlow) output;
- compileLinkDecls(oflow, flowAct);
- compileChildren(oflow, flowAct);
-
- for (Iterator<OLink> i = oflow.localLinks.iterator(); i.hasNext(); ) {
- OLink olink = i.next();
- try {
- if (olink.source == null)
- throw new CompilationException(__cmsgs.errLinkMissingSourceActivity(olink.name).setSource(olink));
- } catch (CompilationException ce) {
- _context.recoveredFromError(src, ce);
- }
-
- try {
- if (olink.target == null)
- throw new CompilationException(__cmsgs.errLinkMissingTargetActivity(olink.name).setSource(olink));
- } catch (CompilationException ce) {
- _context.recoveredFromError(src, ce);
- }
+ public void compile(OActivity output, Activity src) {
+ FlowActivity flowAct = (FlowActivity)src;
+ OFlow oflow = (OFlow) output;
+ compileLinkDecls(oflow, flowAct);
+ compileChildren(oflow, flowAct);
+
+ for (Iterator<OLink> i = oflow.localLinks.iterator(); i.hasNext(); ) {
+ OLink olink = i.next();
+ try {
+ if (olink.source == null)
+ throw new CompilationException(__cmsgs.errLinkMissingSourceActivity(olink.name).setSource(olink));
+ } catch (CompilationException ce) {
+ _context.recoveredFromError(src, ce);
+ }
+
+ try {
+ if (olink.target == null)
+ throw new CompilationException(__cmsgs.errLinkMissingTargetActivity(olink.name).setSource(olink));
+ } catch (CompilationException ce) {
+ _context.recoveredFromError(src, ce);
+ }
+ }
}
- }
+ public OActivity newInstance(Activity src) {
+ return new OFlow(_context.getOProcess());
+ }
- public OActivity newInstance(Activity src) {
- return new OFlow(_context.getOProcess());
- }
-
- private void compileLinkDecls(OFlow oflow, FlowActivity flowAct) {
- for (Iterator<Link> i = flowAct.getLinks().iterator(); i.hasNext(); ) {
- Link link = i.next();
- OLink olink = new OLink(_context.getOProcess());
- olink.name = link.getLinkName();
- declareLink(oflow, olink);
+ private void compileLinkDecls(OFlow oflow, FlowActivity flowAct) {
+ for (Iterator<Link> i = flowAct.getLinks().iterator(); i.hasNext(); ) {
+ Link link = i.next();
+ OLink olink = new OLink(_context.getOProcess());
+ olink.name = link.getLinkName();
+ declareLink(oflow, olink);
+ }
}
- }
- public void declareLink(final OFlow oflow, final OLink olink) throws CompilationException {
- if (CollectionsX.find_if(oflow.localLinks, new MemberOfFunction<OLink>() {
- public boolean isMember(OLink o) {
- return o.name.equals(olink.name);
- }
- }) != null)
- throw new CompilationException(__cmsgs.errDuplicateLinkDecl(olink.name));
-
- olink.declaringFlow = oflow;
- oflow.localLinks.add(olink);
- }
-
- /**
- */
- protected void compileChildren(OFlow dest, CompositeActivity src) {
- for (Iterator<Activity> i = src.getChildren().iterator(); i.hasNext();) {
- Activity child = i.next();
- try {
- OActivity compiledChild = _context.compile(child);
- dest.parallelActivities.add(compiledChild);
- } catch (CompilationException ce) {
- _context.recoveredFromError(child, ce);
- }
+ public void declareLink(final OFlow oflow, final OLink olink) throws CompilationException {
+ if (CollectionsX.find_if(oflow.localLinks, new MemberOfFunction<OLink>() {
+ public boolean isMember(OLink o) {
+ return o.name.equals(olink.name);
+ }
+ }) != null)
+ throw new CompilationException(__cmsgs.errDuplicateLinkDecl(olink.name));
+
+ olink.declaringFlow = oflow;
+ oflow.localLinks.add(olink);
+ }
+
+ /**
+ */
+ protected void compileChildren(OFlow dest, CompositeActivity src) {
+ for (Iterator<Activity> i = src.getChildren().iterator(); i.hasNext();) {
+ Activity child = i.next();
+ try {
+ OActivity compiledChild = _context.compile(child);
+ dest.parallelActivities.add(compiledChild);
+ } catch (CompilationException ce) {
+ _context.recoveredFromError(child, ce);
+ }
+ }
}
- }
}
Modified: incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ForEachGenerator.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ForEachGenerator.java?view=diff&rev=453516&r1=453515&r2=453516
==============================================================================
--- incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ForEachGenerator.java (original)
+++ incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ForEachGenerator.java Fri Oct 6 00:03:02 2006
@@ -38,52 +38,51 @@
*/
public class ForEachGenerator extends DefaultActivityGenerator {
- private static final Log __log = LogFactory.getLog(AssignGenerator.class);
- private static final ForEachGeneratorMessages __cmsgs = MessageBundle.getMessages(ForEachGeneratorMessages.class);
+ private static final Log __log = LogFactory.getLog(AssignGenerator.class);
+ private static final ForEachGeneratorMessages __cmsgs = MessageBundle.getMessages(ForEachGeneratorMessages.class);
- public OActivity newInstance(Activity src) {
- return new OForEach(_context.getOProcess());
- }
-
- public void compile(OActivity output, Activity src) {
- handleDefaultExtensibility(output, src);
- if (__log.isDebugEnabled()) __log.debug("Compiling ForEach activity.");
- OForEach oforEach = (OForEach) output;
- ForEachActivity forEach = (ForEachActivity) src;
- oforEach.parallel = forEach.isParallel();
- oforEach.startCounterValue = _context.compileExpr(forEach.getStartCounter());
- oforEach.finalCounterValue = _context.compileExpr(forEach.getFinalCounter());
- if (forEach.getCompletionCondition() != null) {
- oforEach.completionCondition =
- new OForEach.CompletionCondition(_context.getOProcess());
- oforEach.completionCondition.successfulBranchesOnly
- = forEach.getCompletionCondition().isSuccessfulBranchesOnly();
- oforEach.completionCondition.branchCount = _context.compileExpr(forEach.getCompletionCondition());
+ public OActivity newInstance(Activity src) {
+ return new OForEach(_context.getOProcess());
}
- // ForEach 'adds' a counter variable in inner scope
- if (__log.isDebugEnabled()) __log.debug("Adding the forEach counter variable to inner scope.");
- addCounterVariable(forEach.getCounterName(), forEach);
-
- if (__log.isDebugEnabled()) __log.debug("Compiling forEach inner scope.");
- oforEach.innerScope = (OScope) _context.compileSLC(forEach.getScope());
-
- oforEach.counterVariable = oforEach.innerScope.getLocalVariable(forEach.getCounterName());
- }
-
- private void addCounterVariable(String counterName, ForEachActivity src) {
- // Checking if a variable using the same name as our counter is already defined.
- // The spec requires a static analysis error to be thrown in that case.
- if (src.getScope().getVariableDecl(counterName) != null)
- throw new CompilationException(__cmsgs.errForEachAndScopeVariableRedundant(counterName).setSource(src));
-
- QName varTypeName = new QName(Constants.NS_XML_SCHEMA_2001, "unsignedInt");
- VariableImpl var = new VariableImpl(counterName);
- var.setSchemaType(varTypeName);
- src.getScope().addVariable(var);
-
- if (__log.isDebugEnabled())
- __log.debug("forEach counter variable " + counterName + " has been added to inner scope.");
- }
+ public void compile(OActivity output, Activity src) {
+ if (__log.isDebugEnabled()) __log.debug("Compiling ForEach activity.");
+ OForEach oforEach = (OForEach) output;
+ ForEachActivity forEach = (ForEachActivity) src;
+ oforEach.parallel = forEach.isParallel();
+ oforEach.startCounterValue = _context.compileExpr(forEach.getStartCounter());
+ oforEach.finalCounterValue = _context.compileExpr(forEach.getFinalCounter());
+ if (forEach.getCompletionCondition() != null) {
+ oforEach.completionCondition =
+ new OForEach.CompletionCondition(_context.getOProcess());
+ oforEach.completionCondition.successfulBranchesOnly
+ = forEach.getCompletionCondition().isSuccessfulBranchesOnly();
+ oforEach.completionCondition.branchCount = _context.compileExpr(forEach.getCompletionCondition());
+ }
+
+ // ForEach 'adds' a counter variable in inner scope
+ if (__log.isDebugEnabled()) __log.debug("Adding the forEach counter variable to inner scope.");
+ addCounterVariable(forEach.getCounterName(), forEach);
+
+ if (__log.isDebugEnabled()) __log.debug("Compiling forEach inner scope.");
+ oforEach.innerScope = (OScope) _context.compileSLC(forEach.getScope());
+
+ oforEach.counterVariable = oforEach.innerScope.getLocalVariable(forEach.getCounterName());
+ }
+
+ private void addCounterVariable(String counterName, ForEachActivity src) {
+ // Checking if a variable using the same name as our counter is already defined.
+ // The spec requires a static analysis error to be thrown in that case.
+ if (src.getScope().getVariableDecl(counterName) != null)
+ throw new CompilationException(__cmsgs.errForEachAndScopeVariableRedundant(counterName).setSource(src));
+
+ QName varTypeName = new QName(Constants.NS_XML_SCHEMA_2001, "unsignedInt");
+ VariableImpl var = new VariableImpl(counterName);
+ var.setSchemaType(varTypeName);
+ src.getScope().addVariable(var);
+
+ if (__log.isDebugEnabled())
+ __log.debug("forEach counter variable " + counterName + " has been added to inner scope.");
+ }
}
Modified: incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/InvokeGenerator.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/InvokeGenerator.java?view=diff&rev=453516&r1=453515&r2=453516
==============================================================================
--- incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/InvokeGenerator.java (original)
+++ incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/InvokeGenerator.java Fri Oct 6 00:03:02 2006
@@ -42,81 +42,80 @@
*/
class InvokeGenerator extends DefaultActivityGenerator {
- private static final CommonCompilationMessages __cmsgs = MessageBundle.getMessages(CommonCompilationMessages.class);
- private static final InvokeGeneratorMessages __imsgs = MessageBundle.getMessages(InvokeGeneratorMessages.class);
+ private static final CommonCompilationMessages __cmsgs = MessageBundle.getMessages(CommonCompilationMessages.class);
+ private static final InvokeGeneratorMessages __imsgs = MessageBundle.getMessages(InvokeGeneratorMessages.class);
- public OActivity newInstance(Activity src) {
- return new OInvoke(_context.getOProcess());
- }
-
- public void compile(OActivity output, Activity srcx) {
- handleDefaultExtensibility(output, srcx);
- InvokeActivity src = (InvokeActivity)srcx;
- OInvoke oinvoke = (OInvoke) output;
-
- oinvoke.partnerLink = _context.resolvePartnerLink(src.getPartnerLink());
- oinvoke.operation = _context.resolvePartnerRoleOperation(oinvoke.partnerLink, src.getOperation());
- assert oinvoke.operation.getInput() != null; // ensured by resolvePartnerRoleOperation
- assert oinvoke.operation.getInput().getMessage() != null; // ensured by resolvePartnerRoleOperation
- //TODO: Add portType checking if specified by user
-// if (portType != null && !portType.equals(onMessage.partnerLink.myRolePortType.getQName()))
-// throw new CompilationException(CMSGSG.errPortTypeMismatch(portType, onMessage.partnerLink.myRolePortType.getQName()));
-
- if (oinvoke.operation.getInput() != null && oinvoke.operation.getInput().getMessage() != null) {
- if (src.getInputVar() == null)
- throw new CompilationException(__imsgs.errInvokeNoInputMessageForInputOp(oinvoke.operation.getName()));
- oinvoke.inputVar = _context.resolveMessageVariable(src.getInputVar(), oinvoke.operation.getInput().getMessage().getQName());
- }
-
- if (oinvoke.operation.getOutput() != null && oinvoke.operation.getOutput().getMessage() != null) {
- if (src.getOutputVar() == null)
- throw new CompilationException(__imsgs.errInvokeNoOutputMessageForOutputOp(oinvoke.operation.getName()));
- oinvoke.outputVar = _context.resolveMessageVariable(src.getOutputVar(), oinvoke.operation.getOutput().getMessage().getQName());
+ public OActivity newInstance(Activity src) {
+ return new OInvoke(_context.getOProcess());
}
- if (oinvoke.inputVar != null)
- doCorrelations(src.getCorrelations(Correlation.CORRPATTERN_OUT), oinvoke.inputVar, oinvoke.assertCorrelationsInput, oinvoke.initCorrelationsInput);
+ public void compile(OActivity output, Activity srcx) {
+ InvokeActivity src = (InvokeActivity)srcx;
+ OInvoke oinvoke = (OInvoke) output;
+
+ oinvoke.partnerLink = _context.resolvePartnerLink(src.getPartnerLink());
+ oinvoke.operation = _context.resolvePartnerRoleOperation(oinvoke.partnerLink, src.getOperation());
+ assert oinvoke.operation.getInput() != null; // ensured by resolvePartnerRoleOperation
+ assert oinvoke.operation.getInput().getMessage() != null; // ensured by resolvePartnerRoleOperation
+ //TODO: Add portType checking if specified by user
+ // if (portType != null && !portType.equals(onMessage.partnerLink.myRolePortType.getQName()))
+ // throw new CompilationException(CMSGSG.errPortTypeMismatch(portType, onMessage.partnerLink.myRolePortType.getQName()));
+
+ if (oinvoke.operation.getInput() != null && oinvoke.operation.getInput().getMessage() != null) {
+ if (src.getInputVar() == null)
+ throw new CompilationException(__imsgs.errInvokeNoInputMessageForInputOp(oinvoke.operation.getName()));
+ oinvoke.inputVar = _context.resolveMessageVariable(src.getInputVar(), oinvoke.operation.getInput().getMessage().getQName());
+ }
+
+ if (oinvoke.operation.getOutput() != null && oinvoke.operation.getOutput().getMessage() != null) {
+ if (src.getOutputVar() == null)
+ throw new CompilationException(__imsgs.errInvokeNoOutputMessageForOutputOp(oinvoke.operation.getName()));
+ oinvoke.outputVar = _context.resolveMessageVariable(src.getOutputVar(), oinvoke.operation.getOutput().getMessage().getQName());
+ }
- if (oinvoke.outputVar != null)
- doCorrelations(src.getCorrelations(Correlation.CORRPATTERN_IN), oinvoke.outputVar, oinvoke.assertCorrelationsOutput, oinvoke.initCorrelationsOutput);
+ if (oinvoke.inputVar != null)
+ doCorrelations(src.getCorrelations(Correlation.CORRPATTERN_OUT), oinvoke.inputVar, oinvoke.assertCorrelationsInput, oinvoke.initCorrelationsInput);
- if (!oinvoke.getOwner().version.equals(Constants.NS_BPEL4WS_2003_03)) {
- if (!oinvoke.partnerLink.initializePartnerRole && !_context.isPartnerLinkAssigned(oinvoke.partnerLink.getName())) {
- throw new CompilationException(__cmsgs.errUninitializedPartnerLinkInInvoke(oinvoke.partnerLink.getName()));
- }
+ if (oinvoke.outputVar != null)
+ doCorrelations(src.getCorrelations(Correlation.CORRPATTERN_IN), oinvoke.outputVar, oinvoke.assertCorrelationsOutput, oinvoke.initCorrelationsOutput);
+
+ if (!oinvoke.getOwner().version.equals(Constants.NS_BPEL4WS_2003_03)) {
+ if (!oinvoke.partnerLink.initializePartnerRole && !_context.isPartnerLinkAssigned(oinvoke.partnerLink.getName())) {
+ throw new CompilationException(__cmsgs.errUninitializedPartnerLinkInInvoke(oinvoke.partnerLink.getName()));
+ }
+ }
}
- }
- private void doCorrelations(List<Correlation> correlations, OScope.Variable var, Collection<OScope.CorrelationSet> assertCorrelations, Collection<OScope.CorrelationSet> initCorrelations) {
- for (Correlation correlation : correlations) {
- OScope.CorrelationSet cset = _context.resolveCorrelationSet(correlation.getCorrelationSet());
-
- switch (correlation.getInitiate()) {
- case Correlation.INITIATE_NO:
- assertCorrelations.add(cset);
- break;
- case Correlation.INITIATE_YES:
- initCorrelations.add(cset);
- break;
- case Correlation.INITIATE_RENDEZVOUS:
- // TODO: fixe errror
- throw new UnsupportedOperationException();
- }
-
- for (OProcess.OProperty property : cset.properties) {
- // Force resolution of alias, to make sure that we have one for this variable-property pair.
- try {
- _context.resolvePropertyAlias(var, property.name);
- } catch (CompilationException ce) {
- if (ce.getCompilationMessage().source == null) {
- ce.getCompilationMessage().source = correlation;
- }
- throw ce;
+ private void doCorrelations(List<Correlation> correlations, OScope.Variable var, Collection<OScope.CorrelationSet> assertCorrelations, Collection<OScope.CorrelationSet> initCorrelations) {
+ for (Correlation correlation : correlations) {
+ OScope.CorrelationSet cset = _context.resolveCorrelationSet(correlation.getCorrelationSet());
+
+ switch (correlation.getInitiate()) {
+ case Correlation.INITIATE_NO:
+ assertCorrelations.add(cset);
+ break;
+ case Correlation.INITIATE_YES:
+ initCorrelations.add(cset);
+ break;
+ case Correlation.INITIATE_RENDEZVOUS:
+ // TODO: fixe errror
+ throw new UnsupportedOperationException();
+ }
+
+ for (OProcess.OProperty property : cset.properties) {
+ // Force resolution of alias, to make sure that we have one for this variable-property pair.
+ try {
+ _context.resolvePropertyAlias(var, property.name);
+ } catch (CompilationException ce) {
+ if (ce.getCompilationMessage().source == null) {
+ ce.getCompilationMessage().source = correlation;
+ }
+ throw ce;
+ }
+ //onMessage.
+ }
}
- //onMessage.
- }
}
- }
}
Modified: incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/SequenceGenerator.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/SequenceGenerator.java?view=diff&rev=453516&r1=453515&r2=453516
==============================================================================
--- incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/SequenceGenerator.java (original)
+++ incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/SequenceGenerator.java Fri Oct 6 00:03:02 2006
@@ -34,27 +34,26 @@
class SequenceGenerator extends DefaultActivityGenerator {
- public OActivity newInstance(Activity src) {
- return new OSequence(_context.getOProcess());
- }
+ public OActivity newInstance(Activity src) {
+ return new OSequence(_context.getOProcess());
+ }
- public void compile(OActivity output, Activity src) {
- handleDefaultExtensibility(output, src);
- OSequence oseq = (OSequence) output;
- compileChildren(oseq, (SequenceActivity) src);
- }
+ public void compile(OActivity output, Activity src) {
+ OSequence oseq = (OSequence) output;
+ compileChildren(oseq, (SequenceActivity) src);
+ }
- protected void compileChildren(OSequence dest, CompositeActivity src) {
- for (Iterator<Activity> i = src.getChildren().iterator(); i.hasNext();) {
- Activity child = i.next();
- try {
- OActivity compiledChild = _context.compile(child);
- dest.sequence.add(compiledChild);
- }
- catch (CompilationException ce) {
- _context.recoveredFromError(child, ce);
- }
+ protected void compileChildren(OSequence dest, CompositeActivity src) {
+ for (Iterator<Activity> i = src.getChildren().iterator(); i.hasNext();) {
+ Activity child = i.next();
+ try {
+ OActivity compiledChild = _context.compile(child);
+ dest.sequence.add(compiledChild);
+ }
+ catch (CompilationException ce) {
+ _context.recoveredFromError(child, ce);
+ }
+ }
}
- }
}
Modified: incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/WhileGenerator.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/WhileGenerator.java?view=diff&rev=453516&r1=453515&r2=453516
==============================================================================
--- incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/WhileGenerator.java (original)
+++ incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/WhileGenerator.java Fri Oct 6 00:03:02 2006
@@ -28,15 +28,14 @@
* Generates code for <code><while></code> activities.
*/
class WhileGenerator extends DefaultActivityGenerator {
- public OActivity newInstance(Activity src) {
- return new OWhile(_context.getOProcess());
- }
+ public OActivity newInstance(Activity src) {
+ return new OWhile(_context.getOProcess());
+ }
- public void compile(OActivity output, Activity srcx) {
- handleDefaultExtensibility(output, srcx);
- OWhile owhile = (OWhile) output;
- WhileActivity src = (WhileActivity)srcx;
- owhile.whileCondition = _context.compileExpr(src.getCondition());
- owhile.activity = _context.compile(src.getActivity());
- }
+ public void compile(OActivity output, Activity srcx) {
+ OWhile owhile = (OWhile) output;
+ WhileActivity src = (WhileActivity)srcx;
+ owhile.whileCondition = _context.compileExpr(src.getCondition());
+ owhile.activity = _context.compile(src.getActivity());
+ }
}
Modified: incubator/ode/trunk/bpel-runtime/src/test/resources/recovery/failure-inheritence.bpel
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/test/resources/recovery/failure-inheritence.bpel?view=diff&rev=453516&r1=453515&r2=453516
==============================================================================
--- incubator/ode/trunk/bpel-runtime/src/test/resources/recovery/failure-inheritence.bpel (original)
+++ incubator/ode/trunk/bpel-runtime/src/test/resources/recovery/failure-inheritence.bpel Fri Oct 6 00:03:02 2006
@@ -6,6 +6,10 @@
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:ext="http://ode.apache.org/activityRecovery">
+ <ext:failureHandling>
+ <ext:retryFor>2</ext:retryFor>
+ <ext:retryDelay>0</ext:retryDelay>
+ </ext:failureHandling>
<import location="services.wsdl"
namespace="http://ode.apache.org/bpel/unit-test"
importType="http://schemas.xmlsoap.org/wsdl/"/>
@@ -25,10 +29,6 @@
</variables>
<sequence>
- <ext:failureHandling>
- <ext:retryFor>2</ext:retryFor>
- <ext:retryDelay>0</ext:retryDelay>
- </ext:failureHandling>
<receive name="start"
partnerLink="instantiatingPartnerLink"
portType="tns:InstantiatingPortType"