public OLink resolveLink(String linkName) { OLink ret = null; // Fist find where the link is declared. for (Iterator<OActivity> i = _structureStack.iterator(); i.hasNext();) { OActivity oact = i.next(); if (oact instanceof OFlow) ret = ((OFlow) oact).getLocalLink(linkName); if (ret != null) return ret; } throw new CompilationException(__cmsgs.errUndeclaredLink(linkName)); }
public OScope.CorrelationSet resolveCorrelationSet(String csetName) { for (Iterator<OScope> i = _structureStack.oscopeIterator(); i.hasNext();) { OScope.CorrelationSet cset = i.next().getCorrelationSet(csetName); if (cset != null) return cset; } throw new CompilationException(__cmsgs.errUndeclaredCorrelationSet(csetName)); }
public void compile(OActivity context, BpelObject source, Runnable run) { DefaultActivityGenerator.defaultExtensibilityElements(context, source); _structureStack.push(context,source); try { run.run(); } finally { OActivity popped = _structureStack.pop(); OActivity newtop = _structureStack.topActivity(); OScope topScope = _structureStack.topScope(); if (newtop != null) { newtop.nested.add(popped); // Transfer outgoing and incoming links, excluding the locally defined links. newtop.incomingLinks.addAll(popped.incomingLinks); if (newtop instanceof OFlow) newtop.incomingLinks.removeAll(((OFlow) newtop).localLinks); newtop.outgoingLinks.addAll(popped.outgoingLinks); if (newtop instanceof OFlow) newtop.outgoingLinks.removeAll(((OFlow) newtop).localLinks); // Transfer variables read/writen newtop.variableRd.addAll(popped.variableRd); newtop.variableWr.addAll(popped.variableWr); } if (topScope != null && popped instanceof OScope) topScope.compensatable.add((OScope) popped); } }
private void compile(FaultHandler fh) { OScope oscope = _structureStack.topScope(); oscope.faultHandler = new OFaultHandler(_oprocess); if (fh == null) { final OCatch ctch = new OCatch(_oprocess, oscope); ctch.debugInfo = createDebugInfo(catchSrc, catchSrc.toString()); ctch.name = "__catch#" + i + ":" + _structureStack.topScope().name; ctch.faultName = catchSrc.getFaultName(); compile(ctch, catchSrc, new Runnable() {
private void compile(final OnEvent onEvent) { final OScope oscope = _structureStack.topScope(); assert oscope.eventHandler != null;
oevent.variable.declaringScope = _structureStack.topScope();
oplink.declaringScope = _structureStack.topScope(); if (oplink.declaringScope.partnerLinks.containsKey(oplink.name)) throw new CompilationException(__cmsgs.errDuplicatePartnerLinkDecl(oplink.name));
private void compile(final Variable src) { final OScope oscope = _structureStack.topScope();
private void compile(final OnAlarm onAlarm) { OScope oscope = _structureStack.topScope(); assert oscope.eventHandler != null;
public void run() { if (process.getRootActivity() == null) { throw new CompilationException(__cmsgs.errNoRootActivity()); } // Process custom properties are created as variables associated // with the top scope if (_customProcessProperties != null) { for (Map.Entry<QName, Node> customVar : _customProcessProperties.entrySet()) { final OScope oscope = _structureStack.topScope(); OVarType varType = new OConstantVarType(_oprocess, customVar.getValue()); OScope.Variable ovar = new OScope.Variable(_oprocess, varType); ovar.name = customVar.getKey().getLocalPart(); ovar.declaringScope = oscope; ovar.debugInfo = createDebugInfo(null, "Process custom property variable"); oscope.addLocalVariable(ovar); if (__log.isDebugEnabled()) __log.debug("Compiled custom property variable " + ovar); } } _structureStack.topScope().activity = compile(process.getRootActivity()); } });
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 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(); } } }
public BpelObject topSource() { return _srcMap.get(topActivity()); }
public OActivity getCurrent() { return _structureStack.topActivity(); }
public OScope topScope() { List<OScope> scopeStack = scopeStack(); return scopeStack.isEmpty() ? null : scopeStack.get(scopeStack.size() - 1); }
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); }
public OScope.Variable resolveVariable(String varName) { for (Iterator<OScope> i = _structureStack.oscopeIterator(); i.hasNext();) { OScope.Variable var = i.next().getLocalVariable(varName); if (var != null) return var; } // A "real" variable couldn't be found, checking if we're dealing with a // process custom property if (_customProcessProperties != null && _customProcessProperties.get(QName.valueOf(varName)) != null) { } throw new CompilationException(__cmsgs.errUndeclaredVariable(varName)); }
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; }