Package org.apache.ode.bpel.dao

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


        _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


        _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

            throw new RuntimeException(e);
        }
    }

    private boolean deleteProcessDAO(BpelDAOConnection conn, QName pid) {
        final ProcessDAO proc = conn.getProcess(pid);
        if (proc != null) {
            // delete routes
            if(__log.isDebugEnabled()) __log.debug("Deleting only the process " + pid + "...");
            proc.deleteProcessAndRoutes();
            if(__log.isInfoEnabled()) __log.info("Deleted only the process " + pid + ".");
             // we do deferred instance cleanup only for hibernate, for now
            if( proc instanceof DeferredProcessInstanceCleanable &&
                !DEFERRED_PROCESS_INSTANCE_CLEANUP_DISABLED ) {
                // schedule deletion of process runtime data
View Full Code Here

            }

            if(suspend){
                _step.remove(evt.getProcessInstanceId());
                try {
                    ProcessDAO process = _db.getProcessDAO();
                    ProcessInstanceDAO instance = process.getInstance(evt.getProcessInstanceId());
                    if(ProcessState.canExecute(instance.getState())){
                        // send event
                        ProcessInstanceStateChangeEvent changeEvent = new ProcessInstanceStateChangeEvent();
                        changeEvent.setOldState(instance.getState());
                        instance.setState(ProcessState.STATE_SUSPENDED);
                        changeEvent.setNewState(ProcessState.STATE_SUSPENDED);
                        changeEvent.setProcessInstanceId(instance.getInstanceId());

                        changeEvent.setProcessName(process.getType());
                        changeEvent.setProcessId(_db.getProcessId());

                        _process.saveEvent(changeEvent, instance);
                        onEvent(changeEvent);
                    }
View Full Code Here

                        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

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

                    __log.debug(__msgs.msgScheduledJobReferencesUnknownInstance(we.getInstanceId()));
                    // nothing we can do, this instance is not in the database, it will always fail, not
                    // exactly an error since can occur in normal course of events.
                    return;
                }
                ProcessDAO processDao = instance.getProcess();
                process = _activeProcesses.get(processDao.getProcessId());
            }

            if (process == null) {
                // The process is not active, there's nothing we can do with this job
                __log.debug("Process " + we.getProcessId() + " can't be found, job abandoned.");
View Full Code Here

            scheduler.scheduleReplayerJob(new Callable<Void>() {
                public Void call() throws Exception {
                    __log.debug("initial call " + e);

                    final BpelProcess p = bpelEngine.getNewestProcessByType(r.getProcessType());
                    final ProcessDAO processDAO = p.getProcessDAO();
                    final MyRoleMessageExchangeImpl mex = ReplayerBpelRuntimeContextImpl.createMyRoleMex(e, bpelEngine);

                    p.invokeProcess(mex,
                    // time,
                            new BpelProcess.InvokeHandler() {
                                public boolean invoke(PartnerLinkMyRoleImpl target, RoutingInfo routing, boolean createInstance) {
                                    if (routing.messageRoute == null && createInstance) {
                                        ProcessInstanceDAO newInstance = processDAO.createInstance(routing.correlator);

                                        runtimeContext = new ReplayerBpelRuntimeContextImpl(p, newInstance, new PROCESS(p.getOProcess()), mex,
                                        // time,
                                                ReplayerContext.this);
                                        runtimeContext.setCurrentEventDateTime(time);
View Full Code Here

    public void handleJobDetails(JobDetails jobDetail, final Date when) {
        JobDetails we = jobDetail;
        __log.debug("handleJobDetails " + jobDetail + " " + when);
        if (we.getType() == JobType.INVOKE_INTERNAL) {
            final BpelProcess p = engine._activeProcesses.get(we.getProcessId());
            final ProcessDAO processDAO = p.getProcessDAO();
            final MyRoleMessageExchangeImpl mex = (MyRoleMessageExchangeImpl) engine.getMessageExchange(we.getMexId());

            p.invokeProcess(mex,
            // time,
                    new BpelProcess.InvokeHandler() {
                        public boolean invoke(PartnerLinkMyRoleImpl target, RoutingInfo routing, boolean createInstance) {
                            if (routing.messageRoute == null && createInstance) {
                                __log.debug("creating new instance via live communication mex:" + mex);
                                ProcessInstanceDAO newInstance = processDAO.createInstance(routing.correlator);

                                ReplayerContext context = new ReplayerContext(null);
                                context.bpelEngine = (BpelEngineImpl) engine;
                                contexts.add(context);
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.