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/06/03 16:02:05 UTC

svn commit: r543894 - in /webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2: ./ handlers/ msgprocessors/ storage/beans/ util/ workers/

Author: chamikara
Date: Sun Jun  3 07:02:04 2007
New Revision: 543894

URL: http://svn.apache.org/viewvc?view=rev&rev=543894
Log:
Added a sequenceIDDispatcher which does the service dispatching of incoming messages according the the sequenceID.

Added:
    webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/handlers/SequenceIDDispatcher.java
Modified:
    webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/SandeshaModule.java
    webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/msgprocessors/CreateSeqResponseMsgProcessor.java
    webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/msgprocessors/LastMessageProcessor.java
    webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/storage/beans/RMDBean.java
    webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/storage/beans/RMSBean.java
    webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/util/SandeshaUtil.java
    webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/workers/SenderWorker.java

Modified: webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/SandeshaModule.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/SandeshaModule.java?view=diff&rev=543894&r1=543893&r2=543894
==============================================================================
--- webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/SandeshaModule.java (original)
+++ webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/SandeshaModule.java Sun Jun  3 07:02:04 2007
@@ -1,289 +1,288 @@
-/*
- * 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.sandesha2;
-
-import java.util.Collection;
-import java.util.Iterator;
-
-import javax.xml.namespace.QName;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.Constants;
-import org.apache.axis2.client.ServiceClient;
-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.AxisOperation;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.Parameter;
-import org.apache.axis2.engine.AxisConfiguration;
-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.axis2.wsdl.WSDLConstants;
-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.i18n.SandeshaMessageHelper;
-import org.apache.sandesha2.i18n.SandeshaMessageKeys;
-import org.apache.sandesha2.policy.RMPolicyExtension;
-import org.apache.sandesha2.policy.SandeshaPolicyBean;
-import org.apache.sandesha2.security.SecurityManager;
-import org.apache.sandesha2.storage.SandeshaStorageException;
-import org.apache.sandesha2.storage.StorageManager;
-import org.apache.sandesha2.util.PropertyManager;
-import org.apache.sandesha2.util.SandeshaUtil;
-
-/**
- * The Module class of Sandesha2.
- */
-
-public class SandeshaModule implements Module, ModulePolicyExtension {
-    
-    private Log log = LogFactory.getLog(SandeshaModule.class);
-    
-	// initialize the module
-	public void init(ConfigurationContext configContext,
-			AxisModule module) throws AxisFault {
-		if(log.isDebugEnabled()) log.debug("Entry: SandeshaModule::init, " + configContext);
-
-		AxisConfiguration config = configContext.getAxisConfiguration();
-
-		//storing the Sandesha module as a parameter.
-		Parameter parameter = new Parameter(Sandesha2Constants.MODULE_CLASS_LOADER,module.getModuleClassLoader());
-		config.addParameter(parameter);
-
-		//init the i18n messages
-		SandeshaMessageHelper.innit();
-		
-		//storing the module as a static variable
-		SandeshaUtil.setAxisModule(module);
-		
-		// continueUncompletedSequences (storageManager,configCtx);
-
-		SandeshaPolicyBean constantPropertyBean = PropertyManager.loadPropertiesFromDefaultValues();
-		SandeshaPolicyBean propertyBean = PropertyManager.loadPropertiesFromModuleDescPolicy(module,constantPropertyBean);
-		
-		if (propertyBean==null) {
-			String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.couldNotLoadModulePolicies);
-			log.warn (message);
-			
-			propertyBean = PropertyManager.loadPropertiesFromDefaultValues();
-		} else {
-			if (log.isDebugEnabled()) {
-				String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.modulePoliciesLoaded);
-				log.info (message);
-			}
-		}
-		
-		parameter = new Parameter (Sandesha2Constants.SANDESHA_PROPERTY_BEAN, propertyBean);
-		config.addParameter(parameter);
-		
-		// Reset both storage managers
-		parameter = config.getParameter(Sandesha2Constants.INMEMORY_STORAGE_MANAGER);
-		if(parameter != null) config.removeParameter(parameter);
-		parameter = config.getParameter(Sandesha2Constants.PERMANENT_STORAGE_MANAGER);
-		if(parameter != null) config.removeParameter(parameter);
-
-		try {
-			StorageManager inMemorytorageManager = SandeshaUtil.getInMemoryStorageManager(configContext);
-			inMemorytorageManager.initStorage(module);
-		} catch (SandeshaStorageException e) {
-			String message = SandeshaMessageHelper.getMessage(
-					SandeshaMessageKeys.cannotInitInMemoryStorageManager,
-					e.toString());
-			log.debug(message,e);
-		}
-		
-		try {
-			StorageManager permanentStorageManager = SandeshaUtil.getPermanentStorageManager(configContext);
-			permanentStorageManager.initStorage(module);
-		} catch (SandeshaStorageException e) {
-			String message = SandeshaMessageHelper.getMessage(
-					SandeshaMessageKeys.cannotInitPersistentStorageManager,
-					e.toString());
-			log.debug(message,e);
-		}
-		
-		// Reset the security manager, and then load it
-		parameter = config.getParameter(Sandesha2Constants.SECURITY_MANAGER);
-		if(parameter != null) config.removeParameter(parameter);
-		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) {
-						
-						//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");
-							messageContext.setProperty(Constants.Configuration.USE_ASYNC_OPERATIONS, Boolean.FALSE);
-						}
-						if(log.isDebugEnabled()) log.debug("Exit: SandeshaModule::resolveTarget");
-					}
-				}
-		);
-
-		if(log.isDebugEnabled()) log.debug("Exit: SandeshaModule::init");
-	}
-
-	public void engageNotify(AxisDescription axisDescription) throws AxisFault {
-		if(log.isDebugEnabled()) log.debug("Entry: SandeshaModule::engageNotify, " + axisDescription);
-		
-		SandeshaPolicyBean parentPropertyBean = SandeshaUtil.getPropertyBean(axisDescription.getParent());
-		
-		SandeshaPolicyBean axisDescPropertyBean = PropertyManager.loadPropertiesFromAxisDescription(axisDescription,parentPropertyBean);
-		
-		if (axisDescPropertyBean!=null) {
-			Parameter parameter = new Parameter ();
-			parameter.setName(Sandesha2Constants.SANDESHA_PROPERTY_BEAN);
-			parameter.setValue(axisDescPropertyBean);
-			axisDescription.addParameter(parameter);
-		}
-		
-		// When we engage Sandesha for a Service, we check to see if there are
-		// any OUT_IN MEPs on it's operations. If there are then we record that,
-		// so that we know we should send an Offer for WSRM 1.0 Sequences.
-		// We check the operation names, as the RM operations are added in as
-		// well, and and we only want to consider the user's operations.
-		if(axisDescription instanceof AxisService) {
-			AxisService service = (AxisService) axisDescription;
-			Iterator ops = service.getOperations();
-			while(ops.hasNext()) {
-				AxisOperation op = (AxisOperation) ops.next();
-				log.debug("Examining operation " + op.getName() + ", mep " + op.getMessageExchangePattern());
-
-				String name = null;
-				QName qName = op.getName();
-				if(qName != null) name = qName.getLocalPart();
-				if((name != null && name.startsWith(Sandesha2Constants.SANDESHA_OP_PREFIX)) ||
-				   ServiceClient.ANON_OUT_IN_OP.equals(qName))
-					break;
-
-				// If we get to here then we must have one of the user's operations, so
-				// check the MEP.
-				if(op.getAxisSpecifMEPConstant() == WSDLConstants.MEP_CONSTANT_OUT_IN) {
-					Parameter p = new Parameter(Sandesha2Constants.SERVICE_CONTAINS_OUT_IN_MEPS, Boolean.TRUE);
-					service.addParameter(p);
-					break;
-				}
-			}
-		} else if(axisDescription instanceof AxisOperation) {
-			AxisOperation op = (AxisOperation) axisDescription;
-			log.debug("Examining operation " + op.getName() + ", mep " + op.getAxisSpecifMEPConstant());
-
-			String name = null;
-			QName qName = op.getName();
-			if(qName != null) name = qName.getLocalPart();
-			if((name != null && !name.startsWith(Sandesha2Constants.SANDESHA_OP_PREFIX)) &&
-			   !ServiceClient.ANON_OUT_IN_OP.equals(qName)) {
-
-				// If we get to here then we must have one of the user's operations, so
-				// check the MEP.
-				if(op.getAxisSpecifMEPConstant() == WSDLConstants.MEP_CONSTANT_OUT_IN) {
-					Parameter p = new Parameter(Sandesha2Constants.SERVICE_CONTAINS_OUT_IN_MEPS, Boolean.TRUE);
-					op.getParent().addParameter(p);
-				}
-			}
-		} 
-
-
-		if(log.isDebugEnabled()) log.debug("Exit: SandeshaModule::engageNotify");
-	}
-
-	public PolicyExtension getPolicyExtension() {
-		return new RMPolicyExtension();
-	}
-
-	public void shutdown(ConfigurationContext configurationContext) throws AxisFault {
-		if(log.isDebugEnabled()) log.debug("Entry: SandeshaModule::shutdown, " + configurationContext);
-		SandeshaUtil.
-			getSandeshaStorageManager(configurationContext, configurationContext.getAxisConfiguration())
-				.shutdown();
-		if(log.isDebugEnabled()) log.debug("Exit: SandeshaModule::shutdown");
-	}
-
-    public void applyPolicy(Policy policy, AxisDescription axisDescription) throws AxisFault {
-        // TODO 
-        
-    }
-
-    public boolean canSupportAssertion(Assertion assertion) {
-        // TODO 
-        return true;
-    }
-    
-    
-
-}
+/*
+ * 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.sandesha2;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
+import org.apache.axis2.client.ServiceClient;
+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.AxisOperation;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.Parameter;
+import org.apache.axis2.engine.AxisConfiguration;
+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.axis2.wsdl.WSDLConstants;
+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.i18n.SandeshaMessageHelper;
+import org.apache.sandesha2.i18n.SandeshaMessageKeys;
+import org.apache.sandesha2.policy.RMPolicyExtension;
+import org.apache.sandesha2.policy.SandeshaPolicyBean;
+import org.apache.sandesha2.security.SecurityManager;
+import org.apache.sandesha2.storage.SandeshaStorageException;
+import org.apache.sandesha2.storage.StorageManager;
+import org.apache.sandesha2.util.PropertyManager;
+import org.apache.sandesha2.util.SandeshaUtil;
+
+/**
+ * The Module class of Sandesha2.
+ */
+
+public class SandeshaModule implements Module, ModulePolicyExtension {
+    
+    private Log log = LogFactory.getLog(SandeshaModule.class);
+    
+	// initialize the module
+	public void init(ConfigurationContext configContext,
+			AxisModule module) throws AxisFault {
+		if(log.isDebugEnabled()) log.debug("Entry: SandeshaModule::init, " + configContext);
+
+		AxisConfiguration config = configContext.getAxisConfiguration();
+
+		//storing the Sandesha module as a parameter.
+		Parameter parameter = new Parameter(Sandesha2Constants.MODULE_CLASS_LOADER,module.getModuleClassLoader());
+		config.addParameter(parameter);
+
+		//init the i18n messages
+		SandeshaMessageHelper.innit();
+		
+		//storing the module as a static variable
+		SandeshaUtil.setAxisModule(module);
+		
+		// continueUncompletedSequences (storageManager,configCtx);
+
+		SandeshaPolicyBean constantPropertyBean = PropertyManager.loadPropertiesFromDefaultValues();
+		SandeshaPolicyBean propertyBean = PropertyManager.loadPropertiesFromModuleDescPolicy(module,constantPropertyBean);
+		
+		if (propertyBean==null) {
+			String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.couldNotLoadModulePolicies);
+			log.error (message);
+			propertyBean = PropertyManager.loadPropertiesFromDefaultValues();
+		} else {
+			if (log.isDebugEnabled()) {
+				String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.modulePoliciesLoaded);
+				log.info (message);
+			}
+		}
+		
+		parameter = new Parameter (Sandesha2Constants.SANDESHA_PROPERTY_BEAN, propertyBean);
+		config.addParameter(parameter);
+		
+		// Reset both storage managers
+		parameter = config.getParameter(Sandesha2Constants.INMEMORY_STORAGE_MANAGER);
+		if(parameter != null) config.removeParameter(parameter);
+		parameter = config.getParameter(Sandesha2Constants.PERMANENT_STORAGE_MANAGER);
+		if(parameter != null) config.removeParameter(parameter);
+
+		try {
+			StorageManager inMemorytorageManager = SandeshaUtil.getInMemoryStorageManager(configContext);
+			inMemorytorageManager.initStorage(module);
+		} catch (SandeshaStorageException e) {
+			String message = SandeshaMessageHelper.getMessage(
+					SandeshaMessageKeys.cannotInitInMemoryStorageManager,
+					e.toString());
+			log.debug(message,e);
+		}
+		
+		try {
+			StorageManager permanentStorageManager = SandeshaUtil.getPermanentStorageManager(configContext);
+			permanentStorageManager.initStorage(module);
+		} catch (SandeshaStorageException e) {
+			String message = SandeshaMessageHelper.getMessage(
+					SandeshaMessageKeys.cannotInitPersistentStorageManager,
+					e.toString());
+			log.debug(message,e);
+		}
+		
+		// Reset the security manager, and then load it
+		parameter = config.getParameter(Sandesha2Constants.SECURITY_MANAGER);
+		if(parameter != null) config.removeParameter(parameter);
+		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) {
+						
+						//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");
+							messageContext.setProperty(Constants.Configuration.USE_ASYNC_OPERATIONS, Boolean.FALSE);
+						}
+						if(log.isDebugEnabled()) log.debug("Exit: SandeshaModule::resolveTarget");
+					}
+				}
+		);
+
+		if(log.isDebugEnabled()) log.debug("Exit: SandeshaModule::init");
+	}
+
+	public void engageNotify(AxisDescription axisDescription) throws AxisFault {
+		if(log.isDebugEnabled()) log.debug("Entry: SandeshaModule::engageNotify, " + axisDescription);
+		
+		SandeshaPolicyBean parentPropertyBean = SandeshaUtil.getPropertyBean(axisDescription.getParent());
+		
+		SandeshaPolicyBean axisDescPropertyBean = PropertyManager.loadPropertiesFromAxisDescription(axisDescription,parentPropertyBean);
+		
+		if (axisDescPropertyBean!=null) {
+			Parameter parameter = new Parameter ();
+			parameter.setName(Sandesha2Constants.SANDESHA_PROPERTY_BEAN);
+			parameter.setValue(axisDescPropertyBean);
+			axisDescription.addParameter(parameter);
+		}
+		
+		// When we engage Sandesha for a Service, we check to see if there are
+		// any OUT_IN MEPs on it's operations. If there are then we record that,
+		// so that we know we should send an Offer for WSRM 1.0 Sequences.
+		// We check the operation names, as the RM operations are added in as
+		// well, and and we only want to consider the user's operations.
+		if(axisDescription instanceof AxisService) {
+			AxisService service = (AxisService) axisDescription;
+			Iterator ops = service.getOperations();
+			while(ops.hasNext()) {
+				AxisOperation op = (AxisOperation) ops.next();
+				log.debug("Examining operation " + op.getName() + ", mep " + op.getMessageExchangePattern());
+
+				String name = null;
+				QName qName = op.getName();
+				if(qName != null) name = qName.getLocalPart();
+				if((name != null && name.startsWith(Sandesha2Constants.SANDESHA_OP_PREFIX)) ||
+				   ServiceClient.ANON_OUT_IN_OP.equals(qName))
+					break;
+
+				// If we get to here then we must have one of the user's operations, so
+				// check the MEP.
+				if(op.getAxisSpecifMEPConstant() == WSDLConstants.MEP_CONSTANT_OUT_IN) {
+					Parameter p = new Parameter(Sandesha2Constants.SERVICE_CONTAINS_OUT_IN_MEPS, Boolean.TRUE);
+					service.addParameter(p);
+					break;
+				}
+			}
+		} else if(axisDescription instanceof AxisOperation) {
+			AxisOperation op = (AxisOperation) axisDescription;
+			log.debug("Examining operation " + op.getName() + ", mep " + op.getAxisSpecifMEPConstant());
+
+			String name = null;
+			QName qName = op.getName();
+			if(qName != null) name = qName.getLocalPart();
+			if((name != null && !name.startsWith(Sandesha2Constants.SANDESHA_OP_PREFIX)) &&
+			   !ServiceClient.ANON_OUT_IN_OP.equals(qName)) {
+
+				// If we get to here then we must have one of the user's operations, so
+				// check the MEP.
+				if(op.getAxisSpecifMEPConstant() == WSDLConstants.MEP_CONSTANT_OUT_IN) {
+					Parameter p = new Parameter(Sandesha2Constants.SERVICE_CONTAINS_OUT_IN_MEPS, Boolean.TRUE);
+					op.getParent().addParameter(p);
+				}
+			}
+		} 
+
+
+		if(log.isDebugEnabled()) log.debug("Exit: SandeshaModule::engageNotify");
+	}
+
+	public PolicyExtension getPolicyExtension() {
+		return new RMPolicyExtension();
+	}
+
+	public void shutdown(ConfigurationContext configurationContext) throws AxisFault {
+		if(log.isDebugEnabled()) log.debug("Entry: SandeshaModule::shutdown, " + configurationContext);
+		SandeshaUtil.
+			getSandeshaStorageManager(configurationContext, configurationContext.getAxisConfiguration())
+				.shutdown();
+		if(log.isDebugEnabled()) log.debug("Exit: SandeshaModule::shutdown");
+	}
+
+    public void applyPolicy(Policy policy, AxisDescription axisDescription) throws AxisFault {
+        // TODO 
+        
+    }
+
+    public boolean canSupportAssertion(Assertion assertion) {
+        // TODO 
+        return true;
+    }
+    
+    
+
+}

Added: webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/handlers/SequenceIDDispatcher.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/handlers/SequenceIDDispatcher.java?view=auto&rev=543894
==============================================================================
--- webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/handlers/SequenceIDDispatcher.java (added)
+++ webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/handlers/SequenceIDDispatcher.java Sun Jun  3 07:02:04 2007
@@ -0,0 +1,106 @@
+/*
+ * 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.sandesha2.handlers;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.HandlerDescription;
+import org.apache.axis2.description.Parameter;
+import org.apache.axis2.engine.AbstractDispatcher;
+import org.apache.axis2.engine.Handler;
+import org.apache.sandesha2.RMMsgContext;
+import org.apache.sandesha2.Sandesha2Constants;
+import org.apache.sandesha2.storage.StorageManager;
+import org.apache.sandesha2.storage.Transaction;
+import org.apache.sandesha2.storage.beanmanagers.RMDBeanMgr;
+import org.apache.sandesha2.storage.beanmanagers.RMSBeanMgr;
+import org.apache.sandesha2.storage.beans.RMDBean;
+import org.apache.sandesha2.storage.beans.RMSBean;
+import org.apache.sandesha2.util.MsgInitializer;
+import org.apache.sandesha2.util.SandeshaUtil;
+
+public class SequenceIDDispatcher extends AbstractDispatcher {
+
+	private final String NAME = "SequenceIDDIspatcher";
+	
+	public AxisOperation findOperation(AxisService service, MessageContext messageContext) throws AxisFault {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public void initDispatcher() {
+		  init(new HandlerDescription(NAME));
+	}
+
+	public AxisService findService(MessageContext msgContext) throws AxisFault {
+		// TODO Auto-generated method stub
+		
+		
+		ConfigurationContext configurationContext = msgContext.getConfigurationContext();
+		RMMsgContext rmmsgContext = MsgInitializer.initializeMessage(msgContext);
+		StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(configurationContext, configurationContext.getAxisConfiguration());
+		
+		Transaction transaction = storageManager.getTransaction();
+		
+		AxisService service;
+		try {
+			String sequenceID = (String) rmmsgContext
+					.getProperty(Sandesha2Constants.MessageContextProperties.SEQUENCE_ID);
+			service = null;
+			if (sequenceID != null) {
+
+				//If this is the RMD of the sequence 
+				RMDBeanMgr rmdBeanMgr = storageManager.getRMDBeanMgr();
+				RMDBean rmdFindBean = new RMDBean();
+				rmdFindBean.setSequenceID(sequenceID);
+
+				RMDBean rmdBean = rmdBeanMgr.findUnique(rmdFindBean);
+				String serviceName = rmdBean.getServiceName();
+				if (serviceName != null) {
+					service = configurationContext.getAxisConfiguration()
+							.getService(serviceName);
+				}
+
+				if (service == null && rmdBean == null) {
+					//If this is the RMD of the sequence 
+					RMSBeanMgr rmsBeanMgr = storageManager.getRMSBeanMgr();
+					RMSBean rmsfindBean = new RMSBean();
+					rmsfindBean.setSequenceID(sequenceID);
+
+					RMSBean rmsBean = rmsBeanMgr.findUnique(rmsfindBean);
+
+					serviceName = rmsBean.getServiceName();
+					if (serviceName != null) {
+						service = configurationContext.getAxisConfiguration()
+								.getService(serviceName);
+					}
+				}
+
+			}
+		} finally  {
+			transaction.commit();
+		}		
+		
+		return service;
+	}
+
+
+}

Modified: webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/msgprocessors/CreateSeqResponseMsgProcessor.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/msgprocessors/CreateSeqResponseMsgProcessor.java?view=diff&rev=543894&r1=543893&r2=543894
==============================================================================
--- webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/msgprocessors/CreateSeqResponseMsgProcessor.java (original)
+++ webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/msgprocessors/CreateSeqResponseMsgProcessor.java Sun Jun  3 07:02:04 2007
@@ -173,6 +173,8 @@
 			rMDBean.setNextMsgNoToProcess(1);
 			rMDBean.setOutboundInternalSequence(rmsBean.getInternalSequenceID());
 
+			rMDBean.setServiceName(createSeqResponseRMMsgCtx.getMessageContext().getAxisService().getName());
+			
 			//Storing the referenceMessage of the sending side sequence as the reference message
 			//of the receiving side as well.
 			//This can be used when creating new outgoing messages.

Modified: webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/msgprocessors/LastMessageProcessor.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/msgprocessors/LastMessageProcessor.java?view=diff&rev=543894&r1=543893&r2=543894
==============================================================================
--- webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/msgprocessors/LastMessageProcessor.java (original)
+++ webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/msgprocessors/LastMessageProcessor.java Sun Jun  3 07:02:04 2007
@@ -1,3 +1,20 @@
+/*
+ * 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.sandesha2.msgprocessors;
 
 import org.apache.axiom.soap.SOAPEnvelope;

Modified: webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/storage/beans/RMDBean.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/storage/beans/RMDBean.java?view=diff&rev=543894&r1=543893&r2=543894
==============================================================================
--- webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/storage/beans/RMDBean.java (original)
+++ webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/storage/beans/RMDBean.java Sun Jun  3 07:02:04 2007
@@ -73,6 +73,8 @@
 		
 	private long highestInMessageNumber = 0;
 	
+	private String serviceName = null;
+	
 	/**
 	 * Flags that are used to check if the primitive types on this bean
 	 * have been set. If a primitive type has not been set then it will
@@ -223,6 +225,14 @@
 			equal = false;
 
 		return equal;
+	}
+
+	public String getServiceName() {
+		return serviceName;
+	}
+
+	public void setServiceName(String serviceName) {
+		this.serviceName = serviceName;
 	}
 
 

Modified: webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/storage/beans/RMSBean.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/storage/beans/RMSBean.java?view=diff&rev=543894&r1=543893&r2=543894
==============================================================================
--- webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/storage/beans/RMSBean.java (original)
+++ webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/storage/beans/RMSBean.java Sun Jun  3 07:02:04 2007
@@ -135,6 +135,7 @@
 	 */
 	private int soapVersion;
 	
+	
 	/**
 	 * Flags that are used to check if the primitive types on this bean
 	 * have been set. If a primitive type has not been set then it will
@@ -165,6 +166,8 @@
 	 * I.e. the user explicitly have to call for termination (using SandeshaClient).  
 	 */
 	private boolean avoidAutoTermination = false;
+
+	private String serviceName = null;
 	
 	public RMSBean() {
 	}
@@ -472,6 +475,14 @@
 			match = false;
 
 		return match;
+	}
+
+	public String getServiceName() {
+		return serviceName;
+	}
+
+	public void setServiceName(String serviceName) {
+		this.serviceName = serviceName;
 	}
 
 }

Modified: webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/util/SandeshaUtil.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/util/SandeshaUtil.java?view=diff&rev=543894&r1=543893&r2=543894
==============================================================================
--- webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/util/SandeshaUtil.java (original)
+++ webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/util/SandeshaUtil.java Sun Jun  3 07:02:04 2007
@@ -355,6 +355,7 @@
 			MessageContext newMessageContext = new MessageContext();
 			newMessageContext.setConfigurationContext(configContext);
 			
+			Options oldOptions = referenceMessage.getOptions();
 			Options newOptions = new Options ();
 			
 			newMessageContext.setOptions(newOptions);
@@ -427,7 +428,11 @@
 
 			//copying the serverSide property
 			newMessageContext.setServerSide(referenceMessage.isServerSide());
-
+			
+			//this had to be set here to avoid a double invocation.
+			if (oldOptions!=null)
+				newOptions.setUseSeparateListener(oldOptions.isUseSeparateListener());
+			
 			return newMessageContext;
 
 		} catch (AxisFault e) {

Modified: webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/workers/SenderWorker.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/workers/SenderWorker.java?view=diff&rev=543894&r1=543893&r2=543894
==============================================================================
--- webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/workers/SenderWorker.java (original)
+++ webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/workers/SenderWorker.java Sun Jun  3 07:02:04 2007
@@ -521,6 +521,8 @@
 
 			MessageContext responseMessageContext = msgCtx.getOperationContext().getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
 			SOAPEnvelope resenvelope = null;
+			if (responseMessageContext!=null)
+				resenvelope = responseMessageContext.getEnvelope();
 			
 			boolean transportInPresent = (msgCtx.getProperty(MessageContext.TRANSPORT_IN) != null);
 			if (!transportInPresent && (responseMessageContext==null || responseMessageContext.getEnvelope()==null)) {
@@ -528,6 +530,9 @@
 				return;
 			}
 			
+			//to find out weather the response was built by me.
+			boolean syncResponseBuilt = false;
+			
 			if (responseMessageContext==null || responseMessageContext.getEnvelope()==null) {
 				if (responseMessageContext==null)
 					responseMessageContext = new MessageContext();
@@ -550,16 +555,6 @@
 									transportInfoMap.get(Constants.Configuration.CHARACTER_SET_ENCODING));
 				}
 			
-				//setting the message as serverSide will let it go through the MessageReceiver (may be callback MR).
-				responseMessageContext.setServerSide(true);
-			
-				if (responseMessageContext.getSoapAction()==null) {
-					//if there is no SOAP action in the response message, Axis2 will wrongly identify it as a REST message
-					//This happens because we set serverSide to True in a previous step.
-					//So we have to add a empty SOAPAction here.
-					responseMessageContext.setSoapAction("");
-				}
-			
 				responseMessageContext.setConfigurationContext(msgCtx.getConfigurationContext());
 				responseMessageContext.setTransportIn(msgCtx.getTransportIn());
 				responseMessageContext.setTransportOut(msgCtx.getTransportOut());
@@ -586,6 +581,7 @@
 						//We try to build the response out of the transport stream.
 						resenvelope = TransportUtils.createSOAPMessage(responseMessageContext);
 						responseMessageContext.setEnvelope(resenvelope);
+						syncResponseBuilt = true;
 					} else {
 						
 					}
@@ -633,6 +629,23 @@
 				
 			}
 			
+			//if the syncResponseWas not built here and the client was not expecting a sync response. We will not try to execute 
+			//here. Doing so will cause a double invocation for a async message. 
+			if (msgCtx.getOptions().isUseSeparateListener()==true &&  !syncResponseBuilt) {
+				return;
+			}
+			
+			
+			//setting the message as serverSide will let it go through the MessageReceiver (may be callback MR).
+			responseMessageContext.setServerSide(true);
+		
+			if (responseMessageContext.getSoapAction()==null) {
+				//if there is no SOAP action in the response message, Axis2 will wrongly identify it as a REST message
+				//This happens because we set serverSide to True in a previous step.
+				//So we have to add a empty SOAPAction here.
+				responseMessageContext.setSoapAction("");
+			}
+
 			AxisEngine engine = new AxisEngine(msgCtx.getConfigurationContext());
 			if (resenvelope!=null) {
 				//we proceed only if we hv found a valid envelope.



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