Package org.apache.ode.bpel.rapi

Examples of org.apache.ode.bpel.rapi.ConstantsModel


     *
     * @param mex
     */
    void invokeProcess(final MessageExchangeDAO mexdao) {
        InvocationStyle istyle = mexdao.getInvocationStyle();
        ConstantsModel constants = null;

        _hydrationLatch.latch(1);
        try {
            // The following check is mostly for sanity purposes. MexImpls should prevent this from
            // happening.
            PartnerLinkMyRoleImpl target = getMyRoleForService(mexdao.getCallee());
            constants = target._process.getProcessModel().getConstantsModel();
            Status oldstatus = mexdao.getStatus();
            if (target == null) {
                String errmsg = __msgs.msgMyRoleRoutingFailure(mexdao.getMessageExchangeId());
                __log.error(errmsg);
                MexDaoUtil.setFailed(mexdao, MessageExchange.FailureType.UNKNOWN_ENDPOINT, errmsg);
                onMyRoleMexAck(mexdao, oldstatus);
                return;
            }

            Operation op = target._plinkDef.getMyRoleOperation(mexdao.getOperation());
            if (op == null) {
                String errmsg = __msgs.msgMyRoleRoutingFailure(mexdao.getMessageExchangeId());
                __log.error(errmsg);
                MexDaoUtil.setFailed(mexdao, MessageExchange.FailureType.UNKNOWN_OPERATION, errmsg);
                onMyRoleMexAck(mexdao, oldstatus);
                return;
            }

            mexdao.setPattern((op.getOutput() == null) ? MessageExchangePattern.REQUEST_ONLY
                    : MessageExchangePattern.REQUEST_RESPONSE);
            if (!processInterceptors(mexdao, InterceptorInvoker.__onProcessInvoked)) {
                __log.debug("Aborting processing of mex " + mexdao.getMessageExchangeId() + " due to interceptors.");
                onMyRoleMexAck(mexdao, oldstatus);
                return;
            }

            // "Acknowledge" any one-way invokes
            if (op.getOutput() == null) {
                mexdao.setStatus(Status.ACK);
                mexdao.setAckType(AckType.ONEWAY);
                onMyRoleMexAck(mexdao, oldstatus);
            }

            mexdao.setProcess(getProcessDAO());

            markused();
            CorrelationStatus cstatus = target.invokeMyRole(mexdao);
            if (cstatus == null) {
                ; // do nothing
            } else if (cstatus == CorrelationStatus.CREATE_INSTANCE) {
                doInstanceWork(mexdao.getInstance().getInstanceId(), new Callable<Void>() {
                    public Void call() {
                        executeCreateInstance(mexdao);
                        return null;
                    }
                });

            } else if (cstatus == CorrelationStatus.MATCHED) {
                // This should not occur for in-memory processes, since they are technically not allowed to
                // have any <receive>/<pick> elements that are not start activities.
                if (isInMemory())
                    __log.warn("In-memory process " + _pid + " is participating in a non-createinstance exchange!");

                // We don't like to do the work in the same TX that did the matching, since this creates fertile
                // conditions for deadlock in the correlation tables. However if invocation style is transacted,
                // we need to do the work right then and there.

                if (istyle == InvocationStyle.TRANSACTED) {
                    doInstanceWork(mexdao.getInstance().getInstanceId(), new Callable<Void>() {
                        public Void call() {
                            executeContinueInstanceMyRoleRequestReceived(mexdao);
                            return null;
                        }
                    });
                } else if (istyle == InvocationStyle.P2P_TRANSACTED) /* transact p2p invoke in the same thread */ {
                    executeContinueInstanceMyRoleRequestReceived(mexdao);
                } else /* non-transacted style */{
                    WorkEvent we = new WorkEvent();
                    we.setType(WorkEvent.Type.MYROLE_INVOKE);
                    we.setIID(mexdao.getInstance().getInstanceId());
                    we.setMexId(mexdao.getMessageExchangeId());
                    // Could be different to this pid when routing to an older version
                    we.setProcessId(mexdao.getInstance().getProcess().getProcessId());

                    scheduleWorkEvent(we, null);
                }
            } else if (cstatus == CorrelationStatus.QUEUED) {
                ; // do nothing
            }
        } catch (InvalidProcessException ipe) {
            QName faultQName = null;
            if (constants != null) {
                Document document = DOMUtils.newDocument();
                Element faultElement = document.createElementNS(Namespaces.SOAP_ENV_NS, "Fault");
                Element faultDetail = document.createElementNS(Namespaces.ODE_EXTENSION_NS, "fault");
                faultElement.appendChild(faultDetail);
                switch (ipe.getCauseCode()) {
                    case InvalidProcessException.DUPLICATE_CAUSE_CODE:
                        faultQName = constants.getDuplicateInstance();
                        faultDetail.setTextContent("Found a duplicate instance with the same message key");
                        break;
                    case InvalidProcessException.RETIRED_CAUSE_CODE:
                        faultQName = constants.getRetiredProcess();
                        faultDetail.setTextContent("The process you're trying to instantiate has been retired");
                        break;
                    case InvalidProcessException.DEFAULT_CAUSE_CODE:
                    default:
                        faultQName = constants.getUnknownFault();
                        break;
                }
                MexDaoUtil.setFaulted(mexdao, faultQName, faultElement);
            }
        } finally {
View Full Code Here


    public int getModelVersion() {
        return 2;
    }
   
    public ConstantsModel getConstantsModel() {
      return new ConstantsModel() {

      public QName getConflictingReceive() {
        return constants.qnConflictingReceive;
      }
View Full Code Here

    public int getModelVersion() {
        return 1;
    }

    public ConstantsModel getConstantsModel() {
      return new ConstantsModel() {

      public QName getConflictingReceive() {
        return constants.qnConflictingReceive;
      }
View Full Code Here

TOP

Related Classes of org.apache.ode.bpel.rapi.ConstantsModel

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.