Author: mszefler
Date: Thu Sep 21 09:14:46 2006
New Revision: 448596
URL: http://svn.apache.org/viewvc?view=rev&rev=448596
Log:
Fixed handling of "Rendezvous" ((TM) Tibco Corp. ALL RIGHTS RESERVED) now know
by the more mundane name
"join" for the subset of cases where the createInstance receive is embedded in
a <while> loop.
Modified:
incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/PickGeneratorMessages.java
incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/PickReceiveGenerator.java
incubator/ode/trunk/bpel-parser/src/main/java/org/apache/ode/sax/fsa/bpel_1_1/BaseBpelState.java
incubator/ode/trunk/bpel-parser/src/main/java/org/apache/ode/sax/fsa/bpel_2_0/BaseBpelState.java
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/PICK.java
Modified:
incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/PickGeneratorMessages.java
URL:
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/PickGeneratorMessages.java?view=diff&rev=448596&r1=448595&r2=448596
==============================================================================
---
incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/PickGeneratorMessages.java
(original)
+++
incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/PickGeneratorMessages.java
Thu Sep 21 09:14:46 2006
@@ -24,24 +24,27 @@
public class PickGeneratorMessages extends CompilationMessageBundle {
- /**
- * Attempt to use multiple non-initiate correlation sets; second set was
- * "{0}".
- */
- public CompilationMessage errSecondNonInitiateCorrelationSet(String setName)
{
- return this.formatCompilationMessage(
- "Attempt to use multiple non-initiate correlation sets;" + " second
set was \"{0}\".",
- setName);
- }
+ /**
+ * Attempt to use multiple non-initiate correlation sets; second set was
+ * "{0}".
+ */
+ public CompilationMessage errSecondNonInitiateCorrelationSet(String
setName) {
+ return this.formatCompilationMessage("Attempt to use multiple
non-initiate correlation sets;"
+ + " second set was \"{0}\".", setName);
+ }
- // TODO: better error message
- public CompilationMessage errForOrUntilMustBeGiven() {
- return this.formatCompilationMessage("errForOrUntilMustBeGiven");
- }
+ // TODO: better error message
+ public CompilationMessage errForOrUntilMustBeGiven() {
+ return this.formatCompilationMessage("errForOrUntilMustBeGiven");
+ }
- // TODO: better error message
- public CompilationMessage errOnAlarmWithCreateInstance() {
- return this.formatCompilationMessage("errOnAlarmWithCreateInstance");
- }
+ // TODO: better error message
+ public CompilationMessage errOnAlarmWithCreateInstance() {
+ return this.formatCompilationMessage("errOnAlarmWithCreateInstance");
+ }
+
+ public CompilationMessage errRendezvousNotSupported() {
+ return this.formatCompilationMessage("Rendezvous correlation mode not
supported in this context.");
+ }
}
Modified:
incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/PickReceiveGenerator.java
URL:
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/PickReceiveGenerator.java?view=diff&rev=448596&r1=448595&r2=448596
==============================================================================
---
incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/PickReceiveGenerator.java
(original)
+++
incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/PickReceiveGenerator.java
Thu Sep 21 09:14:46 2006
@@ -31,79 +31,99 @@
import java.util.Collection;
/**
- * Base class for the [EMAIL PROTECTED] PickGenerator} and [EMAIL PROTECTED]
ReceiveGenerator} classes.
- * Provides common functionality related to generating [EMAIL PROTECTED]
org.apache.ode.bpel.o.OPickReceive.OnMessage}
- * objects.
+ * Base class for the [EMAIL PROTECTED] PickGenerator} and [EMAIL PROTECTED]
ReceiveGenerator}
+ * classes. Provides common functionality related to generating
+ * [EMAIL PROTECTED] org.apache.ode.bpel.o.OPickReceive.OnMessage} objects.
*/
abstract class PickReceiveGenerator extends DefaultActivityGenerator {
- protected static final CommonCompilationMessages __cmsgsGeneral =
- MessageBundle.getMessages(CommonCompilationMessages.class);
+ protected static final CommonCompilationMessages __cmsgsGeneral =
MessageBundle
+ .getMessages(CommonCompilationMessages.class);
- protected static final PickGeneratorMessages __cmsgs =
- MessageBundle.getMessages(PickGeneratorMessages.class);
+ protected static final PickGeneratorMessages __cmsgs =
MessageBundle.getMessages(PickGeneratorMessages.class);
- public OActivity newInstance(Activity src) {
- return new OPickReceive(_context.getOProcess());
- }
-
-
- /**
- * Compile an On-Message or Receive block.
- * @param varname name of variable to receive into
- * @param plink partner link to receive on
- * @param operation name of operation
- * @param portType optional portType
- * @param createInstance is this a start activity
- * @param correlations the correlations used
- * @return
- */
- protected OPickReceive.OnMessage compileOnMessage(String varname, String
plink, String operation, String messageExchangeId, QName portType, boolean
createInstance,
- Collection<Correlation> correlations) {
-
- OPickReceive.OnMessage onMessage = new
OPickReceive.OnMessage(_context.getOProcess());
- onMessage.partnerLink = _context.resolvePartnerLink(plink);
- onMessage.operation =
_context.resolveMyRoleOperation(onMessage.partnerLink, operation);
- if (onMessage.operation.getInput() != null &&
onMessage.operation.getInput().getMessage() != null)
- onMessage.variable =
_context.resolveMessageVariable(varname,onMessage.operation.getInput().getMessage().getQName());
- onMessage.messageExchangeId = messageExchangeId;
-
- if (portType != null &&
!portType.equals(onMessage.partnerLink.myRolePortType.getQName()))
- throw new
CompilationException(__cmsgsGeneral.errPortTypeMismatch(portType,
onMessage.partnerLink.myRolePortType.getQName()));
-
- if (createInstance)
- onMessage.partnerLink.addCreateInstanceOperation(onMessage.operation);
-
- for (Correlation correlation : correlations) {
- OScope.CorrelationSet cset =
_context.resolveCorrelationSet(correlation.getCorrelationSet());
-
- switch (correlation.getInitiate()) {
- case Correlation.INITIATE_NO:
- if (createInstance)
- throw new
CompilationException(__cmsgsGeneral.errUseOfUninitializedCorrelationSet(correlation.getCorrelationSet()));
- if (onMessage.matchCorrelation != null)
- throw new
CompilationException(__cmsgs.errSecondNonInitiateCorrelationSet(correlation.getCorrelationSet()));
- onMessage.matchCorrelation = cset;
-
onMessage.partnerLink.addCorrelationSetForOperation(onMessage.operation, cset);
- break;
- case Correlation.INITIATE_YES:
- onMessage.initCorrelations.add(cset);
-
onMessage.partnerLink.addCorrelationSetForOperation(onMessage.operation, cset);
- break;
- case Correlation.INITIATE_RENDEZVOUS:
- 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.
- _context.resolvePropertyAlias(onMessage.variable, property.name);
- }
+ public OActivity newInstance(Activity src) {
+ return new OPickReceive(_context.getOProcess());
}
- if (!onMessage.partnerLink.hasMyRole()) {
- throw new
CompilationException(__cmsgsGeneral.errNoMyRoleOnReceivePartnerLink(onMessage.partnerLink.getName()));
- }
+ /**
+ * Compile an On-Message or Receive block.
+ *
+ * @param varname
+ * name of variable to receive into
+ * @param plink
+ * partner link to receive on
+ * @param operation
+ * name of operation
+ * @param portType
+ * optional portType
+ * @param createInstance
+ * is this a start activity
+ * @param correlations
+ * the correlations used
+ * @return
+ */
+ protected OPickReceive.OnMessage compileOnMessage(String varname, String
plink, String operation,
+ String messageExchangeId, QName portType, boolean createInstance,
Collection<Correlation> correlations) {
+
+ OPickReceive.OnMessage onMessage = new
OPickReceive.OnMessage(_context.getOProcess());
+ onMessage.partnerLink = _context.resolvePartnerLink(plink);
+ onMessage.operation =
_context.resolveMyRoleOperation(onMessage.partnerLink, operation);
+ if (onMessage.operation.getInput() != null &&
onMessage.operation.getInput().getMessage() != null)
+ onMessage.variable = _context.resolveMessageVariable(varname,
onMessage.operation.getInput().getMessage()
+ .getQName());
+ onMessage.messageExchangeId = messageExchangeId;
+
+ if (portType != null &&
!portType.equals(onMessage.partnerLink.myRolePortType.getQName()))
+ throw new
CompilationException(__cmsgsGeneral.errPortTypeMismatch(portType,
+ onMessage.partnerLink.myRolePortType.getQName()));
+
+ if (createInstance)
+
onMessage.partnerLink.addCreateInstanceOperation(onMessage.operation);
+
+ for (Correlation correlation : correlations) {
+ OScope.CorrelationSet cset =
_context.resolveCorrelationSet(correlation.getCorrelationSet());
+
+ switch (correlation.getInitiate()) {
+ case Correlation.INITIATE_NO:
+ if (createInstance)
+ throw new
CompilationException(__cmsgsGeneral.errUseOfUninitializedCorrelationSet(correlation
+ .getCorrelationSet()));
+ if (onMessage.matchCorrelation != null)
+ throw new
CompilationException(__cmsgs.errSecondNonInitiateCorrelationSet(correlation
+ .getCorrelationSet()));
+ onMessage.matchCorrelation = cset;
+
onMessage.partnerLink.addCorrelationSetForOperation(onMessage.operation, cset);
+ break;
+ case Correlation.INITIATE_YES:
+ onMessage.initCorrelations.add(cset);
+
onMessage.partnerLink.addCorrelationSetForOperation(onMessage.operation, cset);
+ break;
+ case Correlation.INITIATE_RENDEZVOUS:
+ if (createInstance) {
+
onMessage.partnerLink.addCorrelationSetForOperation(onMessage.operation, cset);
+ onMessage.initCorrelations.add(cset);
+ onMessage.matchCorrelation = cset;
+ } else {
+ throw new
CompilationException(__cmsgs.errRendezvousNotSupported());
+
+ }
+ break;
+
+ }
+
+ for (OProcess.OProperty property : cset.properties) {
+ // Force resolution of alias, to make sure that we have one for
+ // this variable-property pair.
+ _context.resolvePropertyAlias(onMessage.variable,
property.name);
+ }
+ }
+
+ if (!onMessage.partnerLink.hasMyRole()) {
+ throw new
CompilationException(__cmsgsGeneral.errNoMyRoleOnReceivePartnerLink(onMessage.partnerLink
+ .getName()));
+ }
- return onMessage;
- }
+ return onMessage;
+ }
}
Modified:
incubator/ode/trunk/bpel-parser/src/main/java/org/apache/ode/sax/fsa/bpel_1_1/BaseBpelState.java
URL:
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-parser/src/main/java/org/apache/ode/sax/fsa/bpel_1_1/BaseBpelState.java?view=diff&rev=448596&r1=448595&r2=448596
==============================================================================
---
incubator/ode/trunk/bpel-parser/src/main/java/org/apache/ode/sax/fsa/bpel_1_1/BaseBpelState.java
(original)
+++
incubator/ode/trunk/bpel-parser/src/main/java/org/apache/ode/sax/fsa/bpel_1_1/BaseBpelState.java
Thu Sep 21 09:14:46 2006
@@ -29,78 +29,114 @@
abstract class BaseBpelState extends AbstractState {
- public static final int START_STATE = -1;
-
- public static final int BPEL11_PROCESS = 1000;
- public static final int BPEL11_PARTNERLINKS = 1001;
- public static final int BPEL11_PARTNERLINK = 1002;
- public static final int BPEL11_PARTNERS = 1003;
- public static final int BPEL11_PARTNER = 1004;
- public static final int BPEL11_VARIABLES = 1005;
- public static final int BPEL11_VARIABLE = 1006;
- public static final int BPEL11_CORRELATIONSETS = 1007;
- public static final int BPEL11_CORRELATIONSET = 1008;
- public static final int BPEL11_FAULTHANDLERS = 1009;
- public static final int BPEL11_CATCH = 1010;
- public static final int BPEL11_CATCHALL = 1011;
- public static final int BPEL11_COMPENSATIONHANDLER = 1012;
- public static final int BPEL11_EVENTHANDLERS = 1013;
- public static final int BPEL11_ONMESSAGE = 1014;
- public static final int BPEL11_CORRELATIONS = 1015;
- public static final int BPEL11_ONALARM = 1016;
- public static final int BPEL11_EMPTY = 1017;
- public static final int BPEL11_INVOKE = 1018;
- public static final int BPEL11_RECEIVE = 1019;
- public static final int BPEL11_REPLY = 1020;
- public static final int BPEL11_ASSIGN = 1021;
- public static final int BPEL11_COPY = 1022;
- public static final int BPEL11_FROM = 1023;
- public static final int BPEL11_TO = 1024;
- public static final int BPEL11_WAIT = 1025;
- public static final int BPEL11_THROW = 1026;
- public static final int BPEL11_TERMINATE = 1027;
- public static final int BPEL11_FLOW = 1028;
- public static final int BPEL11_SWITCH = 1029;
- public static final int BPEL11_WHILE = 1030;
- public static final int BPEL11_SEQUENCE = 1031;
- public static final int BPEL11_PICK = 1032;
- public static final int BPEL11_SCOPE = 1033;
- public static final int BPEL11_CASE = 1034;
- public static final int BPEL11_COMPENSATE = 1035;
- public static final int BPEL11_SOURCE = 1036;
- public static final int BPEL11_TARGET = 1037;
- public static final int BPEL11_LINKS = 1038;
- public static final int BPEL11_LINK = 1039;
- public static final int BPEL11_CORRELATION = 1040;
- public static final int BPEL11_OTHERWISE = 1041;
-
- public static final int BPEL20_PROCESS = 2000;
-
- protected static final XmlAttributeSpec BPEL11_ACTIVITY_ATTS = new
FilterSpec(
- new String[] {},
- new String[] {"name","joinCondition","suppressJoinFailure"});
-
-
-
- protected BaseBpelState(ParseContext pc) {
- super(pc);
- }
-
- protected boolean checkYesNo(String val) {
- return val != null && val.equals("yes");
- }
-
- protected short getSuppressJoinFailure(XmlAttributes atts) {
- if (!atts.hasAtt("suppressJoinFailure")) {
- return JoinFailureSuppressor.SUPJOINFAILURE_NOTSET;
- } else {
- String sjf = atts.getValue("suppressJoinFailure");
- return
checkYesNo(sjf)?Process.SUPJOINFAILURE_YES:Process.SUPJOINFAILURE_NO;
- }
- }
-
- protected short getInitiateYesNo(XmlAttributes atts) {
- return
checkYesNo(atts.getValue("initiate"))?Correlation.INITIATE_YES:Correlation.INITIATE_NO;
- }
-
+ public static final int START_STATE = -1;
+
+ public static final int BPEL11_PROCESS = 1000;
+
+ public static final int BPEL11_PARTNERLINKS = 1001;
+
+ public static final int BPEL11_PARTNERLINK = 1002;
+
+ public static final int BPEL11_PARTNERS = 1003;
+
+ public static final int BPEL11_PARTNER = 1004;
+
+ public static final int BPEL11_VARIABLES = 1005;
+
+ public static final int BPEL11_VARIABLE = 1006;
+
+ public static final int BPEL11_CORRELATIONSETS = 1007;
+
+ public static final int BPEL11_CORRELATIONSET = 1008;
+
+ public static final int BPEL11_FAULTHANDLERS = 1009;
+
+ public static final int BPEL11_CATCH = 1010;
+
+ public static final int BPEL11_CATCHALL = 1011;
+
+ public static final int BPEL11_COMPENSATIONHANDLER = 1012;
+
+ public static final int BPEL11_EVENTHANDLERS = 1013;
+
+ public static final int BPEL11_ONMESSAGE = 1014;
+
+ public static final int BPEL11_CORRELATIONS = 1015;
+
+ public static final int BPEL11_ONALARM = 1016;
+
+ public static final int BPEL11_EMPTY = 1017;
+
+ public static final int BPEL11_INVOKE = 1018;
+
+ public static final int BPEL11_RECEIVE = 1019;
+
+ public static final int BPEL11_REPLY = 1020;
+
+ public static final int BPEL11_ASSIGN = 1021;
+
+ public static final int BPEL11_COPY = 1022;
+
+ public static final int BPEL11_FROM = 1023;
+
+ public static final int BPEL11_TO = 1024;
+
+ public static final int BPEL11_WAIT = 1025;
+
+ public static final int BPEL11_THROW = 1026;
+
+ public static final int BPEL11_TERMINATE = 1027;
+
+ public static final int BPEL11_FLOW = 1028;
+
+ public static final int BPEL11_SWITCH = 1029;
+
+ public static final int BPEL11_WHILE = 1030;
+
+ public static final int BPEL11_SEQUENCE = 1031;
+
+ public static final int BPEL11_PICK = 1032;
+
+ public static final int BPEL11_SCOPE = 1033;
+
+ public static final int BPEL11_CASE = 1034;
+
+ public static final int BPEL11_COMPENSATE = 1035;
+
+ public static final int BPEL11_SOURCE = 1036;
+
+ public static final int BPEL11_TARGET = 1037;
+
+ public static final int BPEL11_LINKS = 1038;
+
+ public static final int BPEL11_LINK = 1039;
+
+ public static final int BPEL11_CORRELATION = 1040;
+
+ public static final int BPEL11_OTHERWISE = 1041;
+
+ public static final int BPEL20_PROCESS = 2000;
+
+ protected static final XmlAttributeSpec BPEL11_ACTIVITY_ATTS = new
FilterSpec(new String[] {}, new String[] {
+ "name", "joinCondition", "suppressJoinFailure" });
+
+ protected BaseBpelState(ParseContext pc) {
+ super(pc);
+ }
+
+ protected boolean checkYesNo(String val) {
+ return val != null && val.equals("yes");
+ }
+
+ protected short getSuppressJoinFailure(XmlAttributes atts) {
+ if (!atts.hasAtt("suppressJoinFailure"))
+ return JoinFailureSuppressor.SUPJOINFAILURE_NOTSET;
+ String sjf = atts.getValue("suppressJoinFailure");
+ return checkYesNo(sjf) ? Process.SUPJOINFAILURE_YES :
Process.SUPJOINFAILURE_NO;
+ }
+
+ protected short getInitiateYesNo(XmlAttributes atts) {
+ return checkYesNo(atts.getValue("initiate")) ?
Correlation.INITIATE_YES : Correlation.INITIATE_NO;
+ }
+
}
Modified:
incubator/ode/trunk/bpel-parser/src/main/java/org/apache/ode/sax/fsa/bpel_2_0/BaseBpelState.java
URL:
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-parser/src/main/java/org/apache/ode/sax/fsa/bpel_2_0/BaseBpelState.java?view=diff&rev=448596&r1=448595&r2=448596
==============================================================================
---
incubator/ode/trunk/bpel-parser/src/main/java/org/apache/ode/sax/fsa/bpel_2_0/BaseBpelState.java
(original)
+++
incubator/ode/trunk/bpel-parser/src/main/java/org/apache/ode/sax/fsa/bpel_2_0/BaseBpelState.java
Thu Sep 21 09:14:46 2006
@@ -164,7 +164,16 @@
}
protected short getInitiateYesNo(XmlAttributes atts) {
- return
checkYesNo(atts.getValue("initiate"))?Correlation.INITIATE_YES:Correlation.INITIATE_NO;
+ String val = atts.getValue("initiate");
+ if (val == null || "".equals(val))
+ return Correlation.INITIATE_NO;
+ if (val.equals("yes"))
+ return Correlation.INITIATE_YES;
+ if (val.equals("join"))
+ return Correlation.INITIATE_RENDEZVOUS;
+
+ // TODO: Should really throw an error here no?
+ return Correlation.INITIATE_NO;
}
protected abstract BpelObject createBpelObject(StartElement se) throws
ParseException;
Modified:
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/PICK.java
URL:
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/PICK.java?view=diff&rev=448596&r1=448595&r2=448596
==============================================================================
---
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/PICK.java
(original)
+++
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/PICK.java
Thu Sep 21 09:14:46 2006
@@ -70,19 +70,24 @@
selectors = new Selector[_opick.onMessages.size()];
int idx = 0;
for (OPickReceive.OnMessage onMessage : _opick.onMessages) {
- CorrelationKey key = null;
+ CorrelationKey key = null; // this will be the case for the
createInstance activity
+
PartnerLinkInstance pLinkInstance =
_scopeFrame.resolve(onMessage.partnerLink);
if (onMessage.matchCorrelation == null && !_opick.createInstanceFlag) {
// Adding a route for opaque correlation. In this case, correlation
is on "out-of-band" session-id
String sessionId =
getBpelRuntimeContext().fetchMySessionId(pLinkInstance);
key = new CorrelationKey(-1, new String[]{sessionId});
} else if (onMessage.matchCorrelation != null) {
- if
(!getBpelRuntimeContext().isCorrelationInitialized(_scopeFrame.resolve(onMessage.matchCorrelation)))
- throw new
FaultException(_opick.getOwner().constants.qnCorrelationViolation, "Correlation
not initialized.");
-
- key =
getBpelRuntimeContext().readCorrelation(_scopeFrame.resolve(onMessage.matchCorrelation));
-
- assert key != null;
+ if
(!getBpelRuntimeContext().isCorrelationInitialized(_scopeFrame.resolve(onMessage.matchCorrelation)))
{
+ // the following should really test if this is a "join" type
correlation...
+ if (!_opick.createInstanceFlag)
+ throw new
FaultException(_opick.getOwner().constants.qnCorrelationViolation, "Correlation
not initialized.");
+ } else {
+
+ key =
getBpelRuntimeContext().readCorrelation(_scopeFrame.resolve(onMessage.matchCorrelation));
+
+ assert key != null;
+ }
}
selectors[idx] = new Selector(idx, pLinkInstance,
onMessage.operation.getName(), onMessage.operation.getOutput() == null,
onMessage.messageExchangeId, key);