Package org.apache.sandesha2.policy

Examples of org.apache.sandesha2.policy.SandeshaPolicyBean


     
      boolean processResponseForFaults = false ;
      try {
        InvocationResponse response = InvocationResponse.CONTINUE;
       
        SandeshaPolicyBean policy = SandeshaUtil.getPropertyBean(msgCtx.getAxisOperation());
        if(policy.isUseMessageSerialization()) {
          if(msgCtx.isPaused()) {
            if (log.isDebugEnabled())
              log.debug("Resuming a send for message : " + msgCtx.getEnvelope().getHeader());
            msgCtx.setPaused(false);
            msgCtx.setProperty(MessageContext.TRANSPORT_NON_BLOCKING, Boolean.FALSE);
View Full Code Here


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

        SandeshaPolicyBean constantPropertyBean = new SandeshaPolicyBean ();
    SandeshaPolicyBean propertyBean = PropertyManager.loadPropertiesFromModuleDescPolicy(module,constantPropertyBean);
   
    if (propertyBean==null) {
      String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.couldNotLoadModulePolicies);
      log.error (message);
      propertyBean = new SandeshaPolicyBean ();
    } else {
      if (log.isDebugEnabled()) {
        String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.modulePoliciesLoaded);
        log.info (message);
      }
View Full Code Here

  public void engageNotify(AxisDescription axisDescription) throws AxisFault {
    if(log.isDebugEnabled()) log.debug("Entry: SandeshaModule::engageNotify, " + axisDescription);
   
    AxisDescription parent = axisDescription.getParent();
    SandeshaPolicyBean parentPropertyBean = null;
    if(parent != null) parentPropertyBean = SandeshaUtil.getPropertyBean(parent);
   
    SandeshaPolicyBean axisDescPropertyBean = PropertyManager.loadPropertiesFromAxisDescription(axisDescription,parentPropertyBean);
   
    if (axisDescPropertyBean!=null) {
      Parameter parameter = new Parameter ();
      parameter.setName(Sandesha2Constants.SANDESHA_PROPERTY_BEAN);
      parameter.setValue(axisDescPropertyBean);
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

  public static void setPolicyBean (ServiceClient serviceClient, SandeshaPolicyBean policyBean) throws SandeshaException {
    try {
      AxisService axisService = serviceClient.getAxisService();
      if (axisService!=null) {
        Parameter parameter = axisService.getParameter(Sandesha2Constants.SANDESHA_PROPERTY_BEAN);
        SandeshaPolicyBean parent = null;
        if (parameter==null) {
          parameter = new Parameter ();
          parameter.setName(Sandesha2Constants.SANDESHA_PROPERTY_BEAN);
        } else {
          parameter.setEditable(true); //if we don't do it here, Axis2 will not allow us to override the parameter value.
View Full Code Here

    propertyBean.setEnforceRM(Sandesha2Constants.Properties.DefaultValues.enforceRM);
   
  }

  public static SandeshaPolicyBean loadPropertiesFromPropertyFile(InputStream in) throws SandeshaException {
    SandeshaPolicyBean propertyBean = new SandeshaPolicyBean();
    try {
      if (in == null)
        in = Thread.currentThread().getContextClassLoader().getResourceAsStream(
            Sandesha2Constants.PROPERTY_FILE);
View Full Code Here

    return propertyBean;
  }

  public static SandeshaPolicyBean loadPropertiesFromModuleDesc(AxisModule desc) throws SandeshaException {
    SandeshaPolicyBean propertyBean = new SandeshaPolicyBean();

    Parameter expoBackoffParam = desc.getParameter(Sandesha2Constants.Properties.ExponentialBackoff);
    String expoBackoffStr = (String) expoBackoffParam.getValue();
    loadExponentialBackoff(expoBackoffStr, propertyBean);
View Full Code Here

  }

  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) {
          if(parentPropertyBean != null) 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

    if(Sandesha2Constants.SPEC_2005_02.NS_URI.equals(rmNamespaceValue)) {
      autoOffer = twoWayService;
    } else {
      // We also do some checking at this point to see if MakeConection is required to
      // enable WS-RM 1.1, and write a warning to the log if it has been disabled.
      SandeshaPolicyBean policy = SandeshaUtil.getPropertyBean(context.getAxisConfiguration());
      if(twoWayService && !policy.isEnableMakeConnection()) {
        String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.makeConnectionWarning);
        log.warn(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.