Package org.apache.ode.bpel.dao

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


                        ProcessInstanceStateChangeEvent evt = new ProcessInstanceStateChangeEvent();
                        evt.setOldState(instance.getState());
                        instance.setState(ProcessState.STATE_SUSPENDED);
                        evt.setNewState(ProcessState.STATE_SUSPENDED);
                        evt.setProcessInstanceId(iid);
                        ProcessDAO process = instance.getProcess();
                        evt.setProcessName(process.getType());
                        evt.setProcessId(process.getProcessId());
                        _process.saveEvent(evt, instance);
                        onEvent(evt);
                    }
                    return null;
                }
View Full Code Here


                    ProcessInstanceStateChangeEvent evt = new ProcessInstanceStateChangeEvent();
                    evt.setOldState(instance.getState());
                    instance.setState(ProcessState.STATE_TERMINATED);
                    evt.setNewState(ProcessState.STATE_TERMINATED);
                    evt.setProcessInstanceId(iid);
                    ProcessDAO process = instance.getProcess();
                    QName processName = process.getType();
                    evt.setProcessName(processName);
                    QName processId = process.getProcessId();
                    evt.setProcessId(processId);
                    _process.saveEvent(evt, instance);
                    //
                    // TerminationEvent (peer of ProcessCompletionEvent)
                    //
View Full Code Here

        });
    }

    private void fillInstanceInfo(TInstanceInfo info, ProcessInstanceDAO instance) {
        info.setIid("" + instance.getInstanceId());
        ProcessDAO processDAO = instance.getProcess();
        info.setPid(processDAO.getProcessId().toString());
        info.setProcessName(processDAO.getType());
        if (instance.getRootScope() != null)
            info.setRootScope(genScopeRef(instance.getRootScope()));
        info.setDtStarted(toCalendar(instance.getCreateTime()));
        info.setDtLastActive(toCalendar(instance.getLastActiveTime()));
        info.setStatus(__psc.cvtInstanceStatus(instance.getState()));
View Full Code Here

        _txm.begin();       

        BpelDAOConnection conn = factory.getConnection();
   
    // Assert the ProcessDAO
    ProcessDAO p = conn.getProcess(new QName(TEST_NS,"testPID1"));
    assertNotNull( p );
    Collection<ProcessInstanceDAO> insts = p.findInstance(key1);
    assertNotNull( insts );
    assertTrue( insts.size() > 0 );
    assertNotNull(p.getType());
    assertNotNull(p.getProcessId());
    assertEquals( p.getVersion() , 1 );
   
    // Assert the CorrelatorDAO
    CorrelatorDAO corr = p.getCorrelator(CORRELATOR_ID1);
    assertNotNull( corr );
    assertEquals(corr.getCorrelatorId(),CORRELATOR_ID1);
   
    // Assert the MessageRouteDAO
    MessageRouteDAO route = corr.findRoute(key1);
    assertNotNull( route );
    assertEquals(route.getGroupId(),"testRoute" );
    assertEquals(route.getIndex() , 1 );
    assertNotNull(route.getTargetInstance() );

    // Assert the ProcessInstanceDAO
    for ( ProcessInstanceDAO inst : insts ) {
      Long id = inst.getInstanceId();
      assertNotNull( id );
     
      ProcessInstanceDAO inst2 = conn.getInstance(id);
      assertSame(inst2,inst);
     
      ProcessInstanceDAO inst3 = p.getInstance(id);
      assertSame( inst3 , inst );
     
      Long mon = inst.genMonotonic();
      assertEquals(inst.getActivityFailureCount() , 2);
      assertNotNull(inst.getActivityFailureDateTime() );
View Full Code Here

    public void select(String selectChannelId, Date timeout, Selector[] selectors) {
        if (ODEProcess.__log.isTraceEnabled())
            ODEProcess.__log.trace(ObjectPrinter.stringifyMethodEnter("select", new Object[] { "pickResponseChannel",
                    selectChannelId, "timeout", timeout, "selectors", selectors }));

        ProcessDAO processDao = _dao.getProcess();

        // check if this is first pick
        if (_dao.getState() == ProcessState.STATE_NEW) {
            // send event
            ProcessInstanceStateChangeEvent evt = new ProcessInstanceStateChangeEvent();
            evt.setOldState(ProcessState.STATE_NEW);
            _dao.setState(ProcessState.STATE_READY);
            evt.setNewState(ProcessState.STATE_READY);
            sendEvent(evt);
        }

        List<CorrelatorDAO> correlators = new ArrayList<CorrelatorDAO>(selectors.length);
        for (Selector selector : selectors) {
            String correlatorId = ODEProcess.genCorrelatorId(selector.getPartnerLink().getModel(), selector.getOperation());
            if (ODEProcess.__log.isDebugEnabled()) {
                ODEProcess.__log.debug("SELECT: " + selectChannelId + ": USING CORRELATOR " + correlatorId);
            }
            correlators.add(processDao.getCorrelator(correlatorId));
        }

        // First check if we match to a new instance.
        if (_instantiatingMessageExchange != null && _dao.getState() == ProcessState.STATE_READY) {
            if (ODEProcess.__log.isDebugEnabled()) {
View Full Code Here

        sendEvent(evt);
    }

    public void writeCorrelation(CorrelationSet cset, QName[] propNames, CorrelationKey correlation) throws FaultException {
        // enforce unique correlation set constraint
        ProcessDAO processDAO = _dao.getProcess();
        if (correlation.isUnique()) {
            Collection<ProcessInstanceDAO> instances = processDAO.findInstance(correlation, false);
            if (instances.size() != 0) {
                __log.debug("Not creating a new instance for process " + processDAO.getProcessId() + "; unique correlation constraint would be violated!");
                throw new FaultException(cset.getOwner().getConstantsModel().getDuplicateInstance());
            }
        }         
       
        ScopeDAO scopeDAO = _dao.getScope(cset.getScopeId());
View Full Code Here

    private void invokeMyRoleCreateInstance(MessageExchangeDAO mex, Operation operation, String correlatorId,
            CorrelatorDAO correlator, CorrelationKey[] uniqueKeys) {
        if (__log.isDebugEnabled()) {
            __log.debug("INPUTMSG: " + correlatorId + ": routing failed, CREATING NEW INSTANCE");
        }
        ProcessDAO processDAO = _process.getProcessDAO();

        if (_process._pconf.getState() == ProcessState.RETIRED) {
            throw new InvalidProcessException("Process is retired.", InvalidProcessException.RETIRED_CAUSE_CODE);
        }

        // if (!_process.processInterceptors(mex, InterceptorInvoker.__onNewInstanceInvoked)) {
        // __log.debug("Not creating a new instance for mex " + mex + "; interceptor prevented!");
        // return;
        // }

        enforceUniqueConstraint(processDAO, uniqueKeys);
       
        ProcessInstanceDAO newInstance = processDAO.createInstance(correlator);
       
        // send process instance event
        NewProcessInstanceEvent evt = new NewProcessInstanceEvent(_process.getProcessModel().getQName(),
                processDAO.getProcessId(), newInstance.getInstanceId());
        evt.setPortType(mex.getPortType());
        evt.setOperation(operation.getName());
        evt.setMexId(mex.getMessageExchangeId());
        _process._debugger.onEvent(evt);
        _process.saveEvent(evt, newInstance);
View Full Code Here

    }
   
    private void deleteProcessDAO(BpelDAOConnection conn, final QName pid, final long version, final ProcessModel mprocess) {
        __log.debug("Creating process DAO for " + pid + " (guid=" + mprocess.getGuid() + ")");
        try {
            ProcessDAO old = conn.getProcess(pid);
            if (old != null) {
                __log.debug("Found ProcessDAO for " + pid + " with GUID " + old.getGuid());
                if (mprocess.getGuid() == null) {
                    // No guid, old version assume its good
                } else {
                    if (old.getGuid().equals(mprocess.getGuid())) {
                        // Guids match, no need to create
                    } else {
                        // GUIDS dont match, delete and create new
                        String errmsg = "ProcessDAO GUID " + old.getGuid() + " does not match " + mprocess.getGuid() + "; replacing.";
                        __log.debug(errmsg);
                        old.delete();
                    }
                }
            }
        } catch (BpelEngineException ex) {
            throw ex;
View Full Code Here

    private void createProcessDAO(BpelDAOConnection conn, final QName pid, final long version, final ProcessModel mprocess) {
        __log.debug("Creating process DAO for " + pid + " (guid=" + mprocess.getGuid() + ")");
        try {
            boolean create = true;
            ProcessDAO old = conn.getProcess(pid);
            if (old != null) {
                __log.debug("Found ProcessDAO for " + pid + " with GUID " + old.getGuid());
                if (mprocess.getGuid() == null) {
                    // No guid, old version assume its good
                    create = false;
                } else {
                    if (old.getGuid().equals(mprocess.getGuid())) {
                        // Guids match, no need to create
                        create = false;
                    } else {
                        // GUIDS dont match, delete and create new
                        String errmsg = "ProcessDAO GUID " + old.getGuid() + " does not match " + mprocess.getGuid() + "; replacing.";
                        __log.debug(errmsg);
                    }
                }
            }

            if (create) {
                ProcessDAO newDao = conn.createProcess(pid, mprocess.getQName(), mprocess.getGuid(), (int) version);
                for (String correlator : mprocess.getCorrelators()) {
                    newDao.addCorrelator(correlator);
                }
            }
        } catch (BpelEngineException ex) {
            throw ex;
        } catch (Exception dce) {
View Full Code Here

        if (key.startsWith("+") || key.startsWith("-")) {
            orderKey = key.substring(1, key.length());
            if (key.startsWith("-"))
                ascending = false;
        }
        ProcessDAO process1 = getProcess(instanceDAO1.getProcess().getProcessId());
        ProcessDAO process2 = getProcess(instanceDAO2.getProcess().getProcessId());
        if ("pid".equals(orderKey)) {
            s1 = process1.getProcessId().toString();
            s2 = process2.getProcessId().toString();
        } else if ("name".equals(orderKey)) {
            s1 = process1.getProcessId().getLocalPart();
            s2 = process2.getProcessId().getLocalPart();
        } else if ("namespace".equals(orderKey)) {
            s1 = process1.getProcessId().getNamespaceURI();
            s2 = process2.getProcessId().getNamespaceURI();
        } else if ("version".equals(orderKey)) {
            s1 = "" + process1.getVersion();
            s2 = "" + process2.getVersion();
        } else if ("status".equals(orderKey)) {
            s1 = "" + instanceDAO1.getState();
            s2 = "" + instanceDAO2.getState();
        } else if ("started".equals(orderKey)) {
            s1 = ISO8601DateParser.format(instanceDAO1.getCreateTime());
View Full Code Here

TOP

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

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.