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 2007/04/20 20:53:11 UTC

svn commit: r530884 - in /webservices/sandesha/trunk/java/src/org/apache/sandesha2: Sandesha2Constants.java SandeshaModule.java

Author: chamikara
Date: Fri Apr 20 11:53:10 2007
New Revision: 530884

URL: http://svn.apache.org/viewvc?view=rev&rev=530884
Log:
Improved the target resolver to set "USE_ASYNC" to false when Sandesha2 is not engaged.

Modified:
    webservices/sandesha/trunk/java/src/org/apache/sandesha2/Sandesha2Constants.java
    webservices/sandesha/trunk/java/src/org/apache/sandesha2/SandeshaModule.java

Modified: webservices/sandesha/trunk/java/src/org/apache/sandesha2/Sandesha2Constants.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/Sandesha2Constants.java?view=diff&rev=530884&r1=530883&r2=530884
==============================================================================
--- webservices/sandesha/trunk/java/src/org/apache/sandesha2/Sandesha2Constants.java (original)
+++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/Sandesha2Constants.java Fri Apr 20 11:53:10 2007
@@ -471,6 +471,8 @@
 		
 	}
 	
+	static final String MODULE_NAME = "sandesha2";
+	
 	static final String IN_HANDLER_NAME = "SandeshaInHandler";
 
 	static final String OUT_HANDLER_NAME = "SandeshaOutHandler";

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=530884&r1=530883&r2=530884
==============================================================================
--- webservices/sandesha/trunk/java/src/org/apache/sandesha2/SandeshaModule.java (original)
+++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/SandeshaModule.java Fri Apr 20 11:53:10 2007
@@ -17,6 +17,7 @@
 
 package org.apache.sandesha2;
 
+import java.util.Collection;
 import java.util.Iterator;
 
 import javax.xml.namespace.QName;
@@ -133,6 +134,56 @@
 		configContext.getAxisConfiguration().addTargetResolver(
 				new TargetResolver() {
 					public void resolveTarget(MessageContext messageContext) {
+						
+						//if Sandesha2 is not engaged we can set the property straight away 
+						
+						boolean engaged = false;
+						
+						//checking weather the module is engaged at the System level
+						AxisConfiguration axisConfiguration = messageContext.getConfigurationContext().getAxisConfiguration();
+						if (axisConfiguration!=null) {
+							Collection modules = axisConfiguration.getEngagedModules();
+							for (Iterator iter = modules.iterator();iter.hasNext();) {
+								String moduleName = (String) iter.next();
+								if (moduleName!=null && moduleName.startsWith (Sandesha2Constants.MODULE_NAME)) {
+									engaged = true;
+								}
+							}
+						}
+						
+						//checking weather the module is engaged at the Service level
+						AxisService service = messageContext.getAxisService();
+						if (service!=null) {
+							Collection modules = service.getEngagedModules();
+							for (Iterator iter = modules.iterator();iter.hasNext();) {
+								AxisModule module = (AxisModule) iter.next();
+								String name = module.getName();
+								if (name!=null && name.startsWith (Sandesha2Constants.MODULE_NAME)) {
+									engaged = true;
+								}
+							}
+						}
+
+						//checking weather the module is engaged at the Operation level
+						AxisOperation operation = messageContext.getAxisOperation();
+						if (operation!=null) {
+							Collection modules = operation.getEngagedModules();
+							for (Iterator iter = modules.iterator();iter.hasNext();) {
+								AxisModule module = (AxisModule) iter.next();
+								String name = module.getName();
+								if (name!=null && name.startsWith (Sandesha2Constants.MODULE_NAME)) {
+									engaged = true;
+								}
+							}
+						}
+						
+						//if the module is not engaed we mark the message as unreliable.
+						if (!engaged) {
+							if(log.isDebugEnabled()) log.debug("Unsetting USE_ASYNC_OPERATIONS for unreliable message");
+							messageContext.setProperty(Constants.Configuration.USE_ASYNC_OPERATIONS, Boolean.FALSE);
+						}
+						
+						//Even when Sandesha2 is engaged this may be marked as unreliable.
 						if(log.isDebugEnabled()) log.debug("Entry: SandeshaModule::resolveTarget");
 						if(SandeshaUtil.isMessageUnreliable(messageContext)) {
 							if(log.isDebugEnabled()) log.debug("Unsetting USE_ASYNC_OPERATIONS for unreliable message");



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