? sandesha/.classpath
? sandesha/.project
? sandesha/axis.log
? sandesha/patches
? sandesha/target
? sandesha/interop/Test.bat
? sandesha/interop/axis.log
Index: sandesha/maven.xml
===================================================================
RCS file: /home/cvspublic/ws-fx/sandesha/maven.xml,v
retrieving revision 1.4
diff -u -r1.4 maven.xml
--- sandesha/maven.xml	2 Mar 2005 14:26:03 -0000	1.4
+++ sandesha/maven.xml	15 Mar 2005 06:11:26 -0000
@@ -18,12 +18,14 @@
      	<copy file="config/sandesha.properties" todir="${maven.build.dir}/classes"/>
      	<copy file="config/log4j.properties" todir="${maven.build.dir}/classes"/>
      	<copy file="config/commons-logging.properties" todir="${maven.build.dir}/classes"/>
+	<copy file="config/WSRMPolicy.xml" todir="${maven.build.dir}/classes"/>
      </preGoal>
 
  	<preGoal name="interop:compile">
      	<copy file="config/sandesha.properties" todir="${maven.build.dir}/classes"/>
      	<copy file="config/log4j.properties" todir="${maven.build.dir}/classes"/>
      	<copy file="config/commons-logging.properties" todir="${maven.build.dir}/classes"/>
+	<copy file="config/WSRMPolicy.xml" todir="${maven.build.dir}/classes"/>
      </preGoal>
 
     <postGoal name="jar">
Index: sandesha/config/WSRMPolicy.xml
===================================================================
RCS file: /home/cvspublic/ws-fx/sandesha/config/WSRMPolicy.xml,v
retrieving revision 1.1
diff -u -r1.1 WSRMPolicy.xml
--- sandesha/config/WSRMPolicy.xml	15 Mar 2005 05:18:32 -0000	1.1
+++ sandesha/config/WSRMPolicy.xml	15 Mar 2005 06:03:11 -0000
@@ -1 +1,23 @@
-<policy></policy>
\ No newline at end of file
+<wsdl:definitions 
+	targetNamespace="example.com" 
+	xmlns:tns="example.com" 
+	xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
+	xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" 
+	xmlns:wsrm="http://schemas.xmlsoap.org/ws/2005/02/rm/policy" 
+	xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" > 
+		<wsp:UsingPolicy wsdl:required="true" /> 
+		<wsp:Policy wsu:Id="MyPolicy" > 
+			<wsrm:RMAssertion> 
+				<wsrm:InactivityTimeout Milliseconds="600000" /> 
+				<wsrm:BaseRetransmissionInterval Milliseconds="3000" /> 
+				<wsrm:ExponentialBackoff /> 
+				<wsrm:AcknowledgementInterval Milliseconds="200" /> 
+			</wsrm:RMAssertion> 
+				<!-- omitted assertions --> 
+		</wsp:Policy> 
+				<!-- omitted elements --> 
+		<wsdl:binding name="MyBinding" type="tns:MyPortType" > 
+			<wsp:PolicyReference URI="#MyPolicy" />
+				<!-- omitted elements --> 
+		</wsdl:binding> 
+</wsdl:definitions>
\ No newline at end of file
Index: sandesha/interop/client-config.wsdd
===================================================================
RCS file: /home/cvspublic/ws-fx/sandesha/interop/client-config.wsdd,v
retrieving revision 1.1
diff -u -r1.1 client-config.wsdd
--- sandesha/interop/client-config.wsdd	2 Mar 2005 03:47:04 -0000	1.1
+++ sandesha/interop/client-config.wsdd	14 Mar 2005 14:04:46 -0000
@@ -3,9 +3,9 @@
  <globalConfiguration>
   <parameter name="adminPassword" value="admin"/>
   <parameter name="disablePrettyXML" value="true"/>
-  <parameter name="attachments.implementation" value="org.apache.axis.attachments.AttachmentsImpl"/>
-  <parameter name="sendXsiTypes" value="true"/>
   <parameter name="sendMultiRefs" value="true"/>
+  <parameter name="sendXsiTypes" value="true"/>
+  <parameter name="attachments.implementation" value="org.apache.axis.attachments.AttachmentsImpl"/>
   <parameter name="sendXMLDeclaration" value="true"/>
  </globalConfiguration>
  <handler name="RMSender" type="java:org.apache.sandesha.client.RMSender"/>
Index: sandesha/src/org/apache/sandesha/Constants.java
===================================================================
RCS file: /home/cvspublic/ws-fx/sandesha/src/org/apache/sandesha/Constants.java,v
retrieving revision 1.36
diff -u -r1.36 Constants.java
--- sandesha/src/org/apache/sandesha/Constants.java	12 Mar 2005 19:14:57 -0000	1.36
+++ sandesha/src/org/apache/sandesha/Constants.java	15 Mar 2005 06:32:53 -0000
@@ -41,6 +41,8 @@
 
 
     public static final long RETRANSMISSION_INTERVAL = 4000;
+    public static final long ACKNOWLEDGEMENT_INTERVAL = 200;
+    public static final long INACTIVITY_TIMEOUT = 600000;
     public static final int MAXIMUM_RETRANSMISSION_COUNT = 20;
     public static final long RMINVOKER_SLEEP_TIME = 2000;
     public static final long SENDER_SLEEP_TIME = 2000;
@@ -169,6 +171,8 @@
     public interface ClientProperties {
 
         public static final String PROPERTY_FILE = "sandesha.properties";
+        
+        public static final String WSRM_POLICY_FILE = "WSRMPolicy.xml"; 
 
         public static final String CLIENT_LISTENER_PORT = "CLIENT_LISTENER_PORT";
         public static final String SIMPLE_AXIS_SERVER_PORT_POPERTY = "SIMPLE_AXIS_SERVER_PORT";
@@ -194,5 +198,15 @@
         public static final String RMSERVICE_CLASS="org.apache.sandesha.client.RMService";
         public static final String ALLOWED_METHODS="allowedMethods";
     }
+
+	//interface relating to policy assertion
+    public interface WSRMPolicy {
+    	public final String INA_TIMEOUT = "InactivityTimeout";
+    	public final String BASE_TX_INTERVAL = "BaseRetransmissionInterval";
+    	public final String ACK_INTERVAL = "AcknowledgementInterval";
+    	public final String EXP_BACKOFF = "ExponentialBackoff";
+    	
+    	public final String WSRM = "http://schemas.xmlsoap.org/ws/2005/02/rm/policy"; 
+    }
 }
 
Index: sandesha/src/org/apache/sandesha/server/Sender.java
===================================================================
RCS file: /home/cvspublic/ws-fx/sandesha/src/org/apache/sandesha/server/Sender.java,v
retrieving revision 1.30
diff -u -r1.30 Sender.java
--- sandesha/src/org/apache/sandesha/server/Sender.java	7 Mar 2005 05:34:34 -0000	1.30
+++ sandesha/src/org/apache/sandesha/server/Sender.java	15 Mar 2005 06:35:27 -0000
@@ -30,6 +30,7 @@
 import org.apache.sandesha.RMMessageContext;
 import org.apache.sandesha.server.msgprocessors.IRMMessageProcessor;
 import org.apache.sandesha.storage.dao.SandeshaQueueDAO;
+import org.apache.sandesha.util.PolicyLoader;
 import org.apache.sandesha.ws.rm.RMHeaders;
 
 import javax.xml.rpc.ServiceException;
@@ -92,9 +93,9 @@
                     hasMessages = false;
                 } else {
                     //Send the message.
-                    if ((rmMessageContext.getReTransmissionCount() <= Constants.MAXIMUM_RETRANSMISSION_COUNT)
+                    if ((rmMessageContext.getReTransmissionCount() <= PolicyLoader.getInstance().getRetransmissionCount())
                             && ((System.currentTimeMillis() - rmMessageContext
-                            .getLastPrecessedTime()) > Constants.RETRANSMISSION_INTERVAL)) {
+                            .getLastPrecessedTime()) > PolicyLoader.getInstance().getBaseRetransmissionInterval())) {
                         try {
                             sendMessage(rmMessageContext);
                         } catch (AxisFault e) {
Index: sandesha/src/org/apache/sandesha/util/PolicyLoader.java
===================================================================
RCS file: /home/cvspublic/ws-fx/sandesha/src/org/apache/sandesha/util/PolicyLoader.java,v
retrieving revision 1.1
diff -u -r1.1 PolicyLoader.java
--- sandesha/src/org/apache/sandesha/util/PolicyLoader.java	15 Mar 2005 05:14:45 -0000	1.1
+++ sandesha/src/org/apache/sandesha/util/PolicyLoader.java	15 Mar 2005 08:30:02 -0000
@@ -1,3 +1,152 @@
+/*
+* Copyright 1999-2004 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License. You may obtain a copy of
+* the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+* License for the specific language governing permissions and limitations under
+* the License.
+*
+*/
+package org.apache.sandesha.util;
+
+/**
+ * @author Saminda Wishwajith Abeyruwan
+ *
+ */
+
+
+
+import java.io.InputStream;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.NodeList;
+
+import org.apache.axis.components.logger.LogFactory;
+import org.apache.commons.logging.Log;
+import org.apache.sandesha.Constants;
+
+
 public class PolicyLoader{
+	
+	private static final Log log = LogFactory.getLog(PolicyLoader.class.getName());
+	
+	private long inactivityTimeout;
+	private long baseRetransmissionInterval;
+	private long acknowledgementInterval;
+	private String exponentialBackoff;
+	
+	private DocumentBuilderFactory  factory; 
+	private DocumentBuilder builder; 
+	private Document document;
+	
+	private static PolicyLoader instance;
+	private static boolean policyInstance = false;
+		
+	private Element rootNodeElement;
+	
+	private PolicyLoader (){
+		policyInstance = true;
+	}
+	
+	public static PolicyLoader getInstance (){
+		if (policyInstance == false)
+			return instance = new PolicyLoader();
+		else
+			return instance;
+	}
+	
+	public int getRetransmissionCount () {
+		return Constants.MAXIMUM_RETRANSMISSION_COUNT; 
+	}
+	
+	public long getInactivityTimeout (){
+		helper();
+		if (inactivityTimeout == 0)
+			return Constants.INACTIVITY_TIMEOUT;
+		else
+			return inactivityTimeout;
+	}
+	
+	public long getBaseRetransmissionInterval (){
+		helper();
+		if (baseRetransmissionInterval == 0)
+			return Constants.RETRANSMISSION_INTERVAL;
+		else
+			return baseRetransmissionInterval;
+	}
+	
+	public long getAcknowledgementInterval () {
+		helper();
+		if (acknowledgementInterval == 0)
+			return Constants.ACKNOWLEDGEMENT_INTERVAL;
+		else
+			return acknowledgementInterval;
+	}
+	
+	public String getExponentialBackoff () {
+		helper();
+		return exponentialBackoff;
+	} 
+	
+	public void helper () {
+			init();
+			try{
+				inactivityTimeout = getAttributeValue(Constants.WSRMPolicy.WSRM,Constants.WSRMPolicy.INA_TIMEOUT);
+				baseRetransmissionInterval = getAttributeValue(Constants.WSRMPolicy.WSRM, Constants.WSRMPolicy.BASE_TX_INTERVAL);
+				acknowledgementInterval = getAttributeValue(Constants.WSRMPolicy.WSRM, Constants.WSRMPolicy.ACK_INTERVAL);
+				exponentialBackoff = getExpBackoffInterval(Constants.WSRMPolicy.WSRM, Constants.WSRMPolicy.EXP_BACKOFF);
+			}catch(Exception e){
+				e.printStackTrace();	
+			}
+	}
+	
+	private long getAttributeValue(String namespaceURI, String elementName) {
+		NodeList list = rootNodeElement.getElementsByTagNameNS(namespaceURI,elementName);
+		NamedNodeMap map = list.item(0).getAttributes();
+		Attr att = (Attr)map.item(0);
+		String value = att.getNodeValue();
+		return Long.parseLong(value.trim());
+	
+	}
+	private String getExpBackoffInterval(String namespaceURI,String elementName){
+		NodeList list = rootNodeElement.getElementsByTagNameNS(namespaceURI,elementName);
+		String name = list.item(0).getLocalName();
+		return name;
+	}
+	
+	private void init() {
+		try{
+			factory = DocumentBuilderFactory.newInstance();
+			factory.setNamespaceAware(true);
+			builder = factory.newDocumentBuilder();
+			InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(Constants.ClientProperties.WSRM_POLICY_FILE);
+			
+			if ( in != null){
+				document = builder.parse(in);
+				rootNodeElement = document.getDocumentElement();
+			}
+			else
+				log.error("No WSRMPolicy.xml Found");
+		}catch (Exception e){
+			e.printStackTrace();
+		}
+	}
+	
+	
+
 
-}
\ No newline at end of file
+}
