Package org.apache.ode.bpel.rtrep.v2.channels

Examples of org.apache.ode.bpel.rtrep.v2.channels.InvokeResponseChannelListener


                final InvokeResponseChannel invokeResponseChannel = newChannel(InvokeResponseChannel.class);

                final String mexId = getBpelRuntime().invoke(invokeResponseChannel.export(),
                    _scopeFrame.resolve(_oinvoke.partnerLink), _oinvoke.operation, outboundMsg, invokeResponseChannel);

                object(false, new InvokeResponseChannelListener(invokeResponseChannel) {
                    private static final long serialVerstmptmpionUID = 4496880438819196765L;

                    public void onResponse() {
                        // we don't have to write variable data -> this already
                        // happened in the nativeAPI impl
                        FaultData fault = null;

                        Element response;
                        try {
                            response = getBpelRuntime().getPartnerResponse(mexId);
                        } catch (Exception e) {
                            __log.error("Exception while processing invoke response", e);
                            throw new RuntimeException(e);
                        }

                        try {
                        initializeVariable(outputVar, response);
                        } catch (ExternalVariableModuleException e) {
                          __log.error("Exception while initializing external variable", e);
                            _self.parent.failure(e.toString(), null);
                            return;
                        }
                       
                        // Generating event
                        VariableModificationEvent se = new VariableModificationEvent(outputVar.declaration.name);
                        se.setNewValue(response);
                        if (_oinvoke.debugInfo != null)
                            se.setLineNo(_oinvoke.debugInfo.startLine);
                        sendEvent(se);

                        try {
                            for (OScope.CorrelationSet anInitCorrelationsOutput : _oinvoke.initCorrelationsOutput) {
                                initializeCorrelation(_scopeFrame.resolve(anInitCorrelationsOutput), outputVar);
                            }
                            if (_oinvoke.partnerLink.hasPartnerRole()) {
                                // Trying to initialize partner epr based on a message-provided epr/session.
                                if (!getBpelRuntime().isPartnerRoleEndpointInitialized(_scopeFrame
                                        .resolve(_oinvoke.partnerLink)) || !_oinvoke.partnerLink.initializePartnerRole) {
                   
                                    Node fromEpr = getBpelRuntime().getSourceEPR(mexId);
                                    if (fromEpr != null) {
                                        getBpelRuntime().writeEndpointReference(
                                            _scopeFrame.resolve(_oinvoke.partnerLink), (Element) fromEpr);
                                    }
                                }                   
                               
                                String partnersSessionId = getBpelRuntime().getSourceSessionId(mexId);
                                if (partnersSessionId != null)
                                    getBpelRuntime().initializePartnersSessionId(_scopeFrame.resolve(_oinvoke.partnerLink),
                                        partnersSessionId);
                               
                            }
                        } catch (FaultException e) {
                            fault = createFault(e.getQName(), _oinvoke);
                        }

                        // TODO update output variable with data from non-initiate correlation sets

                        _self.parent.completed(fault, CompensationHandler.emptySet());
                        getBpelRuntime().releasePartnerMex(mexId);
                    }

                    public void onFault() {
                        QName faultName = getBpelRuntime().getPartnerFault(mexId);
                        Element msg = getBpelRuntime().getPartnerResponse(mexId);
                        QName msgType = getBpelRuntime().getPartnerResponseType(mexId);
                        FaultData fault = createFault(faultName, msg,
                            _oinvoke.getOwner().messageTypes.get(msgType), _self.o);
                        _self.parent.completed(fault, CompensationHandler.emptySet());
                        getBpelRuntime().releasePartnerMex(mexId);
                    }

                    public void onFailure() {
                        // This indicates a communication failure. We don't throw a fault,
                        // because there is no fault, instead we'll re-incarnate the invoke
                        // and either retry or indicate failure condition.
                        // admin to resume the process.
                        String reason = getBpelRuntime().getPartnerFaultExplanation(mexId);
                        __log.error("Failure during invoke: " + reason);
                        try {
                            Element el = DOMUtils.stringToDOM("<invokeFailure><![CDATA["+reason+"]]></invokeFailure>");
                            _self.parent.failure(reason, el);
                        } catch (Exception e) {
                            _self.parent.failure(reason, null);
                        }
                        getBpelRuntime().releasePartnerMex(mexId);
                    }

                }.or(new TerminationChannelListener(_self.self) {
                    private static final long serialVersionUID = 4219496341785922396L;

                    public void terminate() {
                      _self.parent.completed(null, CompensationHandler.emptySet());
                      object(new InvokeResponseChannelListener(invokeResponseChannel) {
                        private static final long serialVersionUID = 688746737897792929L;
            public void onFailure() {
              __log.debug("Failure on invoke ignored, the invoke has already been terminated: " + _oinvoke.toString());
            }
            public void onFault() {
View Full Code Here


    private DebugInfo createDebugInfo(BpelObject bpelObject, String description) {
        int lineNo = bpelObject == null ? -1 : bpelObject.getLineNo();
        String str = description == null && bpelObject != null ? bpelObject.toString() : null;
        Map<QName, Object> extElmt = bpelObject == null ? null : bpelObject.getExtensibilityElements();
        DebugInfo debugInfo = new DebugInfo(_processDef.getSource(), lineNo, extElmt);
        debugInfo.description = str;
        return debugInfo;
    }
View Full Code Here

    }

    protected void compileChildren(OExtensionActivity dest, CompositeActivity src) {
        for (Activity child : src.getActivities()) {
            try {
                OActivity compiledChild = _context.compile(child);
                dest.children.add(compiledChild);
            }
            catch (CompilationException ce) {
                _context.recoveredFromError(child, ce);
            }
View Full Code Here

        if (src.getActivities().size() == 0)
            throw new CompilationException(__cmsgs.errEmptySequence().setSource(src));

        for (Activity child : src.getActivities()) {
            try {
                OActivity compiledChild = _context.compile(child);
                dest.sequence.add(compiledChild);
            }
            catch (CompilationException ce) {
                _context.recoveredFromError(child, ce);
            }
View Full Code Here

    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;
        }
View Full Code Here

        case YES:
            _supressJoinFailure = true;
            break;
        }

        OActivity compiled;
        try {
            compiled = (source instanceof ScopeLikeActivity) ? compileSLC((ScopeLikeActivity) source, new OScope.Variable[0])
                    : compileActivity(true, source);
            compiled.suppressJoinFailure = _supressJoinFailure;
        } finally {
View Full Code Here

        return implicitScope;
    }

    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() {
View Full Code Here

        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.
View Full Code Here

  /**
   */
  protected void compileChildren(OFlow dest, CompositeActivity src) {
    for (Activity child : src.getActivities()){
      try {
        OActivity compiledChild = _context.compile(child);
        dest.parallelActivities.add(compiledChild);
      } catch (CompilationException ce) {
        _context.recoveredFromError(child, ce);
      }
    }
View Full Code Here

    }

    public boolean isPartnerLinkAssigned(String plink) {
        for (OActivity act : _compiledActivities) {
            if (act instanceof OAssign) {
                OAssign assign = (OAssign) act;
                for (OAssign.OAssignOperation operation: assign.operations) {
                  if (operation instanceof OAssign.Copy) {
                    OAssign.Copy copy = (OAssign.Copy)operation;
                      if (copy.to instanceof OAssign.PartnerLinkRef) {
                          if (((OAssign.PartnerLinkRef) copy.to).partnerLink.getName().equals(plink))
View Full Code Here

TOP

Related Classes of org.apache.ode.bpel.rtrep.v2.channels.InvokeResponseChannelListener

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.