Package org.apache.ode.bpel.dao

Examples of org.apache.ode.bpel.dao.MessageExchangeDAO


    public QName getPartnerResponseType(String mexId) {
        return _getPartnerResponse(mexId).getType();
    }

    public String getPartnerFaultExplanation(String mexId) {
        MessageExchangeDAO dao = _dao.getConnection().getMessageExchange(mexId);
        return dao != null ? dao.getFaultExplanation() : null;
    }
View Full Code Here


        MessageExchangeDAO dao = _dao.getConnection().getMessageExchange(mexId);
        return dao != null ? dao.getFaultExplanation() : null;
    }

    private MessageDAO _getPartnerResponse(String mexId) {
        MessageExchangeDAO dao = _dao.getConnection().getMessageExchange(mexId);
        if (dao == null) {
            // this should not happen....
            String msg = "Engine requested non-existent message exchange: " + mexId;
            __log.fatal(msg);
            throw new BpelEngineException(msg);
        }
        if (dao.getDirection() != MessageExchangeDAO.DIR_BPEL_INVOKES_PARTNERROLE) {
            // this should not happen....
            String msg = "Engine requested partner response for a my-role mex: " + mexId;
            __log.fatal(msg);
            throw new BpelEngineException(msg);
        }

        MessageDAO response;
        MessageExchange.Status status = MessageExchange.Status.valueOf(dao.getStatus());
        switch (status) {
            case FAULT:
            case RESPONSE:
                response = dao.getResponse();
                if (response == null) {
                    // this also should not happen
                    String msg = "Engine requested response for message exchange that did not have one: " + mexId;
                    __log.fatal(msg);
                    throw new BpelEngineException(msg);
View Full Code Here

        }
        return response;
    }

    public void releasePartnerMex(String mexId) {
        MessageExchangeDAO dao = _dao.getConnection().getMessageExchange(mexId);
        dao.release();
    }
View Full Code Here

        // xsd-type-wrapper
        return container;
    }

    public Element getSourceEPR(String mexId) {
        MessageExchangeDAO dao = _dao.getConnection().getMessageExchange(mexId);
        String epr = dao.getProperty(MessageExchange.PROPERTY_SEP_PARTNERROLE_EPR);
        if (epr == null)
            return null;
        try {
            Element eepr = DOMUtils.stringToDOM(epr);
            return eepr;
View Full Code Here

        return null;
    }

    public String getSourceSessionId(String mexId) {
        MessageExchangeDAO dao = _dao.getConnection().getMessageExchange(mexId);
        return dao.getProperty(MessageExchange.PROPERTY_SEP_PARTNERROLE_SESSIONID);
    }
View Full Code Here

            __log.debug("MatcherEvent handling: nothing to do, route no longer in DB");
            return;
        }

        // Now see if there is a message that matches this selector.
        MessageExchangeDAO mexdao = correlator.dequeueMessage(ckey);
        if (mexdao != null) {
            __log.debug("MatcherEvent handling: found matching message in DB (i.e. message arrived before <receive>)");

            // We have a match, so we can get rid of the routing entries.
            correlator.removeRoutes(mroute.getGroupId(),_dao);
View Full Code Here

                                                       String operation, String pipedMexId)
            throws BpelEngineException {

        BpelProcess target = route(targetService, null);

        MessageExchangeDAO dao;
        if (target == null || target.isInMemory()) {
            dao = _contexts.inMemDao.getConnection().createMessageExchange(MessageExchangeDAO.DIR_PARTNER_INVOKES_MYROLE);
        } else {
            dao = _contexts.dao.getConnection().createMessageExchange(MessageExchangeDAO.DIR_PARTNER_INVOKES_MYROLE);
        }
        dao.setCorrelationId(clientKey);
        dao.setCorrelationStatus(CorrelationStatus.UKNOWN_ENDPOINT.toString());
        dao.setPattern(MessageExchangePattern.UNKNOWN.toString());
        dao.setCallee(targetService);
        dao.setStatus(Status.NEW.toString());
        dao.setOperation(operation);
        dao.setPipedMessageExchangeId(pipedMexId);
        MyRoleMessageExchangeImpl mex = new MyRoleMessageExchangeImpl(this, dao);

        if (target != null) {
            target.initMyRoleMex(mex);
        }
View Full Code Here

    public MyRoleMessageExchange createMessageExchange(String clientKey, QName targetService, String operation) {
        return createMessageExchange(clientKey, targetService, operation, null);       
    }

    public MessageExchange getMessageExchange(String mexId) throws BpelEngineException {
        MessageExchangeDAO mexdao = _contexts.inMemDao.getConnection().getMessageExchange(mexId);
        if (mexdao == null) mexdao = _contexts.dao.getConnection().getMessageExchange(mexId);
        if (mexdao == null)
            return null;

        ProcessDAO pdao = mexdao.getProcess();
        BpelProcess process = pdao == null ? null : _activeProcesses.get(pdao.getProcessId());

        MessageExchangeImpl mex;
        switch (mexdao.getDirection()) {
        case MessageExchangeDAO.DIR_BPEL_INVOKES_PARTNERROLE:
            if (process == null) {
                String errmsg = __msgs.msgProcessNotActive(pdao.getProcessId());
                __log.error(errmsg);
                // TODO: Perhaps we should define a checked exception for this
                // condition.
                throw new BpelEngineException(errmsg);
            }
            {
                OPartnerLink plink = (OPartnerLink) process.getOProcess().getChild(mexdao.getPartnerLinkModelId());
                PortType ptype = plink.partnerRolePortType;
                Operation op = plink.getPartnerRoleOperation(mexdao.getOperation());
                // TODO: recover Partner's EPR
                mex = new PartnerRoleMessageExchangeImpl(this, mexdao, ptype, op, null, plink.hasMyRole() ? process
                        .getInitialMyRoleEPR(plink) : null, process.getPartnerRoleChannel(plink));
            }
            break;
        case MessageExchangeDAO.DIR_PARTNER_INVOKES_MYROLE:
            mex = new MyRoleMessageExchangeImpl(this, mexdao);
            if (process != null) {
                OPartnerLink plink = (OPartnerLink) process.getOProcess().getChild(mexdao.getPartnerLinkModelId());
                PortType ptype = plink.myRolePortType;
                Operation op = plink.getMyRoleOperation(mexdao.getOperation());
                mex.setPortOp(ptype, op);
            }
            break;
        default:
            String errmsg = "BpelEngineImpl: internal error, invalid MexDAO direction: " + mexId;
View Full Code Here

   
    public MessageExchange getMessageExchange(final String mexId) throws BpelEngineException {

        _mngmtLock.readLock().lock();
        try {
            final MessageExchangeDAO inmemdao = getInMemMexDAO(mexId);

            Callable<MessageExchange> loadMex = new Callable<MessageExchange>() {

                public MessageExchange call() {
                    MessageExchangeDAO mexdao = (inmemdao == null) ?
                            mexdao = _contexts.dao.getConnection().getMessageExchange(mexId) : inmemdao;
                    if (mexdao == null) return null;

                    ProcessDAO pdao = mexdao.getProcess();
                    ODEProcess process = pdao == null ? null : _registeredProcesses.get(pdao.getProcessId());

                    if (process == null) {
                        String errmsg = __msgs.msgProcessNotActive(pdao.getProcessId());
                        __log.error(errmsg);
                        // TODO: Perhaps we should define a checked exception for this
                        // condition.
                        throw new BpelEngineException(errmsg);
                    }

                    InvocationStyle istyle = mexdao.getInvocationStyle();
                    if (istyle == InvocationStyle.RELIABLE || istyle == InvocationStyle.TRANSACTED)
                        assertTransaction();

                    switch (mexdao.getDirection()) {
                    case MessageExchangeDAO.DIR_BPEL_INVOKES_PARTNERROLE:
                        return process.createPartnerRoleMex(mexdao);
                    case MessageExchangeDAO.DIR_PARTNER_INVOKES_MYROLE:
                        return process.lookupMyRoleMex(mexdao);
                    default:
View Full Code Here

    MessageExchangeDAO getInMemMexDAO(String mexId) {
        _mngmtLock.readLock().lock();
        try {
          for (ODEProcess p : _registeredProcesses.values()) {
              MessageExchangeDAO mexDao = p.getInMemMexDAO(mexId);
              if (mexDao != null)
                  return mexDao;
          }
        } finally {
            _mngmtLock.readLock().unlock();
View Full Code Here

TOP

Related Classes of org.apache.ode.bpel.dao.MessageExchangeDAO

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.