Package org.apache.sandesha2.policy

Examples of org.apache.sandesha2.policy.SandeshaPolicyBean


  }

  public static SandeshaPolicyBean loadPropertiesFromModuleDescPolicy(AxisModule desc,
      SandeshaPolicyBean parentPropertyBean) throws SandeshaException {
   
        SandeshaPolicyBean propertyBean = new SandeshaPolicyBean();

    Policy policy = desc.getPolicyInclude().getEffectivePolicy();

    if (policy == null) {
      return null; // no pilicy is available in the module description
    }
       
        Iterator iterator = policy.getAlternatives();
        if (! iterator.hasNext()) {
            throw new SandeshaException("No Policy Alternative found");
        }

        List assertionList = (List) iterator.next();
        Assertion assertion = null;
       
        boolean found = false;
       
        for (Iterator assertions = assertionList.iterator(); assertions.hasNext();) {
            assertion = (Assertion) assertions.next();
           
            if (assertion instanceof SandeshaPolicyBean) {
                found = true;
                break;
            }
        }
       
        if (! found) {
            // no RMAssertion found
            return null;
        }
       
        propertyBean = (SandeshaPolicyBean) assertion;
        propertyBean.setParent(parentPropertyBean);

    return propertyBean;
  }
View Full Code Here


  }

  public static SandeshaPolicyBean loadPropertiesFromAxisDescription(AxisDescription desc,
      SandeshaPolicyBean parentPropertyBean) throws SandeshaException {
   
        SandeshaPolicyBean propertyBean = new SandeshaPolicyBean();

        Policy policy = desc.getPolicyInclude().getEffectivePolicy();

        if (policy == null) {
            return null; // no pilicy is available in the module description
        }
       
        Iterator iterator = policy.getAlternatives();
        if (! iterator.hasNext()) {
            throw new SandeshaException("No Policy Alternative found");
        }

        List assertionList = (List) iterator.next();
        Assertion assertion = null;
       
        boolean found = false;
       
        for (Iterator assertions = assertionList.iterator(); assertions.hasNext();) {
            assertion = (Assertion) assertions.next();
           
            if (assertion instanceof SandeshaPolicyBean) {
                found = true;
                break;
            }
        }
       
        if (! found) {
            // no RMAssertion found
            return null;
        }
       
        propertyBean = (SandeshaPolicyBean) assertion;
       
        if (propertyBean!=parentPropertyBean) {
          propertyBean.setParent(parentPropertyBean);
          return propertyBean;
        } else {
          //propertyBean and parent being the same object means that there is no policy in this level, this is simply the reflection of
          //the parent.
          return null;
View Full Code Here

      // checking if policies hv been set to enforceRM.
      // If this is set and this message is not an RM message, validation
      // will fail here.

      SandeshaPolicyBean propertyBean = SandeshaUtil
          .getPropertyBean(rmMsg.getMessageContext()
              .getAxisOperation());
      if (propertyBean.isEnforceRM()) {
        String message = SandeshaMessageHelper.getMessage(
            SandeshaMessageKeys.rmEnforceFailure, rmMsg
                .getMessageId());
        throw new SandeshaException(message);
      }
View Full Code Here

    Parameter parameter = axisConfiguration.getParameter(Sandesha2Constants.SANDESHA_PROPERTY_BEAN);
    if (parameter==null)
      throw new SandeshaException (SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.defaultPropertyBeanNotSet));
   
    SandeshaPolicyBean sandeshaPropertyBean = (SandeshaPolicyBean) parameter.getValue();
    return sandeshaPropertyBean;
  }
View Full Code Here

    Parameter parameter = axisDescription.getParameter(Sandesha2Constants.SANDESHA_PROPERTY_BEAN);
    if (parameter==null)
      throw new SandeshaException (SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.propertyBeanNotSet));
   
    SandeshaPolicyBean propertyBean = (SandeshaPolicyBean) parameter.getValue();
    if (propertyBean==null) {
      String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.policyBeanNotFound);
      throw new SandeshaException (message);
    }
View Full Code Here

      log.debug("Enter: SandeshaUtil::executeAndStore, " + storageKey);
   
    MessageContext msgContext = rmMsgContext.getMessageContext();
    ConfigurationContext configurationContext = msgContext.getConfigurationContext();

    SandeshaPolicyBean policy = getPropertyBean(msgContext.getAxisOperation());
    if(policy.isUseMessageSerialization()) {
      msgContext.setProperty(Sandesha2Constants.QUALIFIED_FOR_SENDING, Sandesha2Constants.VALUE_TRUE);

      StorageManager store = getSandeshaStorageManager(configurationContext, configurationContext.getAxisConfiguration());
      store.storeMessageContext(storageKey, msgContext);
     
View Full Code Here

   
    Object property = message.getProperty(Sandesha2Constants.RETRANSMITTABLE_PHASES);
    if (property!=null)
      return; //Phases are already set. Dont hv to redo.
   
    SandeshaPolicyBean policy = getPropertyBean(message.getAxisOperation());
    if(policy.isUseMessageSerialization())
      return; // No need to mess with the transport when we use message serialization
   
    TransportOutDescription transportOutDescription = message.getTransportOut();
    if (!(transportOutDescription instanceof Sandesha2TransportOutDesc))
      return; //This message is aimed to be stored only if, Sandesha2TransportOutDescription is set.
View Full Code Here

  throws SandeshaException
  {
    if (log.isDebugEnabled())
      log.debug("Enter: SandeshaUtil::rewriteEPR " + epr);

    SandeshaPolicyBean policy = SandeshaUtil.getPropertyBean(configContext.getAxisConfiguration());
    if(!policy.isEnableRMAnonURI()) {
      if (log.isDebugEnabled())
        log.debug("Exit: SandeshaUtil::rewriteEPR, anon uri is disabled");
      return epr;
    }
View Full Code Here

    Transaction transaction = null;
   
    try {
      transaction = storageManager.getTransaction();
     
      SandeshaPolicyBean propertyBean =
        SandeshaUtil.getPropertyBean(storageManager.getContext().getAxisConfiguration());     

      long deleteTime = propertyBean.getSequenceRemovalTimeoutInterval();
      if (deleteTime < 0)
        deleteTime = 0;

      if (deleteTime > 0) {
        // Find terminated sequences.
        List rmsBeans = storageManager.getRMSBeanMgr().find(finderBean);
       
        deleteRMSBeans(rmsBeans, propertyBean, deleteTime);
       
        finderBean.setTerminated(false);
        finderBean.setTimedOut(true);
       
        // Find timed out sequences
        rmsBeans = storageManager.getRMSBeanMgr().find(finderBean);
             
        deleteRMSBeans(rmsBeans, propertyBean, deleteTime);
       
        // Remove any terminated RMDBeans.
        RMDBean finderRMDBean = new RMDBean();
        finderRMDBean.setTerminated(true);
       
        List rmdBeans = storageManager.getRMDBeanMgr().find(finderRMDBean);
 
        Iterator beans = rmdBeans.iterator();
        while (beans.hasNext()) {
          RMDBean rmdBean = (RMDBean)beans.next();
         
          long timeNow = System.currentTimeMillis();
          long lastActivated = rmdBean.getLastActivatedTime();
 
          // delete sequences that have been timedout or deleted for more than
          // the SequenceRemovalTimeoutInterval
          if ((lastActivated + deleteTime) < timeNow) {
            if (log.isDebugEnabled())
              log.debug("Deleting RMDBean " + deleteTime + " : " + rmdBean);
            storageManager.getRMDBeanMgr().delete(rmdBean.getSequenceID());
          }               
        }
      }

      // Terminate RMD Sequences that have been inactive.     
      if (propertyBean.getInactivityTimeoutInterval() > 0) {
        RMDBean finderRMDBean = new RMDBean();
        finderRMDBean.setTerminated(false);
       
        List rmdBeans = storageManager.getRMDBeanMgr().find(finderRMDBean);
     
        Iterator beans = rmdBeans.iterator();
        while (beans.hasNext()) {
          RMDBean rmdBean = (RMDBean)beans.next();
         
          long timeNow = System.currentTimeMillis();
          long lastActivated = rmdBean.getLastActivatedTime();
         
          if ((lastActivated + propertyBean.getInactivityTimeoutInterval()) < timeNow) {
            // Terminate
            rmdBean.setTerminated(true);
            rmdBean.setLastActivatedTime(timeNow);
            if (log.isDebugEnabled())
              log.debug(System.currentTimeMillis() + "Marking RMDBean as terminated " + rmdBean);
View Full Code Here

    //storing the module as a static variable
    SandeshaUtil.setAxisModule(module);
   
    // continueUncompletedSequences (storageManager,configCtx);

    SandeshaPolicyBean constantPropertyBean = PropertyManager.loadPropertiesFromDefaultValues();
    SandeshaPolicyBean propertyBean = PropertyManager.loadPropertiesFromModuleDescPolicy(module,constantPropertyBean);
   
    if (propertyBean==null) {
      String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.couldNotLoadModulePolicies);
      log.error (message);
     
View Full Code Here

TOP

Related Classes of org.apache.sandesha2.policy.SandeshaPolicyBean

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.