/** * Produce a boolean {@link OExpression} expression that returns a constant * value. * * @param value * constant value to return * @return {@link OExpression} returning a constant value. */ public OExpression constantExpr(boolean value) { OConstantExpression ce = new OConstantExpression(_oprocess, value ? Boolean.TRUE : Boolean.FALSE); ce.debugInfo = createDebugInfo(_processDef, "Constant Boolean Expression: " + value); ce.expressionLanguage = _konstExprLang; return ce; }
private OCompensate createDefaultCompensateActivity(BpelObject source, String desc) { OCompensate activity = new OCompensate(_oprocess, getCurrent()); activity.name = "__autoGenCompensate:" + _structureStack.topScope().name; activity.debugInfo = createDebugInfo(source, desc); return activity; }
private OActivity compileActivity(final boolean doLinks, final Activity source) { final ActivityGenerator actgen = findActivityGen(source); final OActivity oact = actgen.newInstance(source); oact.name = createName(source, "activity"); oact.debugInfo = createDebugInfo(source, "Activity body for " + source); _compiledActivities.add(oact); compile(oact, source, new Runnable() { public void run() { if (doLinks) compileLinks(source); actgen.compile(oact, source); } }); return oact; }
public OXsdTypeVarType resolveXsdType(QName typeName) throws CompilationException { OXsdTypeVarType type = _oprocess.xsdTypes.get(typeName); if (type == null) { __log.debug("Resolving XSD type " + typeName); SchemaModel model = null; try { model = _wsdlRegistry.getSchemaModel(); } catch (IllegalArgumentException iaa) { } if (model == null || !model.knowsSchemaType(typeName)) throw new CompilationException(__cmsgs.errUndeclaredXsdType(typeName)); type = new OXsdTypeVarType(_oprocess); type.debugInfo = createDebugInfo(_processDef, "XSD Type: " + typeName); type.xsdType = typeName; type.simple = _wsdlRegistry.getSchemaModel().isSimpleType(typeName); _oprocess.xsdTypes.put(typeName, type); } return type; }
private void compile(TerminationHandler terminationHandler) { OScope oscope = _structureStack.topScope(); oscope.terminationHandler = new OTerminationHandler(_oprocess, oscope); oscope.terminationHandler.name = "__terminationHandler:" + oscope.name; oscope.terminationHandler.debugInfo = createDebugInfo(terminationHandler, null); if (terminationHandler == null) { oscope.terminationHandler.activity = createDefaultCompensateActivity(null, "Auto-generated 'compensate all' pseudo-activity for default termination handler on " + oscope.toString()); } else { _recoveryContextStack.push(oscope); try { oscope.terminationHandler.activity = compile(terminationHandler.getActivity()); } finally { _recoveryContextStack.pop(); } } }
private void compile(CompensationHandler compensationHandler) { OScope oscope = _structureStack.topScope(); oscope.compensationHandler = new OCompensationHandler(_oprocess, oscope); oscope.compensationHandler.name = "__compenationHandler_" + oscope.name; oscope.compensationHandler.debugInfo = createDebugInfo(compensationHandler, null); if (compensationHandler == null) { oscope.compensationHandler.activity = createDefaultCompensateActivity(compensationHandler, "Auto-generated 'compensate all' pseudo-activity for default compensation handler on " + oscope.toString()); } else { _recoveryContextStack.push(oscope); try { oscope.compensationHandler.activity = compile(compensationHandler.getActivity()); } finally { _recoveryContextStack.pop(); } } }
private OProcess.OProperty compile(Property property) { OProcess.OProperty oproperty = new OProcess.OProperty(_oprocess); oproperty.name = property.getName(); oproperty.debugInfo = createDebugInfo(_processDef, "Property " + property.getName()); if (!_wsdlRegistry.getSchemaModel().isSimpleType(property.getPropertyType())) throw new CompilationException(__cmsgs.errPropertyDeclaredWithComplexType(property.getName(), property.getPropertyType()).setSource(property)); _oprocess.properties.add(oproperty); if (__log.isDebugEnabled()) __log.debug("Compiled property " + oproperty); return oproperty; }
private void compile(CorrelationSet cset) { OScope oscope = _structureStack.topScope(); OScope.CorrelationSet ocset = new OScope.CorrelationSet(_oprocess); ocset.name = cset.getName(); ocset.declaringScope = oscope; ocset.debugInfo = createDebugInfo(cset, cset.toString()); QName[] setprops = cset.getProperties(); for (int j = 0; j < setprops.length; ++j) ocset.properties.add(resolveProperty(setprops[j])); oscope.addCorrelationSet(ocset); }
@SuppressWarnings("unchecked") public OMessageVarType resolveMessageType(QName messageType) { OMessageVarType msgType = _oprocess.messageTypes.get(messageType); if (msgType == null) { Message msg = _wsdlRegistry.getMessage(messageType); if (msg == null) { throw new CompilationException(__cmsgs.errUndeclaredMessage(messageType.getLocalPart(), messageType .getNamespaceURI())); } List<OMessageVarType.Part> parts = new ArrayList<OMessageVarType.Part>(); CollectionsX.transform(parts, ((List<Part>) msg.getOrderedParts(null)), new UnaryFunction<Part, OMessageVarType.Part>() { public OMessageVarType.Part apply(Part part) { OVarType partType; if (part.getElementName() != null) { partType = resolveElementType(part.getElementName()); } else { partType = resolveXsdType(part.getTypeName()); } OMessageVarType.Part opart = new OMessageVarType.Part(_oprocess, part.getName(), partType); opart.debugInfo = createDebugInfo(_processDef, "Message Variable Part: " + part.getName()); return opart; } }); msgType = new OMessageVarType(_oprocess, msg.getQName(), parts); msgType.debugInfo = createDebugInfo(_processDef, "Message Type: " + msg.getQName()); _oprocess.messageTypes.put(msg.getQName(), msgType); } return msgType; }
OSequence sequence = new OSequence(_oprocess, defaultCatch); sequence.name = "__defaultFaultHandler_sequence:" + oscope.name; sequence.debugInfo = createDebugInfo(fh, "Auto-generated sequence activity."); ORethrow rethrow = new ORethrow(_oprocess, sequence); rethrow.name = "__defaultFaultHandler_rethrow:" + oscope.name; rethrow.debugInfo = createDebugInfo(fh, "Auto-generated re-throw activity."); sequence.sequence.add(createDefaultCompensateActivity(fh, "Default compensation handler for " + oscope)); sequence.sequence.add(rethrow); for (final Catch catchSrc : fh.getCatches()) { final OCatch ctch = new OCatch(_oprocess, oscope); ctch.debugInfo = createDebugInfo(catchSrc, catchSrc.toString()); ctch.name = "__catch#" + i + ":" + _structureStack.topScope().name; ctch.faultName = catchSrc.getFaultName();
private void compileLinkTarget(LinkTarget target) { OLink ol = resolveLink(target.getLinkName()); assert ol != null; ol.debugInfo = createDebugInfo(target, target.toString()); if (ol.target != null) throw new CompilationException(__cmsgs.errDuplicateLinkTarget(target.getLinkName()).setSource(target)); ol.target = _structureStack.topActivity(); _structureStack.topActivity().targetLinks.add(ol); }
oexpr.debugInfo = createDebugInfo(expression, expression.toString()); expLanguage.debugInfo = createDebugInfo(_processDef, "Expression Language: " + expLang); expLanguage.expressionLanguageUri = expLang; _expLanguages.put(expLang, expLanguage);
public OScope compileSLC(final ScopeLikeActivity source, final OScope.Variable[] variables) { final OScope implicitScope = new OScope(_oprocess, getCurrent()); implicitScope.implicitScope = true; implicitScope.name = createName(source, "implicit-scope"); implicitScope.debugInfo = createDebugInfo(source, "Scope-like construct " + source); compileScope(implicitScope, source.getScope(), new Runnable() { public void run() { compileLinks(source); for (OScope.Variable v : variables) { v.declaringScope = implicitScope; implicitScope.addLocalVariable(v); } if (source instanceof ScopeActivity) { Activity scopeChild = ((ScopeActivity) source).getChildActivity(); if (scopeChild == null) throw new CompilationException(__cmsgs.errEmptyScope().setSource(source)); implicitScope.activity = compile(scopeChild); } else { implicitScope.activity = compileActivity(false, source); } } }); return implicitScope; }
private void compileLinkSource(LinkSource linksrc) { OLink ol = resolveLink(linksrc.getLinkName()); assert ol != null; ol.debugInfo = createDebugInfo(linksrc, linksrc.toString()); if (ol.source != null) throw new CompilationException(__cmsgs.errDuplicateLinkSource(linksrc.getLinkName()).setSource(linksrc)); ol.source = _structureStack.topActivity(); ol.transitionCondition = linksrc.getTransitionCondition() == null ? constantExpr(true) : compileExpr(linksrc .getTransitionCondition()); _structureStack.topActivity().sourceLinks.add(ol); _structureStack.topActivity().outgoingLinks.add(ol); }
throw new IllegalArgumentException("Unnamed scope:" + src); oscope.debugInfo = createDebugInfo(src, src.toString());
private OProcess.OPropertyAlias compile(PropertyAlias src) { OProcess.OProperty property = resolveProperty(src.getPropertyName()); OProcess.OPropertyAlias alias = new OProcess.OPropertyAlias(_oprocess); alias.debugInfo = createDebugInfo(_processDef, "PropertyAlias " + src.getPropertyName() + " for " + src.getMessageType()); if (src.getMessageType() == null){ throw new CompilationException(__cmsgs.errAliasUndeclaredMessage(src.getPropertyName(), src.getQuery().getPath())); } OMessageVarType messageType = resolveMessageType(src.getMessageType()); OVarType rootNodeType = messageType; alias.varType = messageType; // bpel 2.0 excludes declaration of part; // bpel 1.1 requires it if (src.getPart() != null) { alias.part = messageType.parts.get(src.getPart()); if (alias.part == null) throw new CompilationException(__cmsgs.errUnknownPartInAlias(src.getPart(), messageType.messageType.toString())); rootNodeType = alias.part.type; } if (src.getQuery() != null) alias.location = compileExpr(src.getQuery(), rootNodeType, null, new Object[1]); property.aliases.add(alias); alias.debugInfo = createDebugInfo(_processDef, src.getMessageType() + " --> " + src.getPropertyName()); return alias; }
/** * Compile external variable declaration. * @param src variable object * @return compiled {@link OExtVar} representation. */ private OExtVar compileExtVar(Variable src) { if (!src.isExternal()) return null; OExtVar oextvar = new OExtVar(_oprocess); oextvar.externalVariableId = src.getExternalId(); oextvar.debugInfo = createDebugInfo(src, null); if (src.getExternalId() == null) throw new CompilationException(__cmsgs.errMustSpecifyExternalVariableId(src.getName())); if (src.getRelated() == null) throw new CompilationException(__cmsgs.errMustSpecifyRelatedVariable(src.getName())); oextvar.related = resolveVariable(src.getRelated()); return oextvar; }
ovar.debugInfo = createDebugInfo(src, null);
private void compile(final PartnerLink plink) { OPartnerLink oplink = new OPartnerLink(_oprocess); oplink.debugInfo = createDebugInfo(plink, plink.toString()); try { PartnerLinkType plinkType = resolvePartnerLinkType(plink.getPartnerLinkType());
oalarm.debugInfo = createDebugInfo(onAlarm, "OnAlarm Event Handler: " + onAlarm);