ws-sandesha-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chamik...@apache.org
Subject svn commit: r543896 - in /webservices/sandesha/branches/sandesha2/java/1_2/modules/core/src/main/java/org/apache/sandesha2: ./ handlers/ msgprocessors/ storage/beans/ util/ workers/
Date Sun, 03 Jun 2007 14:04:33 GMT
Author: chamikara
Date: Sun Jun  3 07:04:32 2007
New Revision: 543896

URL: http://svn.apache.org/viewvc?view=rev&rev=543896
Log:
Added the commit 543894 to the branch

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

Modified: webservices/sandesha/branches/sandesha2/java/1_2/modules/core/src/main/java/org/apache/sandesha2/SandeshaModule.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/branches/sandesha2/java/1_2/modules/core/src/main/java/org/apache/sandesha2/SandeshaModule.java?view=diff&rev=543896&r1=543895&r2=543896
==============================================================================
--- webservices/sandesha/branches/sandesha2/java/1_2/modules/core/src/main/java/org/apache/sandesha2/SandeshaModule.java
(original)
+++ webservices/sandesha/branches/sandesha2/java/1_2/modules/core/src/main/java/org/apache/sandesha2/SandeshaModule.java
Sun Jun  3 07:04:32 2007
@@ -84,7 +84,7 @@
 		
 		if (propertyBean==null) {
 			String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.couldNotLoadModulePolicies);
-			log.warn (message);
+			log.error (message);
 			
 			propertyBean = PropertyManager.loadPropertiesFromDefaultValues();
 		} else {

Added: webservices/sandesha/branches/sandesha2/java/1_2/modules/core/src/main/java/org/apache/sandesha2/handlers/SequenceIDDispatcher.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/branches/sandesha2/java/1_2/modules/core/src/main/java/org/apache/sandesha2/handlers/SequenceIDDispatcher.java?view=auto&rev=543896
==============================================================================
--- webservices/sandesha/branches/sandesha2/java/1_2/modules/core/src/main/java/org/apache/sandesha2/handlers/SequenceIDDispatcher.java
(added)
+++ webservices/sandesha/branches/sandesha2/java/1_2/modules/core/src/main/java/org/apache/sandesha2/handlers/SequenceIDDispatcher.java
Sun Jun  3 07:04:32 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/branches/sandesha2/java/1_2/modules/core/src/main/java/org/apache/sandesha2/msgprocessors/CreateSeqResponseMsgProcessor.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/branches/sandesha2/java/1_2/modules/core/src/main/java/org/apache/sandesha2/msgprocessors/CreateSeqResponseMsgProcessor.java?view=diff&rev=543896&r1=543895&r2=543896
==============================================================================
--- webservices/sandesha/branches/sandesha2/java/1_2/modules/core/src/main/java/org/apache/sandesha2/msgprocessors/CreateSeqResponseMsgProcessor.java
(original)
+++ webservices/sandesha/branches/sandesha2/java/1_2/modules/core/src/main/java/org/apache/sandesha2/msgprocessors/CreateSeqResponseMsgProcessor.java
Sun Jun  3 07:04:32 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/branches/sandesha2/java/1_2/modules/core/src/main/java/org/apache/sandesha2/msgprocessors/LastMessageProcessor.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/branches/sandesha2/java/1_2/modules/core/src/main/java/org/apache/sandesha2/msgprocessors/LastMessageProcessor.java?view=diff&rev=543896&r1=543895&r2=543896
==============================================================================
--- webservices/sandesha/branches/sandesha2/java/1_2/modules/core/src/main/java/org/apache/sandesha2/msgprocessors/LastMessageProcessor.java
(original)
+++ webservices/sandesha/branches/sandesha2/java/1_2/modules/core/src/main/java/org/apache/sandesha2/msgprocessors/LastMessageProcessor.java
Sun Jun  3 07:04:32 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/branches/sandesha2/java/1_2/modules/core/src/main/java/org/apache/sandesha2/storage/beans/RMDBean.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/branches/sandesha2/java/1_2/modules/core/src/main/java/org/apache/sandesha2/storage/beans/RMDBean.java?view=diff&rev=543896&r1=543895&r2=543896
==============================================================================
--- webservices/sandesha/branches/sandesha2/java/1_2/modules/core/src/main/java/org/apache/sandesha2/storage/beans/RMDBean.java
(original)
+++ webservices/sandesha/branches/sandesha2/java/1_2/modules/core/src/main/java/org/apache/sandesha2/storage/beans/RMDBean.java
Sun Jun  3 07:04:32 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/branches/sandesha2/java/1_2/modules/core/src/main/java/org/apache/sandesha2/storage/beans/RMSBean.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/branches/sandesha2/java/1_2/modules/core/src/main/java/org/apache/sandesha2/storage/beans/RMSBean.java?view=diff&rev=543896&r1=543895&r2=543896
==============================================================================
--- webservices/sandesha/branches/sandesha2/java/1_2/modules/core/src/main/java/org/apache/sandesha2/storage/beans/RMSBean.java
(original)
+++ webservices/sandesha/branches/sandesha2/java/1_2/modules/core/src/main/java/org/apache/sandesha2/storage/beans/RMSBean.java
Sun Jun  3 07:04:32 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/branches/sandesha2/java/1_2/modules/core/src/main/java/org/apache/sandesha2/util/SandeshaUtil.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/branches/sandesha2/java/1_2/modules/core/src/main/java/org/apache/sandesha2/util/SandeshaUtil.java?view=diff&rev=543896&r1=543895&r2=543896
==============================================================================
--- webservices/sandesha/branches/sandesha2/java/1_2/modules/core/src/main/java/org/apache/sandesha2/util/SandeshaUtil.java
(original)
+++ webservices/sandesha/branches/sandesha2/java/1_2/modules/core/src/main/java/org/apache/sandesha2/util/SandeshaUtil.java
Sun Jun  3 07:04:32 2007
@@ -355,6 +355,7 @@
 			newMessageContext.setConfigurationContext(configContext);
 			
 			Options newOptions = new Options ();
+			Options oldOptions = referenceMessage.getOptions();
 			
 			newMessageContext.setOptions(newOptions);
 			
@@ -426,6 +427,10 @@
 
 			//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;
 

Modified: webservices/sandesha/branches/sandesha2/java/1_2/modules/core/src/main/java/org/apache/sandesha2/workers/SenderWorker.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/branches/sandesha2/java/1_2/modules/core/src/main/java/org/apache/sandesha2/workers/SenderWorker.java?view=diff&rev=543896&r1=543895&r2=543896
==============================================================================
--- webservices/sandesha/branches/sandesha2/java/1_2/modules/core/src/main/java/org/apache/sandesha2/workers/SenderWorker.java
(original)
+++ webservices/sandesha/branches/sandesha2/java/1_2/modules/core/src/main/java/org/apache/sandesha2/workers/SenderWorker.java
Sun Jun  3 07:04:32 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


Mime
View raw message