Author: mlovett
Date: Mon Jan 15 08:55:05 2007
New Revision: 496404

URL: http://svn.apache.org/viewvc?view=rev&rev=496404
Log:
Simplify config of sync 2-way apps, see SANDESHA2-64

Modified:
    webservices/sandesha/trunk/java/src/org/apache/sandesha2/SandeshaModule.java
    
webservices/sandesha/trunk/java/test/src/org/apache/sandesha2/scenarios/AnonymousEchoTest.java

Modified: 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/SandeshaModule.java
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/SandeshaModule.java?view=diff&rev=496404&r1=496403&r2=496404
==============================================================================
--- 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/SandeshaModule.java 
(original)
+++ 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/SandeshaModule.java 
Mon Jan 15 08:55:05 2007
@@ -18,17 +18,21 @@
 package org.apache.sandesha2;
 
 import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
 import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.description.AxisDescription;
 import org.apache.axis2.description.AxisModule;
 import org.apache.axis2.description.Parameter;
 import org.apache.axis2.modules.Module;
 import org.apache.axis2.modules.ModulePolicyExtension;
 import org.apache.axis2.modules.PolicyExtension;
+import org.apache.axis2.util.TargetResolver;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.neethi.Assertion;
 import org.apache.neethi.Policy;
+import org.apache.sandesha2.client.SandeshaClientConstants;
 import org.apache.sandesha2.i18n.SandeshaMessageHelper;
 import org.apache.sandesha2.i18n.SandeshaMessageKeys;
 import org.apache.sandesha2.policy.RMPolicyExtension;
@@ -109,6 +113,19 @@
                SecurityManager util = 
SandeshaUtil.getSecurityManager(configContext);
                util.initSecurity(module);
 
+               // Mark the config context so that we can run sync 2-way 
interations over
+               // RM, but at the same time switch it off for unreliable 
messages.
+               
configContext.setProperty(Constants.Configuration.USE_ASYNC_OPERATIONS, 
Boolean.TRUE);
+               configContext.getAxisConfiguration().addTargetResolver(
+                               new TargetResolver() {
+                                       public void 
resolveTarget(MessageContext messageContext) {
+                                               String unreliable = (String) 
messageContext.getProperty(SandeshaClientConstants.UNRELIABLE_MESSAGE);
+                                               if("true".equals(unreliable)) {
+                                                       
messageContext.setProperty(Constants.Configuration.USE_ASYNC_OPERATIONS, 
Boolean.FALSE);
+                                               }
+                                       }
+                               }
+               );
        }
 
        public void engageNotify(AxisDescription axisDescription) throws 
AxisFault {

Modified: 
webservices/sandesha/trunk/java/test/src/org/apache/sandesha2/scenarios/AnonymousEchoTest.java
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/test/src/org/apache/sandesha2/scenarios/AnonymousEchoTest.java?view=diff&rev=496404&r1=496403&r2=496404
==============================================================================
--- 
webservices/sandesha/trunk/java/test/src/org/apache/sandesha2/scenarios/AnonymousEchoTest.java
 (original)
+++ 
webservices/sandesha/trunk/java/test/src/org/apache/sandesha2/scenarios/AnonymousEchoTest.java
 Mon Jan 15 08:55:05 2007
@@ -26,7 +26,6 @@
 import org.apache.axis2.client.ServiceClient;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.log4j.BasicConfigurator;
 import org.apache.sandesha2.Sandesha2Constants;
 import org.apache.sandesha2.SandeshaTestCase;
 import org.apache.sandesha2.client.SandeshaClient;
@@ -65,10 +64,6 @@
        public void testSyncEchoWithRMAnon() throws Exception {
 
                Options clientOptions = new Options ();
-               EndpointReference ref = new EndpointReference(
-                               
Sandesha2Constants.SPEC_2006_08.ANONYMOUS_URI_PREFIX +
-                               SandeshaUtil.getUUID());
-               clientOptions.setReplyTo(ref);
                runSyncEchoTest(clientOptions);
                
        }
@@ -87,11 +82,6 @@
                
clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY,sequenceKey);
                
clientOptions.setProperty(SandeshaClientConstants.RM_SPEC_VERSION,Sandesha2Constants.SPEC_VERSIONS.v1_1);
                clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
-               
-               // Put in enough config to convince Axis that this is async, 
without setting up
-               // new WS-Adressing replyTo etc.
-               clientOptions.setUseSeparateListener(true);
-               
clientOptions.setProperty(Constants.Configuration.USE_CUSTOM_LISTENER,Boolean.TRUE);
                
                ServiceClient serviceClient = new ServiceClient 
(configContext,null);
                serviceClient.setOptions(clientOptions);



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to