You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fx-dev@ws.apache.org by ch...@apache.org on 2007/03/03 18:34:24 UTC

svn commit: r514201 - in /webservices/sandesha/trunk/java: ./ config/ src/org/apache/sandesha2/client/ src/org/apache/sandesha2/i18n/ src/org/apache/sandesha2/msgprocessors/ src/org/apache/sandesha2/polling/ src/org/apache/sandesha2/security/rampart/ s...

Author: chamikara
Date: Sat Mar  3 09:34:22 2007
New Revision: 514201

URL: http://svn.apache.org/viewvc?view=rev&rev=514201
Log:
Made the property copying logic (from referenceMessage to newMessage) generic. Properties to be copied can be specified 
in the module.xml within the "propertiesToCopyFromReferenceMessage" property.
If it is in the key1:key2 format, the property with the key 'key1' will be copied with the key 'key2'.

Fixed a bug that was causing random test failuers (polling messages having server side set to true causing the sync responses
to be ignored in the SenderWorker).

Added the goal secure:rampart:create which causes some services to be built which are configured according to Rampart.

Added a way to ask Sandesha2 to avoid automatic termination of sequences (I.e. when all acks are received).

Modified:
    webservices/sandesha/trunk/java/config/module.xml
    webservices/sandesha/trunk/java/maven.xml
    webservices/sandesha/trunk/java/src/org/apache/sandesha2/client/SandeshaClientConstants.java
    webservices/sandesha/trunk/java/src/org/apache/sandesha2/i18n/SandeshaMessageKeys.java
    webservices/sandesha/trunk/java/src/org/apache/sandesha2/i18n/resource.properties
    webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/AcknowledgementProcessor.java
    webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java
    webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/SequenceProcessor.java
    webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/TerminateSeqMsgProcessor.java
    webservices/sandesha/trunk/java/src/org/apache/sandesha2/polling/PollingManager.java
    webservices/sandesha/trunk/java/src/org/apache/sandesha2/security/rampart/RampartBasedSecurityManager.java
    webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beans/RMSBean.java
    webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/RMMsgCreator.java
    webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/SandeshaUtil.java
    webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/SequenceManager.java
    webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/TerminateManager.java
    webservices/sandesha/trunk/java/src/org/apache/sandesha2/workers/SenderWorker.java
    webservices/sandesha/trunk/java/test/src/org/apache/sandesha2/scenarios/RMScenariosTest.java

Modified: webservices/sandesha/trunk/java/config/module.xml
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/config/module.xml?view=diff&rev=514201&r1=514200&r2=514201
==============================================================================
--- webservices/sandesha/trunk/java/config/module.xml (original)
+++ webservices/sandesha/trunk/java/config/module.xml Sat Mar  3 09:34:22 2007
@@ -35,6 +35,10 @@
             <order phase="RMPhase"/>
         </handler>   
     </OutFaultFlow>
+    
+    <!-- Parameters that will be copied when creating related MessageContexts -->
+    <parameter name="propertiesToCopyFromReferenceMessage" locked="false">TransportURL,WSAddressingVersion,disableAddressingForOutMessages,rampartPolicy,RECV_RESULTS,PROXY</parameter>
+    <parameter name="propertiesToCopyFromReferenceRequestMessage" locked="false">WSAddressingVersion,RECV_RESULTS,rampartPolicy</parameter>
 
     <operation name="RMInOnlyOperation" mep="http://www.w3.org/2006/01/wsdl/in-only">
         <messageReceiver class="org.apache.sandesha2.msgreceivers.RMMessageReceiver"/>
@@ -44,6 +48,9 @@
 
         <!-- namespaces for the 2007-02 spec -->
         <actionMapping>http://docs.oasis-open.org/ws-rx/wsrm/200702/SequenceAcknowledgement</actionMapping>
+        
+        <!--  For interoparability perposes. Some WSRM implementations tend to send this as the LastMessage -->
+        <actionMapping>http://schemas.xmlsoap.org/ws/2005/02/rm/LastMessage</actionMapping>
      </operation>
  
      <operation name="RMInOutOperation" mep="http://www.w3.org/2006/01/wsdl/in-out">
@@ -53,14 +60,10 @@
         <actionMapping>http://schemas.xmlsoap.org/ws/2005/02/rm/CreateSequence</actionMapping>
         <actionMapping>http://schemas.xmlsoap.org/ws/2005/02/rm/AckRequested</actionMapping>
         
-        <!--  For interoparability perposes. Some WSRM implementations tend to send this as the LastMessage, 
-        	  replied with an ack -->
-        <actionMapping>http://schemas.xmlsoap.org/ws/2005/02/rm/LastMessage</actionMapping>
         <actionMapping>http://docs.oasis-open.org/ws-rx/wsrm/200702/AckRequested</actionMapping>
         
         <!--  TerminateSequence works as a InOut in RM 1.0 anonymous scenario -->
         <actionMapping>http://schemas.xmlsoap.org/ws/2005/02/rm/TerminateSequence</actionMapping>
-        
         
         <!-- namespaces for the 2007-02 spec -->
         <actionMapping>http://docs.oasis-open.org/ws-rx/wsrm/200702/CreateSequence</actionMapping>

Modified: webservices/sandesha/trunk/java/maven.xml
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/maven.xml?view=diff&rev=514201&r1=514200&r2=514201
==============================================================================
--- webservices/sandesha/trunk/java/maven.xml (original)
+++ webservices/sandesha/trunk/java/maven.xml Sat Mar  3 09:34:22 2007
@@ -32,7 +32,11 @@
     <ant:property name="repo.addressing.mar.full.name" value="${repo.addressing.mar.name}-${addressing.version}.mar" />
     <ant:property name="repo.addressing.mar.path" value="${maven.repo.local}/${axis2.mar.groupid}/mars" />
     <ant:property name="repo.addressing.mar" value="${repo.addressing.mar.path}/${repo.addressing.mar.full.name}" />
-    <ant:property name="repo.rampart.mar" value="${maven.repo.local}/${axis2.mar.groupid}/mars/rampart-${rampart.version}.mar" />
+
+    <ant:property name="repo.rampart.mar" value="${maven.repo.local}/org.apache.axis2/mars/rampart-${rampart.version}.mar" />
+    <ant:property name="repo.trust.mar" value="${maven.repo.local}/org.apache.axis2/mars/rampart_sts-${rampart.version}.mar" />
+    	
+	<ant:property name="test.service.name" value="RMSampleService.aar" />
 	
 	
     <goal name="build:all" prereqs="mar,jar,client:jar,policy:jar,sample:create,repo:create,test:test" />
@@ -112,7 +116,9 @@
             <fileset dir="${basedir}/target/classes" >
             	<include name="**/policy/**/*.class"/>
 				<include name="**/*Sandesha2Constants*.class"/>
-            	<include name="**/*.properties" /> 
+            	<include name="**/*.properties" /> 
+				<include name="**/*SandeshaException*.class"/>
+				<include name="**/i18n/**" /> 
             </fileset>
         </copy>
 
@@ -161,7 +167,7 @@
 		
 		<!-- Copying addressing mar file--> 
 		<ant:copy file="${repo.addressing.mar}" toDir="${client.dist.path}/modules/" />    
-		<ant:copy file="${repo.rampart.mar}" toDir="${client.dist.path}/modules/" />
+		<ant:copy file="${repo.rampart.mar}" toDir="${client.dist.path}/modules/" />
 	</goal>
 
 	<goal name="secure:create" prereqs="server:create,client:create">
@@ -193,7 +199,69 @@
 		
 		<delete dir="${build.temp.dir}"/>
 	</goal>
-
+
+	<goal name="secure:rampart:create" prereqs="server:create,client:create">
+		<ant:property name="secure.rampart.client.path" value="${build.repo.dir}/secure-rampart-client"/>
+		<ant:property name="secure.rampart.server.path" value="${build.repo.dir}/secure-rampart-server"/>
+     	<ant:mkdir dir="${secure.rampart.client.path}" />
+     	<ant:mkdir dir="${secure.rampart.server.path}" />    
+		
+		<ant:property name="secure.rampart.temp.path" value="${build.temp.dir}/secure-rampart" />
+		<ant:mkdir dir="${secure.rampart.temp.path}" />
+				
+		<copy todir="${secure.rampart.client.path}">
+		  <fileset dir="${build.repo.dir}/client">
+		    <exclude name="modules/${mar.name}"/>
+		  </fileset>
+		</copy>
+
+		<copy todir="${secure.rampart.server.path}">
+		  <fileset dir="${build.repo.dir}/server">
+		    <exclude name="modules/${mar.name}"/>
+		  </fileset>
+		</copy>
+		
+		<!-- creating the Sandesha2 module configured for Rampart -->
+		
+		<ant:mkdir dir="${secure.rampart.temp.path}/module" />
+		<!-- Replace the security manager in the module.xml file -->
+		<ant:unjar src="${maven.build.dir}/${mar.name}" dest="${secure.rampart.temp.path}/module"/>
+		
+		<ant:replace file="${secure.rampart.temp.path}/module/META-INF/module.xml" 
+		  token="dummy.DummySecurityManager"
+		  value="rampart.RampartBasedSecurityManager"/>
+		
+		<ant:jar jarfile="${secure.rampart.client.path}/modules/${mar.name}" basedir="${secure.rampart.temp.path}/module"/>
+		<ant:jar jarfile="${secure.rampart.server.path}/modules/${mar.name}" basedir="${secure.rampart.temp.path}/module"/>
+		
+		
+		<!-- Creating the service for UsernameToken+RM -->
+		<ant:mkdir dir="${secure.rampart.temp.path}/service1" />
+		<ant:unjar src="${build.repo.dir}/server/services/${test.service.name}" dest="${secure.rampart.temp.path}/service1"/>
+   		<ant:copy file="${dir.test.resources}/rampart-config/UT-services.xml" toFile="${secure.rampart.temp.path}/service1/META-INF/services.xml" overwrite="true" />		
+		<ant:copy file="${dir.interop}/conf/store.jks" todir="${secure.rampart.temp.path}/service1" /> 
+		<ant:jar jarfile="${secure.rampart.server.path}/services/UTRMTestService.aar" basedir="${secure.rampart.temp.path}/service1"/>
+						
+		<!-- Creating the service for Assymetric+RM -->
+		<ant:mkdir dir="${secure.rampart.temp.path}/service2" />
+		<ant:unjar src="${build.repo.dir}/server/services/${test.service.name}" dest="${secure.rampart.temp.path}/service2"/>
+   		<ant:copy file="${dir.test.resources}/rampart-config/Asymmetric-services.xml" toFile="${secure.rampart.temp.path}/service2/META-INF/services.xml" overwrite="true" />		
+		<ant:copy file="${dir.interop}/conf/store.jks" todir="${secure.rampart.temp.path}/service2" /> 
+		<ant:jar jarfile="${secure.rampart.server.path}/services/AsymmetricRMTestService.aar" basedir="${secure.rampart.temp.path}/service2"/>
+			
+			
+		<!-- Creating the service for SecCon+RM -->
+		<ant:mkdir dir="${secure.rampart.temp.path}/service3" />
+		<ant:unjar src="${build.repo.dir}/server/services/${test.service.name}" dest="${secure.rampart.temp.path}/service3"/>
+   		<ant:copy file="${dir.test.resources}/rampart-config/SecCon-services.xml" toFile="${secure.rampart.temp.path}/service3/META-INF/services.xml" overwrite="true" />		
+		<ant:copy file="${dir.interop}/conf/store.jks" todir="${secure.rampart.temp.path}/service3" /> 
+		<ant:jar jarfile="${secure.rampart.server.path}/services/SecConRMTestService.aar" basedir="${secure.rampart.temp.path}/service3"/>
+							
+		<!-- 
+		<delete dir="${build.temp.dir}"/>
+		 -->
+	</goal>
+	
 	<goal name="serialize:create" prereqs="server:create,client:create">
 		<ant:property name="serialize.client.path" value="${build.repo.dir}/serialize-client"/>
 		<ant:property name="serialize.server.path" value="${build.repo.dir}/serialize-server"/>
@@ -246,7 +314,7 @@
         
         <!-- Copying addressing mar file-->
         <ant:copy file="${repo.addressing.mar}" toDir="${server.dist.path}/modules/" />
-		<ant:copy file="${repo.rampart.mar}" toDir="${server.dist.path}/modules/" />
+		<ant:copy file="${repo.rampart.mar}" toDir="${server.dist.path}/modules/" />
 	</goal>
 	
     <goal name="sample:compile">

Modified: webservices/sandesha/trunk/java/src/org/apache/sandesha2/client/SandeshaClientConstants.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/client/SandeshaClientConstants.java?view=diff&rev=514201&r1=514200&r2=514201
==============================================================================
--- webservices/sandesha/trunk/java/src/org/apache/sandesha2/client/SandeshaClientConstants.java (original)
+++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/client/SandeshaClientConstants.java Sat Mar  3 09:34:22 2007
@@ -33,4 +33,5 @@
 	public static String SANDESHA_LISTENER = "Sandesha2Listener";
 	public static String USE_REPLY_TO_AS_ACKS_TO = "UseReplyToAsAcksTo";
 	public static String OFFERED_ENDPOINT = "OfferedEndpoint";
+	public static String AVOID_AUTO_TERMINATION = "AviodAutoTermination";
 }

Modified: webservices/sandesha/trunk/java/src/org/apache/sandesha2/i18n/SandeshaMessageKeys.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/i18n/SandeshaMessageKeys.java?view=diff&rev=514201&r1=514200&r2=514201
==============================================================================
--- webservices/sandesha/trunk/java/src/org/apache/sandesha2/i18n/SandeshaMessageKeys.java (original)
+++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/i18n/SandeshaMessageKeys.java Sat Mar  3 09:34:22 2007
@@ -226,4 +226,6 @@
 	public final static String rmdBeanNotFound = "rmdBeanNotFound";
 	public final static String rmEnforceFailure = "rmEnforceFailure";
 	public final static String policyHasNotBeenSet = "policyHasNotBeenSet";
+	public final static String referenceMessageNotSetForSequence = "referenceMessageNotSetForSequence";
+	public final static String moduleNotSet = "moduleNotSet";
 }

Modified: webservices/sandesha/trunk/java/src/org/apache/sandesha2/i18n/resource.properties
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/i18n/resource.properties?view=diff&rev=514201&r1=514200&r2=514201
==============================================================================
--- webservices/sandesha/trunk/java/src/org/apache/sandesha2/i18n/resource.properties (original)
+++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/i18n/resource.properties Sat Mar  3 09:34:22 2007
@@ -76,6 +76,8 @@
 rmdBeanNotFound=RMDBean not available for the sequence:{0}.
 policyHasNotBeenSet="WSRM Policy ''{0}'' has not been set for this endpoint.
 rmEnforceFailure=The message with MessageID ''{0}'' is not WSRM enabled but the service enforces WSRM.
+referenceMessageNotSetForSequence=ReferenceMessage has not been set for the sequence ''{0}''
+moduleNotSet=Sandesha Module has not been set at the initiation
 
 #-------------------------------------
 #

Modified: webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/AcknowledgementProcessor.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/AcknowledgementProcessor.java?view=diff&rev=514201&r1=514200&r2=514201
==============================================================================
--- webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/AcknowledgementProcessor.java (original)
+++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/AcknowledgementProcessor.java Sat Mar  3 09:34:22 2007
@@ -235,7 +235,8 @@
 		storageManager.getRMSBeanMgr().update(rmsBean);
 
 		// Try and terminate the sequence
-		TerminateManager.checkAndTerminate(rmMsgCtx, storageManager, rmsBean);
+		if (!rmsBean.isAvoidAutoTermination()) 
+			TerminateManager.checkAndTerminate(rmMsgCtx.getConfigurationContext(), storageManager, rmsBean);
 
 		if (log.isDebugEnabled())
 			log.debug("Exit: AcknowledgementProcessor::processAckHeader");

Modified: webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java?view=diff&rev=514201&r1=514200&r2=514201
==============================================================================
--- webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java (original)
+++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java Sat Mar  3 09:34:22 2007
@@ -204,6 +204,15 @@
 			throw new SandeshaException(SandeshaMessageHelper.getMessage(SandeshaMessageKeys.cannotSendMsgAsSequenceTimedout, internalSequenceId));
 		}
 
+		//setting the reference msg store key.
+		if (rmsBean!=null && rmsBean.getReferenceMessageStoreKey()==null) {
+			//setting this application message as the reference, if it hsnt already been set.
+			
+			String referenceMsgKey = SandeshaUtil.getUUID();
+			storageManager.storeMessageContext(referenceMsgKey, msgContext);
+			rmsBean.setReferenceMessageStoreKey(referenceMsgKey);
+		}
+		
 		String outSequenceID = null;
 
 		if (rmsBean == null) { 

Modified: webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/SequenceProcessor.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/SequenceProcessor.java?view=diff&rev=514201&r1=514200&r2=514201
==============================================================================
--- webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/SequenceProcessor.java (original)
+++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/SequenceProcessor.java Sat Mar  3 09:34:22 2007
@@ -297,7 +297,7 @@
 					
 					// Try and terminate the corresponding outbound sequence
 					RMSBean rmsBean = SandeshaUtil.getRMSBeanFromSequenceId(storageManager, sender.getSequenceID());
-					TerminateManager.checkAndTerminate(rmMsgCtx, storageManager, rmsBean);
+					TerminateManager.checkAndTerminate(rmMsgCtx.getConfigurationContext(), storageManager, rmsBean);
 				}
 			}
 		}

Modified: webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/TerminateSeqMsgProcessor.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/TerminateSeqMsgProcessor.java?view=diff&rev=514201&r1=514200&r2=514201
==============================================================================
--- webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/TerminateSeqMsgProcessor.java (original)
+++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/TerminateSeqMsgProcessor.java Sat Mar  3 09:34:22 2007
@@ -292,8 +292,24 @@
 				if (allAcked)
 				{
 					RMSBean rmsBean = SandeshaUtil.getRMSBeanFromSequenceId(storageManager, outgoingSequnceID);
-					if (!rmsBean.isTerminateAdded())
+					if (!rmsBean.isTerminateAdded()) {
 						TerminateManager.addTerminateSequenceMessage(terminateRMMsg, rmsBean.getInternalSequenceID(), outgoingSequnceID , storageManager);
+						String referenceMsgKey = rmsBean.getReferenceMessageStoreKey();
+						if (referenceMsgKey==null) {
+							String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.referenceMessageNotSetForSequence,rmsBean.getSequenceID());
+							throw new SandeshaException (message);
+						}
+						
+						MessageContext referenceMessage = storageManager.retrieveMessageContext(referenceMsgKey, configCtx);
+						
+						if (referenceMessage==null) {
+							String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.referencedMessageNotFound, rmsBean.getSequenceID());
+							throw new SandeshaException (message);
+						}
+						
+						RMMsgContext referenceRMMsg = MsgInitializer.initializeMessage(referenceMessage);
+									
+					}
 				}
 			}
 		} catch (AxisFault e) {

Modified: webservices/sandesha/trunk/java/src/org/apache/sandesha2/polling/PollingManager.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/polling/PollingManager.java?view=diff&rev=514201&r1=514200&r2=514201
==============================================================================
--- webservices/sandesha/trunk/java/src/org/apache/sandesha2/polling/PollingManager.java (original)
+++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/polling/PollingManager.java Sat Mar  3 09:34:22 2007
@@ -210,6 +210,11 @@
 		RMMsgContext makeConnectionRMMessage = RMMsgCreator.createMakeConnectionMessage(referenceRMMessage,
 				rmBean, wireSeqId, wireAddress, storageManager);
 		
+		
+		//we must set serverSide to false. Having serverSide as true (I.e. when polling for RMD) will cause the SenderWorker to ignore
+		//the sync response message.
+		makeConnectionRMMessage.getMessageContext().setServerSide(false);
+		
 		// Store properties so that we know which sequence we are polling for. This can be used
 		// to match reply sequences up to requests, as well as to help process messagePending
 		// headers.

Modified: webservices/sandesha/trunk/java/src/org/apache/sandesha2/security/rampart/RampartBasedSecurityManager.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/security/rampart/RampartBasedSecurityManager.java?view=diff&rev=514201&r1=514200&r2=514201
==============================================================================
--- webservices/sandesha/trunk/java/src/org/apache/sandesha2/security/rampart/RampartBasedSecurityManager.java (original)
+++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/security/rampart/RampartBasedSecurityManager.java Sat Mar  3 09:34:22 2007
@@ -65,260 +65,295 @@
 
 
 public class RampartBasedSecurityManager extends SecurityManager {
-
-	private static final Log log = LogFactory.getLog(RampartBasedSecurityManager.class);
 	
-    TokenStorage storage = null;
-    
-    /**
-     * @param context
-     */
-    public RampartBasedSecurityManager(ConfigurationContext context) {
-        super(context);
-
-        this.storage = (TokenStorage)context.getProperty(
-                        TokenStorage.TOKEN_STORAGE_KEY);
-        if(this.storage == null) {
-            this.storage = new SimpleTokenStore();
-            context.setProperty(
-                    TokenStorage.TOKEN_STORAGE_KEY, this.storage);
-        }
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.sandesha2.security.SecurityManager#checkProofOfPossession(org.apache.sandesha2.security.SecurityToken, org.apache.axiom.om.OMElement, org.apache.axis2.context.MessageContext)
-     */
-    public void checkProofOfPossession(SecurityToken token,
-            OMElement messagePart, MessageContext message)
-            throws SandeshaException {
-        
-        Vector results = null;
-        if ((results =
-                (Vector) message.getProperty(WSHandlerConstants.RECV_RESULTS))
-                == null) {
-            String msg = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.noSecurityResults);
-            throw new SandeshaException(msg);
-        } else {
-            boolean verified = false;
-            for (int i = 0; i < results.size() && !verified; i++) {
-                WSHandlerResult rResult =
-                        (WSHandlerResult) results.get(i);
-                Vector wsSecEngineResults = rResult.getResults();
-    
-                for (int j = 0; j < wsSecEngineResults.size() && !verified; j++) {
-                    WSSecurityEngineResult wser =
-                            (WSSecurityEngineResult) wsSecEngineResults.get(j);
-                    if (wser.getAction() == WSConstants.SIGN && wser.getPrincipal() != null) {
-                        
-                        // first verify the base token
-                        Principal principal = wser.getPrincipal();
-                        if(principal instanceof WSDerivedKeyTokenPrincipal) {
-                            //Get the id of the SCT that was used to create the DKT 
-                            String baseTokenId = ((WSDerivedKeyTokenPrincipal)principal).getBasetokenId();
-                            //Get the token that matches the id
-                            SecurityToken recoveredToken = this.recoverSecurityToken(baseTokenId);
-                            if(recoveredToken != null) {
-                                Token rahasToken = ((RampartSecurityToken)recoveredToken).getToken();
-                                //check whether the SCT used in the message is 
-                                //similar to the one given into the method
-                                String recoverdTokenId = rahasToken.getId();
-                                String attRefId = null;
-                                String unattrefId = null;
-                                if(rahasToken.getAttachedReference() != null) {
-                                    attRefId = this.getUriFromSTR(rahasToken.getAttachedReference());
-                                }
-                                if(rahasToken.getUnattachedReference() != null) {
-                                    unattrefId = this.getUriFromSTR(rahasToken.getUnattachedReference());
-                                }
-                                
-                                String id = ((RampartSecurityToken)token).getToken().getId();
-                                if(recoverdTokenId.equals(id) || attRefId.equals(id) || unattrefId.equals(id)) {
-                                    //Token matched with a token that signed the message part
-                                    //Now check signature parts
-                                    OMAttribute idattr = messagePart.getAttribute(new QName(WSConstants.WSU_NS, "Id"));
-                                    verified = wser.getSignedElements().contains(idattr.getAttributeValue());
-                                    if(verified) {
-                                    	    break;
-                                    }
-                                }
-                            }
-                        }
-                    }
-                }
-            }
-            
-            if(!verified) {
-                String msg = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.proofOfPossessionNotVerified);
-                throw new SandeshaException(msg);
-            }
-        }
-        
-    }
-    
-    private String getUriFromSTR(OMElement str) {
-        OMElement refElem = str.getFirstChildWithName(Reference.TOKEN);
-        return refElem.getAttributeValue(new QName("URI")).substring(1);
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.sandesha2.security.SecurityManager#createSecurityTokenReference(org.apache.sandesha2.security.SecurityToken, org.apache.axis2.context.MessageContext)
-     */
-    public OMElement createSecurityTokenReference(SecurityToken token,
-            MessageContext message) throws SandeshaException {
-        
-        OMFactory fac = message.getEnvelope().getOMFactory();
-        
-        RampartSecurityToken rampartToken = (RampartSecurityToken)token;
-        OMElement element = rampartToken.getToken().getAttachedReference();
-        if(element == null) {
-            element = rampartToken.getToken().getUnattachedReference();
-        }
-        
-        if(element == null) {
-            //Now use the token id and construct the ref element
-            element = fac.createOMElement(SecurityTokenReference.SECURITY_TOKEN_REFERENCE, WSConstants.WSSE_LN, WSConstants.WSSE_PREFIX);
-            OMElement refElem = fac.createOMElement(Reference.TOKEN, element);
-            refElem.addAttribute("ValueType", "http://schemas.xmlsoap.org/ws/2005/02/sc/sct", null);
-            refElem.addAttribute("URI", rampartToken.getToken().getId(), null);
-        }
-        
-        return this.convertOMElement(fac, element);
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.sandesha2.security.SecurityManager#getSecurityToken(org.apache.axis2.context.MessageContext)
-     */
-    public SecurityToken getSecurityToken(MessageContext message)
-            throws SandeshaException {
-        String contextIdentifierKey = RampartUtil.getContextIdentifierKey(message);
-        String identifier = (String)RampartUtil.getContextMap(message).get(contextIdentifierKey);
-        
-        if(identifier == null && !message.isServerSide()) {
-            try {
-                OMElement rstTmpl = RampartUtil.createRSTTempalteForSCT(
-                        ConversationConstants.VERSION_05_02, 
-                        RahasConstants.VERSION_05_02);
-                
-                String action = TrustUtil.getActionValue(
-                        RahasConstants.VERSION_05_02,
-                        RahasConstants.RST_ACTION_SCT);
-                
-                Policy servicePolicy = (Policy)message.getProperty(RampartMessageData.KEY_RAMPART_POLICY);
-                if(servicePolicy == null) {
-                    //Missing service policy means no security requirement
-                    return null;
-                }
-                List it = (List)servicePolicy.getAlternatives().next();
-                RampartPolicyData rpd = RampartPolicyBuilder.build(it);
-                
-                SecureConversationToken secConvTok = null;
-                
-                org.apache.ws.secpolicy.model.Token encrtok = rpd.getEncryptionToken();
-                secConvTok = (encrtok != null && encrtok instanceof SecureConversationToken) ? (SecureConversationToken)encrtok : null;
-                
-                if(secConvTok == null) {
-                    org.apache.ws.secpolicy.model.Token sigtok = rpd.getSignatureToken();
-                    secConvTok = (sigtok != null && sigtok instanceof SecureConversationToken) ? (SecureConversationToken)sigtok : null;
-                }
-                
-                if(secConvTok != null) {
-                    
-                    Policy issuerPolicy = secConvTok.getBootstrapPolicy();
-                    issuerPolicy.addAssertion(rpd.getRampartConfig());
-                    
-                    STSClient client = new STSClient(message.getConfigurationContext());
-                    Options op = new Options();
-                    op.setProperty(SandeshaClientConstants.UNRELIABLE_MESSAGE, Constants.VALUE_TRUE);
-                    client.setOptions(op);
-                    client.setAction(action);
-                    client.setRstTemplate(rstTmpl);
-                    client.setCryptoInfo(RampartUtil.getEncryptionCrypto(rpd
-                            .getRampartConfig(), message.getAxisService()
-                            .getClassLoader()), RampartUtil.getPasswordCB(
-                            message, rpd));
-                    String address = message.getTo().getAddress();
-                    Token tok = client.requestSecurityToken(servicePolicy,
-                            address, issuerPolicy, null);
-                    
-                    tok.setState(Token.ISSUED);
-                    this.storage.add(tok);
-                    
-                    contextIdentifierKey = RampartUtil.getContextIdentifierKey(message);
-                    RampartUtil.getContextMap(message).put(
-                                                        contextIdentifierKey,
-                                                        tok.getId());
-                    identifier = tok.getId();
-                    
-                } else {
-                    String msg = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.noSecConvTokenInPolicy);
-                	log.debug (msg);
-                	return null;
-                }
-                
-            } catch (RampartException e) {
-                throw new SandeshaException(e.getMessage(), e);
-            } catch (TrustException e) {
-                throw new SandeshaException(e.getMessage(), e);
-            } catch (WSSPolicyException e) {
-                throw new SandeshaException(e.getMessage(), e);
-            }
-        }
-
-        
-        return this.recoverSecurityToken(identifier);
-
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.sandesha2.security.SecurityManager#getSecurityToken(org.apache.axiom.om.OMElement, org.apache.axis2.context.MessageContext)
-     */
-    public SecurityToken getSecurityToken(OMElement theSTR,
-            MessageContext message) throws SandeshaException {
-
-        OMElement refElem = theSTR.getFirstChildWithName(Reference.TOKEN);
-        String id = refElem.getAttributeValue(new QName("URI"));
-        return this.recoverSecurityToken(id.substring(1));
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.sandesha2.security.SecurityManager#getTokenRecoveryData(org.apache.sandesha2.security.SecurityToken)
-     */
-    public String getTokenRecoveryData(SecurityToken token)
-            throws SandeshaException {
-        return ((RampartSecurityToken)token).getToken().getId().substring(1);
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.sandesha2.security.SecurityManager#initSecurity(org.apache.axis2.description.AxisModule)
-     */
-    public void initSecurity(AxisModule moduleDesc) {
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.sandesha2.security.SecurityManager#recoverSecurityToken(java.lang.String)
-     */
-    public SecurityToken recoverSecurityToken(String tokenData)
-            throws SandeshaException { 
-        try {
-            Token token = this.storage.getToken(tokenData);
-            if(token != null) {
-                return new RampartSecurityToken(token);
-            } else {
-                String msg = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.errorRetrievingSecurityToken);
-                throw new SandeshaException(msg);
-            }
-        } catch (TrustException e) {
-            String msg = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.errorRetrievingSecurityToken);
-            throw new SandeshaException(msg);
-        }
-    }
-
-    
-    private OMElement convertOMElement(OMFactory fac, OMElement elem) {
-        return new StAXOMBuilder(fac, elem.getXMLStreamReader()).getDocumentElement();
-    }
+	private static final Log log = LogFactory.getLog(RampartBasedSecurityManager.class);
+
+	TokenStorage storage = null;
+
+	/**
+	 * @param context
+	 */
+	public RampartBasedSecurityManager(ConfigurationContext context) {
+		super(context);
+
+		this.storage = (TokenStorage) context
+				.getProperty(TokenStorage.TOKEN_STORAGE_KEY);
+		if (this.storage == null) {
+			this.storage = new SimpleTokenStore();
+			context.setProperty(TokenStorage.TOKEN_STORAGE_KEY, this.storage);
+		}
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.sandesha2.security.SecurityManager#checkProofOfPossession(org.apache.sandesha2.security.SecurityToken, org.apache.axiom.om.OMElement, org.apache.axis2.context.MessageContext)
+	 */
+	public void checkProofOfPossession(SecurityToken token,
+			OMElement messagePart, MessageContext message)
+			throws SandeshaException {
+
+		Vector results = null;
+		if ((results = (Vector) message
+				.getProperty(WSHandlerConstants.RECV_RESULTS)) == null) {
+			String msg = SandeshaMessageHelper
+					.getMessage(SandeshaMessageKeys.noSecurityResults);
+			throw new SandeshaException(msg);
+		} else {
+			boolean verified = false;
+			for (int i = 0; i < results.size() && !verified; i++) {
+				WSHandlerResult rResult = (WSHandlerResult) results.get(i);
+				Vector wsSecEngineResults = rResult.getResults();
+
+				for (int j = 0; j < wsSecEngineResults.size() && !verified; j++) {
+					WSSecurityEngineResult wser = (WSSecurityEngineResult) wsSecEngineResults
+							.get(j);
+					if (wser.getAction() == WSConstants.SIGN
+							&& wser.getPrincipal() != null) {
+
+						// first verify the base token
+						Principal principal = wser.getPrincipal();
+						if (principal instanceof WSDerivedKeyTokenPrincipal) {
+							//Get the id of the SCT that was used to create the DKT 
+							String baseTokenId = ((WSDerivedKeyTokenPrincipal) principal)
+									.getBasetokenId();
+							//Get the token that matches the id
+							SecurityToken recoveredToken = this
+									.recoverSecurityToken(baseTokenId);
+							if (recoveredToken != null) {
+								Token rahasToken = ((RampartSecurityToken) recoveredToken)
+										.getToken();
+								//check whether the SCT used in the message is 
+								//similar to the one given into the method
+								String recoverdTokenId = rahasToken.getId();
+								String attRefId = null;
+								String unattrefId = null;
+								if (rahasToken.getAttachedReference() != null) {
+									attRefId = this.getUriFromSTR(rahasToken
+											.getAttachedReference());
+								}
+								if (rahasToken.getUnattachedReference() != null) {
+									unattrefId = this.getUriFromSTR(rahasToken
+											.getUnattachedReference());
+								}
+
+								String id = ((RampartSecurityToken) token)
+										.getToken().getId();
+								if (recoverdTokenId.equals(id)
+										|| attRefId.equals(id)
+										|| unattrefId.equals(id)) {
+									//Token matched with a token that signed the message part
+									//Now check signature parts
+									OMAttribute idattr = messagePart
+											.getAttribute(new QName(
+													WSConstants.WSU_NS, "Id"));
+									verified = wser.getSignedElements()
+											.contains(
+													idattr.getAttributeValue());
+									if (verified) {
+										break;
+									}
+								}
+							}
+						}
+					}
+				}
+			}
+
+			if (!verified) {
+				String msg = SandeshaMessageHelper
+						.getMessage(SandeshaMessageKeys.proofOfPossessionNotVerified);
+				throw new SandeshaException(msg);
+			}
+		}
+
+	}
+
+	private String getUriFromSTR(OMElement str) {
+		OMElement refElem = str.getFirstChildWithName(Reference.TOKEN);
+		return refElem.getAttributeValue(new QName("URI")).substring(1);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.sandesha2.security.SecurityManager#createSecurityTokenReference(org.apache.sandesha2.security.SecurityToken, org.apache.axis2.context.MessageContext)
+	 */
+	public OMElement createSecurityTokenReference(SecurityToken token,
+			MessageContext message) throws SandeshaException {
+
+		OMFactory fac = message.getEnvelope().getOMFactory();
+
+		RampartSecurityToken rampartToken = (RampartSecurityToken) token;
+		OMElement element = rampartToken.getToken().getAttachedReference();
+		if (element == null) {
+			element = rampartToken.getToken().getUnattachedReference();
+		}
+
+		if (element == null) {
+			//Now use the token id and construct the ref element
+			element = fac.createOMElement(
+					SecurityTokenReference.SECURITY_TOKEN_REFERENCE,
+					WSConstants.WSSE_LN, WSConstants.WSSE_PREFIX);
+			OMElement refElem = fac.createOMElement(Reference.TOKEN, element);
+			refElem.addAttribute("ValueType",
+					"http://schemas.xmlsoap.org/ws/2005/02/sc/sct", null);
+			refElem.addAttribute("URI", rampartToken.getToken().getId(), null);
+		}
+
+		return this.convertOMElement(fac, element);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.sandesha2.security.SecurityManager#getSecurityToken(org.apache.axis2.context.MessageContext)
+	 */
+	public SecurityToken getSecurityToken(MessageContext message)
+			throws SandeshaException {
+		String contextIdentifierKey = RampartUtil
+				.getContextIdentifierKey(message);
+		String identifier = (String) RampartUtil.getContextMap(message).get(
+				contextIdentifierKey);
+
+		if (identifier == null && !message.isServerSide()) {
+			try {
+				OMElement rstTmpl = RampartUtil.createRSTTempalteForSCT(
+						ConversationConstants.VERSION_05_02,
+						RahasConstants.VERSION_05_02);
+
+				String action = TrustUtil.getActionValue(
+						RahasConstants.VERSION_05_02,
+						RahasConstants.RST_ACTION_SCT);
+
+				Policy servicePolicy = (Policy) message
+						.getProperty(RampartMessageData.KEY_RAMPART_POLICY);
+				if (servicePolicy == null) {
+					//Missing service policy means no security requirement
+					return null;
+				}
+				List it = (List) servicePolicy.getAlternatives().next();
+				RampartPolicyData rpd = RampartPolicyBuilder.build(it);
+
+				SecureConversationToken secConvTok = null;
+
+				org.apache.ws.secpolicy.model.Token encrtok = rpd
+						.getEncryptionToken();
+				secConvTok = (encrtok != null && encrtok instanceof SecureConversationToken) ? (SecureConversationToken) encrtok
+						: null;
+
+				if (secConvTok == null) {
+					org.apache.ws.secpolicy.model.Token sigtok = rpd
+							.getSignatureToken();
+					secConvTok = (sigtok != null && sigtok instanceof SecureConversationToken) ? (SecureConversationToken) sigtok
+							: null;
+				}
+
+				if (secConvTok != null) {
+
+					Policy issuerPolicy = secConvTok.getBootstrapPolicy();
+					issuerPolicy.addAssertion(rpd.getRampartConfig());
+
+					STSClient client = new STSClient(message
+							.getConfigurationContext());
+					Options op = new Options();
+					op.setProperty(SandeshaClientConstants.UNRELIABLE_MESSAGE,
+							Constants.VALUE_TRUE);
+					client.setOptions(op);
+					client.setAction(action);
+					client.setRstTemplate(rstTmpl);
+					client.setCryptoInfo(RampartUtil.getEncryptionCrypto(rpd
+							.getRampartConfig(), message.getAxisService()
+							.getClassLoader()), RampartUtil.getPasswordCB(
+							message, rpd));
+					String address = message.getTo().getAddress();
+					Token tok = client.requestSecurityToken(servicePolicy,
+							address, issuerPolicy, null);
+
+					tok.setState(Token.ISSUED);
+					this.storage.add(tok);
+
+					contextIdentifierKey = RampartUtil
+							.getContextIdentifierKey(message);
+					RampartUtil.getContextMap(message).put(
+							contextIdentifierKey, tok.getId());
+					identifier = tok.getId();
+
+				} else {
+					String msg = SandeshaMessageHelper
+							.getMessage(SandeshaMessageKeys.noSecConvTokenInPolicy);
+					log.debug(msg);
+					return null;
+				}
+
+			} catch (RampartException e) {
+				throw new SandeshaException(e.getMessage(), e);
+			} catch (TrustException e) {
+				throw new SandeshaException(e.getMessage(), e);
+			} catch (WSSPolicyException e) {
+				throw new SandeshaException(e.getMessage(), e);
+			}
+		}
+
+		return this.recoverSecurityToken(identifier);
+
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.sandesha2.security.SecurityManager#getSecurityToken(org.apache.axiom.om.OMElement, org.apache.axis2.context.MessageContext)
+	 */
+	public SecurityToken getSecurityToken(OMElement theSTR,
+			MessageContext message) throws SandeshaException {
+
+		OMElement refElem = theSTR.getFirstChildWithName(Reference.TOKEN);
+		String id = refElem.getAttributeValue(new QName("URI"));
+		String tokenId = id;
+		if (!id.startsWith("urn:") && id.startsWith("#")) {
+			tokenId = tokenId.substring(1);
+		}
+		return this.recoverSecurityToken(tokenId);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.sandesha2.security.SecurityManager#getTokenRecoveryData(org.apache.sandesha2.security.SecurityToken)
+	 */
+	public String getTokenRecoveryData(SecurityToken token)
+			throws SandeshaException {
+		String id = ((RampartSecurityToken) token).getToken().getId();
+		if (!id.startsWith("urn:") && id.startsWith("#")) {
+			id = id.substring(1);
+		}
+		return id;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.sandesha2.security.SecurityManager#initSecurity(org.apache.axis2.description.AxisModule)
+	 */
+	public void initSecurity(AxisModule moduleDesc) {
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.sandesha2.security.SecurityManager#recoverSecurityToken(java.lang.String)
+	 */
+	public SecurityToken recoverSecurityToken(String tokenData)
+			throws SandeshaException {
+		try {
+			Token token = this.storage.getToken(tokenData);
+			if (token != null) {
+				return new RampartSecurityToken(token);
+			} else {
+				String msg = SandeshaMessageHelper
+						.getMessage(SandeshaMessageKeys.errorRetrievingSecurityToken);
+				throw new SandeshaException(msg);
+			}
+		} catch (TrustException e) {
+			String msg = SandeshaMessageHelper
+					.getMessage(SandeshaMessageKeys.errorRetrievingSecurityToken);
+			throw new SandeshaException(msg);
+		}
+	}
+
+	private OMElement convertOMElement(OMFactory fac, OMElement elem) {
+		return new StAXOMBuilder(fac, elem.getXMLStreamReader())
+				.getDocumentElement();
+	}
 
-	public void applySecurityToken(SecurityToken token, MessageContext outboundMessage) throws SandeshaException {
+	public void applySecurityToken(SecurityToken token,
+			MessageContext outboundMessage) throws SandeshaException {
 		// TODO If there are any properties that should be put onto the outbound message
 		// to ensure that the correct token is used to secure it, then they should be
 		// added now.

Modified: webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beans/RMSBean.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beans/RMSBean.java?view=diff&rev=514201&r1=514200&r2=514201
==============================================================================
--- webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beans/RMSBean.java (original)
+++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beans/RMSBean.java Sat Mar  3 09:34:22 2007
@@ -152,6 +152,12 @@
    */
   private boolean terminationPauserForCS = false;
   
+	/**
+	 * If this is set, the current sequence is not expected to auto terminate when all the acks are received.
+	 * I.e. the user explicitly have to call for termination (using SandeshaClient).  
+	 */
+	private boolean avoidAutoTermination = false;
+	
 	public RMSBean() {
 	}
 
@@ -335,6 +341,14 @@
 		this.anonymousUUID = anonymousUUID;
 	}
 
+	public boolean isAvoidAutoTermination() {
+		return avoidAutoTermination;
+	}
+
+	public void setAvoidAutoTermination(boolean avoidAutoTermination) {
+		this.avoidAutoTermination = avoidAutoTermination;
+	}
+	
 	public String toString() {
 		StringBuffer result = new StringBuffer();
 		result.append(this.getClass().getName());

Modified: webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/RMMsgCreator.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/RMMsgCreator.java?view=diff&rev=514201&r1=514200&r2=514201
==============================================================================
--- webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/RMMsgCreator.java (original)
+++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/RMMsgCreator.java Sat Mar  3 09:34:22 2007
@@ -490,7 +490,6 @@
 		makeConnectionMessageCtx.setTo(epr);
 		makeConnectionMessageCtx.setWSAAction(SpecSpecificConstants.getMakeConnectionAction(rmVersion));
 		makeConnectionMessageCtx.setMessageID(SandeshaUtil.getUUID());
-		
 		makeConnectionRMMessageCtx.setMessagePart(Sandesha2Constants.MessageParts.MAKE_CONNECTION,
 				makeConnection);
 		

Modified: webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/SandeshaUtil.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/SandeshaUtil.java?view=diff&rev=514201&r1=514200&r2=514201
==============================================================================
--- webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/SandeshaUtil.java (original)
+++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/SandeshaUtil.java Sat Mar  3 09:34:22 2007
@@ -377,8 +377,6 @@
 			newMessageContext.setTransportIn(referenceMessage.getTransportIn());
 			newMessageContext.setTransportOut(referenceMessage.getTransportOut());
 
-			copyNecessaryPropertiesFromRelatedContext(referenceMessage, newMessageContext);
-
 			// copying transport info.
 			newMessageContext.setProperty(MessageContext.TRANSPORT_OUT, referenceMessage
 					.getProperty(MessageContext.TRANSPORT_OUT));
@@ -392,48 +390,10 @@
 			newMessageContext.setProperty(MessageContext.TRANSPORT_OUT, referenceMessage
 					.getProperty(MessageContext.TRANSPORT_OUT));
 			
-			//copying properties as configured in the module.xml properties. Module xml has several
-			//properties which gives comma seperated lists of property names that have to be copited
-			//from various places when creating related messages.
-			
-			AxisModule axisModule = SandeshaUtil.getAxisModule();
+			copyConfiguredProperties (referenceMessage,newMessageContext);
 
-			Parameter propertiesFromRefMsg = axisModule.getParameter(Sandesha2Constants.propertiesToCopyFromReferenceMessage);
-			if (propertiesFromRefMsg!=null) {
-				String value = (String) propertiesFromRefMsg.getValue();
-				if (value!=null) {
-					value = value.trim();
-					String[] propertyNames = value.split(",");
-					for (int i=0;i<propertyNames.length;i++) {
-						String propertyName = propertyNames[i];
-						Object val = referenceMessage.getProperty(propertyName);
-						if (val!=null) {
-							newMessageContext.setProperty(propertyName,val);
-						}
-					}
-				}
-			}
-			
-			Parameter propertiesFromRefReqMsg = axisModule.getParameter(Sandesha2Constants.propertiesToCopyFromReferenceRequestMessage);
-			OperationContext referenceOpCtx = referenceMessage.getOperationContext();
-			MessageContext referenceRequestMessage = null;
-			if (referenceOpCtx!=null) 
-				referenceRequestMessage=referenceOpCtx.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
-			
-			if (propertiesFromRefReqMsg!=null && referenceRequestMessage!=null) {
-				String value = (String) propertiesFromRefReqMsg.getValue();
-				if (value!=null) {
-					value = value.trim();
-					String[] propertyNames = value.split(",");
-					for (int i=0;i<propertyNames.length;i++) {
-						String propertyName = propertyNames[i];
-						Object val = referenceRequestMessage.getProperty(propertyName);
-						if (val!=null) {
-							newMessageContext.setProperty(propertyName,val);
-						}
-					}
-				}
-			}
+			//copying the serverSide property
+			newMessageContext.setServerSide(referenceMessage.isServerSide());
 
 			return newMessageContext;
 
@@ -445,6 +405,68 @@
 	}
 	
 
+	private static void copyConfiguredProperties (MessageContext fromMessage, MessageContext toMessage) throws AxisFault {
+
+//		copying properties as configured in the module.xml properties. Module xml has several
+		//properties which gives comma seperated lists of property names that have to be copited
+		//from various places when creating related messages.
+		
+		if (axisModule==null) {
+			String message = SandeshaMessageKeys.moduleNotSet;
+			throw new SandeshaException (message);
+		}
+		
+		Parameter propertiesFromRefMsg = axisModule.getParameter(Sandesha2Constants.propertiesToCopyFromReferenceMessage);
+		if (propertiesFromRefMsg!=null) {
+			String value = (String) propertiesFromRefMsg.getValue();
+			if (value!=null) {
+				value = value.trim();
+				String[] propertyNames = value.split(",");
+				for (int i=0;i<propertyNames.length;i++) {
+					String tmp = propertyNames[i];
+					String propertyName = null;
+					String targetPropertyName = null;
+					if (tmp.indexOf (":")>=0) {
+						//if the property name is given as two values seperated by a colon, this gives the key of the from msg
+						//and the key for the To Msg respsctively.
+						String[] vals = tmp.split(":");
+						propertyName = vals[0].trim();
+						targetPropertyName = vals[1].trim();
+					} else {
+						propertyName = targetPropertyName = tmp;
+					}
+					
+					Object val = fromMessage.getProperty(propertyName);
+					if (val!=null) {
+						toMessage.setProperty(targetPropertyName,val);
+					}
+				}
+			}
+		}
+		
+		Parameter propertiesFromRefReqMsg = axisModule.getParameter(Sandesha2Constants.propertiesToCopyFromReferenceRequestMessage);
+		OperationContext referenceOpCtx = fromMessage.getOperationContext();
+		MessageContext referenceRequestMessage = null;
+		if (referenceOpCtx!=null) 
+			referenceRequestMessage=referenceOpCtx.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+		
+		if (propertiesFromRefReqMsg!=null && referenceRequestMessage!=null) {
+			String value = (String) propertiesFromRefReqMsg.getValue();
+			if (value!=null) {
+				value = value.trim();
+				String[] propertyNames = value.split(",");
+				for (int i=0;i<propertyNames.length;i++) {
+					String propertyName = propertyNames[i];
+					Object val = referenceRequestMessage.getProperty(propertyName);
+					if (val!=null) {
+						toMessage.setProperty(propertyName,val);
+					}
+				}
+			}
+		}
+
+		
+	}
 	
 	public static SandeshaPolicyBean getDefaultPropertyBean (AxisConfiguration axisConfiguration) throws SandeshaException {
 		Parameter parameter = axisConfiguration.getParameter(Sandesha2Constants.SANDESHA_PROPERTY_BEAN);
@@ -454,29 +476,6 @@
 		
 		SandeshaPolicyBean sandeshaPropertyBean = (SandeshaPolicyBean) parameter.getValue();
 		return sandeshaPropertyBean;
-	}
-
-	private static void copyNecessaryPropertiesFromRelatedContext(MessageContext fromMessage, MessageContext toMessage) throws SandeshaException {
-		toMessage.setProperty(Constants.Configuration.TRANSPORT_URL, fromMessage
-				.getProperty(Constants.Configuration.TRANSPORT_URL));
-		
-		String addressingVersion = (String) fromMessage.getProperty(AddressingConstants.WS_ADDRESSING_VERSION);
-		if (addressingVersion==null) {
-			OperationContext opCtx = fromMessage.getOperationContext();
-			if (opCtx!=null) {
-				try {
-					MessageContext requestMsg = opCtx.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
-					if (requestMsg!=null)
-						addressingVersion = (String) requestMsg.getProperty(AddressingConstants.WS_ADDRESSING_VERSION);
-				} catch (AxisFault e) {
-					throw new SandeshaException (e);
-				}
-			}
-		}
-		toMessage.setProperty(AddressingConstants.WS_ADDRESSING_VERSION,addressingVersion);
-		
-		toMessage.setProperty(AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES, fromMessage
-				.getProperty(AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES));
 	}
 
 	//TODO change this method.

Modified: webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/SequenceManager.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/SequenceManager.java?view=diff&rev=514201&r1=514200&r2=514201
==============================================================================
--- webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/SequenceManager.java (original)
+++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/SequenceManager.java Sat Mar  3 09:34:22 2007
@@ -23,6 +23,7 @@
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.description.Parameter;
+import org.apache.axis2.util.JavaUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.sandesha2.RMMsgContext;
@@ -272,6 +273,12 @@
 			rmsBean.setTransportTo(transportTo);
 		}
 
+		//setting the autoTermination property for the client side.
+		if (!firstAplicationMsgCtx.isServerSide()) {
+			Object avoidAutoTermination = firstAplicationMsgCtx.getProperty(SandeshaClientConstants.AVOID_AUTO_TERMINATION);
+			if (avoidAutoTermination!=null && JavaUtils.isTrueExplicitly(avoidAutoTermination))
+				rmsBean.setAvoidAutoTermination(true);
+		}
 		// updating the last activated time.
 		rmsBean.setLastActivatedTime(System.currentTimeMillis());
 		

Modified: webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/TerminateManager.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/TerminateManager.java?view=diff&rev=514201&r1=514200&r2=514201
==============================================================================
--- webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/TerminateManager.java (original)
+++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/TerminateManager.java Sat Mar  3 09:34:22 2007
@@ -59,7 +59,7 @@
 
 	public static HashMap receivingSideCleanMap = new HashMap();
 
-	public static void checkAndTerminate(RMMsgContext relatedMessage, StorageManager storageManager, RMSBean rmsBean)
+	public static void checkAndTerminate(ConfigurationContext configurationContext, StorageManager storageManager, RMSBean rmsBean)
 	throws SandeshaStorageException, AxisFault {
 		if(log.isDebugEnabled()) log.debug("Enter: TerminateManager::checkAndTerminate " +rmsBean);
 
@@ -93,7 +93,7 @@
 			// so check to see if all the senders have been removed
 			EndpointReference replyTo = new EndpointReference (replyToAddress);
 			if (complete &&
-					Sandesha2Constants.SPEC_VERSIONS.v1_0.equals(rmVersion) && replyTo.hasAnonymousAddress()) {
+					Sandesha2Constants.SPEC_VERSIONS.v1_0.equals(rmVersion) && (replyToAddress==null || replyTo.hasAnonymousAddress())) {
 				SenderBean matcher = new SenderBean();
 				matcher.setMessageType(Sandesha2Constants.MessageTypes.APPLICATION);
 				matcher.setSequenceID(rmsBean.getSequenceID());
@@ -103,7 +103,22 @@
 			}
 			
 			if (complete) {
-				addTerminateSequenceMessage(relatedMessage, rmsBean.getInternalSequenceID(), rmsBean.getSequenceID(), storageManager);
+				
+				String referenceMsgKey = rmsBean.getReferenceMessageStoreKey();
+				if (referenceMsgKey==null) {
+					String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.referenceMessageNotSetForSequence,rmsBean.getSequenceID());
+					throw new SandeshaException (message);
+				}
+				
+				MessageContext referenceMessage = storageManager.retrieveMessageContext(referenceMsgKey, configurationContext);
+				
+				if (referenceMessage==null) {
+					String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.referencedMessageNotFound, rmsBean.getSequenceID());
+					throw new SandeshaException (message);
+				}
+				
+				RMMsgContext referenceRMMsg = MsgInitializer.initializeMessage(referenceMessage);
+				addTerminateSequenceMessage(referenceRMMsg, rmsBean.getInternalSequenceID(), rmsBean.getSequenceID(), storageManager);
 			}
 			
 		}

Modified: webservices/sandesha/trunk/java/src/org/apache/sandesha2/workers/SenderWorker.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/workers/SenderWorker.java?view=diff&rev=514201&r1=514200&r2=514201
==============================================================================
--- webservices/sandesha/trunk/java/src/org/apache/sandesha2/workers/SenderWorker.java (original)
+++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/workers/SenderWorker.java Sat Mar  3 09:34:22 2007
@@ -332,7 +332,7 @@
 			}
 
 		} catch (Exception e) {
-			if (log.isDebugEnabled()) log.debug("Caught exception", e);
+			if (log.isErrorEnabled()) log.error("Caught exception", e);
 			if (transaction!=null) {
 				transaction.rollback();
 				transaction = null;

Modified: webservices/sandesha/trunk/java/test/src/org/apache/sandesha2/scenarios/RMScenariosTest.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/test/src/org/apache/sandesha2/scenarios/RMScenariosTest.java?view=diff&rev=514201&r1=514200&r2=514201
==============================================================================
--- webservices/sandesha/trunk/java/test/src/org/apache/sandesha2/scenarios/RMScenariosTest.java (original)
+++ webservices/sandesha/trunk/java/test/src/org/apache/sandesha2/scenarios/RMScenariosTest.java Sat Mar  3 09:34:22 2007
@@ -86,16 +86,16 @@
 	public void testAsyncEcho() throws Exception {
 		// Test async echo with sync acks
 		Options clientOptions = new Options();
-		runEcho(clientOptions, true, false);
+		runEcho(clientOptions, true, false, false);
 		
 		// Test async echo with async acks
 		clientOptions = new Options();
-		runEcho(clientOptions, true, true);
+		runEcho(clientOptions, true, true, false);
 		
 		// Test async echo with async acks and offer
 		clientOptions = new Options();
 		clientOptions.setProperty(SandeshaClientConstants.OFFERED_SEQUENCE_ID,SandeshaUtil.getUUID());
-		runEcho(clientOptions, true, true);
+		runEcho(clientOptions, true, true, false);
 	}
 		
 	public void testSyncEcho() throws Exception {
@@ -103,18 +103,18 @@
 		Options clientOptions = new Options();
 		clientOptions.setProperty(SandeshaClientConstants.OFFERED_SEQUENCE_ID,SandeshaUtil.getUUID());
 		clientOptions.setProperty(SandeshaClientConstants.RM_SPEC_VERSION,Sandesha2Constants.SPEC_VERSIONS.v1_1);
-		runEcho(clientOptions, false, false);
+		runEcho(clientOptions, false, false, false);
 		
 		// Test sync echo with an offer, and the 1.0 spec
 		clientOptions = new Options();
 		clientOptions.setProperty(SandeshaClientConstants.OFFERED_SEQUENCE_ID,SandeshaUtil.getUUID());
 		clientOptions.setProperty(SandeshaClientConstants.RM_SPEC_VERSION,Sandesha2Constants.SPEC_VERSIONS.v1_0);
-		runEcho(clientOptions, false, false);
+		runEcho(clientOptions, false, false, true);
 		
 		// Test sync echo with no offer, and the 1.1 spec
 		clientOptions = new Options();
 		clientOptions.setProperty(SandeshaClientConstants.RM_SPEC_VERSION,Sandesha2Constants.SPEC_VERSIONS.v1_1);
-		runEcho(clientOptions, false, false);
+		runEcho(clientOptions, false, false, false);
 	}
 
 	public void runPing(boolean asyncAcks) throws Exception {
@@ -163,7 +163,7 @@
 		serviceClient.cleanup();
 	}
 
-	public void runEcho(Options clientOptions, boolean asyncReply, boolean asyncAcks) throws Exception {
+	public void runEcho(Options clientOptions, boolean asyncReply, boolean asyncAcks, boolean explicitTermination) throws Exception {
 		
 		String sequenceKey = SandeshaUtil.getUUID();
 
@@ -186,7 +186,21 @@
 				clientOptions.setProperty(SandeshaClientConstants.AcksTo,acksTo);
 			}
 		}
+		
+		if(asyncAcks) {
+			String acksTo = serviceClient.getMyEPR(Constants.TRANSPORT_HTTP).getAddress();
+			clientOptions.setProperty(SandeshaClientConstants.AcksTo,acksTo);
+		} else {
+			String acksTo = AddressingConstants.Final.WSA_ANONYMOUS_URL;
+			clientOptions.setProperty(SandeshaClientConstants.AcksTo,acksTo);
+		}
 
+		if (explicitTermination) {
+			clientOptions.setProperty(SandeshaClientConstants.AVOID_AUTO_TERMINATION, Boolean.TRUE);
+		} else {
+			clientOptions.setProperty(SandeshaClientConstants.AVOID_AUTO_TERMINATION, Boolean.FALSE);
+		}
+		
 		// Establish a baseline count for inbound sequences
 		ArrayList oldIncomingReports = SandeshaClient.getIncomingSequenceReports(configContext);
 		
@@ -200,12 +214,18 @@
 		clientOptions.setProperty(SandeshaClientConstants.LAST_MESSAGE, "true");
 		serviceClient.sendReceiveNonBlocking (getEchoOMBlock("echo3",sequenceKey),callback3);
 		
+		if (explicitTermination) {
+			Thread.sleep(6000);
+			SandeshaClient.terminateSequence(serviceClient);
+		}
+		
 		long limit = System.currentTimeMillis() + waitTime;
 		Error lastError = null;
 		while(System.currentTimeMillis() < limit) {
 			Thread.sleep(tickTime); // Try the assertions each tick interval, until they pass or we time out
 			
 			try {
+				
 		        //assertions for the out sequence.
 				SequenceReport outgoingSequenceReport = SandeshaClient.getOutgoingSequenceReport(serviceClient);
 				System.out.println("Checking Outbound Sequence: " + outgoingSequenceReport.getSequenceID());



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