ws-sandesha-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gatf...@apache.org
Subject svn commit: r546061 - in /webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/handlers: SandeshaGlobalInHandler.java SequenceIDDispatcher.java
Date Mon, 11 Jun 2007 09:40:25 GMT
Author: gatfora
Date: Mon Jun 11 02:40:24 2007
New Revision: 546061

URL: http://svn.apache.org/viewvc?view=rev&rev=546061
Log:
Skip Sandesha processingfor services which have unreliable message set, or if a sequence property
bean can't be found

Modified:
    webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/handlers/SandeshaGlobalInHandler.java
    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/handlers/SandeshaGlobalInHandler.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/handlers/SandeshaGlobalInHandler.java?view=diff&rev=546061&r1=546060&r2=546061
==============================================================================
--- webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/handlers/SandeshaGlobalInHandler.java
(original)
+++ webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/handlers/SandeshaGlobalInHandler.java
Mon Jun 11 02:40:24 2007
@@ -72,9 +72,15 @@
 		if (msgContext.getAxisService() != null) {
 			Parameter unreliableParam = msgContext.getAxisService().getParameter(SandeshaClientConstants.UNRELIABLE_MESSAGE);
 			if (null != unreliableParam && "true".equals(unreliableParam.getValue())) {
-				log.debug("Exit: SandeshaGlobalInHandler::invoke, Service has disabled RM " + InvocationResponse.CONTINUE);
+				if (log.isDebugEnabled())
+					log.debug("Exit: SandeshaGlobalInHandler::invoke, Service has disabled RM " + InvocationResponse.CONTINUE);
 				return InvocationResponse.CONTINUE;
 			}
+		} else if (msgContext.getConfigurationContext().getAxisConfiguration().getParameter(Sandesha2Constants.SANDESHA_PROPERTY_BEAN)
== null) {
+			if (log.isDebugEnabled())
+				log.debug("Exit: SandeshaGlobalInHandler::invoke, No Property Bean found " + InvocationResponse.CONTINUE);
+			
+			return InvocationResponse.CONTINUE;						
 		}
 
 		// The only work that this handler needs to do is identify messages which

Modified: 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=diff&rev=546061&r1=546060&r2=546061
==============================================================================
--- webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/handlers/SequenceIDDispatcher.java
(original)
+++ webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/handlers/SequenceIDDispatcher.java
Mon Jun 11 02:40:24 2007
@@ -25,13 +25,13 @@
 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.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.sandesha2.RMMsgContext;
 import org.apache.sandesha2.Sandesha2Constants;
+import org.apache.sandesha2.client.SandeshaClientConstants;
 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;
@@ -40,9 +40,9 @@
 public class SequenceIDDispatcher extends AbstractDispatcher {
 
 	private final String NAME = "SequenceIDDIspatcher";
+	private static final Log log = LogFactory.getLog(SequenceIDDispatcher.class);
 	
-	public AxisOperation findOperation(AxisService service, MessageContext messageContext) throws
AxisFault {
-		// TODO Auto-generated method stub
+	public AxisOperation findOperation(AxisService service, MessageContext messageContext) {
 		return null;
 	}
 
@@ -51,8 +51,18 @@
 	}
 
 	public AxisService findService(MessageContext msgContext) throws AxisFault {
-		// TODO Auto-generated method stub
-		
+		if (log.isDebugEnabled())
+			log.debug("Enter: SequenceIDDispatcher::findService, " + msgContext.getEnvelope().getHeader());
+		// look at the service to see if RM is totally disabled. This allows the user to disable
RM using
+		// a property on the service, even when Sandesha is engaged.
+		if (msgContext.getAxisService() != null) {
+			Parameter unreliableParam = msgContext.getAxisService().getParameter(SandeshaClientConstants.UNRELIABLE_MESSAGE);
+			if (null != unreliableParam && "true".equals(unreliableParam.getValue())) {
+				if (log.isDebugEnabled())
+					log.debug("Exit: SequenceIDDispatcher::findService, Service has disabled RM ");
+				return null;
+			}
+		} 
 		
 		ConfigurationContext configurationContext = msgContext.getConfigurationContext();
 		RMMsgContext rmmsgContext = MsgInitializer.initializeMessage(msgContext);
@@ -60,19 +70,15 @@
 		
 		Transaction transaction = storageManager.getTransaction();
 		
-		AxisService service;
+		AxisService service = null;
 		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);
+				//If this is the RMD of the sequence 				
+				RMDBean rmdBean = SandeshaUtil.getRMDBeanFromSequenceId(storageManager, sequenceID);
 				String serviceName = rmdBean.getServiceName();
 				if (serviceName != null) {
 					service = configurationContext.getAxisConfiguration()
@@ -80,12 +86,8 @@
 				}
 
 				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);
+					//If this is the RMS of the sequence 
+					RMSBean rmsBean = SandeshaUtil.getRMSBeanFromSequenceId(storageManager, sequenceID);
 
 					serviceName = rmsBean.getServiceName();
 					if (serviceName != null) {
@@ -96,9 +98,12 @@
 
 			}
 		} finally  {
-			transaction.commit();
+			if (transaction != null && transaction.isActive())
+				transaction.commit();
 		}		
 		
+		if (log.isDebugEnabled())
+			log.debug("Exit: SequenceIDDispatcher::findService, " + service);
 		return service;
 	}
 



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


Mime
View raw message