ws-sandesha-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chamik...@apache.org
Subject svn commit: r327099 - in /webservices/sandesha/trunk/src/org/apache/sandesha2: ./ handlers/ msgprocessors/ msgreceivers/
Date Fri, 21 Oct 2005 05:05:56 GMT
Author: chamikara
Date: Thu Oct 20 22:05:19 2005
New Revision: 327099

URL: http://svn.apache.org/viewcvs?rev=327099&view=rev
Log:
Moved CreeateSequence logic from RMMessageReceiver to CreateSequenceMsgProcessor.

Removed unnecessary prints.

Modified:
    webservices/sandesha/trunk/src/org/apache/sandesha2/Constants.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/Sender.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/CreateSeqMsgProcessor.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/TerminateSeqMsgProcessor.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/msgreceivers/RMMessageReceiver.java

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/Constants.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/Constants.java?rev=327099&r1=327098&r2=327099&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/Constants.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/Constants.java Thu Oct 20 22:05:19
2005
@@ -184,7 +184,7 @@
 
 			String NOT_IN_ORDER = "NotInOrder";
 
-			String DEFAULT_DELIVERY_ASSURANCE = NOT_IN_ORDER;
+			String DEFAULT_DELIVERY_ASSURANCE = IN_ORDER;
 		}
 		
 		public interface InvocationType {

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/Sender.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/Sender.java?rev=327099&r1=327098&r2=327099&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/Sender.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/Sender.java Thu Oct 20 22:05:19 2005
@@ -66,7 +66,6 @@
 	public void run() {
 
 		while (senderStarted) {
-			//System.out.println ("|-|");
 			try {
 				if (context == null)
 					throw new SandeshaException(
@@ -190,7 +189,6 @@
 						response, msgCtx.getEnvelope().getNamespace().getName());
 			} catch (AxisFault e) {
 				//TODO: change to log.debug
-				System.out.println("No response message");
 			}
 			
 			if (resenvelope != null) {

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=327099&r1=327098&r2=327099&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaInHandler.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaInHandler.java Thu
Oct 20 22:05:19 2005
@@ -51,7 +51,6 @@
 	}
 
 	public void invoke(MessageContext msgCtx) throws AxisFault {
-		System.out.println ("Sandesha in handler called");
 		
 		RMMsgContext rmMsgCtx = null;
 		try {
@@ -59,23 +58,6 @@
 		} catch (SandeshaException ex) {
 			throw new AxisFault("Cant initialize the message");
 		}
-		
-		System.out.println("Got message of type:" + rmMsgCtx.getMessageType() + " MessageId:" +
msgCtx.getMessageID());
-
-//		try {
-//			System.out.println("SandeshaInHandler Got a message of type:" + rmMsgCtx.getMessageType());
-//			XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(System.out);
-//			SOAPEnvelope env123 = msgCtx.getEnvelope();
-//			env123.serialize(writer);
-//		} catch (XMLStreamException e) {
-//			// TODO Auto-generated catch block
-//			e.printStackTrace();
-//		} catch (FactoryConfigurationError e) {
-//			// TODO Auto-generated catch block
-//			e.printStackTrace();
-//		}
-			
-
 
 		MsgProcessor msgProcessor = MsgProcessorFactory
 				.getMessageProcessor(rmMsgCtx.getMessageType());

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=327099&r1=327098&r2=327099&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java Thu
Oct 20 22:05:19 2005
@@ -66,7 +66,6 @@
 	}
 
 	public void invoke(MessageContext msgCtx) throws AxisFault {
-		System.out.println("Sandesha out handler called");
 
 		String DONE = (String) msgCtx
 				.getProperty(Constants.APPLICATION_PROCESSING_DONE);
@@ -231,7 +230,6 @@
 				String messageId1 = SandeshaUtil.getUUID();
 				if (rmMsgCtx.getMessageId()==null) {
 					rmMsgCtx.setMessageId(messageId1);
-					System.out.println("Message id was null");
 				}
 				//OperationContext opCtx = msgCtx.getOperationContext();
 //				msgCtx.getSystemContext().registerOperationContext(messageId,
@@ -397,9 +395,6 @@
 		CreateSeqBean createSeqBean = new CreateSeqBean(tempSequenceId,
 				createSeqMsg.getMessageID(), null);
 		createSeqMgr.insert(createSeqBean);
-
-		System.out.println("Create sequence msg id:"
-				+ createSeqRMMessage.getMessageId());
 
 		RetransmitterBeanMgr retransmitterMgr = AbstractBeanMgrFactory
 				.getInstance(context).getRetransmitterBeanMgr();

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=327099&r1=327098&r2=327099&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqMsgProcessor.java
(original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqMsgProcessor.java
Thu Oct 20 22:05:19 2005
@@ -17,10 +17,24 @@
 
 package org.apache.sandesha2.msgprocessors;
 
+import javax.xml.namespace.QName;
+
+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.engine.AxisEngine;
+import org.apache.axis2.util.Utils;
 import org.apache.sandesha2.Constants;
 import org.apache.sandesha2.RMMsgContext;
+import org.apache.sandesha2.RMMsgCreator;
 import org.apache.sandesha2.SandeshaException;
+import org.apache.sandesha2.SequenceMenager;
+import org.apache.sandesha2.storage.AbstractBeanMgrFactory;
+import org.apache.sandesha2.storage.beanmanagers.SequencePropertyBeanMgr;
+import org.apache.sandesha2.storage.beans.SequencePropertyBean;
 import org.apache.sandesha2.wsrm.CreateSequence;
+import org.apache.sandesha2.wsrm.CreateSequenceResponse;
 import org.apache.sandesha2.wsrm.SequenceAcknowledgement;
 
 /**
@@ -29,23 +43,53 @@
 
 public class CreateSeqMsgProcessor implements MsgProcessor {
 
-	public void processMessage(RMMsgContext rmMsgCtx) throws SandeshaException {
+	public void processMessage(RMMsgContext createSeqRMMsg) throws SandeshaException {
 		
-		//Processing for ack if any
-		SequenceAcknowledgement sequenceAck = (SequenceAcknowledgement) rmMsgCtx.getMessagePart(Constants.MessageParts.SEQ_ACKNOWLEDGEMENT);
-		if (sequenceAck!=null) {
-			AcknowledgementProcessor ackProcessor = new AcknowledgementProcessor ();
-			ackProcessor.processMessage(rmMsgCtx);
+		MessageContext createSeqMsg = createSeqRMMsg.getMessageContext();
+		MessageContext outMessage = null;
+		try {
+			outMessage = Utils.createOutMessageContext(createSeqMsg);
+		} catch (AxisFault e) {
+			throw new SandeshaException (e.getMessage());
 		}
 		
-		//Processing the create sequence 
-		//TODO: Add create sequence message processing logic
-		CreateSequence createSeq = (CreateSequence) rmMsgCtx.getMessagePart(Constants.MessageParts.CREATE_SEQ);
-
-		//rmMsgCtx.test();
-	
 		
-		//Change the Operation (to go throught CreateSequence)
 		
+		try {
+			String newSequenceId = SequenceMenager.setUpNewSequence(createSeqRMMsg);
+			ConfigurationContext context = createSeqRMMsg.getMessageContext().getSystemContext();
+			if (newSequenceId == null)
+				throw new AxisFault("Internal error - Generated sequence id is null");
+			
+			RMMsgContext createSeqResponse = RMMsgCreator.createCreateSeqResponseMsg(createSeqRMMsg,
outMessage, newSequenceId);
+			CreateSequenceResponse createSeqResPart = (CreateSequenceResponse) createSeqResponse.getMessagePart(Constants.MessageParts.CREATE_SEQ_RESPONSE);
+
+			//ConfigurationContext configCtx = inMessage.getSystemContext();
+
+			CreateSequence createSeq = (CreateSequence) createSeqRMMsg.getMessagePart(Constants.MessageParts.CREATE_SEQ);
+			if (createSeq == null)
+				throw new AxisFault("Create sequence part not present in the create sequence 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");
+
+			SequencePropertyBean seqPropBean = new SequencePropertyBean(newSequenceId, Constants.SequenceProperties.ACKS_TO_EPR,
acksTo);
+			//		SequencePropertyBeanMgr beanMgr = new SequencePropertyBeanMgr
+			// (Constants.DEFAULT_STORAGE_TYPE);
+			//		beanMgr.create(seqPropBean);
+
+			SequencePropertyBeanMgr seqPropMgr = AbstractBeanMgrFactory.getInstance(context).getSequencePropretyBeanMgr();
+			seqPropMgr.insert(seqPropBean);
+			outMessage.setResponseWritten(true);
+
+			AxisEngine engine = new AxisEngine (context);
+			engine.send(outMessage);
+		} catch (AxisFault e1) {
+			throw new SandeshaException (e1.getMessage());
+		}
+		
+		createSeqMsg.setPausedTrue(new QName (Constants.IN_HANDLER_NAME));
 	}
 }

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=327099&r1=327098&r2=327099&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/TerminateSeqMsgProcessor.java
(original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/TerminateSeqMsgProcessor.java
Thu Oct 20 22:05:19 2005
@@ -17,6 +17,9 @@
 
 package org.apache.sandesha2.msgprocessors;
 
+import javax.xml.namespace.QName;
+
+import org.apache.axis2.context.MessageContext;
 import org.apache.sandesha2.Constants;
 import org.apache.sandesha2.RMMsgContext;
 import org.apache.sandesha2.SandeshaException;
@@ -28,17 +31,22 @@
  */
 public class TerminateSeqMsgProcessor implements MsgProcessor {
 
-	public void processMessage(RMMsgContext rmMsgCtx)
+	public void processMessage(RMMsgContext terminateSeqRMMSg)
 			throws SandeshaException {
+		
+		MessageContext terminateSeqMsg = terminateSeqRMMSg.getMessageContext();
 		//Processing for ack if any
-		SequenceAcknowledgement sequenceAck = (SequenceAcknowledgement) rmMsgCtx.getMessagePart(Constants.MessageParts.SEQ_ACKNOWLEDGEMENT);
+		SequenceAcknowledgement sequenceAck = (SequenceAcknowledgement) terminateSeqRMMSg.getMessagePart(Constants.MessageParts.SEQ_ACKNOWLEDGEMENT);
 		if (sequenceAck!=null) {
 			AcknowledgementProcessor ackProcessor = new AcknowledgementProcessor ();
-			ackProcessor.processMessage(rmMsgCtx);
+			ackProcessor.processMessage(terminateSeqRMMSg);
 		}
 		
 		//Processing the terminate message
 		//TODO Add terminate sequence message logic.
 
+		
+		terminateSeqMsg.setPausedTrue(new QName (Constants.IN_HANDLER_NAME));
+		
 	}
 }

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/msgreceivers/RMMessageReceiver.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/msgreceivers/RMMessageReceiver.java?rev=327099&r1=327098&r2=327099&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/msgreceivers/RMMessageReceiver.java
(original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/msgreceivers/RMMessageReceiver.java
Thu Oct 20 22:05:19 2005
@@ -17,212 +17,21 @@
 
 package org.apache.sandesha2.msgreceivers;
 
-import java.util.ArrayList;
-
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamWriter;
 
 import org.apache.axis2.AxisFault;
-import org.apache.axis2.addressing.AddressingConstants;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.addressing.MessageInformationHeaders;
-import org.apache.axis2.addressing.miheaders.RelatesTo;
-import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.engine.AxisEngine;
-import org.apache.axis2.om.OMAbstractFactory;
-import org.apache.axis2.om.OMElement;
-import org.apache.axis2.om.OMFactory;
-import org.apache.axis2.om.OMNamespace;
-import org.apache.axis2.receivers.AbstractInMessageReceiver;
-import org.apache.axis2.receivers.AbstractInOutAsyncMessageReceiver;
-import org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver;
 import org.apache.axis2.receivers.AbstractMessageReceiver;
-import org.apache.axis2.receivers.ServerCallback;
-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.transport.http.HTTPConstants;
-import org.apache.sandesha2.Constants;
-import org.apache.sandesha2.MsgInitializer;
-import org.apache.sandesha2.MsgValidator;
-import org.apache.sandesha2.SandeshaException;
-import org.apache.sandesha2.RMMsgContext;
-import org.apache.sandesha2.RMMsgCreator;
-import org.apache.sandesha2.SequenceMenager;
-import org.apache.sandesha2.storage.AbstractBeanMgrFactory;
-import org.apache.sandesha2.storage.beanmanagers.SequencePropertyBeanMgr;
-import org.apache.sandesha2.storage.beans.SequencePropertyBean;
-import org.apache.sandesha2.wsrm.CreateSequence;
-import org.apache.sandesha2.wsrm.CreateSequenceResponse;
-
-import com.bea.xml.stream.XMLWriterBase;
-
-/**
- * @author
- */
-
-public class RMMessageReceiver extends AbstractMessageReceiver {
-
-	//TODO move this code to create seq msg processor.
-	public void setCreateSequence(MessageContext inMessage,
-			MessageContext outMessage) throws AxisFault {
-
-		RMMsgContext createSeqMsg = null;
-		try {
-			createSeqMsg = MsgInitializer.initializeMessage(inMessage);
-		} catch (SandeshaException ex) {
-			throw new AxisFault("Cant initialize the message");
-		}
-
-		if (createSeqMsg.getMessageType() != Constants.MessageTypes.CREATE_SEQ)
-			throw new AxisFault("Wrong message type");
-
-		String newSequenceId = SequenceMenager.setUpNewSequence(createSeqMsg);
-		
-		if (newSequenceId == null)
-			throw new AxisFault(
-					"Internal error - Generated sequence id is null");
-		
-		RMMsgContext createSeqResponse = RMMsgCreator
-				.createCreateSeqResponseMsg(createSeqMsg, outMessage, newSequenceId);
-		CreateSequenceResponse createSeqResPart = (CreateSequenceResponse) createSeqResponse
-				.getMessagePart(Constants.MessageParts.CREATE_SEQ_RESPONSE);
-
-		//String newSequenceId = createSeqResPart.getIdentifier().getIdentifier();
-
-
-		ConfigurationContext configCtx = inMessage.getSystemContext();
-		
-
-		CreateSequence createSeq = (CreateSequence) createSeqMsg
-				.getMessagePart(Constants.MessageParts.CREATE_SEQ);
-		if (createSeq == null)
-			throw new AxisFault(
-					"Create sequence part not present in the create sequence 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");
-
-		SequencePropertyBean seqPropBean = new SequencePropertyBean(
-				newSequenceId, Constants.SequenceProperties.ACKS_TO_EPR, acksTo);
-		//		SequencePropertyBeanMgr beanMgr = new SequencePropertyBeanMgr
-		// (Constants.DEFAULT_STORAGE_TYPE);
-		//		beanMgr.create(seqPropBean);
-
-		SequencePropertyBeanMgr seqPropMgr = AbstractBeanMgrFactory
-				.getInstance(configCtx).getSequencePropretyBeanMgr();
-		seqPropMgr.insert(seqPropBean);
-		outMessage.setResponseWritten(true);
-
-	}
-
-	public final void receive(MessageContext messgeCtx) throws AxisFault {
-
-		//intitializing the message.
-		RMMsgContext rmMsgCtx = null;
-		try {
-			rmMsgCtx = MsgInitializer.initializeMessage(messgeCtx);
-		} catch (SandeshaException ex) {
-			throw new AxisFault("Cant initialize the message");
-		}
-
-		AbstractMessageReceiver msgReceiver = null;
-
-		//String replyTo = messgeCtx.getFrom().getAddress();
-		String replyTo = messgeCtx.getReplyTo().getAddress();
-		if (rmMsgCtx.getMessageType() == Constants.MessageTypes.TERMINATE_SEQ)
-			msgReceiver = new RMInMsgReceiver();
-		else if (rmMsgCtx.getMessageType() == Constants.MessageTypes.CREATE_SEQ
-				&& ((replyTo == null) || replyTo
-						.equals(Constants.WSA.NS_URI_ANONYMOUS)))
-			msgReceiver = new RMInOutSyncMsgReceiver();
-		else if (rmMsgCtx.getMessageType() == Constants.MessageTypes.CREATE_SEQ)
-			msgReceiver = new RMInOutAsyncMsgReceiver();
-
-		if (msgReceiver != null) {
-			msgReceiver.receive(messgeCtx);
-		}
-	}
-
-	private SOAPFactory getSOAPFactory(MessageContext inMessage)
-			throws AxisFault {
-		String nsURI = inMessage.getEnvelope().getNamespace().getName();
-		if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(nsURI)) {
-			fac = OMAbstractFactory.getSOAP12Factory();
-		} else if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(nsURI)) {
-			fac = OMAbstractFactory.getSOAP11Factory();
-		} else {
-			throw new AxisFault(
-					"Unknown SOAP Version. Current Axis handles only SOAP 1.1 and SOAP 1.2 messages");
-		}
-		return fac;
-	}
-
-	private class RMInMsgReceiver extends AbstractInMessageReceiver {
-
-		public void invokeBusinessLogic(MessageContext inMessage)
-				throws AxisFault {
-			RMMsgContext rmMsgCtx = null;
-			try {
-				rmMsgCtx = MsgInitializer.initializeMessage(inMessage);
-			} catch (SandeshaException ex) {
-				throw new AxisFault("Cant initialize the message");
-			}
-
-			//TODO check for terminate sequence.
-			//TODO handle terminate sequence.
-
-		}
-	}
 
-	private class RMInOutSyncMsgReceiver extends
-			AbstractInOutSyncMessageReceiver {
 
-		public void invokeBusinessLogic(MessageContext inMessage,
-				MessageContext outMessage) throws AxisFault {
+//Currently this is a dummy Msg Receiver.
+//All the necessary RM logic happens at MessageProcessors.
+//This only ensures that the defaults Messsage Receiver does not get called for RM control
messages.
 
-			RMMsgContext rmMsgCtx = null;
-			try {
-				rmMsgCtx = MsgInitializer.initializeMessage(inMessage);
-			} catch (SandeshaException ex) {
-				throw new AxisFault("Cant initialize the message");
-			}
-
-			if (rmMsgCtx.getMessageType() == Constants.MessageTypes.CREATE_SEQ) {
-				//TODO handle sync create seq.
-				setCreateSequence(inMessage, outMessage);
-			}
-
-		}
-	}
+public class RMMessageReceiver extends AbstractMessageReceiver {
 
-	private class RMInOutAsyncMsgReceiver extends
-			AbstractInOutAsyncMessageReceiver {
 
-		public void invokeBusinessLogic(MessageContext inMessage,
-				MessageContext outMessage, ServerCallback callback)
-				throws AxisFault {
-
-			RMMsgContext rmMsgCtx = null;
-			try {
-				rmMsgCtx = MsgInitializer.initializeMessage(inMessage);
-			} catch (SandeshaException ex) {
-				throw new AxisFault("Cant initialize the message");
-			}
-
-			if (rmMsgCtx.getMessageType() == Constants.MessageTypes.CREATE_SEQ) {
-				//TODO handle async create seq.
-				setCreateSequence(inMessage, outMessage);
-				ConfigurationContext configCtx = outMessage.getSystemContext();
-				AxisEngine engine = new AxisEngine(configCtx);
-				engine.send(outMessage);
-			}
-		}
+	public final void receive(MessageContext messgeCtx) throws AxisFault {
+		System.out.println("RM MESSSAGE RECEIVER WAS CALLED");
 	}
-
+	
 }



---------------------------------------------------------------------
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