oevent.variable = resolveMessageVariable(onEvent.getVariable());
break;
case BPEL20_DRAFT:
case BPEL20:
if (onEvent.getMessageType() == null && onEvent.getElementType() == null)
throw new CompilationException(__cmsgs.errVariableDeclMissingType(onEvent.getVariable())
.setSource(onEvent));
if (onEvent.getMessageType() != null && onEvent.getElementType() != null)
throw new CompilationException(__cmsgs.errVariableDeclInvalid(onEvent.getVariable()).setSource(
onEvent));
OVarType varType;
if (onEvent.getMessageType() != null)
varType = resolveMessageType(onEvent.getMessageType());
else if (onEvent.getElement() != null)
varType = resolveElementType(onEvent.getElementType());
else
throw new CompilationException(__cmsgs
.errUnrecognizedVariableDeclaration(onEvent.getVariable()));
oevent.variable = new OScope.Variable(_oprocess, varType);
oevent.variable.name = onEvent.getVariable();
oevent.variable.declaringScope = _structureStack.topScope();
oevent.addLocalVariable(oevent.variable);
break;
default:
throw new AssertionError("Unexpected BPEL VERSION constatnt: " + _processDef.getBpelVersion());
}
oevent.partnerLink = resolvePartnerLink(onEvent.getPartnerLink());
oevent.operation = resolveMyRoleOperation(oevent.partnerLink, onEvent.getOperation());
oevent.messageExchangeId = onEvent.getMessageExchangeId();
if (onEvent.getPortType() != null
&& !onEvent.getPortType().equals(oevent.partnerLink.myRolePortType.getQName()))
throw new CompilationException(__cmsgs.errPortTypeMismatch(onEvent.getPortType(),
oevent.partnerLink.myRolePortType.getQName()));
for (Correlation correlation : onEvent.getCorrelations()) {
OScope.CorrelationSet cset = resolveCorrelationSet(correlation.getCorrelationSet());
switch (correlation.getInitiate()) {
case UNSET:
case NO:
if (oevent.matchCorrelation != null)
throw new CompilationException(__cmsgs.errTODO("Matching multiple correlations sets."));
oevent.matchCorrelation = cset;
oevent.partnerLink.addCorrelationSetForOperation(oevent.operation, cset);
break;
case YES:
oevent.initCorrelations.add(cset);
break;
case JOIN:
throw new CompilationException(__cmsgs.errTODO("Rendezvous."));
}
for (OProcess.OProperty property : cset.properties) {
// Force resolution of alias, to make sure that we have
// one for this variable-property pair.
resolvePropertyAlias(oevent.variable, property.name);
}
}
oevent.activity = compile(onEvent.getActivity());
}
});
// Check links crossing restrictions.
for (OLink link : oevent.incomingLinks)
try {
throw new CompilationException(__cmsgs.errLinkCrossesEventHandlerBoundary(link.name));
} catch (CompilationException ce) {
recoveredFromError(onEvent, ce);
}
for (OLink link : oevent.outgoingLinks)
try {
throw new CompilationException(__cmsgs.errLinkCrossesEventHandlerBoundary(link.name));
} catch (CompilationException ce) {
recoveredFromError(onEvent, ce);
}
oscope.eventHandler.onMessages.add(oevent);