Package org.apache.ode.bpel.common

Examples of org.apache.ode.bpel.common.CorrelationKeySet


     * @param matchCorrelations the match type correlation
     * @return returns the resolved CorrelationKey
     * @throws FaultException thrown when the correlation is not initialized and createInstance flag is not set
     */
    private CorrelationKeySet resolveCorrelationKey(PartnerLinkInstance pLinkInstance, Set<OScope.CorrelationSet> matchCorrelations) throws FaultException {
        CorrelationKeySet keySet = new CorrelationKeySet(); // is empty for the case of the createInstance activity

        if (matchCorrelations.isEmpty() && !_opick.createInstanceFlag) {
            // Adding a route for opaque correlation. In this case,
            // correlation is on "out-of-band" session-id
            String sessionId = getBpelRuntimeContext().fetchMySessionId(pLinkInstance);
            keySet.add(new CorrelationKey("-1", new String[] { sessionId }));
        } else if (!matchCorrelations.isEmpty()) {
        for( OScope.CorrelationSet cset : matchCorrelations ) {
          CorrelationKey key = null;
         
            if(!getBpelRuntimeContext().isCorrelationInitialized(
                    _scopeFrame.resolve(cset))) {
                    if (!_opick.createInstanceFlag) {
                      throw new FaultException(_opick.getOwner().constants.qnCorrelationViolation,
                      "Correlation not initialized.");
                    }
            } else {
              key = getBpelRuntimeContext().readCorrelation(_scopeFrame.resolve(cset));
                    assert key != null;
            }
           
            if( key != null ) {
              keySet.add(key);
            }
        }
        }
       
        return keySet;
View Full Code Here


                    Object selCKey = sel.correlationKey;
                    if (selCKey != null) {
                        OldCorrelationKey old = (OldCorrelationKey) selCKey;
                        __log.debug("   Changing V1 key " + old.toCanonicalString());

                        CorrelationKeySet newKeySet = new CorrelationKeySet();
                        newKeySet.add(new CorrelationKey(""+old.getCSetId(), old.getValues()));
                        Selector newSelector = new Selector(sel.idx, sel.plinkInstance, sel.opName,
                                sel.oneWay, sel.messageExchangeId, newKeySet, "one");
                        newSelector.correlationKey = new CorrelationKey(""+old.getCSetId(), old.getValues());
                        newSelectors[index++] = newSelector;
                    }
View Full Code Here

                OldSelector sel = (OldSelector)selector;
                CorrelationKey selCKey = (CorrelationKey) sel.correlationKey;
                if (selCKey != null) {
                    __log.debug("   Changing V2 key " + selCKey.toCanonicalString());

                    CorrelationKeySet newKeySet = new CorrelationKeySet();
                    newKeySet.add(new CorrelationKey(""+selCKey.getCorrelationSetName(), selCKey.getValues()));
                    Selector newSelector = new Selector(sel.idx, sel.plinkInstance, sel.opName,
                            sel.oneWay, sel.messageExchangeId, newKeySet, "one");
                    newSelector.correlationKey = new CorrelationKey(""+selCKey.getCorrelationSetName(), selCKey.getValues());
                    newSelectors[index++] = newSelector;
                }
View Full Code Here

    public CorrelationKeySet getCorrelationKeySet() {
        return _ckeySet;
    }

    public void setCorrelationKey(CorrelationKey key) {
        _ckeySet = new CorrelationKeySet();
        _ckeySet.add(key);
    }
View Full Code Here

        }
        public void setCorrelatorId(String correlatorId) {
            this.correlatorId = correlatorId;
        }
        public CorrelationKeySet getCorrelationKeySet() {
            return new CorrelationKeySet(correlationKeySet);
        }
View Full Code Here

    CorrelatorDAO corr = p.getCorrelator(CORRELATOR_ID1);
    assertNotNull( corr );
    assertEquals(corr.getCorrelatorId(),CORRELATOR_ID1);
   
    // Assert the MessageRouteDAO
    List<MessageRouteDAO> routes = corr.findRoute(new CorrelationKeySet().add(key1));
        MessageRouteDAO route = null;
        if (routes != null && routes.size() > 0) {
            route = routes.get(0);
        }
    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() );
      assertNotNull(inst.getCreateTime() );
      assertTrue(inst.getExecutionState().length > 0 );
      assertNotNull(inst.getLastActiveTime() );
      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");
View Full Code Here

    pl1.setPartnerEPR(DOMUtils.stringToDOM("<testEPR>testPartnerEPR</testEPR>"));
    pl1.setPartnerSessionId("TestPartnerSessionID");
   
    MessageExchangeDAO mex = createMessageExchange(process,pi,pl1);
   
    corr.addRoute("testRoute", pi, 1, new CorrelationKeySet().add(key1), "one");
    corr.enqueueMessage(mex, new CorrelationKeySet().add(corrkeys[0]).add(corrkeys[1]));
   
    return pi;
  }
View Full Code Here

        // data structure supporting correlation correlationKey matching!
        String correlatorId = BpelProcess.genCorrelatorId(_plinkDef, operation.getName());

        CorrelatorDAO correlator = _process.getProcessDAO().getCorrelator(correlatorId);

        CorrelationKeySet keySet;

        // We need to compute the correlation keys (based on the operation
        // we can  infer which correlation keys to compute - this is merely a set
        // consisting of each correlationKey used in each correlation sets
        // that is ever referenced in an <receive>/<onMessage> on this
View Full Code Here

    private Operation getMyRoleOperation(String operationName) {
        return _plinkDef.getMyRoleOperation(operationName);
    }

    private CorrelationKeySet computeCorrelationKeys(MyRoleMessageExchangeImpl mex) {
        CorrelationKeySet keySet = new CorrelationKeySet();

        Operation operation = mex.getOperation();
        Element msg = mex.getRequest().getMessage();
        javax.wsdl.Message msgDescription = operation.getInput().getMessage();

        Set<OScope.CorrelationSet> csets = _plinkDef.getNonInitiatingCorrelationSetsForOperation(operation);
        for (OScope.CorrelationSet cset : csets) {
            CorrelationKey key = computeCorrelationKey(cset,
                    _process.getOProcess().messageTypes.get(msgDescription.getQName()), msg);
            keySet.add(key);
        }

        csets = _plinkDef.getJoinningCorrelationSetsForOperation(operation);
        for (OScope.CorrelationSet cset : csets) {
            CorrelationKey key = computeCorrelationKey(cset,
                    _process.getOProcess().messageTypes.get(msgDescription.getQName()), msg);
            keySet.add(key);
        }

        // Let's creata a key based on the sessionId
        String mySessionId = mex.getProperty(MessageExchange.PROPERTY_SEP_MYROLE_SESSIONID);
        if (mySessionId != null)
            keySet.add(new CorrelationKey("-1", new String[] { mySessionId }));

        return keySet;
    }
View Full Code Here

         */
        public void run() {
            Selector selector;
            try {
                PickResponseChannel pickResponseChannel = newChannel(PickResponseChannel.class);
                CorrelationKeySet keySet = new CorrelationKeySet();
                PartnerLinkInstance pLinkInstance = _scopeFrame.resolve(_oevent.partnerLink);
                for( OScope.CorrelationSet cset : _oevent.joinCorrelations ) {
                  if(getBpelRuntimeContext().isCorrelationInitialized(_scopeFrame.resolve(cset))) {
                    keySet.add(getBpelRuntimeContext().readCorrelation(_scopeFrame.resolve(cset)));
                  }
                }
                for( OScope.CorrelationSet cset : _oevent.matchCorrelations ) {
                    if (!getBpelRuntimeContext().isCorrelationInitialized(_scopeFrame.resolve(cset))) {
                        throw new FaultException(_oevent.getOwner().constants.qnCorrelationViolation,"Correlation not initialized.");
                    }
                  keySet.add(getBpelRuntimeContext().readCorrelation(_scopeFrame.resolve(cset)));
                }
                if( keySet.isEmpty() ) {
                    // Adding a route for opaque correlation. In this case correlation is done on "out-of-band" session id.
                    String sessionId = getBpelRuntimeContext().fetchMySessionId(pLinkInstance);
                    keySet.add(new CorrelationKey("-1", new String[] {sessionId}));
                }

                selector =  new Selector(0,pLinkInstance,_oevent.operation.getName(), _oevent.operation.getOutput() == null, _oevent.messageExchangeId, keySet, _oevent.route);
                getBpelRuntimeContext().select(pickResponseChannel, null, false, new Selector[] { selector} );
                instance(new WAITING(pickResponseChannel));
View Full Code Here

TOP

Related Classes of org.apache.ode.bpel.common.CorrelationKeySet

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.