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 2006/01/05 07:01:00 UTC

svn commit: r366091 - in /webservices/sandesha/trunk/src/org/apache/sandesha2: ./ handlers/ msgprocessors/ storage/inmemory/ util/ workers/

Author: chamikara
Date: Wed Jan  4 21:59:57 2006
New Revision: 366091

URL: http://svn.apache.org/viewcvs?rev=366091&view=rev
Log:
Updated code to comply with the latest Axis2 source.
Changes to the RM Report functionality.
Added loggers.
Cleaned the code.

Removed:
    webservices/sandesha/trunk/src/org/apache/sandesha2/RMReport.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/Sandesha2ClientAPI.java
Modified:
    webservices/sandesha/trunk/src/org/apache/sandesha2/AcknowledgementManager.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/RMMsgContext.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/SandeshaException.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/TerminateManager.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaGlobalInHandler.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaInHandler.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/AcknowledgementProcessor.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqMsgProcessor.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqResponseMsgProcessor.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/TerminateSeqMsgProcessor.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/storage/inmemory/InMemorySequencePropertyBeanMgr.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/util/PropertyManager.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/util/RMMsgCreator.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/util/SandeshaUtil.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/util/SequenceManager.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/workers/InOrderInvoker.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/workers/Sender.java

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/AcknowledgementManager.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/AcknowledgementManager.java?rev=366091&r1=366090&r2=366091&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/AcknowledgementManager.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/AcknowledgementManager.java Wed Jan  4 21:59:57 2006
@@ -22,6 +22,8 @@
 
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.MessageContext;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.sandesha2.storage.StorageManager;
 import org.apache.sandesha2.storage.beanmanagers.SenderBeanMgr;
 import org.apache.sandesha2.storage.beanmanagers.SequencePropertyBeanMgr;
@@ -40,6 +42,8 @@
 
 public class AcknowledgementManager {
 
+	private static Log log = LogFactory.getLog(AcknowledgementManager.class);
+	
 	/**
 	 * Piggybacks any available acks of the same sequence to the given
 	 * application message.
@@ -63,9 +67,11 @@
 
 		Sequence sequence = (Sequence) applicationRMMsgContext
 				.getMessagePart(Sandesha2Constants.MessageParts.SEQUENCE);
-		if (sequence == null)
-			throw new SandeshaException(
-					"Application message does not contain a sequence part");
+		if (sequence == null) {
+			String message = "Application message does not contain a sequence part";
+			log.debug(message);
+			throw new SandeshaException(message);
+		}
 
 		String sequenceId = sequence.getIdentifier().getIdentifier();
 
@@ -73,8 +79,11 @@
 				.retrieve(
 						sequenceId,
 						Sandesha2Constants.SequenceProperties.INTERNAL_SEQUENCE_ID);
-		if (internalSequenceBean == null)
-			throw new SandeshaException("Temp Sequence is not set");
+		if (internalSequenceBean == null) {
+			String message = "Temp Sequence is not set";
+			log.debug(message);
+			throw new SandeshaException(message);
+		}
 
 		String internalSequenceId = (String) internalSequenceBean.getValue();
 		findBean.setInternalSequenceID(internalSequenceId);
@@ -89,7 +98,8 @@
 			SenderBean ackBean = (SenderBean) it.next();
 
 			long timeNow = System.currentTimeMillis();
-			if (ackBean.getTimeToSend() > timeNow) { //Piggybacking will happen only if the end of ack interval (timeToSend) is not reached.
+			if (ackBean.getTimeToSend() > timeNow) { 
+				//Piggybacking will happen only if the end of ack interval (timeToSend) is not reached.
 
 				//deleting the ack entry.
 				retransmitterBeanMgr.delete(ackBean.getMessageID());
@@ -100,8 +110,11 @@
 								.getMessageContextRefKey());
 				RMMsgContext ackRMMsgContext = MsgInitializer
 						.initializeMessage(ackMsgContext);
-				if (ackRMMsgContext.getMessageType() != Sandesha2Constants.MessageTypes.ACK)
-					throw new SandeshaException("Invalid ack message entry");
+				if (ackRMMsgContext.getMessageType() != Sandesha2Constants.MessageTypes.ACK) {
+					String message = "Invalid ack message entry";
+					log.debug(message);
+					throw new SandeshaException(message);
+				}
 
 				SequenceAcknowledgement sequenceAcknowledgement = (SequenceAcknowledgement) ackRMMsgContext
 						.getMessagePart(Sandesha2Constants.MessageParts.SEQ_ACKNOWLEDGEMENT);

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/RMMsgContext.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/RMMsgContext.java?rev=366091&r1=366090&r2=366091&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/RMMsgContext.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/RMMsgContext.java Wed Jan  4 21:59:57 2006
@@ -20,9 +20,6 @@
 import java.util.HashMap;
 import java.util.Iterator;
 
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamWriter;
-
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.addressing.RelatesTo;
@@ -169,17 +166,6 @@
 		}
 	}
 
-	public void serializeSOAPEnvelop() {
-		try {
-			SOAPEnvelope envelop = msgContext.getEnvelope();
-			XMLStreamWriter writer = XMLOutputFactory.newInstance()
-					.createXMLStreamWriter(System.out);
-			envelop.serialize(writer);
-		} catch (Exception ex) {
-			ex.printStackTrace();
-		}
-	}
-
 	public void setFrom(EndpointReference epr) {
 		msgContext.setFrom(epr);
 	}
@@ -240,5 +226,15 @@
 
 	public void setSOAPAction(String SOAPAction) {
 		msgContext.setSoapAction(SOAPAction);
+	}
+	
+	public void pause () {
+		if (msgContext!=null)
+			msgContext.pause();
+	}
+	
+	public void setPaused (boolean pause) {
+		if (msgContext!=null)
+			msgContext.setPaused(pause);
 	}
 }

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/SandeshaException.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/SandeshaException.java?rev=366091&r1=366090&r2=366091&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/SandeshaException.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/SandeshaException.java Wed Jan  4 21:59:57 2006
@@ -31,4 +31,5 @@
 	public SandeshaException (String message) {
 		super (message);
 	}
+	
 }

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/TerminateManager.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/TerminateManager.java?rev=366091&r1=366090&r2=366091&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/TerminateManager.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/TerminateManager.java Wed Jan  4 21:59:57 2006
@@ -24,16 +24,13 @@
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.sandesha2.storage.StorageManager;
 import org.apache.sandesha2.storage.beanmanagers.CreateSeqBeanMgr;
-import org.apache.sandesha2.storage.beanmanagers.NextMsgBeanMgr;
+import org.apache.sandesha2.storage.beanmanagers.InvokerBeanMgr;
 import org.apache.sandesha2.storage.beanmanagers.SenderBeanMgr;
 import org.apache.sandesha2.storage.beanmanagers.SequencePropertyBeanMgr;
-import org.apache.sandesha2.storage.beanmanagers.InvokerBeanMgr;
 import org.apache.sandesha2.storage.beans.CreateSeqBean;
-import org.apache.sandesha2.storage.beans.NextMsgBean;
+import org.apache.sandesha2.storage.beans.InvokerBean;
 import org.apache.sandesha2.storage.beans.SenderBean;
 import org.apache.sandesha2.storage.beans.SequencePropertyBean;
-import org.apache.sandesha2.storage.beans.InvokerBean;
-import org.apache.sandesha2.util.PropertyManager;
 import org.apache.sandesha2.util.SandeshaUtil;
 
 /**
@@ -55,7 +52,7 @@
 	 * @throws SandeshaException
 	 */
 	public static void terminateReceivingSide (ConfigurationContext configContext, String sequenceID) throws SandeshaException {
-		StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(configContext);
+		/*StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(configContext);
 		NextMsgBeanMgr nextMsgBeanMgr = storageManager.getNextMsgBeanMgr();
 		
 		//removing nextMsgMgr entries
@@ -71,7 +68,7 @@
 		boolean inOrderInvocation = PropertyManager.getInstance().isInOrderInvocation();
 		if(!inOrderInvocation) { 
 			terminateAfterInvocation(configContext,sequenceID);
-		}
+		}*/
 
 	}
 	
@@ -151,9 +148,7 @@
 		Collection collection = retransmitterBeanMgr.find(internalSequenceId);
 		Iterator iterator = collection.iterator();
 		while (iterator.hasNext()) {
-			Object obj = iterator.next();
-			System.out.println(obj);
-			SenderBean retransmitterBean = (SenderBean) obj;
+			SenderBean retransmitterBean = (SenderBean) iterator.next();
 			retransmitterBeanMgr.delete(retransmitterBean.getMessageID());
 		}
 		
@@ -174,21 +169,29 @@
 		iterator = collection.iterator();
 		while (iterator.hasNext()) {
 			SequencePropertyBean sequencePropertyBean = (SequencePropertyBean) iterator.next();
-			sequencePropertyBeanMgr.delete(sequencePropertyBean.getSequenceID(),sequencePropertyBean.getName());
+			
+			if (isProportyDeletable(sequencePropertyBean.getName())) {
+				sequencePropertyBeanMgr.delete(sequencePropertyBean.getSequenceID(),sequencePropertyBean.getName());
+			}
+			
 		}
 		
-		SequencePropertyBean findSequencePropertyBean2 = new SequencePropertyBean ();
-		findSequencePropertyBean2.setSequenceID(internalSequenceId);
-		collection = sequencePropertyBeanMgr.find(findSequencePropertyBean2);
-		iterator = collection.iterator();
-		while (iterator.hasNext()) {
-			SequencePropertyBean sequencePropertyBean = (SequencePropertyBean) iterator.next();
-			sequencePropertyBeanMgr.delete(sequencePropertyBean.getSequenceID(),sequencePropertyBean.getName());
-		}
+//		SequencePropertyBean findSequencePropertyBean2 = new SequencePropertyBean ();
+//		findSequencePropertyBean2.setSequenceID(internalSequenceId);
+//		collection = sequencePropertyBeanMgr.find(findSequencePropertyBean2);
+//		iterator = collection.iterator();
+//		while (iterator.hasNext()) {
+//			SequencePropertyBean sequencePropertyBean = (SequencePropertyBean) iterator.next();
+//			sequencePropertyBeanMgr.delete(sequencePropertyBean.getSequenceID(),sequencePropertyBean.getName());
+//		}
 	}
 	
-	private boolean isProportyDeletable (String name) {
+	private static boolean isProportyDeletable (String name) {
 		boolean deleatable = true;
+		
+//		if (name.equals(Sandesha2Constants.SequenceProperties.INTERNAL_SEQUENCE_ID)) {
+//			int i=1;
+//		}
 		
 		if (Sandesha2Constants.SequenceProperties.TERMINATE_ADDED.equals(name))
 			deleatable = false;

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaGlobalInHandler.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaGlobalInHandler.java?rev=366091&r1=366090&r2=366091&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaGlobalInHandler.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaGlobalInHandler.java Wed Jan  4 21:59:57 2006
@@ -31,9 +31,8 @@
 import org.apache.axis2.soap.SOAPBody;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.sandesha2.Sandesha2ClientAPI;
-import org.apache.sandesha2.Sandesha2Constants;
 import org.apache.sandesha2.RMMsgContext;
+import org.apache.sandesha2.Sandesha2Constants;
 import org.apache.sandesha2.SandeshaException;
 import org.apache.sandesha2.msgprocessors.ApplicationMsgProcessor;
 import org.apache.sandesha2.storage.StorageManager;
@@ -83,24 +82,10 @@
 
 		ServiceContext serviceContext = msgContext.getServiceContext();
 		Object debug = null;
-		if (serviceContext != null) {
-			debug = msgContext.getProperty(Sandesha2ClientAPI.SANDESHA_DEBUG_MODE);
-			if (debug != null && "on".equals(debug)) {
-				System.out.println("DEBUG: SandeshaGlobalInHandler got a '"
-						+ SandeshaUtil.getMessageTypeString(rmMessageContext
-								.getMessageType()) + "' message.");
-			}
-		}
 
 		//Dropping duplicates
 		boolean dropped = dropIfDuplicate(rmMessageContext);
 		if (dropped) {
-			if (debug != null && "on".equals(debug)) {
-				System.out.println("DEBUG: SandeshaGlobalInHandler DROPPED a '"
-						+ SandeshaUtil.getMessageTypeString(rmMessageContext
-								.getMessageType()) + "' message.");
-			}
-
 			processDroppedMessage(rmMessageContext);
 			return;
 		}
@@ -152,7 +137,6 @@
 							drop = true;
 						}
 					}
-					
 				}
 
 				if (drop == false) {
@@ -164,10 +148,8 @@
 					}
 
 					if (emptyBody) {
-						boolean lastMessage = false;
 						if (sequence.getLastMessage() != null) {
-							System.out
-									.println("Empty Body Last Message Received");
+							log.info ("Empty Body LastMessage Received");
 							drop = true;
 
 							if (receivedMsgsBean == null) {
@@ -200,8 +182,7 @@
 		}
 
 		if (drop) {
-			//rmMsgContext.getMessageContext().pause();
-			rmMsgContext.getMessageContext().setPausedTrue(new QName (Sandesha2Constants.IN_HANDLER_NAME));
+			rmMsgContext.getMessageContext().pause();
 			return true;
 		}
 
@@ -229,8 +210,7 @@
 			String receivedMsgStr = (String) receivedMsgsBean.getValue();
 
 			ApplicationMsgProcessor ackProcessor = new ApplicationMsgProcessor();
-			//Even though the duplicate message is dropped, hv to send the ack
-			// if needed.
+			//Even though the duplicate message is dropped, hv to send the ack if needed.
 			ackProcessor.sendAckIfNeeded(rmMsgContext, receivedMsgStr);
 
 		}
@@ -240,9 +220,8 @@
 			throws SandeshaException {
 		switch (rmMsgCtx.getMessageType()) {
 		case Sandesha2Constants.MessageTypes.ACK:
-			rmMsgCtx.setRelatesTo(null); //Removing the relatesTo part from
-		// ackMessageIf present.
-		//Some Frameworks tend to send this.
+			rmMsgCtx.setRelatesTo(null); 
+			//Removing the relatesTo part from ackMessageIf present. Some Frameworks tend to send this.
 		}
 	}
 

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaInHandler.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaInHandler.java?rev=366091&r1=366090&r2=366091&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaInHandler.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaInHandler.java Wed Jan  4 21:59:57 2006
@@ -22,22 +22,18 @@
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.context.ServiceContext;
 import org.apache.axis2.description.AxisService;
 import org.apache.axis2.engine.AxisEngine;
 import org.apache.axis2.handlers.AbstractHandler;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.sandesha2.RMMsgContext;
-import org.apache.sandesha2.Sandesha2ClientAPI;
 import org.apache.sandesha2.Sandesha2Constants;
 import org.apache.sandesha2.SandeshaException;
 import org.apache.sandesha2.msgprocessors.MsgProcessor;
 import org.apache.sandesha2.msgprocessors.MsgProcessorFactory;
-import org.apache.sandesha2.storage.StorageManager;
 import org.apache.sandesha2.util.FaultManager;
 import org.apache.sandesha2.util.MsgInitializer;
-import org.apache.sandesha2.util.SandeshaUtil;
 
 /**
  * This is invoked in the inFlow of an RM endpoint. This is responsible for selecting an suitable
@@ -57,8 +53,11 @@
 	public void invoke(MessageContext msgCtx) throws AxisFault {
 	
 		ConfigurationContext context = msgCtx.getConfigurationContext();
-		if (context == null)
-			throw new AxisFault("ConfigurationContext is null");
+		if (context == null) {
+			String message = "ConfigurationContext is null";
+			log.debug(message);
+			throw new AxisFault(message);
+		}
 
 		String DONE = (String) msgCtx
 				.getProperty(Sandesha2Constants.APPLICATION_PROCESSING_DONE);
@@ -75,41 +74,36 @@
 		}
 
 		AxisService axisService = msgCtx.getAxisService();
-		if (axisService == null)
-			throw new AxisFault("AxisService is null");
+		if (axisService == null) {
+			String message = "AxisService is null";
+			log.debug(message);
+			throw new AxisFault(message);
+		}
 
 		RMMsgContext rmMsgCtx = null;
 		try {
 			rmMsgCtx = MsgInitializer.initializeMessage(msgCtx);
 		} catch (SandeshaException ex) {
-			throw new AxisFault("Cant initialize the message");
-		}
-
-		ServiceContext serviceContext = msgCtx.getServiceContext();
-		Object debug = null;
-		if (serviceContext != null) {
-			debug = msgCtx.getProperty(Sandesha2ClientAPI.SANDESHA_DEBUG_MODE);
-			if (debug != null && "on".equals(debug)) {
-				System.out.println("DEBUG: SandeshaInHandler got a '"
-						+ SandeshaUtil.getMessageTypeString(rmMsgCtx
-								.getMessageType()) + "' message.");
-			}
+			String message = "Cant initialize the message";
+			log.debug(message);
+			throw new AxisFault(message);
 		}
 
 		MsgProcessor msgProcessor = MsgProcessorFactory
 				.getMessageProcessor(rmMsgCtx.getMessageType());
 
-		if (msgProcessor == null)
-			throw new AxisFault("Cant find a suitable message processor");
+		if (msgProcessor == null) {
+			String message = "Cant find a suitable message processor";
+			log.debug(message);
+			throw new AxisFault(message);
+		}
 
 		try {
-			StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(rmMsgCtx.getMessageContext().getConfigurationContext());
-
 			msgProcessor.processMessage(rmMsgCtx);
-			
 		} catch (SandeshaException se) {
-			se.printStackTrace();
-			throw new AxisFault("Error in processing the message");
+			String message = "Error in processing the message";
+			log.debug(message);
+			throw new AxisFault(message);
 		}
 
 	}

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java?rev=366091&r1=366090&r2=366091&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java Wed Jan  4 21:59:57 2006
@@ -36,9 +36,9 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.sandesha2.RMMsgContext;
-import org.apache.sandesha2.Sandesha2ClientAPI;
 import org.apache.sandesha2.Sandesha2Constants;
 import org.apache.sandesha2.SandeshaException;
+import org.apache.sandesha2.client.Sandesha2ClientAPI;
 import org.apache.sandesha2.policy.RMPolicyBean;
 import org.apache.sandesha2.storage.StorageManager;
 import org.apache.sandesha2.storage.Transaction;
@@ -76,12 +76,18 @@
 	public void invoke(MessageContext msgCtx) throws AxisFault {
 
 		ConfigurationContext context = msgCtx.getConfigurationContext();
-		if (context == null)
-			throw new AxisFault("ConfigurationContext is null");
+		if (context == null) {
+			String message = "ConfigurationContext is null";
+			log.debug(message);
+			throw new AxisFault(message);
+		}
 
 		AxisService axisService = msgCtx.getAxisService();
-		if (axisService == null)
-			throw new AxisFault("AxisService is null");
+		if (axisService == null) {
+			String message = "AxisService is null";
+			log.debug(message);
+			throw new AxisFault(message);
+		}
 
 		//getting rm message
 		RMMsgContext rmMsgCtx = MsgInitializer.initializeMessage(msgCtx);
@@ -100,15 +106,6 @@
 		
 		ServiceContext serviceContext = msgCtx.getServiceContext();
 		OperationContext operationContext = msgCtx.getOperationContext();
-		Object debug = null;
-		if (serviceContext != null) {
-			debug = msgCtx.getProperty(Sandesha2ClientAPI.SANDESHA_DEBUG_MODE);
-			if (debug != null && "on".equals(debug)) {
-				System.out.println("DEBUG: SandeshaOutHandler got a '"
-						+ SandeshaUtil.getMessageTypeString(rmMsgCtx
-								.getMessageType()) + "' message.");
-			}
-		}
 
 		//continue only if an possible application message
 		if (!(rmMsgCtx.getMessageType() == Sandesha2Constants.MessageTypes.UNKNOWN)) {
@@ -151,12 +148,18 @@
 
 			Sequence reqSequence = (Sequence) requestRMMsgCtx
 					.getMessagePart(Sandesha2Constants.MessageParts.SEQUENCE);
-			if (reqSequence == null)
-				throw new SandeshaException("Sequence part is null");
+			if (reqSequence == null) {
+				String message = "Sequence part is null";
+				log.debug(message);
+				throw new SandeshaException(message);
+			}
 
 			String incomingSeqId = reqSequence.getIdentifier().getIdentifier();
-			if (incomingSeqId == null || incomingSeqId == "")
-				throw new SandeshaException("Invalid seqence Id");
+			if (incomingSeqId == null || incomingSeqId == "") {
+				String message = "Invalid seqence Id";
+				log.debug(message);
+				throw new SandeshaException(message);
+			}
 
 			internalSequenceId = incomingSeqId;
 
@@ -164,12 +167,13 @@
 			//set the internal sequence id for the client side.
 			EndpointReference toEPR = msgCtx.getTo();
 			if (toEPR == null || toEPR.getAddress() == null
-					|| "".equals(toEPR.getAddress()))
-				throw new AxisFault(
-						"TO End Point Reference is not set correctly. This is a must for the sandesha client side.");
-
+					|| "".equals(toEPR.getAddress())){
+				String message = "TO End Point Reference is not set correctly. This is a must for the sandesha client side.";
+				log.debug(message);
+				throw new AxisFault(message);
+			}
+			
 			String to = toEPR.getAddress();
-			OperationContext opContext = msgCtx.getOperationContext();
 			String sequenceKey = (String) msgCtx
 					.getProperty(Sandesha2ClientAPI.SEQUENCE_KEY);
 			
@@ -224,7 +228,9 @@
 					
 					MessageContext requestMessage = operationContext.getMessageContext(OperationContextFactory.MESSAGE_LABEL_IN_VALUE);
 					if (requestMessage==null) {
-						throw new SandeshaException ("Request message is not present");
+						String message = "Request message is not present";
+						log.debug(message);
+						throw new SandeshaException (message);
 					}
 					
 					acksTo = requestMessage.getTo().getAddress();
@@ -264,9 +270,7 @@
 
 					}
 				}
-
 				addCreateSequenceMessage(rmMsgCtx, internalSequenceId, acksTo);
-
 			}
 		}
 
@@ -280,10 +284,12 @@
 		}
 
 		SOAPBody soapBody = rmMsgCtx.getSOAPEnvelope().getBody();
-		if (soapBody == null)
-			throw new SandeshaException(
-					"Invalid SOAP message. Body is not present");
-
+		if (soapBody == null) {
+			String message = "Invalid SOAP message. Body is not present";
+			log.debug(message);
+			throw new SandeshaException(message);
+		}
+		
 		String messageId1 = SandeshaUtil.getUUID();
 		if (rmMsgCtx.getMessageId() == null) {
 			rmMsgCtx.setMessageId(messageId1);
@@ -309,8 +315,11 @@
 		} else {
 			EndpointReference toEPR = msgCtx.getTo();
 
-			if (toEPR == null)
-				throw new SandeshaException("To EPR is not found");
+			if (toEPR == null) {
+				String message = "To EPR is not found";
+				log.debug(message);
+				throw new SandeshaException(message);
+			}
 
 			String to = toEPR.getAddress();
 			String operationName = msgCtx.getOperationContext()
@@ -330,8 +339,8 @@
 		}
 
 		//pausing the message
-		//msgCtx.pause();
-		rmMsgCtx.getMessageContext().setPausedTrue(new QName (Sandesha2Constants.OUT_HANDLER_NAME));
+		msgCtx.pause();
+		//rmMsgCtx.getMessageContext().setPausedTrue(new QName (Sandesha2Constants.OUT_HANDLER_NAME));
 		
 		transaction.commit();
 	}
@@ -340,15 +349,21 @@
 			String internalSequenceId, String acksTo) throws SandeshaException {
 
 		MessageContext applicationMsg = applicationRMMsg.getMessageContext();
-		if (applicationMsg == null)
-			throw new SandeshaException("Message context is null");
+		if (applicationMsg == null) {
+			String message = "Message context is null";
+			log.debug(message);
+			throw new SandeshaException(message);
+		}
+		
 		RMMsgContext createSeqRMMessage = RMMsgCreator.createCreateSeqMsg(
 				applicationRMMsg, internalSequenceId, acksTo);
 		CreateSequence createSequencePart = (CreateSequence) createSeqRMMessage
 				.getMessagePart(Sandesha2Constants.MessageParts.CREATE_SEQ);
-		if (createSequencePart == null)
-			throw new SandeshaException(
-					"Create Sequence part is null for a CreateSequence message");
+		if (createSequencePart == null) {
+			String message = "Create Sequence part is null for a CreateSequence message"; 
+			log.debug(message);
+			throw new SandeshaException(message);
+		}
 
 		SequenceOffer offer = createSequencePart.getSequenceOffer();
 		if (offer != null) {
@@ -380,8 +395,11 @@
 		createSeqMsg.setRelatesTo(null); //create seq msg does not relateTo
 		// anything
 		AbstractContext context = applicationRMMsg.getContext();
-		if (context == null)
-			throw new SandeshaException("Context is null");
+		if (context == null) {
+			String message = "Context is null";
+			log.debug(message);
+			throw new SandeshaException(message);
+		}
 
 		StorageManager storageManager = SandeshaUtil
 				.getSandeshaStorageManager(applicationMsg.getConfigurationContext());
@@ -418,12 +436,18 @@
 		SOAPFactory factory = SOAPAbstractFactory.getSOAPFactory(SandeshaUtil
 				.getSOAPVersion(rmMsg.getSOAPEnvelope()));
 
-		if (rmMsg == null)
-			throw new SandeshaException("Message or reques message is null");
+		if (rmMsg == null) {
+			String message = "Message or reques message is null";
+			log.debug(message);
+			throw new SandeshaException(message);
+		}
 
 		AbstractContext context = rmMsg.getContext();
-		if (context == null)
-			throw new SandeshaException("Context is null");
+		if (context == null) {
+			String message = "Context is null";
+			log.debug(message);
+			throw new SandeshaException(message);
+		}
 
 		StorageManager storageManager = SandeshaUtil
 				.getSandeshaStorageManager(msg.getConfigurationContext());
@@ -443,8 +467,11 @@
 				internalSequenceId,
 				Sandesha2Constants.SequenceProperties.OUT_SEQUENCE_ID);
 
-		if (toBean == null)
-			throw new SandeshaException("To is null");
+		if (toBean == null) {
+			String message = "To is null";
+			log.debug(message);
+			throw new SandeshaException(message);
+		}
 
 		EndpointReference toEPR = new EndpointReference (toBean.getValue());
 		EndpointReference replyToEPR = null;
@@ -454,8 +481,11 @@
 		}
 
 		if (toEPR == null || toEPR.getAddress() == null
-				|| toEPR.getAddress() == "")
-			throw new SandeshaException("To Property has an invalid value");
+				|| toEPR.getAddress() == "") {
+			String message = "To Property has an invalid value";
+			log.debug(message);
+			throw new SandeshaException(message);
+		}
 
 		String newToStr = null;
 
@@ -504,8 +534,11 @@
 					.initializeMessage(requestMsg);
 			Sequence requestSequence = (Sequence) reqRMMsgCtx
 					.getMessagePart(Sandesha2Constants.MessageParts.SEQUENCE);
-			if (requestSequence == null)
-				throw new SandeshaException("Request Sequence is null");
+			if (requestSequence == null) {
+				String message = "Request Sequence is null";
+				log.debug(message);
+				throw new SandeshaException(message);
+			}
 
 			if (requestSequence.getLastMessage() != null) {
 				lastMessage = true;

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/AcknowledgementProcessor.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/AcknowledgementProcessor.java?rev=366091&r1=366090&r2=366091&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/AcknowledgementProcessor.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/AcknowledgementProcessor.java Wed Jan  4 21:59:57 2006
@@ -20,12 +20,12 @@
 import java.util.Collection;
 import java.util.Iterator;
 
-import javax.xml.namespace.QName;
-
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.context.AbstractContext;
 import org.apache.axis2.context.MessageContextConstants;
+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.SandeshaException;
@@ -50,37 +50,48 @@
 
 public class AcknowledgementProcessor implements MsgProcessor {
 
+	Log log = LogFactory.getLog(getClass());
+	
 	public void processMessage(RMMsgContext rmMsgCtx) throws SandeshaException {
 
-		
-		
 		SequenceAcknowledgement sequenceAck = (SequenceAcknowledgement) rmMsgCtx
 				.getMessagePart(Sandesha2Constants.MessageParts.SEQ_ACKNOWLEDGEMENT);
-		if (sequenceAck == null)
-			throw new SandeshaException("Sequence acknowledgement part is null");
+		if (sequenceAck == null) {
+			String message = "Sequence acknowledgement part is null";
+			log.debug(message);
+			throw new SandeshaException(message);
+		}
 		
 		AbstractContext context = rmMsgCtx.getContext();
 		if (context == null)
-			throw new SandeshaException("Context is null");
+		{
+			String message = "Context is null";
+			log.debug(message);
+			throw new SandeshaException(message);
+		}
 
 		StorageManager storageManager = SandeshaUtil
 				.getSandeshaStorageManager(rmMsgCtx.getMessageContext()
 						.getConfigurationContext());
-		
-		Transaction ackTransaction = storageManager.getTransaction();
-		
 		SenderBeanMgr retransmitterMgr = storageManager
 				.getRetransmitterBeanMgr();
 		SequencePropertyBeanMgr seqPropMgr = storageManager
 				.getSequencePropretyBeanMgr();
 
+
+		//Starting transaction
+		Transaction ackTransaction = storageManager.getTransaction();
+
 		Iterator ackRangeIterator = sequenceAck.getAcknowledgementRanges()
 				.iterator();
 
 		Iterator nackIterator = sequenceAck.getNackList().iterator();
 		String outSequenceId = sequenceAck.getIdentifier().getIdentifier();
-		if (outSequenceId == null || "".equals(outSequenceId))
-			throw new SandeshaException("OutSequenceId is null");
+		if (outSequenceId == null || "".equals(outSequenceId)) {
+			String message = "OutSequenceId is null";
+			log.debug(message);
+			throw new SandeshaException(message);
+		}
 
 		//updating the last activated time of the sequence.
 		SequenceManager.updateLastActivatedTime(outSequenceId,rmMsgCtx.getMessageContext().getConfigurationContext());
@@ -88,8 +99,11 @@
 		SequencePropertyBean internalSequenceBean = seqPropMgr.retrieve(
 				outSequenceId, Sandesha2Constants.SequenceProperties.INTERNAL_SEQUENCE_ID);
 
-		if (internalSequenceBean == null || internalSequenceBean.getValue() == null)
-			throw new SandeshaException("TempSequenceId is not set correctly");
+		if (internalSequenceBean == null || internalSequenceBean.getValue() == null) {
+			String message = "TempSequenceId is not set correctly";
+			log.debug(message);
+			throw new SandeshaException(message);
+		}
 
 		String internalSequenceId = (String) internalSequenceBean.getValue();
 
@@ -97,12 +111,9 @@
 		rmMsgCtx.getMessageContext()
 				.setProperty(Sandesha2Constants.ACK_PROCSSED, "true");
 
-		//Removing relatesTo - Some WSRM endpoints tend to set relatesTo value
-		// for ack messages.
-		//Because of this dispatching may go wrong.
-		//So we set relatesTo value to null for ackMessages. (this happens in
-		// the SandeshaGlobal handler)
-		//Do this only if this is a standalone ACK.
+		//Removing relatesTo - Some WSRM endpoints tend to set relatesTo value for ack messages.
+		//Because of this dispatching may go wrong. So we set relatesTo value to null for ackMessages. 
+		//(this happens in the SandeshaGlobal handler). Do this only if this is a standalone ACK.
 		if (rmMsgCtx.getMessageType() == Sandesha2Constants.MessageTypes.ACK)
 			rmMsgCtx.setRelatesTo(null);
 
@@ -156,22 +167,23 @@
 			seqPropMgr.update(ackedMessagesBean);
 		
 		
-		//following get called in the SandesaInHandler
-		//if (justSendTerminateIfNeeded) {
-		//If all messages up to last message have been acknowledged.
-		//Add terminate Sequence message.
+		//If all messages up to last message have been acknowledged. Add terminate Sequence message.
 		SequencePropertyBean lastOutMsgBean = seqPropMgr.retrieve(
 				internalSequenceId, Sandesha2Constants.SequenceProperties.LAST_OUT_MESSAGE);
 		if (lastOutMsgBean != null) {
 			Long lastOutMsgNoLng = new Long (lastOutMsgBean.getValue());
-			if (lastOutMsgNoLng == null)
-				throw new SandeshaException(
-						"Invalid object set for the Last Out Message");
-
+			if (lastOutMsgNoLng == null) {
+				String message = "Invalid object set for the Last Out Message";
+				log.debug(message);
+				throw new SandeshaException(message);
+			}
+			
 			long lastOutMessageNo = lastOutMsgNoLng.longValue();
-			if (lastOutMessageNo <= 0)
-				throw new SandeshaException(
-						"Invalid value set for the last out message");
+			if (lastOutMessageNo <= 0) {
+				String message = "Invalid value set for the last out message";
+				log.debug(message);
+				throw new SandeshaException(message);
+			}
 
 			boolean complete = SandeshaUtil.verifySequenceCompletion(
 					sequenceAck.getAcknowledgementRanges().iterator(),
@@ -184,13 +196,11 @@
 		}
 		
 	
-		
 		//stopping the progress of the message further.
-		//rmMsgCtx.getMessageContext().pause();
-		rmMsgCtx.getMessageContext().setPausedTrue(new QName (Sandesha2Constants.IN_HANDLER_NAME));
+		rmMsgCtx.pause();	
 		
+		//commiting transaction
 		ackTransaction.commit();
-		
 	}
 
 	private SenderBean getRetransmitterEntry(Collection collection,
@@ -221,7 +231,8 @@
 
 		if (terminated != null && terminated.getValue() != null
 				&& "true".equals(terminated.getValue())) {
-			System.out.println("TERMINATE WAS ADDED PREVIOUSLY....");
+			String message = "Terminate was added previously.";
+			log.info(message);
 			return;
 		}
 
@@ -234,8 +245,10 @@
 				Sandesha2Constants.SequenceProperties.TO_EPR);
 
 		EndpointReference toEPR = new EndpointReference ( toBean.getValue());
-		if (toEPR == null)
-			throw new SandeshaException("To EPR has an invalid value");
+		if (toEPR == null) {
+			String message = "To EPR has an invalid value";
+			throw new SandeshaException(message);
+		}
 
 		terminateRMMessage.setTo(new EndpointReference(toEPR.getAddress()));
 		terminateRMMessage.setFrom(new EndpointReference(
@@ -266,6 +279,7 @@
 		//Set a retransmitter lastSentTime so that terminate will be send with
 		// some delay.
 		//Otherwise this get send before return of the current request (ack).
+		//TODO: refine the terminate delay.
 		terminateBean.setTimeToSend(System.currentTimeMillis()
 				+ Sandesha2Constants.TERMINATE_DELAY);
 
@@ -276,8 +290,6 @@
 		SenderBeanMgr retramsmitterMgr = storageManager
 				.getRetransmitterBeanMgr();
 
-		
-
 		retramsmitterMgr.insert(terminateBean);
 		
 		SequencePropertyBean terminateAdded = new SequencePropertyBean();
@@ -286,9 +298,6 @@
 		terminateAdded.setValue("true");
 
 		seqPropMgr.insert(terminateAdded);
-		
-		
-
 	}
 	
 	private static long getNoOfMessagesAcked (Iterator ackRangeIterator) {
@@ -305,5 +314,4 @@
 		
 		return noOfMsgs;
 	}
-
 }

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java?rev=366091&r1=366090&r2=366091&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java Wed Jan  4 21:59:57 2006
@@ -34,6 +34,8 @@
 import org.apache.axis2.engine.AxisEngine;
 import org.apache.axis2.soap.SOAPEnvelope;
 import org.apache.axis2.soap.SOAPFactory;
+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.SandeshaException;
@@ -69,6 +71,8 @@
 
 	private boolean letInvoke = false;
 
+	private Log log = LogFactory.getLog(getClass());
+	
 	public void processMessage(RMMsgContext rmMsgCtx) throws SandeshaException {
 
 		//Processing for ack if any
@@ -81,8 +85,11 @@
 
 		//Processing the application message.
 		MessageContext msgCtx = rmMsgCtx.getMessageContext();
-		if (msgCtx == null)
-			throw new SandeshaException("Message context is null");
+		if (msgCtx == null) {
+			String message = "Message context is null";
+			log.debug(message);
+			throw new SandeshaException(message);
+		}
 
 		if (rmMsgCtx
 				.getProperty(Sandesha2Constants.APPLICATION_PROCESSING_DONE) != null
@@ -115,8 +122,11 @@
 		String sequenceId = sequence.getIdentifier().getIdentifier();
 		ConfigurationContext configCtx = rmMsgCtx.getMessageContext()
 				.getConfigurationContext();
-		if (configCtx == null)
-			throw new SandeshaException("Configuration Context is null");
+		if (configCtx == null) {
+			String message = "Configuration Context is null";
+			log.debug(message);
+			throw new SandeshaException(message);
+		}
 
 		//updating the last activated time of the sequence.
 		SequenceManager.updateLastActivatedTime(sequenceId,configCtx);
@@ -125,9 +135,12 @@
 				Sandesha2Constants.SequenceProperties.RECEIVED_MESSAGES);
 
 		long msgNo = sequence.getMessageNumber().getMessageNumber();
-		if (msgNo == 0)
-			throw new SandeshaException("Wrong message number");
-
+		if (msgNo == 0) {
+			String message = "Wrong message number";
+			log.debug(message);
+			throw new SandeshaException(message);
+		}
+		
 		String messagesStr = (String) msgsBean.getValue();
 
 		if (msgNoPresentInList(messagesStr, msgNo)
@@ -135,9 +148,7 @@
 			//this is a duplicate message and the invocation type is
 			// EXACTLY_ONCE.
 
-			//msgCtx.pause();
-			rmMsgCtx.getMessageContext().setPausedTrue(
-					new QName(Sandesha2Constants.IN_HANDLER_NAME));
+			rmMsgCtx.pause();
 
 		}
 
@@ -169,10 +180,12 @@
 		boolean inOrderInvocation = PropertyManager.getInstance()
 				.isInOrderInvocation();
 		if (inOrderInvocation) {
+			
 			//pause the message
-			//msgCtx.pause();
-			rmMsgCtx.getMessageContext().setPausedTrue(
-					new QName(Sandesha2Constants.IN_HANDLER_NAME));
+			rmMsgCtx.pause();
+//			rmMsgCtx.getMessageContext().setPausedTrue(
+//					new QName(Sandesha2Constants.IN_HANDLER_NAME));
+			
 			SequencePropertyBean incomingSequenceListBean = (SequencePropertyBean) seqPropMgr
 					.retrieve(
 							Sandesha2Constants.SequenceProperties.ALL_SEQUENCES,
@@ -296,8 +309,7 @@
 		AxisOperation ackOperation = null;
 
 		try {
-			ackOperation = AxisOperationFactory
-					.getOperetionDescription(AxisOperationFactory.MEP_URI_IN_ONLY);
+			ackOperation = AxisOperationFactory.getOperationDescription(AxisOperationFactory.MEP_URI_IN_ONLY);
 		} catch (AxisFault e) {
 			throw new SandeshaException("Could not create the Operation");
 		}

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqMsgProcessor.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqMsgProcessor.java?rev=366091&r1=366090&r2=366091&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqMsgProcessor.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqMsgProcessor.java Wed Jan  4 21:59:57 2006
@@ -25,6 +25,8 @@
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.engine.AxisEngine;
 import org.apache.axis2.util.Utils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.sandesha2.Sandesha2Constants;
 import org.apache.sandesha2.RMMsgContext;
 import org.apache.sandesha2.SandeshaException;
@@ -50,22 +52,22 @@
 
 public class CreateSeqMsgProcessor implements MsgProcessor {
 
+	private Log log = LogFactory.getLog(getClass());
+	
 	public void processMessage(RMMsgContext createSeqRMMsg)
 			throws SandeshaException {
 
 		MessageContext createSeqMsg = createSeqRMMsg.getMessageContext();
 		CreateSequence createSeqPart = (CreateSequence) createSeqRMMsg
 				.getMessagePart(Sandesha2Constants.MessageParts.CREATE_SEQ);
-		if (createSeqPart == null)
-			throw new SandeshaException(
-					"No create sequence part is present in the create sequence message");
+		if (createSeqPart == null) {
+			String message = "No create sequence part is present in the create sequence message"; 
+			log.debug(message);
+			throw new SandeshaException(message);
+		}
 
 		MessageContext outMessage = null;
-		try {
-			outMessage = Utils.createOutMessageContext(createSeqMsg);
-		} catch (AxisFault e) {
-			throw new SandeshaException(e.getMessage());
-		}
+		outMessage = Utils.createOutMessageContext(createSeqMsg);
 		
 		ConfigurationContext context = createSeqRMMsg.getMessageContext()
 			.getConfigurationContext();
@@ -94,9 +96,11 @@
 			Accept accept = createSeqResPart.getAccept();
 			if (accept != null) {
 				SequenceOffer offer = createSeqPart.getSequenceOffer();
-				if (offer == null)
-					throw new SandeshaException(
-							"Internal error - no offer for the response message with Accept");
+				if (offer == null) {
+					String message = "Internal error - no offer for the response message with Accept"; 
+					log.debug(message);
+					throw new SandeshaException(message);
+				}
 
 				//Setting the CreateSequence table entry.
 				String incomingSeqId = createSeqResPart.getIdentifier()
@@ -105,11 +109,7 @@
 				CreateSeqBean createSeqBean = new CreateSeqBean();
 				createSeqBean.setSequenceID(outSequenceId);
 				createSeqBean.setInternalSequenceID(newSequenceId);
-				createSeqBean.setCreateSeqMsgID(SandeshaUtil.getUUID()); //this
-				// is a
-				// dummy
-				// value.
-
+				createSeqBean.setCreateSeqMsgID(SandeshaUtil.getUUID()); //this is a dummy value.
 				
 				CreateSeqBeanMgr createSeqMgr = storageManager
 						.getCreateSeqBeanMgr();
@@ -142,23 +142,25 @@
 
 			CreateSequence createSeq = (CreateSequence) createSeqRMMsg
 					.getMessagePart(Sandesha2Constants.MessageParts.CREATE_SEQ);
-			if (createSeq == null)
-				throw new AxisFault(
-						"Create sequence part not present in the create sequence message");
+			if (createSeq == null) {
+				String message = "Create sequence part not present in the create sequence message";
+				log.debug(message);
+				throw new AxisFault(message);
+			}
 
 			EndpointReference acksTo = createSeq.getAcksTo().getAddress()
 					.getEpr();
 			if (acksTo == null || acksTo.getAddress() == null
-					|| acksTo.getAddress() == "")
-				throw new AxisFault(
-						"Acks to not present in the create sequence message");
+					|| acksTo.getAddress() == "") {
+				String message = "Acks to not present in the create sequence message";
+				log.debug(message);
+				throw new AxisFault(message);
+			}
 
 			SequencePropertyBean seqPropBean = new SequencePropertyBean(
 					newSequenceId, Sandesha2Constants.SequenceProperties.ACKS_TO_EPR,
 					acksTo.getAddress());
 
-//			StorageManager storageManager = SandeshaUtil
-//					.getSandeshaStorageManager(context);
 			SequencePropertyBeanMgr seqPropMgr = storageManager
 					.getSequencePropretyBeanMgr();
 			seqPropMgr.insert(seqPropBean);
@@ -175,8 +177,11 @@
 			
 			SequencePropertyBean toBean = seqPropMgr.retrieve(newSequenceId,Sandesha2Constants.SequenceProperties.TO_EPR);
 			
-			if (toBean==null)
-				throw new SandeshaException ("Internal Error: wsa:To value is not set");
+			if (toBean==null) {
+				String message = "Internal Error: wsa:To value is not set";
+				log.debug(message);
+				throw new SandeshaException (message);
+			}
 			
 			EndpointReference toEPR = new EndpointReference (toBean.getValue());
 			
@@ -192,8 +197,7 @@
 			throw new SandeshaException(e1.getMessage());
 		}
 
-		//createSeqMsg.pause();
-		createSeqRMMsg.getMessageContext().setPausedTrue(new QName (Sandesha2Constants.IN_HANDLER_NAME));
+		createSeqRMMsg.pause();
 		
 		createSequenceTransaction.commit();
 	}

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqResponseMsgProcessor.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqResponseMsgProcessor.java?rev=366091&r1=366090&r2=366091&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqResponseMsgProcessor.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqResponseMsgProcessor.java Wed Jan  4 21:59:57 2006
@@ -17,8 +17,17 @@
 
 package org.apache.sandesha2.msgprocessors;
 
-import org.apache.sandesha2.Sandesha2Constants;
+import java.util.Iterator;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.soap.SOAPFactory;
+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.SandeshaException;
 import org.apache.sandesha2.storage.StorageManager;
 import org.apache.sandesha2.storage.Transaction;
@@ -40,14 +49,6 @@
 import org.apache.sandesha2.wsrm.Identifier;
 import org.apache.sandesha2.wsrm.Sequence;
 import org.apache.sandesha2.wsrm.SequenceAcknowledgement;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.soap.SOAPFactory;
-
-import java.util.Iterator;
-import javax.xml.namespace.QName;
 
 /**
  * Responsible for processing an incoming Create Sequence Response message.
@@ -56,6 +57,9 @@
  */
 
 public class CreateSeqResponseMsgProcessor implements MsgProcessor {
+	
+	private Log log = LogFactory.getLog(getClass());
+	
 	public void processMessage(RMMsgContext createSeqResponseRMMsgCtx)
 			throws SandeshaException {
 
@@ -66,8 +70,8 @@
 			.getMessageContext().getConfigurationContext();		
 		StorageManager storageManager = SandeshaUtil
 			.getSandeshaStorageManager(configCtx);
-		//Processing for ack if any
 		
+		//Processing for ack if available
 		Transaction ackProcessTransaction = storageManager.getTransaction();
 		
 		SequenceAcknowledgement sequenceAck = (SequenceAcknowledgement) createSeqResponseRMMsgCtx
@@ -86,30 +90,41 @@
 		
 		CreateSequenceResponse createSeqResponsePart = (CreateSequenceResponse) createSeqResponseRMMsgCtx
 				.getMessagePart(Sandesha2Constants.MessageParts.CREATE_SEQ_RESPONSE);
-		if (createSeqResponsePart == null)
-			throw new SandeshaException("Create Sequence Response part is null");
+		if (createSeqResponsePart == null) {
+			String message = "Create Sequence Response part is null";
+			log.debug(message);
+			throw new SandeshaException(message);
+		}
 
 		String newOutSequenceId = createSeqResponsePart.getIdentifier()
 				.getIdentifier();
-		if (newOutSequenceId == null)
-			throw new SandeshaException("New sequence Id is null");
+		if (newOutSequenceId == null) {
+			String message = "New sequence Id is null";
+			log.debug(message);
+			throw new SandeshaException(message);
+		}
 
 		String createSeqMsgId = createSeqResponseRMMsgCtx.getMessageContext()
 				.getRelatesTo().getValue();
 
 
-
 		SenderBeanMgr retransmitterMgr = storageManager
 				.getRetransmitterBeanMgr();
 		CreateSeqBeanMgr createSeqMgr = storageManager.getCreateSeqBeanMgr();
 
 		CreateSeqBean createSeqBean = createSeqMgr.retrieve(createSeqMsgId);
-		if (createSeqBean == null)
-			throw new SandeshaException("Create Sequence entry is not found");
+		if (createSeqBean == null) {
+			String message = "Create Sequence entry is not found";
+			log.debug(message);
+			throw new SandeshaException(message);
+		}
 
 		String internalSequenceId = createSeqBean.getInternalSequenceID();
-		if (internalSequenceId == null || "".equals(internalSequenceId))
-			throw new SandeshaException("TempSequenceId has is not set");
+		if (internalSequenceId == null || "".equals(internalSequenceId)) {
+			String message = "TempSequenceId has is not set";
+			log.debug(message);
+			throw new SandeshaException(message);
+		}
 
 		//deleting the create sequence entry.
 		retransmitterMgr.delete(createSeqMsgId);
@@ -142,9 +157,11 @@
 							Sandesha2Constants.SequenceProperties.OFFERED_SEQUENCE);
 
 			//TODO this should be detected in the Fault manager.
-			if (offeredSequenceBean == null)
-				throw new SandeshaException(
-						"No offered sequence. But an accept was received");
+			if (offeredSequenceBean == null) {
+				String message = "No offered sequence. But an accept was received"; 
+				log.debug(message);
+				throw new SandeshaException(message);
+			}
 
 			String offeredSequenceId = (String) offeredSequenceBean.getValue();
 
@@ -189,9 +206,11 @@
 
 			Sequence sequencePart = (Sequence) applicaionRMMsg
 					.getMessagePart(Sandesha2Constants.MessageParts.SEQUENCE);
-			if (sequencePart == null)
-				throw new SandeshaException("Sequence part is null");
-
+			if (sequencePart == null) {
+				String message = "Sequence part is null";
+				log.debug(message);
+				throw new SandeshaException(message);
+			}
 			Identifier identifier = new Identifier(factory);
 			identifier.setIndentifer(newOutSequenceId);
 
@@ -210,7 +229,7 @@
 			} catch (AxisFault e) {
 				throw new SandeshaException(e.getMessage());
 			}
-
+			
 			//asking to send the application msssage
 			tempBean.setSend(true);
 			retransmitterMgr.update(tempBean);
@@ -224,7 +243,6 @@
 				.setProperty(org.apache.axis2.Constants.RESPONSE_WRITTEN,
 						"false");
 
-		//createSeqResponseRMMsgCtx.getMessageContext().pause();
-		createSeqResponseRMMsgCtx.getMessageContext().setPausedTrue(new QName (Sandesha2Constants.IN_HANDLER_NAME));
+		createSeqResponseRMMsgCtx.pause();
 	}
 }

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/TerminateSeqMsgProcessor.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/TerminateSeqMsgProcessor.java?rev=366091&r1=366090&r2=366091&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/TerminateSeqMsgProcessor.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/TerminateSeqMsgProcessor.java Wed Jan  4 21:59:57 2006
@@ -17,10 +17,10 @@
 
 package org.apache.sandesha2.msgprocessors;
 
-import javax.xml.namespace.QName;
-
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.MessageContext;
+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.SandeshaException;
@@ -42,27 +42,35 @@
 
 public class TerminateSeqMsgProcessor implements MsgProcessor {
 
-	public void processMessage(RMMsgContext terminateSeqRMMSg)
+	private Log log = LogFactory.getLog(getClass());
+	
+	public void processMessage(RMMsgContext terminateSeqRMMsg)
 			throws SandeshaException {
 
-		MessageContext terminateSeqMsg = terminateSeqRMMSg.getMessageContext();
+		MessageContext terminateSeqMsg = terminateSeqRMMsg.getMessageContext();
 		//Processing for ack if any
-		SequenceAcknowledgement sequenceAck = (SequenceAcknowledgement) terminateSeqRMMSg
+		SequenceAcknowledgement sequenceAck = (SequenceAcknowledgement) terminateSeqRMMsg
 				.getMessagePart(Sandesha2Constants.MessageParts.SEQ_ACKNOWLEDGEMENT);
 		if (sequenceAck != null) {
 			AcknowledgementProcessor ackProcessor = new AcknowledgementProcessor();
-			ackProcessor.processMessage(terminateSeqRMMSg);
+			ackProcessor.processMessage(terminateSeqRMMsg);
 		}
 		
 		//Processing the terminate message
 		//TODO Add terminate sequence message logic.
-		TerminateSequence terminateSequence = (TerminateSequence) terminateSeqRMMSg.getMessagePart(Sandesha2Constants.MessageParts.TERMINATE_SEQ);
-		if (terminateSequence==null)
-			throw new SandeshaException ("Terminate Sequence part is not available");
+		TerminateSequence terminateSequence = (TerminateSequence) terminateSeqRMMsg.getMessagePart(Sandesha2Constants.MessageParts.TERMINATE_SEQ);
+		if (terminateSequence==null) {
+			String message = "Terminate Sequence part is not available";
+			log.debug(message);
+			throw new SandeshaException (message);
+		}
 		
 		String sequenceId = terminateSequence.getIdentifier().getIdentifier();
-		if (sequenceId==null || "".equals(sequenceId))
-			throw new SandeshaException ("Invalid sequence id");
+		if (sequenceId==null || "".equals(sequenceId)) {
+			String message = "Invalid sequence id";
+			log.debug(message);
+			throw new SandeshaException (message);
+		}
 		
 		ConfigurationContext context = terminateSeqMsg.getConfigurationContext();
 		StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(context);
@@ -86,8 +94,6 @@
 		
 		SequenceManager.updateLastActivatedTime(sequenceId,context);
 
-		//terminateSeqMsg.pause();
-		terminateSeqRMMSg.getMessageContext().setPausedTrue(new QName (Sandesha2Constants.IN_HANDLER_NAME));
-
+		terminateSeqRMMsg.pause();
 	}
 }

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/storage/inmemory/InMemorySequencePropertyBeanMgr.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/storage/inmemory/InMemorySequencePropertyBeanMgr.java?rev=366091&r1=366090&r2=366091&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/storage/inmemory/InMemorySequencePropertyBeanMgr.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/storage/inmemory/InMemorySequencePropertyBeanMgr.java Wed Jan  4 21:59:57 2006
@@ -46,6 +46,13 @@
 	}
 
 	public boolean delete(String sequenceId, String name) {
+		
+		SequencePropertyBean bean = retrieve( sequenceId,name);
+		
+		if (bean.getName().equals(Sandesha2Constants.SequenceProperties.INTERNAL_SEQUENCE_ID)) {
+			int i=1;
+		}
+		
 		return table.remove(sequenceId + ":" + name) != null;
 	}
 
@@ -54,6 +61,9 @@
 	}
 
 	public boolean insert(SequencePropertyBean bean) {
+		
+
+		
 		table.put(bean.getSequenceID() + ":" + bean.getName(), bean);
 		return true;
 	}

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/util/PropertyManager.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/util/PropertyManager.java?rev=366091&r1=366090&r2=366091&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/util/PropertyManager.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/util/PropertyManager.java Wed Jan  4 21:59:57 2006
@@ -21,6 +21,8 @@
 import java.io.InputStream;
 import java.util.Properties;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.sandesha2.Sandesha2Constants;
 import org.apache.sandesha2.policy.RMPolicyBean;
 
@@ -34,6 +36,8 @@
 
 	public static PropertyManager instance = null;
 	
+	Log log = LogFactory.getLog(getClass());
+	
 	private SandeshaPropertyBean propertyBean = null;
 	 
 	private PropertyManager () {
@@ -53,7 +57,7 @@
 			
 			loadPropertiesToBean (properties);
 		} catch (IOException e) {
-			System.out.println("A valid property file was not found. Using default values...");
+			log.info ("A valid property file was not found. Using default values...");
 		}
 	}
 	

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/util/RMMsgCreator.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/util/RMMsgCreator.java?rev=366091&r1=366090&r2=366091&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/util/RMMsgCreator.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/util/RMMsgCreator.java Wed Jan  4 21:59:57 2006
@@ -32,9 +32,9 @@
 import org.apache.axis2.soap.SOAPEnvelope;
 import org.apache.axis2.soap.SOAPFactory;
 import org.apache.sandesha2.RMMsgContext;
-import org.apache.sandesha2.Sandesha2ClientAPI;
 import org.apache.sandesha2.Sandesha2Constants;
 import org.apache.sandesha2.SandeshaException;
+import org.apache.sandesha2.client.Sandesha2ClientAPI;
 import org.apache.sandesha2.storage.StorageManager;
 import org.apache.sandesha2.storage.beanmanagers.SequencePropertyBeanMgr;
 import org.apache.sandesha2.storage.beans.SequencePropertyBean;

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/util/SandeshaUtil.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/util/SandeshaUtil.java?rev=366091&r1=366090&r2=366091&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/util/SandeshaUtil.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/util/SandeshaUtil.java Wed Jan  4 21:59:57 2006
@@ -16,7 +16,6 @@
  */
 package org.apache.sandesha2.util;
 
-import java.io.InputStream;
 import java.lang.reflect.Constructor;
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -25,10 +24,9 @@
 import java.util.StringTokenizer;
 
 import javax.xml.namespace.QName;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
 
 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.context.MessageContextConstants;
@@ -39,21 +37,16 @@
 import org.apache.axis2.description.AxisService;
 import org.apache.axis2.description.AxisServiceGroup;
 import org.apache.axis2.engine.AxisConfiguration;
-import org.apache.axis2.i18n.Messages;
 import org.apache.axis2.om.OMElement;
-import org.apache.axis2.om.impl.llom.builder.StAXBuilder;
-import org.apache.axis2.om.impl.llom.builder.StAXOMBuilder;
 import org.apache.axis2.soap.SOAP11Constants;
 import org.apache.axis2.soap.SOAP12Constants;
 import org.apache.axis2.soap.SOAPEnvelope;
 import org.apache.axis2.soap.SOAPFactory;
 import org.apache.axis2.soap.SOAPHeader;
-import org.apache.axis2.soap.impl.llom.builder.StAXSOAPModelBuilder;
-import org.apache.axis2.soap.impl.llom.soap11.SOAP11Factory;
-import org.apache.axis2.transport.http.HTTPConstants;
-import org.apache.axis2.transport.http.HTTPTransportUtils;
 import org.apache.axis2.util.UUIDGenerator;
 import org.apache.axis2.util.Utils;
+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.SandeshaException;
@@ -79,6 +72,8 @@
 	private static Sender sender = new Sender();
 
 	private static InOrderInvoker invoker = new InOrderInvoker();
+	
+	private static Log log = LogFactory.getLog(SandeshaUtil.class);
 
 	/**
 	 * Create a new UUID.
@@ -159,7 +154,9 @@
 				long msgNo = Long.parseLong(temp);
 				msgNubers.add(new Long(msgNo));
 			} catch (Exception ex) {
-				throw new SandeshaException("Invalid msg number list");
+				String message = "Invalid msg number list";
+				log.debug(message);
+				throw new SandeshaException(message);
 			}
 		}
 
@@ -202,8 +199,11 @@
 	 */
 	public static String storeMessageContext(MessageContext ctx)
 			throws SandeshaException {
-		if (ctx == null)
-			throw new SandeshaException("Stored Msg Ctx is null");
+		if (ctx == null) {
+			String message = "Stored Msg Ctx is null";
+			log.debug(message);
+			throw new SandeshaException(message);
+		}
 
 		String key = getUUID();
 		storedMsgContexts.put(key, ctx);
@@ -261,7 +261,7 @@
 		return false;
 	}
 
-	public static SOAPEnvelope createSOAPMessage(MessageContext msgContext,
+	/*public static SOAPEnvelope createSOAPMessage(MessageContext msgContext,
 			String soapNamespaceURI) throws AxisFault {
 		try {
 
@@ -310,7 +310,7 @@
 			throw new AxisFault(e);
 		}
 
-	}
+	}*/
 
 	public static String getMessageTypeString(int messageType) {
 		switch (messageType) {
@@ -409,7 +409,6 @@
 			return storageManager;
 
 		} catch (Exception e) {
-			System.out.println(e.getMessage());
 			throw new SandeshaException(e.getMessage());
 		}
 	}
@@ -467,6 +466,7 @@
 			return faultRMMsgCtx;
 
 		} catch (AxisFault e) {
+			log.debug(e.getMessage());
 			throw new SandeshaException(e.getMessage());
 		}
 	}
@@ -506,7 +506,7 @@
 				newMessageContext.setServiceContextID(referenceMessage
 						.getServiceContextID());
 			} else {
-				AxisService axisService = new AxisService (new QName ("AnonymousRMService")); //just a dummy name.
+				AxisService axisService = new AxisService ("AnonymousRMService"); //just a dummy name.
 				ServiceContext serviceContext = new ServiceContext (axisService,newMessageContext.getServiceGroupContext());
 				
 				newMessageContext.setAxisService(axisService);
@@ -530,26 +530,25 @@
 					.getTransportOut());
 
 			copyNecessaryPropertiesFromRelatedContext (referenceMessage,newMessageContext);
+			
 			//copying transport info.
 			newMessageContext.setProperty(MessageContext.TRANSPORT_OUT,
 					referenceMessage.getProperty(MessageContext.TRANSPORT_OUT));
-			newMessageContext.setProperty(HTTPConstants.HTTPOutTransportInfo,
-					referenceMessage
-							.getProperty(HTTPConstants.HTTPOutTransportInfo));
 			newMessageContext.setProperty(Sandesha2Constants.WSP.RM_POLICY_BEAN,
 					referenceMessage
 					.getProperty(Sandesha2Constants.WSP.RM_POLICY_BEAN));
 
-//			newMessageContext.setProperty(Constants.OUT_TRANSPORT_INFO,referenceMessage.getProperty(Constants.OUT_TRANSPORT_INFO));
-//			newMessageContext.setProperty(MessageContext.TRANSPORT_HEADERS,referenceMessage.getProperty(MessageContext.TRANSPORT_HEADERS));
-//			newMessageContext.setProperty(MessageContext.TRANSPORT_IN,referenceMessage.getProperty(MessageContext.TRANSPORT_IN));
-//			newMessageContext.setProperty(MessageContext.TRANSPORT_OUT,referenceMessage.getProperty(MessageContext.TRANSPORT_OUT));
-//			newMessageContext.setExecutionChain(referenceMessage.getExecutionChain());
+			newMessageContext.setProperty(Constants.OUT_TRANSPORT_INFO,referenceMessage.getProperty(Constants.OUT_TRANSPORT_INFO));
+			newMessageContext.setProperty(MessageContext.TRANSPORT_HEADERS,referenceMessage.getProperty(MessageContext.TRANSPORT_HEADERS));
+			newMessageContext.setProperty(MessageContext.TRANSPORT_IN,referenceMessage.getProperty(MessageContext.TRANSPORT_IN));
+			newMessageContext.setProperty(MessageContext.TRANSPORT_OUT,referenceMessage.getProperty(MessageContext.TRANSPORT_OUT));
+			newMessageContext.setExecutionChain(referenceMessage.getExecutionChain());
 			
 			
 			return newMessageContext;
 
 		} catch (AxisFault e) {
+			log.debug(e.getMessage());
 			throw new SandeshaException(e.getMessage());
 		}
 
@@ -563,13 +562,19 @@
 		if (str==null)
 			return new ArrayList ();
 		
-		if (str.length()<2)
-			throw new SandeshaException ("Invalid String array");
+		if (str.length()<2) {
+			String message = "Invalid String array";
+			log.debug(message);
+			throw new SandeshaException (message);
+		}
 		
 		int length = str.length();
 		
-		if (str.charAt(0)!='[' || str.charAt(length-1)!=']')
-			throw new SandeshaException ("Invalid String array");
+		if (str.charAt(0)!='[' || str.charAt(length-1)!=']') {
+			String message = "Invalid String array";
+			log.debug(message);
+			throw new SandeshaException (message);
+		}
 		
 		ArrayList retArr = new ArrayList ();
 		

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/util/SequenceManager.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/util/SequenceManager.java?rev=366091&r1=366090&r2=366091&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/util/SequenceManager.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/util/SequenceManager.java Wed Jan  4 21:59:57 2006
@@ -11,14 +11,15 @@
 
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.context.AbstractContext;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.context.MessageContextConstants;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.sandesha2.RMMsgContext;
-import org.apache.sandesha2.Sandesha2ClientAPI;
 import org.apache.sandesha2.Sandesha2Constants;
 import org.apache.sandesha2.SandeshaException;
+import org.apache.sandesha2.client.Sandesha2ClientAPI;
 import org.apache.sandesha2.policy.RMPolicyBean;
 import org.apache.sandesha2.storage.StorageManager;
 import org.apache.sandesha2.storage.Transaction;
@@ -36,30 +37,38 @@
 
 public class SequenceManager {
 
+	private static Log log = LogFactory.getLog(SequenceManager.class);
+	
 	public static String setupNewSequence(RMMsgContext createSequenceMsg)
 			throws AxisFault {
 
 		String sequenceId = SandeshaUtil.getUUID();
-		AbstractContext context = createSequenceMsg.getContext();
 
 		EndpointReference to = createSequenceMsg.getTo();
-		if (to == null)
-			throw new AxisFault("To is null");
+		if (to == null) {
+			String message = "To is null";
+			log.debug(message);
+			throw new AxisFault(message);
+		}
 
 		EndpointReference replyTo = createSequenceMsg.getReplyTo();
-//		if (replyTo == null)
-//			throw new AxisFault("ReplyTo is null");
 
 		CreateSequence createSequence = (CreateSequence) createSequenceMsg
 				.getMessagePart(Sandesha2Constants.MessageParts.CREATE_SEQ);
-		if (createSequence == null)
-			throw new AxisFault("Create Sequence Part is null");
+		if (createSequence == null) {
+			String message = "Create Sequence Part is null";
+			log.debug(message);
+			throw new AxisFault(message);
+		}
 
 		EndpointReference acksTo = createSequence.getAcksTo().getAddress()
 				.getEpr();
 
-		if (acksTo == null)
-			throw new AxisFault("AcksTo is null");
+		if (acksTo == null) {
+			String message = "AcksTo is null";
+			log.debug(message);
+			throw new AxisFault(message);
+		}
 
 		StorageManager storageManager = null;
 
@@ -101,8 +110,7 @@
 
 		NextMsgBeanMgr nextMsgMgr = storageManager.getNextMsgBeanMgr();
 		nextMsgMgr.insert(new NextMsgBean(sequenceId, 1)); // 1 will be the next
-		// message to invoke
-		//this will apply for only in-order invocations.
+		// message to invoke. This will apply for only in-order invocations.
 
 		updateLastActivatedTime(sequenceId,createSequenceMsg.getMessageContext().getConfigurationContext());
 		
@@ -117,8 +125,6 @@
 			MessageContext firstAplicationMsgCtx, String internalSequenceId)
 			throws SandeshaException {
 
-		AbstractContext context = firstAplicationMsgCtx.getConfigurationContext();
- 
 		StorageManager storageManager = SandeshaUtil
 				.getSandeshaStorageManager(firstAplicationMsgCtx
 						.getConfigurationContext());
@@ -127,12 +133,14 @@
 				.getSequencePropretyBeanMgr();
 
 		EndpointReference toEPR = firstAplicationMsgCtx.getTo();
-		EndpointReference replyToEPR = firstAplicationMsgCtx.getReplyTo();
 		String acksTo = (String) firstAplicationMsgCtx
 				.getProperty(Sandesha2ClientAPI.AcksTo);
 
-		if (toEPR == null)
-			throw new SandeshaException("WS-Addressing To is null");
+		if (toEPR == null) {
+			String message = "WS-Addressing To is null";
+			log.debug(message);
+			throw new SandeshaException(message);
+		}
 
 		SequencePropertyBean toBean = new SequencePropertyBean(internalSequenceId,
 				Sandesha2Constants.SequenceProperties.TO_EPR, toEPR.getAddress());
@@ -240,11 +248,17 @@
 		findSeqIDBean.setName(Sandesha2Constants.SequenceProperties.INTERNAL_SEQUENCE_ID);
 		Collection seqIDBeans = seqPropBeanMgr.find(findSeqIDBean);
 		
-		if (seqIDBeans.size()==0)
-			throw new SandeshaException ("A sequence with give data has not been created");
+		if (seqIDBeans.size()==0) {
+			String message = "A sequence with give data has not been created";
+			log.debug(message);
+			throw new SandeshaException (message);
+		}
 		
-		if (seqIDBeans.size()>1) 
-			throw new SandeshaException ("Sequence data is not unique. Cant generate report");
+		if (seqIDBeans.size()>1) {
+			String message = "Sequence data is not unique. Cant generate report";
+			log.debug(message);
+			throw new SandeshaException (message);
+		}
 		
 		SequencePropertyBean seqIDBean = (SequencePropertyBean) seqIDBeans.iterator().next();
 		String sequenceID = seqIDBean.getSequenceID();
@@ -269,11 +283,17 @@
 		findSeqIDBean.setName(Sandesha2Constants.SequenceProperties.INTERNAL_SEQUENCE_ID);
 		Collection seqIDBeans = seqPropBeanMgr.find(findSeqIDBean);
 		
-		if (seqIDBeans.size()==0)
-			throw new SandeshaException ("A sequence with give data has not been created");
+		if (seqIDBeans.size()==0) {
+			String message = "A sequence with give data has not been created";
+			log.debug(message);
+			throw new SandeshaException (message);
+		}
 		
-		if (seqIDBeans.size()>1) 
-			throw new SandeshaException ("Sequence data is not unique. Cant generate report");
+		if (seqIDBeans.size()>1) {
+			String message = "Sequence data is not unique. Cant generate report";
+			log.debug(message);
+			throw new SandeshaException (message);
+		}
 		
 		SequencePropertyBean seqIDBean = (SequencePropertyBean) seqIDBeans.iterator().next();
 		String sequenceID = seqIDBean.getSequenceID();
@@ -306,7 +326,6 @@
 			String temp = tokenizer.nextToken();
 			count++;
 		}
-
 
 		transaction.commit();
 		return count;

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/workers/InOrderInvoker.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/workers/InOrderInvoker.java?rev=366091&r1=366090&r2=366091&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/workers/InOrderInvoker.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/workers/InOrderInvoker.java Wed Jan  4 21:59:57 2006
@@ -24,11 +24,13 @@
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.context.ServiceContext;
 import org.apache.axis2.engine.AxisEngine;
-import org.apache.sandesha2.Sandesha2ClientAPI;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.sandesha2.Sandesha2Constants;
 import org.apache.sandesha2.RMMsgContext;
 import org.apache.sandesha2.SandeshaException;
 import org.apache.sandesha2.TerminateManager;
+import org.apache.sandesha2.client.Sandesha2ClientAPI;
 import org.apache.sandesha2.storage.StorageManager;
 import org.apache.sandesha2.storage.beanmanagers.NextMsgBeanMgr;
 import org.apache.sandesha2.storage.beanmanagers.SequencePropertyBeanMgr;
@@ -52,6 +54,8 @@
 	boolean invokerStarted = false;
 
 	ConfigurationContext context = null;
+	
+	Log log = LogFactory.getLog(getClass());
 
 	public synchronized void stopInvoker() {
 		invokerStarted = false;
@@ -78,9 +82,8 @@
 			try {
 				Thread.sleep(1000);
 			} catch (InterruptedException ex) {
-				System.out.println("Invoker was Inturrepted....");
-				ex.printStackTrace();
-				System.out.println("End printing Interrupt...");
+				log.debug("Invoker was Inturrepted....");
+				log.debug(ex.getMessage());
 			}
 
 			try {
@@ -142,27 +145,14 @@
 
 						try {
 							//Invoking the message.
-							new AxisEngine(msgToInvoke.getConfigurationContext())
-									.receive(msgToInvoke);
-//							new AxisEngine (msgToInvoke.getConfigurationContext())
-//									.resumeReceive(msgToInvoke);
+//							new AxisEngine(msgToInvoke.getConfigurationContext())
+//									.receive(msgToInvoke);
+							new AxisEngine (msgToInvoke.getConfigurationContext())
+									.resume(msgToInvoke);
+							
+							log.info("Invoker invoking a '" + SandeshaUtil.getMessageTypeString(rmMsg
+												.getMessageType()) + "' message.");
 							
-							ServiceContext serviceContext = msgToInvoke
-									.getServiceContext();
-							Object debug = null;
-							if (serviceContext != null) {
-								debug = msgToInvoke
-										.getProperty(Sandesha2ClientAPI.SANDESHA_DEBUG_MODE);
-								if (debug != null && "on".equals(debug)) {
-									System.out
-											.println("DEBUG: Invoker invoking a '"
-													+ SandeshaUtil
-															.getMessageTypeString(rmMsg
-																	.getMessageType())
-													+ "' message.");
-								}
-							}
-
 							//deleting the message entry.
 							storageMapMgr.delete(key);
 

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/workers/Sender.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/workers/Sender.java?rev=366091&r1=366090&r2=366091&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/workers/Sender.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/workers/Sender.java Wed Jan  4 21:59:57 2006
@@ -22,12 +22,16 @@
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.context.ServiceContext;
+import org.apache.axis2.context.OperationContext;
+import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.description.AxisOperationFactory;
 import org.apache.axis2.engine.AxisEngine;
 import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.axis2.transport.TransportUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.sandesha2.AcknowledgementManager;
 import org.apache.sandesha2.RMMsgContext;
-import org.apache.sandesha2.Sandesha2ClientAPI;
 import org.apache.sandesha2.Sandesha2Constants;
 import org.apache.sandesha2.SandeshaException;
 import org.apache.sandesha2.TerminateManager;
@@ -55,6 +59,8 @@
 	private boolean senderStarted = false;
 
 	private ConfigurationContext context = null;
+	
+	Log log = LogFactory.getLog(getClass());
 
 	public synchronized void stopSender() {
 		senderStarted = false;
@@ -72,16 +78,18 @@
 			storageManager = SandeshaUtil.getSandeshaStorageManager(context);
 		} catch (SandeshaException e2) {
 			// TODO Auto-generated catch block
-			System.out.println("ERROR: Could not start sender");
+			log.debug ("ERROR: Could not start sender");
 			e2.printStackTrace();
 			return;
 		}
 
 		while (senderStarted) {
 			try {
-				if (context == null)
-					throw new SandeshaException(
-							"Can't continue the Sender. Context is null");
+				if (context == null) {
+					String message = "Can't continue the Sender. Context is null";
+					log.debug(message);
+					throw new SandeshaException(message);
+				}
 
 				Transaction pickMessagesToSendTransaction = storageManager.getTransaction(); //starting
 																			   // a
@@ -105,8 +113,7 @@
 					try {
 
 						if (msgCtx == null) {
-							System.out
-									.println("ERROR: Sender has an Unavailable Message entry");
+							log.debug ("ERROR: Sender has an Unavailable Message entry");
 							break;
 						}
 						RMMsgContext rmMsgCtx = MsgInitializer
@@ -114,21 +121,9 @@
 
 						updateMessage(msgCtx);
 
-						ServiceContext serviceContext = msgCtx
-								.getServiceContext();
-						Object debug = null;
-						if (serviceContext != null) {
-							debug = msgCtx
-									.getProperty(Sandesha2ClientAPI.SANDESHA_DEBUG_MODE);
-							if (debug != null && "on".equals(debug)) {
-								System.out
-										.println("DEBUG: Sender is sending a '"
-												+ SandeshaUtil
-														.getMessageTypeString(rmMsgCtx
-																.getMessageType())
-												+ "' message.");
-							}
-						}
+						
+						log.info("Sender is sending a '" + SandeshaUtil
+									.getMessageTypeString(rmMsgCtx.getMessageType()) + "' message.");
 						
 						Transaction preSendTransaction = storageManager.getTransaction();
 
@@ -145,34 +140,36 @@
 								//do time out processing.
 								
 								TerminateManager.terminateSendingSide(context,sequenceID);
-								throw new SandeshaException ("Sequence timed out");
+								String message = "Sequence timed out";
+								log.debug(message);
+								throw new SandeshaException (message);
 							}
 							
 							//piggybacking if an ack if available for the same
 							// sequence.
 							AcknowledgementManager
 									.piggybackAckIfPresent(rmMsgCtx);
-							
 						}
 						
 						preSendTransaction.commit();
 
 						try {
+							//every message should be resumed (pause==false) when sending
+							boolean paused = msgCtx.isPaused();
 							
 							AxisEngine engine = new AxisEngine(msgCtx
 									.getConfigurationContext());
-							engine.send(msgCtx);
-							//							if (msgCtx.isPaused())
-							//								engine.resumeSend(msgCtx);
-							//							else
-							//								engine.send(msgCtx);
-
+							if (paused) {
+								engine.resume(msgCtx);
+							}else  {
+								engine.send(msgCtx);
+							}
+							
 						} catch (Exception e) {
 							//Exception is sending. retry later
-							System.out
-									.println("Exception thrown in sending...");
-							e.printStackTrace();
-							//e.printStackTrace();
+							String message = "Exception thrown in sending...";
+							log.debug(message);
+							log.debug(e.getMessage());
 
 						}
 						
@@ -241,9 +238,9 @@
 				Thread.sleep(Sandesha2Constants.SENDER_SLEEP_TIME);
 			} catch (InterruptedException e1) {
 				//e1.printStackTrace();
-				System.out.println("Sender was interupted...");
-				e1.printStackTrace();
-				System.out.println("End printing Interrupt...");
+				log.debug("Sender was interupted...");
+				log.debug(e1.getMessage());
+				log.debug("End printing Interrupt...");
 			}
 		}
 
@@ -279,7 +276,9 @@
 			rmMsgCtx1.addSOAPEnvelope();
 
 		} catch (AxisFault e) {
-			throw new SandeshaException("Exception in updating contexts");
+			String message = "Exception in updating contexts";
+			log.debug(message);
+			throw new SandeshaException(message);
 		}
 
 	}
@@ -287,8 +286,55 @@
 	private void checkForSyncResponses(MessageContext msgCtx) {
 
 		try {
+			
 			boolean responsePresent = (msgCtx
 					.getProperty(MessageContext.TRANSPORT_IN) != null);
+			if (!responsePresent)
+				return;
+			
+			//we never expect sync responses. so we can freely create a new operation context for the incoming RM Specific message.
+	        // create the responseMessageContext
+	        MessageContext responseMessageContext = new MessageContext(msgCtx.getConfigurationContext(),
+	        		msgCtx.getSessionContext(), msgCtx.getTransportIn(),
+	        		msgCtx.getTransportOut());
+
+	        responseMessageContext.setProperty(MessageContext.TRANSPORT_IN,
+	        		msgCtx.getProperty(MessageContext.TRANSPORT_IN));
+	       // msgCtx.getAxisOperation().registerOperationContext(responseMessageContext, msgCtx.getOperationContext());
+	        responseMessageContext.setServerSide(false);
+	        responseMessageContext.setServiceContext(msgCtx.getServiceContext());
+	        responseMessageContext.setServiceGroupContext(msgCtx.getServiceGroupContext());
+
+	        //we never expect sync responses. so we can freely create a new operation context for the incoming RM Specific message.
+	        AxisOperation inOnlyOperation = AxisOperationFactory.getAxisOperation(AxisOperationFactory.MEP_CONSTANT_IN_ONLY);
+	        inOnlyOperation.setRemainingPhasesInFlow(msgCtx.getAxisOperation().getRemainingPhasesInFlow());
+	        
+	        OperationContext inOnlyOperationContext = new OperationContext (inOnlyOperation);
+	        responseMessageContext.setAxisOperation(inOnlyOperation);
+	        responseMessageContext.setOperationContext(inOnlyOperationContext);
+	        
+	        // If request is REST we assume the responseMessageContext is REST, so set the variable
+	        responseMessageContext.setDoingREST(msgCtx.isDoingREST());
+
+	        SOAPEnvelope resenvelope = TransportUtils.createSOAPMessage(responseMessageContext,
+	        		msgCtx.getEnvelope().getNamespace().getName());
+
+	        if (resenvelope != null) {
+	            responseMessageContext.setEnvelope(resenvelope);
+	            AxisEngine engine = new AxisEngine(msgCtx.getConfigurationContext());
+	            engine.receive(responseMessageContext);
+	        } else {
+	        	String message = "Exception is Receiving message...";
+	        	log.debug(message);
+	            throw new AxisFault(message);
+	        }
+			
+			
+			
+			
+			
+			/*boolean responsePresent = (msgCtx
+					.getProperty(MessageContext.TRANSPORT_IN) != null);
 
 			if (responsePresent) {
 				//create the response
@@ -311,34 +357,36 @@
 				response.setAxisService(msgCtx.getAxisService());
 				response.setAxisServiceGroup(msgCtx.getAxisServiceGroup());
 
+				
 				//setting the in-flow.
 				//ArrayList inPhaseHandlers =
 				// response.getAxisOperation().getRemainingPhasesInFlow();
-				/*
-				 * if (inPhaseHandlers==null || inPhaseHandlers.isEmpty()) {
-				 * ArrayList phases =
-				 * msgCtx.getSystemContext().getAxisConfiguration().getInPhasesUptoAndIncludingPostDispatch();
-				 * response.getAxisOperation().setRemainingPhasesInFlow(phases); }
-				 */
+				//
+				// if (inPhaseHandlers==null || inPhaseHandlers.isEmpty()) {
+				// ArrayList phases =
+				// msgCtx.getSystemContext().getAxisConfiguration().getInPhasesUptoAndIncludingPostDispatch();
+				// response.getAxisOperation().setRemainingPhasesInFlow(phases); }
+				//
 
 				//Changed following from TransportUtils to SandeshaUtil since
 				// op.
 				// context is anavailable.
 				SOAPEnvelope resenvelope = null;
-				resenvelope = SandeshaUtil.createSOAPMessage(response, msgCtx
-						.getEnvelope().getNamespace().getName());
+//				resenvelope = SandeshaUtil.createSOAPMessage(response, msgCtx
+//						.getEnvelope().getNamespace().getName());
 
+				resenvelope = TransportUtils.createSOAPMessage(response,msgCtx
+  						.getEnvelope().getNamespace().getName());
 				if (resenvelope != null) {
 					AxisEngine engine = new AxisEngine(msgCtx
 							.getConfigurationContext());
 					response.setEnvelope(resenvelope);
 					engine.receive(response);
 				}
-			}
+			} */
 
 		} catch (Exception e) {
-			System.out
-					.println("Exception was throws in processing the sync response...");
+			log.info("No valid Sync response...");
 		}
 	}
 



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