ws-sandesha-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chamik...@apache.org
Subject svn commit: r240397 - in /webservices/sandesha/trunk/src/org/apache/sandesha2: Constants.java MsgInitializer.java MsgValidator.java RMMsgContext.java handlers/ServerInHandler.java msgprocessors/MsgProcessorFactory.java
Date Sat, 27 Aug 2005 05:54:12 GMT
Author: chamikara
Date: Fri Aug 26 22:53:45 2005
New Revision: 240397

URL: http://svn.apache.org/viewcvs?rev=240397&view=rev
Log:
Some changes in the server classes.

Added:
    webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/MsgProcessorFactory.java
Modified:
    webservices/sandesha/trunk/src/org/apache/sandesha2/Constants.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/MsgInitializer.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/MsgValidator.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/RMMsgContext.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/ServerInHandler.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=240397&r1=240396&r2=240397&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/Constants.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/Constants.java Fri Aug 26 22:53:45
2005
@@ -66,13 +66,15 @@
       int MESSAGE_TYPE_APPLICATION = 3;
       int MESSAGE_TYPE_ACK = 4;
       int MESSAGE_TYPE_TERMINATE_SEQ = 5;
+      int MAX_MSG_TYPE = 5;
       
       int MESSAGE_PART_UNKNOWN = 0;
-      int MESSAGE_PART_RM_HEADERS = 1;
-      int MESSAGE_PART_ADDR_HEADERS = 2;
-      int MESSAGE_PART_CREATE_SEQ = 3;
-      int MESSAGE_PART_CREATE_SEQ_RESPONSE = 4;
-      int MESSAGE_PART_TERMINATE_SEQ = 5;
-      int MAX_MSG_PART_ID = 5;
+      int MESSAGE_PART_SEQUENCE = 1;
+      int MESSAGE_PART_SEQ_ACKNOWLEDGEMENT = 2;
+      int MESSAGE_PART_ADDR_HEADERS = 3;
+      int MESSAGE_PART_CREATE_SEQ = 4;
+      int MESSAGE_PART_CREATE_SEQ_RESPONSE = 5;
+      int MESSAGE_PART_TERMINATE_SEQ = 6;
+      int MAX_MSG_PART_ID = 6;
 
 }

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/MsgInitializer.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/MsgInitializer.java?rev=240397&r1=240396&r2=240397&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/MsgInitializer.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/MsgInitializer.java Fri Aug 26 22:53:45
2005
@@ -18,6 +18,7 @@
 package org.apache.sandesha2;
 
 import org.apache.axis2.context.MessageContext;
+import org.apache.sandesha2.wsrm.RMElements;
 
 
 /**
@@ -26,7 +27,7 @@
 
 public class MsgInitializer {
 
-	public RMMsgContext initializeMessage (MessageContext ctx) {
+	public static RMMsgContext initializeMessage (MessageContext ctx) {
 		RMMsgContext rmMsgCtx = new RMMsgContext ();
 		populateRMMsgContext(ctx,rmMsgCtx);
 		return rmMsgCtx;
@@ -34,5 +35,16 @@
 	
 	public static void populateRMMsgContext (MessageContext msgCtx, RMMsgContext rmMsgContext)
{
 		//TODO set message parts
+		
+		RMElements elements = new RMElements ();
+		elements.fromSOAPEnvelope(msgCtx.getEnvelope());
+		rmMsgContext.setMessagePart(Constants.MESSAGE_PART_CREATE_SEQ,elements.getCreateSequence());
+		rmMsgContext.setMessagePart(Constants.MESSAGE_PART_CREATE_SEQ_RESPONSE,elements.getCreateSequenceResponse());
+		rmMsgContext.setMessagePart(Constants.MESSAGE_PART_SEQUENCE ,elements.getSequence());
+		rmMsgContext.setMessagePart(Constants.MESSAGE_PART_SEQ_ACKNOWLEDGEMENT,elements.getSequenceAcknowledgement());
+		rmMsgContext.setMessagePart(Constants.MESSAGE_PART_TERMINATE_SEQ,elements.getTerminateSequence());
+		
+		
+		
 	}
 }

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/MsgValidator.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/MsgValidator.java?rev=240397&r1=240396&r2=240397&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/MsgValidator.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/MsgValidator.java Fri Aug 26 22:53:45
2005
@@ -25,7 +25,16 @@
  */
 public class MsgValidator {
 
-	public static void validateMessage(MessageContext msgCtx) throws AxisFault{
+	public static void validateMessage(RMMsgContext rmMsgCtx) throws AxisFault{
         //TODO: Validate message
+		
+		//Setting message type.
+		if(rmMsgCtx.getMessagePart(Constants.MESSAGE_PART_CREATE_SEQ)!=null)
+			rmMsgCtx.setMessageType(Constants.MESSAGE_TYPE_CREATE_SEQ);
+		else if (rmMsgCtx.getMessagePart(Constants.MESSAGE_PART_CREATE_SEQ_RESPONSE)!=null)
+			rmMsgCtx.setMessageType(Constants.MESSAGE_TYPE_CREATE_SEQ_RESPONSE);
+		else if (rmMsgCtx.getMessagePart(Constants.MESSAGE_PART_TERMINATE_SEQ)!=null)
+			rmMsgCtx.setMessageType(Constants.MESSAGE_TYPE_TERMINATE_SEQ);
+			
     }
 }

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=240397&r1=240396&r2=240397&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/RMMsgContext.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/RMMsgContext.java Fri Aug 26 22:53:45
2005
@@ -44,8 +44,22 @@
 		MsgInitializer.populateRMMsgContext(ctx,this);
 	}
 	
+	public int getMessageType (){
+		return messageType;
+	}
+	
+	public void setMessageType (int msgType){
+		if(msgType>=0 && msgType<=Constants.MAX_MSG_TYPE)
+			this.messageType = msgType;
+	}
+	
 	public void setMessagePart (int partId, IOMRMElement part){
 		if (partId>=0 && partId<=Constants.MAX_MSG_PART_ID)
 			rmMessageParts.put(new Integer (partId),part);
 	}
+	
+	public IOMRMElement getMessagePart (int partId) {
+		return (IOMRMElement) rmMessageParts.get(new Integer (partId));
+	}
+	
 }

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/ServerInHandler.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/ServerInHandler.java?rev=240397&r1=240396&r2=240397&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/ServerInHandler.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/ServerInHandler.java Fri
Aug 26 22:53:45 2005
@@ -18,16 +18,33 @@
 package org.apache.sandesha2.handlers;
 
 import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.MessageInformationHeaders;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.handlers.AbstractHandler;
+import org.apache.sandesha2.MsgInitializer;
+import org.apache.sandesha2.MsgValidator;
+import org.apache.sandesha2.RMMsgContext;
+import org.apache.sandesha2.msgprocessors.MsgProcessor;
+import org.apache.sandesha2.msgprocessors.MsgProcessorException;
+import org.apache.sandesha2.msgprocessors.MsgProcessorFactory;
 
 /**
  * @author 
  */
 public class ServerInHandler extends AbstractHandler {
 
-	public void invoke(MessageContext arg0) throws AxisFault {
-		// TODO create invoke logic
+	public void invoke(MessageContext msgCtx) throws AxisFault {
+		RMMsgContext rmMsgCtx = MsgInitializer.initializeMessage(msgCtx);
+		MsgValidator.validateMessage(rmMsgCtx);
+		
+		MsgProcessor msgProcessor = MsgProcessorFactory.getMessageProcessor(rmMsgCtx.getMessageType());
+		try {
+			msgProcessor.processMessage(rmMsgCtx);
+		}catch (MsgProcessorException mpe) {
+			mpe.printStackTrace();
+			throw new AxisFault ("Error in processing the message");
+		}
+		
 	}
 	
 }

Added: webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/MsgProcessorFactory.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/MsgProcessorFactory.java?rev=240397&view=auto
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/MsgProcessorFactory.java
(added)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/MsgProcessorFactory.java
Fri Aug 26 22:53:45 2005
@@ -0,0 +1,37 @@
+/*
+ * Copyright  1999-2004 The Apache Software Foundation.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package org.apache.sandesha2.msgprocessors;
+
+import org.apache.sandesha2.Constants;
+
+/**
+ * @author 
+ * 
+ */
+public class MsgProcessorFactory {
+
+	public static MsgProcessor getMessageProcessor (int msgType) {
+		switch (msgType)
+		{
+			case (Constants.MESSAGE_TYPE_CREATE_SEQ):
+				return new CreateSeqMsgProcessor ();
+			default:
+				return null;
+		}
+	}
+}



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