Package org.apache.ode.bpel.dao

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


    /**
     * @see BpelRuntimeContext#writeCorrelation(org.apache.ode.bpel.runtime.CorrelationSetInstance,
     *      org.apache.ode.bpel.common.CorrelationKey)
     */
    public void writeCorrelation(CorrelationSetInstance cset, CorrelationKey correlation) {
        ScopeDAO scopeDAO = _dao.getScope(cset.scopeInstance);
        CorrelationSetDAO cs = scopeDAO.getCorrelationSet(cset.declaration.name);
        QName[] propNames = new QName[cset.declaration.properties.size()];
        for (int m = 0; m < cset.declaration.properties.size(); m++) {
            OProcess.OProperty oProperty = cset.declaration.properties.get(m);
            propNames[m] = oProperty.name;
        }
View Full Code Here


        }
        sendEvent(evt);
    }

    private void saveScopeState(Long scopeId, ScopeStateEnum scopeState) {
        ScopeDAO scope = _dao.getScope(scopeId);
        scope.setState(scopeState);
    }
View Full Code Here

        pi.setState((short) 1);

        pi.createActivityRecovery("testChannel1", 3, "testReason1", cal.getTime(), DOMUtils.stringToDOM("<testData>testData1</testData>"), actions, 2);
        pi.createActivityRecovery("testChannel2", 4, "testReason2", cal.getTime(), DOMUtils.stringToDOM("<testData>testData2</testData>"), actions, 2);

        ScopeDAO root = pi.createScope(null, "Root", 1);
        root.setState(ScopeStateEnum.ACTIVE);
        ScopeDAO child1 = pi.createScope(root, "Child1", 2);
        child1.setState(ScopeStateEnum.ACTIVE);
        XmlDataDAO var1 = child1.getVariable("var1");
        var1.set(DOMUtils.stringToDOM("<testData>testData</testData>"));
        var1.setProperty("key1", "prop1");
        var1.setProperty("key2", "prop2");
        XmlDataDAO var2 = child1.getVariable("var2");
        var2.set(DOMUtils.stringToDOM("<testData>testData</testData>"));
        var2.setProperty("key1", "prop1");
        var2.setProperty("key2", "prop2");

        CorrelationSetDAO cs1 = child1.getCorrelationSet("TestCorrelationSet1");
        cs1.setValue(names,key1);

        PartnerLinkDAO pl1 = child1.createPartnerLink(1, "Test PartnerLink1", "MyRole1", "PartnerRole1");
        pl1.setMyEPR(DOMUtils.stringToDOM("<testEPR>testMyEPR</testEPR>"));
        pl1.setMyRoleServiceName(new QName(TEST_NS,"testRoleService"));
        pl1.setMySessionId("TestMySessionID");
        pl1.setPartnerEPR(DOMUtils.stringToDOM("<testEPR>testPartnerEPR</testEPR>"));
        pl1.setPartnerSessionId("TestPartnerSessionID");
View Full Code Here

            assertSame(inst.getProcess() , p );
            assertEquals(inst.getPreviousState() , 0);
            assertEquals(inst.getState() , 1);

            // Assert the Root ScopeDAO
            ScopeDAO rs = inst.getRootScope();
            assertNotNull( rs );
            assertNotNull(rs.getChildScopes());
            ScopeDAO child1 = null;
            for ( ScopeDAO childItr : rs.getChildScopes()){
                child1 = childItr;
                break;
            }
            assertNotNull(child1);
            assertNotNull(rs.getCorrelationSets());
            assertEquals(rs.getCorrelationSets().size() , 0 );
            assertEquals(rs.getModelId(),1);
            assertEquals(rs.getName(),"Root");
            assertTrue(rs.getParentScope() == null);
            assertNotNull(rs.getPartnerLinks());
            assertEquals(rs.getPartnerLinks().size() ,0);
            assertSame(rs.getProcessInstance(),inst);
            assertNotNull(rs.getScopeInstanceId());
            assertEquals(rs.getState(),ScopeStateEnum.ACTIVE);
            assertNotNull(rs.getVariables());
            assertEquals(rs.getVariables().size(),0);


            // Assert the ActivityRecoveryDAO
            assertNotNull(inst.getActivityRecoveries());
            ActivityRecoveryDAO rec1 = null;
            for (ActivityRecoveryDAO recItr : inst.getActivityRecoveries()) {
       if (recItr.getActivityId() == 3) {
         rec1 = recItr;break;
       }
      }
            assertNotNull(rec1);
            String tmpAct = rec1.getActions();
//      assertEquals(rec1.getActionsList(),actions);
            assertEquals(rec1.getActivityId(),3);
            assertEquals(rec1.getChannel(),"testChannel1");
            assertNotNull(rec1.getDateTime());
//      assertNotNull(rec1.getDetails());
            assertEquals(rec1.getReason(),"testReason1");
            assertEquals(rec1.getRetries(),2);

            // Assert the CorrelationSetDAO
            //assertNotNull(inst.getCorrelationSets());
            //CorrelationSetDAO cs1 = null;
            //for ( CorrelationSetDAO csItr : inst.getCorrelationSets() ) {
            //  cs1 = csItr;
            //  break;
            //}
            //assertNotNull(cs1);

            // Assert the FaultDAO
            FaultDAO fault = inst.getFault();
            assertNotNull(fault);
            assertEquals(fault.getActivityId(),1);
            assertNotNull(fault.getData());
            assertEquals(fault.getExplanation(),"testExplanation");
            assertEquals(fault.getLineNo(),1);
            assertEquals(fault.getName(),new QName(TEST_NS,"testFault"));

            // Assert MessageExchangeDAO
            CorrelatorDAO ic = inst.getInstantiatingCorrelator();
            assertNotNull(ic);
            assertEquals(ic.getCorrelatorId(),CORRELATOR_ID1);
            // The message is dequeued but not persisted
            MessageExchangeDAO me = ic.dequeueMessage(new CorrelationKeySet().add(key1));
            assertNotNull(me);
            assertEquals(me.getCallee(),new QName(TEST_NS,"testCallee"));
            assertEquals(me.getPropagateTransactionFlag(),false);
            assertEquals(me.getChannel(),"testChannel");
            assertEquals(me.getCorrelationId(),"testCorrelationId");
            //assertNotNull(me.getCreateTime());
            assertEquals(me.getDirection(),'0');
            assertNotNull(me.getEPR());
            assertEquals(me.getFault().toString(),"testFault");
            assertEquals(me.getFaultExplanation(),"testFaultExplanation");
            assertSame(me.getInstance(),inst);
            assertEquals(me.getOperation(),"testOperation");
            assertNotNull(me.getPartnerLink());
            assertEquals(me.getPartnerLinkModelId(),1);
            assertEquals(me.getPattern(),"testPattern");
            assertEquals(me.getPortType(),new QName(TEST_NS,"testPortType"));
            assertSame(me.getProcess(),p);
            assertEquals(me.getProperty("testProp1Key"),"testProp1");
            assertNotNull(me.getRequest());
            assertNotNull(me.getResponse());
            assertEquals(me.getStatus(),"testStatus");

            // Assert MessageDAO
            MessageDAO m = me.getRequest();
            assertNotNull(m.getData());
            assertSame(m.getMessageExchange(),me);
            assertEquals(m.getType(),new QName(TEST_NS,"testRequest"));


            //Assert Child ScopeDAO
            assertNotNull(inst.getScopes());
            assertTrue(inst.getScopes().size() > 0);
            assertNotNull(inst.getScopes("Child1"));
            assertTrue(inst.getScopes("Child1").size() == 1);
            ScopeDAO childS = inst.getScopes("Child1").iterator().next();
            assertSame(childS,child1);
            assertSame(childS.getParentScope(),rs);
            assertNotNull(childS.getChildScopes());
            assertEquals(childS.getChildScopes().size(), 0);
            assertNotNull(childS.getVariables());
            assertTrue(childS.getVariables().size() > 0);
            assertNotNull(childS.getVariable("var1"));
            XmlDataDAO chsVar = childS.getVariable("var1");
            assertNotNull(childS.getPartnerLinks());
            assertTrue(childS.getPartnerLinks().size() > 0);
            PartnerLinkDAO spl = childS.getPartnerLinks().iterator().next();
            assertSame(spl,me.getPartnerLink());
            assertSame(spl,childS.getPartnerLink(spl.getPartnerLinkModelId()));
            assertNotNull(childS.getCorrelationSets());
            assertTrue(childS.getCorrelationSets().size() > 0);
            assertNotNull(childS.getCorrelationSet("TestCorrelationSet1"));

            // Assert CorrelationSetDAO
            CorrelationSetDAO cs = childS.getCorrelationSet("TestCorrelationSet1");
            assertEquals(cs.getName(),"TestCorrelationSet1");
            assertNotNull(cs.getProperties());
            assertTrue(cs.getProperties().size() > 0);
            assertSame(cs.getScope(),childS);
            assertNotNull(cs.getValue());
View Full Code Here

        VariableInfoDocument ret = VariableInfoDocument.Factory.newInstance();
        final TVariableInfo vinf = ret.addNewVariableInfo();
        final TVariableRef sref = vinf.addNewSelf();
        dbexec(new BpelDatabase.Callable<Object>() {
            public Object run(BpelDAOConnection session) throws Exception {
                ScopeDAO scope = session.getScope(new Long(scopeId));
                if (scope == null) {
                    throw new InvalidRequestException("ScopeNotFound:" + scopeId);
                }

                sref.setSiid(scopeId);
                sref.setIid(scope.getProcessInstance().getInstanceId().toString());
                sref.setName(varName);

                XmlDataDAO var = scope.getVariable(varName);
                if (var == null) {
                    throw new InvalidRequestException("VarNotFound:" + varName);
                }

                Node nval = var.get();
View Full Code Here

        ii.setSiid(siid);
        dbexec(new BpelDatabase.Callable<Object>() {
            public Object run(BpelDAOConnection conn) throws Exception {
                try {
                ScopeDAO instance = conn.getScope(siidl);
                if (instance == null)
                    throw new InvalidRequestException("Scope not found: " + siidl);
                // TODO: deal with "ERROR" state information.
                fillScopeInfo(ii, instance, includeActivityInfo);
                } catch (Exception e) {
View Full Code Here

    /**
     * @see BpelRuntimeContext#isCorrelationInitialized(org.apache.ode.bpel.runtime.CorrelationSetInstance)
     */
    public boolean isCorrelationInitialized(CorrelationSetInstance correlationSet) {
        ScopeDAO scopeDAO = _dao.getScope(correlationSet.scopeInstance);
        CorrelationSetDAO cs = scopeDAO.getCorrelationSet(correlationSet.declaration.name);

        return cs.getValue() != null;
    }
View Full Code Here

     */
    public boolean isVariableInitialized(VariableInstance var) {
    if (var == null) {
      return false;
    }
        ScopeDAO scopeDAO = _dao.getScope(var.scopeInstance);
        XmlDataDAO dataDAO = scopeDAO.getVariable(var.declaration.name);
        return !dataDAO.isNull();
    }
View Full Code Here

        if (BpelProcess.__log.isTraceEnabled()) {
            BpelProcess.__log.trace(ObjectPrinter.stringifyMethodEnter("createScopeInstance", new Object[] {
                    "parentScopeId", parentScopeId, "scope", scope }));
        }

        ScopeDAO parent = null;

        if (parentScopeId != null) {
            parent = _dao.getScope(parentScopeId);
        }

        ScopeDAO scopeDao = _dao.createScope(parent, scope.name, scope.getId());
        return scopeDao.getScopeInstanceId();
    }
View Full Code Here

        if (BpelProcess.__log.isTraceEnabled()) {
            BpelProcess.__log.trace(ObjectPrinter.stringifyMethodEnter("initializeEndpointReferences", new Object[] {
                    "parentScopeId", parentScopeId, "partnerLinks", partnerLinks }));
        }

        ScopeDAO parent = _dao.getScope(parentScopeId);
        for (OPartnerLink partnerLink : partnerLinks) {
            PartnerLinkDAO pdao = parent.createPartnerLink(partnerLink.getId(), partnerLink.name,
                    partnerLink.myRoleName, partnerLink.partnerRoleName);
            // If there is a myrole on the link, initialize the session id so it
            // is always
            // available for opaque correlations. The myrole session id should
            // never be changed.
View Full Code Here

TOP

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

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.