You are viewing a plain text version of this content. The canonical link for it is here.
Posted to sandesha-dev@ws.apache.org by ch...@apache.org on 2006/01/26 07:29:52 UTC

svn commit: r372458 - in /webservices/sandesha/trunk/src/org/apache/sandesha2: ./ handlers/ msgprocessors/ policy/ policy/processors/ util/ workers/

Author: chamikara
Date: Wed Jan 25 22:29:10 2006
New Revision: 372458

URL: http://svn.apache.org/viewcvs?rev=372458&view=rev
Log:
Changed the parameter loading method to get the values from a policy element (within module.xml or service.xml).

Modified:
    webservices/sandesha/trunk/src/org/apache/sandesha2/Sandesha2Constants.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/SandeshaModule.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/TerminateManager.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/policy/PolicyEngineData.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/policy/RMPolicy.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/policy/processors/StorageManagersProcessor.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/util/MessageRetransmissionAdjuster.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/util/PropertyManager.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/util/RMMsgCreator.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/util/RMPolicyManager.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/util/SandeshaUtil.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/util/SequenceManager.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/workers/Sender.java

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/Sandesha2Constants.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/Sandesha2Constants.java?rev=372458&r1=372457&r2=372458&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/Sandesha2Constants.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/Sandesha2Constants.java Wed Jan 25 22:29:10 2006
@@ -361,4 +361,6 @@
 	String EXECUTIN_CHAIN_SEPERATOR = ".";
 	
 	String INTERNAL_SEQUENCE_PREFIX = "Sandesha2InternalSequence";
+	
+	String SANDESHA2_POLICY_BEAN = "Sandesha2PolicyBean";
 }

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/SandeshaModule.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/SandeshaModule.java?rev=372458&r1=372457&r2=372458&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/SandeshaModule.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/SandeshaModule.java Wed Jan 25 22:29:10 2006
@@ -21,10 +21,14 @@
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.description.AxisDescription;
 import org.apache.axis2.description.AxisModule;
+import org.apache.axis2.description.Parameter;
+import org.apache.axis2.description.ParameterImpl;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.modules.Module;
 import org.apache.sandesha2.storage.StorageManager;
 import org.apache.sandesha2.util.PropertyManager;
+import org.apache.sandesha2.util.RMPolicyManager;
+import org.apache.sandesha2.util.SandeshaPropertyBean;
 import org.apache.sandesha2.util.SandeshaUtil;
 
 
@@ -44,7 +48,7 @@
 
 		// loading properties to property manager.
 		// PropertyManager.getInstance().loadPropertiesFromModuleDesc(module);
-		PropertyManager.getInstance().loadPropertiesFromModuleDesc(module);
+		PropertyManager.getInstance().loadPropertiesFromModuleDescPolicy(module);
 		StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(configContext);
 		storageManager.initStorage(module);
 	}
@@ -52,6 +56,19 @@
 	public void engageNotify(AxisDescription axisDescription) throws AxisFault {
 
 		// TODO add notify logic.
+		
+		SandeshaPropertyBean defaultPropertyBean = PropertyManager.getInstance().getPropertyBean();
+		SandeshaPropertyBean axisDescPropertyBean = RMPolicyManager.loadPoliciesFromAxisDescription(axisDescription);
+		
+		Parameter parameter = new ParameterImpl ();
+		parameter.setName(Sandesha2Constants.SANDESHA2_POLICY_BEAN);
+		if (axisDescPropertyBean==null) {
+			parameter.setValue(defaultPropertyBean);
+		}else {
+			parameter.setValue(axisDescPropertyBean);
+		}
+		
+		axisDescription.addParameter(parameter);
 
 	}
 

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/TerminateManager.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/TerminateManager.java?rev=372458&r1=372457&r2=372458&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/TerminateManager.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/TerminateManager.java Wed Jan 25 22:29:10 2006
@@ -23,6 +23,8 @@
 import java.util.Iterator;
 
 import org.apache.axis2.context.ConfigurationContext;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.sandesha2.storage.StorageManager;
 import org.apache.sandesha2.storage.Transaction;
 import org.apache.sandesha2.storage.beanmanagers.CreateSeqBeanMgr;
@@ -36,6 +38,7 @@
 import org.apache.sandesha2.storage.beans.SenderBean;
 import org.apache.sandesha2.storage.beans.SequencePropertyBean;
 import org.apache.sandesha2.util.PropertyManager;
+import org.apache.sandesha2.util.SandeshaPropertyBean;
 import org.apache.sandesha2.util.SandeshaUtil;
 
 /**
@@ -47,6 +50,8 @@
 
 public class TerminateManager {
 
+	private static Log log = LogFactory.getLog(TerminateManager.class);
+	
 	private static String CLEANED_ON_TERMINATE_MSG = "CleanedOnTerminateMsg";
 	private static String CLEANED_AFTER_INVOCATION = "CleanedAfterInvocation";
 	
@@ -66,6 +71,9 @@
 		//clean senderMap
 		
 		boolean inOrderInvocation = PropertyManager.getInstance().isInOrderInvocation();
+		//SandeshaPropertyBean propertyBean = (SandeshaPropertyBean) msgContext.getParameter(Sandesha2Constants.SANDESHA2_POLICY_BEAN);
+		
+		
 		if(!inOrderInvocation) { 
 			//there is no invoking by Sandesha2. So clean invocations storages.
 			cleanReceivingSideAfterInvocation(configContext,sequenceID);
@@ -136,12 +144,17 @@
 		StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(configContext);
 		SequencePropertyBeanMgr sequencePropertyBeanMgr = storageManager.getSequencePropretyBeanMgr();
 		SequencePropertyBean allSequenceBean = sequencePropertyBeanMgr.retrieve(Sandesha2Constants.SequenceProperties.ALL_SEQUENCES,Sandesha2Constants.SequenceProperties.INCOMING_SEQUENCE_LIST);
-		ArrayList allSequenceList = SandeshaUtil.getArrayListFromString(allSequenceBean.getValue());
-		allSequenceList.remove(sequenceID);
 		
-		//updating 
-		allSequenceBean.setValue(allSequenceList.toString());
-		sequencePropertyBeanMgr.update(allSequenceBean);
+		if (allSequenceBean!=null) {
+			log.debug("AllSequence bean is null");
+			
+			ArrayList allSequenceList = SandeshaUtil.getArrayListFromString(allSequenceBean.getValue());
+			allSequenceList.remove(sequenceID);
+		
+			//updating 
+			allSequenceBean.setValue(allSequenceList.toString());
+			sequencePropertyBeanMgr.update(allSequenceBean);
+		}
 	}
 	
 	private static boolean isRequiredForResponseSide (String name) {

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java?rev=372458&r1=372457&r2=372458&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java Wed Jan 25 22:29:10 2006
@@ -29,6 +29,8 @@
 import org.apache.axis2.context.OperationContextFactory;
 import org.apache.axis2.context.ServiceContext;
 import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.Parameter;
+import org.apache.axis2.description.ParameterImpl;
 import org.apache.axis2.engine.AxisEngine;
 import org.apache.axis2.handlers.AbstractHandler;
 import org.apache.axis2.soap.SOAPBody;
@@ -52,9 +54,11 @@
 import org.apache.sandesha2.storage.beans.SequencePropertyBean;
 import org.apache.sandesha2.transport.Sandesha2TransportSender;
 import org.apache.sandesha2.util.MsgInitializer;
+import org.apache.sandesha2.util.PropertyManager;
 import org.apache.sandesha2.util.RMMsgCreator;
 import org.apache.sandesha2.util.RMPolicyManager;
 import org.apache.sandesha2.util.SOAPAbstractFactory;
+import org.apache.sandesha2.util.SandeshaPropertyBean;
 import org.apache.sandesha2.util.SandeshaUtil;
 import org.apache.sandesha2.util.SequenceManager;
 import org.apache.sandesha2.wsrm.AckRequested;
@@ -66,6 +70,8 @@
 import org.apache.sandesha2.wsrm.SequenceOffer;
 import org.apache.wsdl.WSDLConstants;
 
+import sun.security.action.GetPropertyAction;
+
 /**
  * This is invoked in the outFlow of an RM endpoint
  * 
@@ -114,8 +120,21 @@
 		}
 
 		//Adding the policy bean
-		RMPolicyBean policyBean = RMPolicyManager.getPolicyBean(rmMsgCtx);
-		rmMsgCtx.setProperty(Sandesha2Constants.WSP.RM_POLICY_BEAN, policyBean);
+//		RMPolicyBean policyBean = RMPolicyManager.getPolicyBean(rmMsgCtx);
+//		rmMsgCtx.setProperty(Sandesha2Constants.WSP.RM_POLICY_BEAN, policyBean);
+		Parameter policyParam = msgCtx.getParameter(Sandesha2Constants.SANDESHA2_POLICY_BEAN);
+		if (policyParam==null) {
+			SandeshaPropertyBean propertyBean = PropertyManager.getInstance().getPropertyBean();
+			Parameter parameter = new ParameterImpl ();
+			parameter.setName(Sandesha2Constants.SANDESHA2_POLICY_BEAN);
+			parameter.setValue(propertyBean);
+			
+			//TODO this should be addede to the AxisMessage
+			if (msgCtx.getAxisOperation()!=null)
+				msgCtx.getAxisOperation().addParameter(parameter);
+			else if (msgCtx.getAxisService()!=null) 
+				msgCtx.getAxisService().addParameter(parameter);
+		}
 
 		CreateSeqBeanMgr createSeqMgr = storageManager.getCreateSeqBeanMgr();
 		SequencePropertyBeanMgr seqPropMgr = storageManager

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java?rev=372458&r1=372457&r2=372458&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java Wed Jan 25 22:29:10 2006
@@ -54,6 +54,7 @@
 import org.apache.sandesha2.util.PropertyManager;
 import org.apache.sandesha2.util.RMMsgCreator;
 import org.apache.sandesha2.util.SOAPAbstractFactory;
+import org.apache.sandesha2.util.SandeshaPropertyBean;
 import org.apache.sandesha2.util.SandeshaUtil;
 import org.apache.sandesha2.util.SequenceManager;
 import org.apache.sandesha2.wsrm.AckRequested;
@@ -177,8 +178,15 @@
 
 	//	long nextMsgno = bean.getNextMsgNoToProcess();
 
-		boolean inOrderInvocation = PropertyManager.getInstance()
-				.isInOrderInvocation();
+//		boolean inOrderInvocation = PropertyManager.getInstance()
+//				.isInOrderInvocation();
+//		
+		//TODO currently this is an module-level property. Make this service specific.
+//		SandeshaPropertyBean propertyBean = (SandeshaPropertyBean) msgCtx.getParameter(Sandesha2Constants.SANDESHA2_POLICY_BEAN).getValue();
+//		boolean inOrderInvocation = propertyBean.isInOrder();
+		boolean inOrderInvocation = PropertyManager.getInstance().isInOrderInvocation();
+		
+		
 		if (inOrderInvocation) {
 			
 			//pause the message
@@ -404,13 +412,18 @@
 			//sequence is the actual sequence ID
 			ackBean.setInternalSequenceID(sequenceId);
 
-			RMPolicyBean policyBean = (RMPolicyBean) rmMsgCtx
-					.getProperty(Sandesha2Constants.WSP.RM_POLICY_BEAN);
-			long ackInterval = PropertyManager.getInstance()
-					.getAcknowledgementInterval();
-			if (policyBean != null) {
-				ackInterval = policyBean.getAcknowledgementInaterval();
-			}
+//			RMPolicyBean policyBean = (RMPolicyBean) rmMsgCtx
+//					.getProperty(Sandesha2Constants.WSP.RM_POLICY_BEAN);
+		
+//			long ackInterval = PropertyManager.getInstance()
+//					.getAcknowledgementInterval();
+			
+			SandeshaPropertyBean propertyBean = (SandeshaPropertyBean) msgCtx.getParameter(Sandesha2Constants.SANDESHA2_POLICY_BEAN).getValue();
+			long ackInterval = propertyBean.getAcknowledgementInaterval();
+			
+			//			if (policyBean != null) {
+//				ackInterval = policyBean.getAcknowledgementInaterval();
+//			}
 			
 			//Ack will be sent as stand alone, only after the retransmitter
 			// interval.

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/policy/PolicyEngineData.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/policy/PolicyEngineData.java?rev=372458&r1=372457&r2=372458&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/policy/PolicyEngineData.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/policy/PolicyEngineData.java Wed Jan 25 22:29:10 2006
@@ -9,8 +9,8 @@
 	private boolean invokeInOrder;
 	private String messageTypesToDrop;
 	private long retransmissionInterval;
-	private String permanentStorageMgr;
-	private String inmemoryStorageManager;
+	//private String permanentStorageMgr;
+	private String storageManager;
 	
 
 	public boolean isExponentialBackoff() {
@@ -61,13 +61,13 @@
 		this.retransmissionInterval = retransmissionInterval;
 	}
 
-	public String getPermanentStorageManager() {
-		return permanentStorageMgr;
-	}
-
-	public void setPermanentStorageManager(String storageManager) {
-		this.permanentStorageMgr = storageManager;
-	}
+//	public String getPermanentStorageManager() {
+//		return permanentStorageMgr;
+//	}
+//
+//	public void setPermanentStorageManager(String storageManager) {
+//		this.permanentStorageMgr = storageManager;
+//	}
 
 	public void initializeWithDefaults() {
 		
@@ -83,7 +83,8 @@
 		ped.setInvokeInOrder(this.isInvokeInOrder());
 		ped.setMessageTypesToDrop(this.getMessageTypesToDrop());
 		ped.setRetransmissionInterval(this.getRetransmissionInterval());
-		ped.setPermanentStorageManager(this.getPermanentStorageManager());
+		//ped.setPermanentStorageManager(this.getPermanentStorageManager());
+		ped.setStorageManager(this.getStorageManager());
 		
 		return ped;
 	}
@@ -96,11 +97,11 @@
 		return acknowledgementInterval;
 	}
 	
-	public void setInmemoryStorageManager(String inmemoryStorageManager) {
-		this.inmemoryStorageManager = inmemoryStorageManager;
+	public void setStorageManager(String storageManager) {
+		this.storageManager = storageManager;
 	}
 	
-	public String getInmemoryStorageManager() {
-		return inmemoryStorageManager;
+	public String getStorageManager() {
+		return storageManager;
 	}
 }

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/policy/RMPolicy.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/policy/RMPolicy.java?rev=372458&r1=372457&r2=372458&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/policy/RMPolicy.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/policy/RMPolicy.java Wed Jan 25 22:29:10 2006
@@ -33,8 +33,8 @@
 	public static final RMPolicyToken permenentStorageManager = new RMPolicyToken(
 			"PermanentStorageManager", RMPolicyToken.SIMPLE_TOKEN, new String[]{});
 	
-	public static final RMPolicyToken inmemoryStorageManager = new RMPolicyToken(
-			"InmemoryStorageManager", RMPolicyToken.SIMPLE_TOKEN, new String[]{});
+	public static final RMPolicyToken storageManager = new RMPolicyToken(
+			"StorageManager", RMPolicyToken.SIMPLE_TOKEN, new String[]{});
 	
 	public static final String includeNever = "http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never";
 

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/policy/processors/StorageManagersProcessor.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/policy/processors/StorageManagersProcessor.java?rev=372458&r1=372457&r2=372458&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/policy/processors/StorageManagersProcessor.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/policy/processors/StorageManagersProcessor.java Wed Jan 25 22:29:10 2006
@@ -16,7 +16,7 @@
 			throws NoSuchMethodException {
 		logger.debug("StorageManagersProcessor:initializeStorageManager");
 
-		RMPolicyToken tmpRpt = RMPolicy.inmemoryStorageManager.copy();
+		RMPolicyToken tmpRpt = RMPolicy.storageManager.copy();
 		tmpRpt.setProcessTokenMethod(this);
 		rmpt.setChildToken(tmpRpt);
 
@@ -55,7 +55,7 @@
 		return new Boolean(true);
 	}
 
-	public Object doInmemoryStorageManager(RMProcessorContext rmpc) {
+	public Object doStorageManager(RMProcessorContext rmpc) {
 		logger.debug("Processing "
 				+ rmpc.readCurrentSecurityToken().getTokenName() + ": "
 				+ RMProcessorContext.ACTION_NAMES[rmpc.getAction()]);
@@ -64,7 +64,7 @@
 		String cls = rmpc.getAssertion().getStrValue();
 
 		if (cls != null && !cls.trim().equals("")) {
-			ped.setInmemoryStorageManager(cls.trim());
+			ped.setStorageManager(cls.trim());
 		}
 
 		return new Boolean(true);
@@ -79,7 +79,7 @@
 		String cls = spc.getAssertion().getStrValue();
 
 		if (cls != null && !cls.trim().equals("")) {
-			ped.setPermanentStorageManager(cls.trim());
+			ped.setStorageManager(cls.trim());
 		}
 
 		return new Boolean(true);

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/util/MessageRetransmissionAdjuster.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/util/MessageRetransmissionAdjuster.java?rev=372458&r1=372457&r2=372458&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/util/MessageRetransmissionAdjuster.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/util/MessageRetransmissionAdjuster.java Wed Jan 25 22:29:10 2006
@@ -19,6 +19,9 @@
 
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.Parameter;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.sandesha2.Sandesha2Constants;
 import org.apache.sandesha2.SandeshaException;
 import org.apache.sandesha2.policy.RMPolicyBean;
@@ -33,6 +36,8 @@
 
 public class MessageRetransmissionAdjuster {
 
+	Log log = LogFactory.getLog( getClass());
+	
 	public SenderBean adjustRetransmittion(
 			SenderBean retransmitterBean,ConfigurationContext configContext) throws SandeshaException {
 		StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(configContext);
@@ -47,15 +52,23 @@
 		if (messageContext.getConfigurationContext() == null)
 			return retransmitterBean;
 
-		RMPolicyBean policyBean = (RMPolicyBean) messageContext
-				.getProperty(Sandesha2Constants.WSP.RM_POLICY_BEAN);
-		if (policyBean == null) {
-			//loading default policies.
-			policyBean = PropertyManager.getInstance().getRMPolicyBean();
+//		RMPolicyBean policyBean = (RMPolicyBean) messageContext
+//				.getProperty(Sandesha2Constants.WSP.RM_POLICY_BEAN);
+//		if (policyBean == null) {
+//			//loading default policies.
+//			policyBean = PropertyManager.getInstance().getRMPolicyBean();
+//		}
+
+		Parameter parameter =  messageContext.getParameter(Sandesha2Constants.SANDESHA2_POLICY_BEAN);
+		if (parameter==null) {
+			log.error ("Cant adjust retransmission since, Parameter bean is not set");
+			return retransmitterBean;
 		}
-
+		
+		SandeshaPropertyBean propertyBean = (SandeshaPropertyBean) parameter.getValue();
+		
 		retransmitterBean.setSentCount(retransmitterBean.getSentCount() + 1);
-		adjustNextRetransmissionTime(retransmitterBean, policyBean);
+		adjustNextRetransmissionTime(retransmitterBean, propertyBean);
 
 		if (retransmitterBean.getSentCount() >= Sandesha2Constants.MAXIMUM_RETRANSMISSION_ATTEMPTS)
 			stopRetransmission(retransmitterBean);
@@ -72,16 +85,16 @@
 	 * @return
 	 */
 	private SenderBean adjustNextRetransmissionTime(
-			SenderBean retransmitterBean, RMPolicyBean policyBean) {
+			SenderBean retransmitterBean, SandeshaPropertyBean propertyBean) {
 
 		long lastSentTime = retransmitterBean.getTimeToSend();
 
 		int count = retransmitterBean.getSentCount();
 
-		long baseInterval = policyBean.getRetransmissionInterval();
+		long baseInterval = propertyBean.getRetransmissionInterval();
 
 		long newInterval = baseInterval;
-		if (policyBean.isExponentialBackoff()) {
+		if (propertyBean.isExponentialBackoff()) {
 			newInterval = generateNextExponentialBackedoffDifference(count,
 					baseInterval);
 		}

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/util/PropertyManager.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/util/PropertyManager.java?rev=372458&r1=372457&r2=372458&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/util/PropertyManager.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/util/PropertyManager.java Wed Jan 25 22:29:10 2006
@@ -201,7 +201,7 @@
 				.setRetransmissionInterval(data.getRetransmissionInterval());
 
 		// CHECKME
-		propertyBean.setStorageManagerClass(data.getInmemoryStorageManager());
+		propertyBean.setStorageManagerClass(data.getStorageManager());
 	}
 
 	public static PropertyManager getInstance() {

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/util/RMMsgCreator.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/util/RMMsgCreator.java?rev=372458&r1=372457&r2=372458&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/util/RMMsgCreator.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/util/RMMsgCreator.java Wed Jan 25 22:29:10 2006
@@ -29,6 +29,7 @@
 import org.apache.axis2.context.OperationContext;
 import org.apache.axis2.description.AxisOperation;
 import org.apache.axis2.description.AxisOperationFactory;
+import org.apache.axis2.description.Parameter;
 import org.apache.axis2.soap.SOAPEnvelope;
 import org.apache.axis2.soap.SOAPFactory;
 import org.apache.sandesha2.RMMsgContext;
@@ -58,10 +59,28 @@
 
 public class RMMsgCreator {
 
-	private static void setUpMessage(MessageContext rmMsgCtx) {
+	private static void setUpMessage(MessageContext relatedMessage, MessageContext newMessage) throws SandeshaException {
 		//Seting RMPolicyBean
-		if (rmMsgCtx.getProperty(Sandesha2Constants.WSP.RM_POLICY_BEAN)==null)
-			rmMsgCtx.setProperty(Sandesha2Constants.WSP.RM_POLICY_BEAN, PropertyManager.getInstance().getRMPolicyBean());
+//		if (rmMsgCtx.getProperty(Sandesha2Constants.WSP.RM_POLICY_BEAN)==null)
+//			rmMsgCtx.setProperty(Sandesha2Constants.WSP.RM_POLICY_BEAN, PropertyManager.getInstance().getRMPolicyBean());
+	
+		Parameter policyParam = relatedMessage.getParameter(Sandesha2Constants.SANDESHA2_POLICY_BEAN);
+//		if (propertyParam!=null)
+//			newMessage.setProperty(propertyParam.getName(),propertyParam.getValue());
+		
+		if (policyParam!=null) {
+			
+			try {
+				//TODO this should be added to the AxisMessage
+				if (newMessage.getAxisOperation()!=null)
+					newMessage.getAxisOperation().addParameter(policyParam);
+				else if (newMessage.getAxisService()!=null) {
+					newMessage.getAxisService().addParameter(policyParam);
+				}
+			} catch (AxisFault e) {
+				throw new SandeshaException (e.getMessage());
+			}
+		}
 	}
 
 	/**
@@ -111,7 +130,7 @@
 			throw new SandeshaException(e.getMessage());
 		}
 
-		setUpMessage(createSeqmsgContext);
+		setUpMessage(applicationMsgContext, createSeqmsgContext);
 
 		AxisOperation appMsgOperationDesc = applicationMsgContext
 				.getAxisOperation();
@@ -236,7 +255,7 @@
 		if (terminateMessage == null)
 			throw new SandeshaException("MessageContext is null");
 
-		setUpMessage(terminateMessage);
+		setUpMessage(referenceMessage, terminateMessage);
 
 		SOAPFactory factory = SOAPAbstractFactory.getSOAPFactory(SandeshaUtil
 				.getSOAPVersion(referenceMessage.getEnvelope()));
@@ -327,7 +346,7 @@
 
 		outMessage.setEnvelope(envelope);
 
-		setUpMessage(outMessage);
+		setUpMessage(createSeqMessage.getMessageContext(), outMessage);
 
 		RMMsgContext createSeqResponse = null;
 		try {
@@ -414,7 +433,7 @@
 			RMMsgContext ackRMMsgCtx = MsgInitializer
 					.initializeMessage(ackMsgCtx);
 
-			setUpMessage(ackMsgCtx);
+			setUpMessage(applicationMsgCtx, ackMsgCtx);
 
 			Sequence reqSequence = (Sequence) applicationRMMsgCtx
 					.getMessagePart(Sandesha2Constants.MessageParts.SEQUENCE);

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/util/RMPolicyManager.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/util/RMPolicyManager.java?rev=372458&r1=372457&r2=372458&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/util/RMPolicyManager.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/util/RMPolicyManager.java Wed Jan 25 22:29:10 2006
@@ -17,8 +17,16 @@
 
 package org.apache.sandesha2.util;
 
+import java.util.ArrayList;
+
+import org.apache.axis2.description.AxisDescription;
 import org.apache.sandesha2.RMMsgContext;
+import org.apache.sandesha2.SandeshaException;
+import org.apache.sandesha2.policy.PolicyEngineData;
 import org.apache.sandesha2.policy.RMPolicyBean;
+import org.apache.sandesha2.policy.RMPolicyProcessor;
+import org.apache.sandesha2.policy.RMProcessorContext;
+import org.apache.ws.policy.Policy;
 
 /**
  * This is used to manage RM Policies.
@@ -34,5 +42,50 @@
 		
 		RMPolicyBean policyBean = PropertyManager.getInstance().getRMPolicyBean();
 		return policyBean;
+	}
+	
+	public static SandeshaPropertyBean loadPoliciesFromAxisDescription (AxisDescription desc) throws SandeshaException{
+		
+		SandeshaPropertyBean propertyBean = new SandeshaPropertyBean ();
+		
+		Policy policy = desc.getPolicyInclude().getEffectivePolicy();
+
+		if (policy == null) {
+			//no policy found
+			return null;
+		}
+
+		RMPolicyProcessor processor = new RMPolicyProcessor();
+
+		try {
+			processor.setup();
+		} catch (NoSuchMethodException e) {
+			throw new SandeshaException(e.getMessage());
+		}
+		
+		processor.processPolicy(policy);
+
+		RMProcessorContext ctx = processor.getContext();
+		PolicyEngineData data = ctx.readCurrentPolicyEngineData();
+
+		propertyBean.setAcknowledgementInterval(data
+				.getAcknowledgementInterval());
+		propertyBean.setExponentialBackoff(data.isExponentialBackoff());
+		propertyBean.setInactiveTimeoutInterval((int) data
+				.getInactivityTimeout(), data.getInactivityTimeoutMeassure());
+		propertyBean.setInOrder(data.isInvokeInOrder());
+
+		// CHECKME
+		ArrayList msgTypesToDrop = new ArrayList();
+		msgTypesToDrop.add(data.getMessageTypesToDrop());
+		propertyBean.setMsgTypesToDrop(msgTypesToDrop);
+
+		propertyBean
+				.setRetransmissionInterval(data.getRetransmissionInterval());
+
+		// CHECKME
+		propertyBean.setStorageManagerClass(data.getStorageManager());
+		
+		return propertyBean;
 	}
 }

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/util/SandeshaUtil.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/util/SandeshaUtil.java?rev=372458&r1=372457&r2=372458&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/util/SandeshaUtil.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/util/SandeshaUtil.java Wed Jan 25 22:29:10 2006
@@ -421,7 +421,9 @@
 			return storageManager;
 
 		} catch (Exception e) {
-			throw new SandeshaException(e.getMessage());
+			String message = "Cannot load the given storage manager";
+			log.error(message);
+			throw new SandeshaException(message);
 		}
 	}
 

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/util/SequenceManager.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/util/SequenceManager.java?rev=372458&r1=372457&r2=372458&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/util/SequenceManager.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/util/SequenceManager.java Wed Jan 25 22:29:10 2006
@@ -14,6 +14,7 @@
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.context.MessageContextConstants;
+import org.apache.axis2.description.Parameter;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.sandesha2.RMMsgContext;
@@ -256,7 +257,10 @@
 			.getProperty(Sandesha2Constants.WSP.RM_POLICY_BEAN);
 		if (policyBean == null) {
 			//loading default policies.
-			policyBean = PropertyManager.getInstance().getRMPolicyBean();
+			//policyBean = PropertyManager.getInstance().getRMPolicyBean();
+			Parameter parameter =  rmMsgCtx.getMessageContext().getParameter(Sandesha2Constants.SANDESHA2_POLICY_BEAN);
+			SandeshaPropertyBean propertyBean = (SandeshaPropertyBean) parameter.getValue();
+			policyBean = propertyBean.getPolicyBean();
 		}
 		
 		if (policyBean.getInactiveTimeoutInterval()<=0)

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/workers/Sender.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/workers/Sender.java?rev=372458&r1=372457&r2=372458&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/workers/Sender.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/workers/Sender.java Wed Jan 25 22:29:10 2006
@@ -43,6 +43,7 @@
 import org.apache.sandesha2.util.MessageRetransmissionAdjuster;
 import org.apache.sandesha2.util.MsgInitializer;
 import org.apache.sandesha2.util.PropertyManager;
+import org.apache.sandesha2.util.SandeshaPropertyBean;
 import org.apache.sandesha2.util.SandeshaUtil;
 import org.apache.sandesha2.util.SequenceManager;
 import org.apache.sandesha2.wsrm.Sequence;
@@ -144,6 +145,8 @@
 
 						//skip sending if this message has been mentioned as a message not to send (within sandesha2.properties)
 						ArrayList msgsNotToSend = PropertyManager.getInstance().getMessagesNotToSend();
+						//SandeshaPropertyBean propertyBean = (SandeshaPropertyBean) messageContext.getParameter(Sandesha2Constants.SANDESHA2_POLICY_BEAN);
+						
 						if (msgsNotToSend!=null && msgsNotToSend.contains(new Integer (rmMsgCtx.getMessageType()))) {
 							continue;
 						}



---------------------------------------------------------------------
To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: sandesha-dev-help@ws.apache.org