Examples of SequencePropertyBean


Examples of org.apache.sandesha2.storage.beans.SequencePropertyBean

  public static ArrayList getServerCompletedMessagesList(String sequenceID, SequencePropertyBeanMgr seqPropMgr)
      throws SandeshaException {
    if (log.isDebugEnabled())
      log.debug("Enter: AcknowledgementManager::getServerCompletedMessagesList");

    SequencePropertyBean completedMessagesBean = null;

    completedMessagesBean = seqPropMgr.retrieve(sequenceID,
        Sandesha2Constants.SequenceProperties.SERVER_COMPLETED_MESSAGES);

    ArrayList completedMsgList = null;
    if (completedMessagesBean != null) {
      completedMsgList = SandeshaUtil.getArrayListFromMsgsString(completedMessagesBean.getValue());
    } else {
      String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.completedMsgBeanIsNull, sequenceID);
      SandeshaException e = new SandeshaException(message);
      if(log.isDebugEnabled()) log.debug("Throwing exception", e);
      throw e;
View Full Code Here

Examples of org.apache.sandesha2.storage.beans.SequencePropertyBean

    MessageContext referenceMsg = referenceRMMessage.getMessageContext();

    SequencePropertyBeanMgr seqPropMgr = storageManager.getSequencePropertyBeanMgr();

    // Setting the ack depending on AcksTo.
    SequencePropertyBean acksToBean = seqPropMgr.retrieve(sequencePropertyKey,
        Sandesha2Constants.SequenceProperties.ACKS_TO_EPR);

    EndpointReference acksTo = new EndpointReference(acksToBean.getValue());
    String acksToStr = acksTo.getAddress();

    if (acksToStr == null)
      throw new SandeshaException(SandeshaMessageHelper.getMessage(SandeshaMessageKeys.acksToStrNotSet));
View Full Code Here

Examples of org.apache.sandesha2.storage.beans.SequencePropertyBean

  public static String getSequenceIDFromInternalSequenceID(String internalSequenceID,
      StorageManager storageManager) throws SandeshaException {

    SequencePropertyBeanMgr sequencePropertyBeanMgr = storageManager.getSequencePropertyBeanMgr();

    SequencePropertyBean outSequenceBean = sequencePropertyBeanMgr.retrieve(internalSequenceID,
        Sandesha2Constants.SequenceProperties.OUT_SEQUENCE_ID);

    String sequeunceID = null;
    if (outSequenceBean != null)
      sequeunceID = outSequenceBean.getValue();

    return sequeunceID;
  }
View Full Code Here

Examples of org.apache.sandesha2.storage.beans.SequencePropertyBean

   */
  public static String getRMVersion(String propertyKey, StorageManager storageManager)
      throws SandeshaException {

    SequencePropertyBeanMgr sequencePropertyBeanMgr = storageManager.getSequencePropertyBeanMgr();
    SequencePropertyBean specVersionBean = sequencePropertyBeanMgr.retrieve(propertyKey,
        Sandesha2Constants.SequenceProperties.RM_SPEC_VERSION);

    if (specVersionBean == null)
      return null;

    return specVersionBean.getValue();
  }
View Full Code Here

Examples of org.apache.sandesha2.storage.beans.SequencePropertyBean

  public static String getSequenceProperty(String id, String name, StorageManager storageManager)
      throws SandeshaException {
    SequencePropertyBeanMgr sequencePropertyBeanMgr = storageManager.getSequencePropertyBeanMgr();

    SequencePropertyBean sequencePropertyBean = sequencePropertyBeanMgr.retrieve(id, name);
    if (sequencePropertyBean == null)
      return null;
    else
      return sequencePropertyBean.getValue();
  }
View Full Code Here

Examples of org.apache.sandesha2.storage.beans.SequencePropertyBean

    //not getting the sequencePropertyKey from the usual method since the ackRequest may be embedded in a message
    //of a different sequence. (usual method SandeshaUtil.getSequencePropertyKey)
    String sequencePropertyKey = sequenceId;
   
    // Check that the sender of this AckRequest holds the correct token
    SequencePropertyBean tokenBean = seqPropMgr.retrieve(sequencePropertyKey, Sandesha2Constants.SequenceProperties.SECURITY_TOKEN);
    if(tokenBean != null) {
      SecurityManager secManager = SandeshaUtil.getSecurityManager(configurationContext);
      SecurityToken token = secManager.recoverSecurityToken(tokenBean.getValue());
     
      secManager.checkProofOfPossession(token, soapHeader, msgContext);
    }

    // Setting the ack depending on AcksTo.
    SequencePropertyBean acksToBean = seqPropMgr.retrieve(sequencePropertyKey,
        Sandesha2Constants.SequenceProperties.ACKS_TO_EPR);

    EndpointReference acksTo = new EndpointReference(acksToBean.getValue());
    String acksToStr = acksTo.getAddress();

    if (acksToStr == null)
      throw new SandeshaException(SandeshaMessageHelper.getMessage(SandeshaMessageKeys.acksToStrNotSet));
View Full Code Here

Examples of org.apache.sandesha2.storage.beans.SequencePropertyBean

    StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(configCtx, configCtx
        .getAxisConfiguration());
    SequencePropertyBeanMgr sequencePropMgr = storageManager.getSequencePropertyBeanMgr();
   
    // Check that the sender of this CloseSequence holds the correct token
    SequencePropertyBean tokenBean = sequencePropMgr.retrieve(sequenceId, Sandesha2Constants.SequenceProperties.SECURITY_TOKEN);
    if(tokenBean != null) {
      SecurityManager secManager = SandeshaUtil.getSecurityManager(msgCtx.getConfigurationContext());
      OMElement body = msgCtx.getEnvelope().getBody();
      SecurityToken token = secManager.recoverSecurityToken(tokenBean.getValue());
      secManager.checkProofOfPossession(token, body, msgCtx);
    }

    FaultManager faultManager = new FaultManager();
    SandeshaException fault = faultManager.checkForUnknownSequence(rmMsgCtx, sequenceId, storageManager);
    if (fault != null) {
      throw fault;
    }

    SequencePropertyBean sequenceClosedBean = new SequencePropertyBean();
    sequenceClosedBean.setSequencePropertyKey(sequencePropertyKey);
    sequenceClosedBean.setName(Sandesha2Constants.SequenceProperties.SEQUENCE_CLOSED);
    sequenceClosedBean.setValue(Sandesha2Constants.VALUE_TRUE);

    sequencePropMgr.insert(sequenceClosedBean);

    RMMsgContext ackRMMsgCtx = AcknowledgementManager.generateAckMessage(rmMsgCtx, sequencePropertyKey, sequenceId, storageManager);
View Full Code Here

Examples of org.apache.sandesha2.storage.beans.SequencePropertyBean

    // deleting the create sequence entry.
    senderBeanMgr.delete(createSeqMsgId);

    // storing new out sequence id
    SequencePropertyBeanMgr sequencePropMgr = storageManager.getSequencePropertyBeanMgr();
    SequencePropertyBean outSequenceBean = new SequencePropertyBean(sequencePropertyKey,
        Sandesha2Constants.SequenceProperties.OUT_SEQUENCE_ID, newOutSequenceId);
    SequencePropertyBean internalSequenceBean = new SequencePropertyBean(newOutSequenceId,
        Sandesha2Constants.SequenceProperties.INTERNAL_SEQUENCE_ID, sequencePropertyKey);

    sequencePropMgr.insert(outSequenceBean);
    sequencePropMgr.insert(internalSequenceBean);
   
    // Store the security token under the new sequence id
    if(tokenData != null) {
      SequencePropertyBean newToken = new SequencePropertyBean(newOutSequenceId,
          Sandesha2Constants.SequenceProperties.SECURITY_TOKEN, tokenData);
      sequencePropMgr.insert(newToken);
    }

    // processing for accept (offer has been sent)
    Accept accept = createSeqResponsePart.getAccept();
    if (accept != null) {
      // Find offered sequence from internal sequence id.
      SequencePropertyBean offeredSequenceBean = sequencePropMgr.retrieve(sequencePropertyKey,
          Sandesha2Constants.SequenceProperties.OFFERED_SEQUENCE);

      // TODO this should be detected in the Fault manager.
      if (offeredSequenceBean == null) {
        String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.accptButNoSequenceOffered);
        log.debug(message);
        throw new SandeshaException(message);
      }

      String offeredSequenceId = (String) offeredSequenceBean.getValue();

      EndpointReference acksToEPR = accept.getAcksTo().getEPR();
      SequencePropertyBean acksToBean = new SequencePropertyBean();
      acksToBean.setName(Sandesha2Constants.SequenceProperties.ACKS_TO_EPR);
      acksToBean.setSequencePropertyKey(offeredSequenceId);
      acksToBean.setValue(acksToEPR.getAddress());

      sequencePropMgr.insert(acksToBean);

      RMDBean rmdBean = new RMDBean();
      rmdBean.setSequenceID(offeredSequenceId);
      rmdBean.setNextMsgNoToProcess(1);
     

      boolean pollingMode = false;
      if (Sandesha2Constants.SPEC_VERSIONS.v1_1.equals(createSeqResponseRMMsgCtx.getRMSpecVersion())) {
        String replyToAddress = SandeshaUtil.getSequenceProperty(sequencePropertyKey,
                Sandesha2Constants.SequenceProperties.REPLY_TO_EPR, storageManager);
        if (replyToAddress!=null) {
          if (AddressingConstants.Submission.WSA_ANONYMOUS_URL.equals(replyToAddress))
            pollingMode = true;
          else if (AddressingConstants.Final.WSA_ANONYMOUS_URL.equals(replyToAddress))
            pollingMode = true;
          else if (replyToAddress.startsWith(Sandesha2Constants.WSRM_ANONYMOUS_URI_PREFIX))
            pollingMode = true;
        }
      }
     
      //Storing the referenceMessage of the sending side sequence as the reference message
      //of the receiving side as well.
      //This can be used when creating new outgoing messages.
     
      String referenceMsgStoreKey = rmsBean.getReferenceMessageStoreKey();
      MessageContext referenceMsg = storageManager.retrieveMessageContext(referenceMsgStoreKey, configCtx);
     
      String newMessageStoreKey = SandeshaUtil.getUUID();
      storageManager.storeMessageContext(newMessageStoreKey,referenceMsg);
     
      rmdBean.setReferenceMessageKey(newMessageStoreKey);
     
      rmdBean.setPollingMode(pollingMode);
     
      //if PollingMode is true, starting the pollingmanager.
      if (pollingMode)
        SandeshaUtil.startPollingManager(configCtx);
     
      RMDBeanMgr rmdBeanMgr = storageManager.getRMDBeanMgr();
      rmdBeanMgr.insert(rmdBean);

      String rmSpecVersion = createSeqResponseRMMsgCtx.getRMSpecVersion();

      SequencePropertyBean specVersionBean = new SequencePropertyBean(offeredSequenceId,
          Sandesha2Constants.SequenceProperties.RM_SPEC_VERSION, rmSpecVersion);
      sequencePropMgr.insert(specVersionBean);

      SequencePropertyBean receivedMsgBean = new SequencePropertyBean(offeredSequenceId,
          Sandesha2Constants.SequenceProperties.SERVER_COMPLETED_MESSAGES, "");
      sequencePropMgr.insert(receivedMsgBean);

      SequencePropertyBean msgsBean = new SequencePropertyBean();
      msgsBean.setSequencePropertyKey(offeredSequenceId);
      msgsBean.setName(Sandesha2Constants.SequenceProperties.CLIENT_COMPLETED_MESSAGES);
      msgsBean.setValue("");
      sequencePropMgr.insert(msgsBean);

      // setting the addressing version.
      String addressingNamespace = createSeqResponseRMMsgCtx.getAddressingNamespaceValue();
      SequencePropertyBean addressingVersionBean = new SequencePropertyBean(offeredSequenceId,
          Sandesha2Constants.SequenceProperties.ADDRESSING_NAMESPACE_VALUE, addressingNamespace);
      sequencePropMgr.insert(addressingVersionBean);

      // Store the security token for the offered sequence
      if(tokenData != null) {
        SequencePropertyBean newToken = new SequencePropertyBean(offeredSequenceId,
            Sandesha2Constants.SequenceProperties.SECURITY_TOKEN, tokenData);
        sequencePropMgr.insert(newToken);
      }
    }
View Full Code Here

Examples of org.apache.sandesha2.storage.beans.SequencePropertyBean

    public void tearDown() throws Exception {
      transaction.commit();
    }

    public void testDelete() throws SandeshaStorageException {
        mgr.insert(new SequencePropertyBean("SeqId1", "Name1", "Value1"));
        mgr.delete("SeqId1", "Name1");
        assertNull(mgr.retrieve("SeqId1", "Name1"));
    }
View Full Code Here

Examples of org.apache.sandesha2.storage.beans.SequencePropertyBean

        mgr.delete("SeqId1", "Name1");
        assertNull(mgr.retrieve("SeqId1", "Name1"));
    }

    public void testFind() throws SandeshaStorageException {
        mgr.insert(new SequencePropertyBean("SeqId2", "Name2", "Value2"));
        mgr.insert(new SequencePropertyBean("SeqId3", "Name3", "Value2"));

        SequencePropertyBean bean = new SequencePropertyBean();
        bean.setValue("Value2");
        Iterator iter = mgr.find(bean).iterator();
        SequencePropertyBean tmp = (SequencePropertyBean) iter.next();
        if (tmp.getSequencePropertyKey().equals("SeqId2")) {
            tmp = (SequencePropertyBean) iter.next();
            assertTrue(tmp.getSequencePropertyKey().equals("SeqId3"));
        } else {
            tmp = (SequencePropertyBean) iter.next();
            assertTrue(tmp.getSequencePropertyKey().equals("SeqId2"));
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.