Author: chamikara
Date: Mon Sep  5 21:03:11 2005
New Revision: 278907

URL: http://svn.apache.org/viewcvs?rev=278907&view=rev
Log:
updated server classes

Added:
    webservices/sandesha/trunk/src/org/apache/sandesha2/RMException.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/SequenceMenager.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/RMMsgCreator.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/SOAPAbstractFactory.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/SandeshaModule.java
    
webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/ServerInHandler.java
    
webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/ServerOutHandler.java
    
webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java
    
webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/MsgProcessorException.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=278907&r1=278906&r2=278907&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/Constants.java 
(original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/Constants.java Mon Sep  
5 21:03:11 2005
@@ -18,8 +18,9 @@
 package org.apache.sandesha2;

 

 /**

- * @author chamikara

- * @author sanka

+ * @author Chamikara

+ * @author Sanka

+ * @author Jaliya 

  */

 

 

@@ -29,7 +30,11 @@
                String NS_PREFIX_RM = "wsrm";

 

                String NS_URI_RM = "http://schemas.xmlsoap.org/ws/2005/02/rm";;

+               

 

+               String ACTION_SEQ_ACK = 
"http://schemas.xmlsoap.org/ws/2005/02/rm/SequenceAcknowledgement";;

+               

+               

                String NS_URI_CREATE_SEQ_RESPONSE = 
"http://schemas.xmlsoap.org/ws/2005/02/rm/CreateSequenceResponse";;

                

                String MSG_NUMBER = "MessageNumber";

@@ -137,7 +142,15 @@
        

        int STORAGE_TYPE_PERSISTANCE = 2;

        

-       String SEQ_PROPERTY_RECEIVED_MSG_LIST = "SeqMsgList";

+       int DEFAULT_STORAGE_TYPE = STORAGE_TYPE_IN_MEMORY;

+       

+       

+       

+       

+       String SEQ_PROPERTY_RECEIVED_MESSAGES = "SeqMsgListProperty";

+       

+       String SEQ_PROPERTY_ACKS_TO = "acksToProperty";

+       

        

        int SOAP_1_1 = 1;

        


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=278907&r1=278906&r2=278907&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/MsgInitializer.java 
(original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/MsgInitializer.java Mon 
Sep  5 21:03:11 2005
@@ -26,20 +26,22 @@
 

 

 /**

- * @author chamikara

- * @author sanka

+ * @author Chamikara

+ * @author Sanka

+ * @author Jaliya 

  */

 

 

 public class MsgInitializer {

 

-       public static RMMsgContext initializeMessage (MessageContext ctx) {

+       public static RMMsgContext initializeMessage (MessageContext ctx) 
throws RMException {

                RMMsgContext rmMsgCtx = new RMMsgContext (ctx);

                populateRMMsgContext(ctx,rmMsgCtx);

+               validateMessage(rmMsgCtx);

                return rmMsgCtx;

        }

        

-       public static void populateRMMsgContext (MessageContext msgCtx, 
RMMsgContext rmMsgContext) {

+       private static void populateRMMsgContext (MessageContext msgCtx, 
RMMsgContext rmMsgContext) {

                //TODO set message parts

                

                RMElements elements = new RMElements ();

@@ -65,5 +67,21 @@
                

                

                

+       }

+       

+       private static boolean validateMessage (RMMsgContext rmMsgCtx) throws 
RMException {

+        

+               //TODO: performa validation

+               

+               //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);

+               

+               

+               return true;

        }

 }


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=278907&r1=278906&r2=278907&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/MsgValidator.java 
(original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/MsgValidator.java Mon 
Sep  5 21:03:11 2005
@@ -21,22 +21,18 @@
 import org.apache.axis2.context.MessageContext;

 

 /**

- * @author chamikara

- * @author sanka

+ * @author Chamikara

+ * @author Sanka

+ * @author Jaliya 

  */

 

+//TODO remove this class.

 public class MsgValidator {

 

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

-                       

+       

+       private static void validateMessage(RMMsgContext rmMsgCtx) throws 
AxisFault{

+

+                       //no need of this method any more.

+                       //Validation is done in the message initialized

     }

 }


Added: webservices/sandesha/trunk/src/org/apache/sandesha2/RMException.java
URL: 
http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/RMException.java?rev=278907&view=auto
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/RMException.java (added)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/RMException.java Mon 
Sep  5 21:03:11 2005
@@ -0,0 +1,17 @@
+/*

+ * Created on Sep 5, 2005

+ *

+ * TODO To change the template for this generated file go to

+ * Window - Preferences - Java - Code Style - Code Templates

+ */

+package org.apache.sandesha2;

+

+/**

+ * @author chamikara

+ *

+ * TODO To change the template for this generated type comment go to

+ * Window - Preferences - Java - Code Style - Code Templates

+ */

+public class RMException extends Exception {

+

+}


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=278907&r1=278906&r2=278907&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/RMMsgContext.java 
(original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/RMMsgContext.java Mon 
Sep  5 21:03:11 2005
@@ -31,10 +31,12 @@
 import org.apache.sandesha2.wsrm.CreateSequence;

 import org.apache.sandesha2.wsrm.IOMRMElement;

 import org.apache.sandesha2.wsrm.TerminateSequence;

+import org.apache.wsdl.WSDLConstants;

 

 /**

- * @author chamikara

- * @author sanka

+ * @author Chamikara

+ * @author Sanka

+ * @author Jaliya 

  */

 

 public class RMMsgContext {

@@ -133,6 +135,10 @@
        

        public void setRelatesTo (RelatesTo relatesTo){

                msgContext.setRelatesTo(relatesTo);

+       }

+       

+       public MessageContext getMessageContext () {

+               return msgContext;

        }

        

        


Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/RMMsgCreator.java
URL: 
http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/RMMsgCreator.java?rev=278907&r1=278906&r2=278907&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/RMMsgCreator.java 
(original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/RMMsgCreator.java Mon 
Sep  5 21:03:11 2005
@@ -22,12 +22,15 @@
 

 import org.apache.axis2.AxisFault;

 import org.apache.axis2.addressing.EndpointReference;

+import org.apache.axis2.addressing.MessageInformationHeaders;

 import org.apache.axis2.addressing.om.AddressingHeaders;

 import org.apache.axis2.context.MessageContext;

 import org.apache.axis2.om.OMAbstractFactory;

 import org.apache.axis2.om.impl.MIMEOutputUtils;

 import org.apache.axis2.soap.SOAPEnvelope;

 import org.apache.axis2.soap.SOAPFactory;

+import org.apache.axis2.wsdl.builder.wsdl4j.WSDL11MEPFinder;

+import org.apache.sandesha2.msgreceivers.RMMessageReceiver;

 import org.apache.sandesha2.util.SandeshaUtil;

 import org.apache.sandesha2.wsrm.Accept;

 import org.apache.sandesha2.wsrm.AckRequested;

@@ -38,11 +41,14 @@
 import org.apache.sandesha2.wsrm.CreateSequenceResponse;

 import org.apache.sandesha2.wsrm.IOMRMElement;

 import org.apache.sandesha2.wsrm.Identifier;

+import org.apache.sandesha2.wsrm.Sequence;

 import org.apache.sandesha2.wsrm.SequenceAcknowledgement;

+import org.apache.wsdl.WSDLConstants;

 

 /**

- * @author chamikara

- * @author sanka

+ * @author Chamikara

+ * @author Sanka

+ * @author Jaliya 

  */

 

 public class RMMsgCreator {

@@ -78,30 +84,58 @@
         outMessage.setMessageID(newMessageId);

                

         outMessage.setEnvelope(envelope);

-        RMMsgContext createSeqResponse = 
MsgInitializer.initializeMessage(outMessage);

-        MsgValidator.validateMessage(createSeqResponse);

-               return createSeqResponse;

+        

+        RMMsgContext createSeqResponse = null;

+        try {

+               createSeqResponse = 
MsgInitializer.initializeMessage(outMessage);

+        }catch (RMException ex) {

+               throw new AxisFault ("Cant initialize the message");

+        }

+        

+        return createSeqResponse;

        }

        

-       public static void createAckMessage (RMMsgContext applicationMsg) 
throws AxisFault {

-               /*SOAPEnvelope envelope = applicationMsg.getSOAPEnvelope();

+       

+       //Adds a ack message to the following message.

+       public static void addAckMessage (RMMsgContext applicationMsg) throws 
AxisFault {

+               SOAPEnvelope envelope = applicationMsg.getSOAPEnvelope();

                if(envelope==null) {

                        SOAPEnvelope newEnvelope = 
SOAPAbstractFactory.getSOAPFactory(Constants.DEFAULT_SOAP_VERSION).getDefaultEnvelope();

                        applicationMsg.setSOAPEnvelop(envelope);

                }

-               

                envelope = applicationMsg.getSOAPEnvelope();

-               SequenceAcknowledgement sequenceAck = new 
SequenceAcknowledgement ();

+               

+               MessageContext requestMessage = 
applicationMsg.getMessageContext().getOperationContext().getMessageContext(WSDLConstants.MESSAGE_LABEL_IN);

+

+               RMMsgContext reqRMMsgCtx = null;

+               

+        try {

+               reqRMMsgCtx = MsgInitializer.initializeMessage(requestMessage);

+        }catch (RMException ex) {

+               throw new AxisFault ("Cant initialize the message");

+        }

+               

+        

+        Sequence reqSequence = (Sequence) 
reqRMMsgCtx.getMessagePart(Constants.MESSAGE_PART_SEQUENCE);

+               if (reqSequence==null)

+                       throw new AxisFault ("Sequence part of application 
message is null");

+        

+               String sequenceId = reqSequence.getIdentifier().getIdentifier();

+               

+        SequenceAcknowledgement sequenceAck = new SequenceAcknowledgement ();

                Identifier id = new Identifier ();

-               id.setIndentifer("uuid:temp-id-of-sandesha");

+               id.setIndentifer(sequenceId);

                sequenceAck.setIdentifier(id);

                AcknowledgementRange range = new AcknowledgementRange ();

-               range.setMaxValue(1);

-               range.setMinValue(1);

+               

+               //TODO correct below

+               range.setUpperValue(1);

+               range.setLowerValue(1);

+                       

                sequenceAck.addAcknowledgementRanges(range);

-               sequenceAck.toSOAPEnvelope(envelope);

-               
applicationMsg.setAction("http://schemas.xmlsoap.org/ws/2005/02/rm/SequenceAcknowledgement";);

-               applicationMsg.setMessageId("uuid:msg-id-of-first-ack"); */

+               sequenceAck.toOMElement(envelope.getHeader());

+               applicationMsg.setAction(Constants.WSRM.ACTION_SEQ_ACK);

+               applicationMsg.setMessageId(SandeshaUtil.getUUID()); 

                

        }

 }


Modified: 
webservices/sandesha/trunk/src/org/apache/sandesha2/SOAPAbstractFactory.java
URL: 
http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/SOAPAbstractFactory.java?rev=278907&r1=278906&r2=278907&view=diff
==============================================================================
--- 
webservices/sandesha/trunk/src/org/apache/sandesha2/SOAPAbstractFactory.java 
(original)
+++ 
webservices/sandesha/trunk/src/org/apache/sandesha2/SOAPAbstractFactory.java 
Mon Sep  5 21:03:11 2005
@@ -21,8 +21,9 @@
 import org.apache.axis2.soap.SOAPFactory;

 

 /**

- * @author chamikara

- * @author sanka

+ * @author Chamikara

+ * @author Sanka

+ * @author Jaliya 

  */

 

 


Modified: 
webservices/sandesha/trunk/src/org/apache/sandesha2/SandeshaModule.java
URL: 
http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/SandeshaModule.java?rev=278907&r1=278906&r2=278907&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/SandeshaModule.java 
(original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/SandeshaModule.java Mon 
Sep  5 21:03:11 2005
@@ -22,8 +22,9 @@
 import org.apache.axis2.modules.Module;

 

 /**

- * @author chamikara

- * @author sanka

+ * @author Chamikara

+ * @author Sanka

+ * @author Jaliya 

  */

 

 public class SandeshaModule implements Module{


Added: webservices/sandesha/trunk/src/org/apache/sandesha2/SequenceMenager.java
URL: 
http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/SequenceMenager.java?rev=278907&view=auto
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/SequenceMenager.java 
(added)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/SequenceMenager.java 
Mon Sep  5 21:03:11 2005
@@ -0,0 +1,31 @@
+/*

+ * Created on Sep 5, 2005

+ *

+ * TODO To change the template for this generated file go to

+ * Window - Preferences - Java - Code Style - Code Templates

+ */

+package org.apache.sandesha2;

+

+import java.util.ArrayList;

+

+import org.apache.sandesha2.storage.beanmanagers.SequencePropertyBeanMgr;

+import org.apache.sandesha2.storage.beans.SequencePropertyBean;

+

+/**

+ * @author Chamikara

+ * @author Sanka

+ * @author Jaliya 

+ */

+public class SequenceMenager {

+

+       public static void setUpNewSequence (String sequenceId) {

+               ArrayList arr;

+               SequencePropertyBean seqPropBean = new SequencePropertyBean 
(sequenceId,Constants.SEQ_PROPERTY_RECEIVED_MESSAGES,"");

+               SequencePropertyBeanMgr beanMgr = new SequencePropertyBeanMgr 
(Constants.DEFAULT_STORAGE_TYPE);

+               beanMgr.create(seqPropBean);

+       }

+       

+       public void removeSequence (String sequence) {

+               

+       }

+}


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=278907&r1=278906&r2=278907&view=diff
==============================================================================
--- 
webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/ServerInHandler.java
 (original)
+++ 
webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/ServerInHandler.java
 Mon Sep  5 21:03:11 2005
@@ -25,6 +25,7 @@
 import org.apache.axis2.handlers.AbstractHandler;

 import org.apache.sandesha2.MsgInitializer;

 import org.apache.sandesha2.MsgValidator;

+import org.apache.sandesha2.RMException;

 import org.apache.sandesha2.RMMsgContext;

 import org.apache.sandesha2.msgprocessors.MsgProcessor;

 import org.apache.sandesha2.msgprocessors.MsgProcessorException;

@@ -32,7 +33,9 @@
 import org.apache.sandesha2.storage.beanmanagers.SequencePropertyBeanMgr;

 

 /**

- * @author 

+ * @author Chamikara

+ * @author Sanka

+ * @author Jaliya 

  */

 public class ServerInHandler extends AbstractHandler {

 

@@ -43,8 +46,13 @@
                System.out.println ("Operation is:" + opearaitonName);

                

                msgCtx.setProperty("aaaa","abcd");

-               RMMsgContext rmMsgCtx = 
MsgInitializer.initializeMessage(msgCtx);

-               MsgValidator.validateMessage(rmMsgCtx);

+               RMMsgContext rmMsgCtx = null;

+

+        try {

+               rmMsgCtx = MsgInitializer.initializeMessage(msgCtx);

+        }catch (RMException ex) {

+               throw new AxisFault ("Cant initialize the message");

+        }

                

                MsgProcessor msgProcessor = 
MsgProcessorFactory.getMessageProcessor(rmMsgCtx.getMessageType());

                


Modified: 
webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/ServerOutHandler.java
URL: 
http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/ServerOutHandler.java?rev=278907&r1=278906&r2=278907&view=diff
==============================================================================
--- 
webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/ServerOutHandler.java
 (original)
+++ 
webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/ServerOutHandler.java
 Mon Sep  5 21:03:11 2005
@@ -23,6 +23,7 @@
 import org.apache.sandesha2.Constants;

 import org.apache.sandesha2.MsgInitializer;

 import org.apache.sandesha2.MsgValidator;

+import org.apache.sandesha2.RMException;

 import org.apache.sandesha2.RMMsgContext;

 import org.apache.sandesha2.RMMsgCreator;

 import org.apache.sandesha2.msgreceivers.RMMessageReceiver;

@@ -30,27 +31,37 @@
 import org.apache.wsdl.WSDLConstants;

 

 /**

- * @author 

+ * @author Sanka

+ * @author Chamikara

+ * @author Jaliya 

  */

 public class ServerOutHandler extends AbstractHandler {

 

        public void invoke(MessageContext msgCtx) throws AxisFault {

                System.out.println ("Server out handler called");

                

-               RMMsgContext rmMsgCtx = 
MsgInitializer.initializeMessage(msgCtx);

-               MsgValidator.validateMessage(rmMsgCtx);

+               RMMsgContext rmMsgCtx;

+        try {

+               rmMsgCtx = MsgInitializer.initializeMessage(msgCtx);

+        }catch (RMException ex) {

+               throw new AxisFault ("Cant initialize the message");

+        }

        

        

                //getting the request message.

                MessageContext reqMsgCtx = 
msgCtx.getOperationContext().getMessageContext(WSDLConstants.MESSAGE_LABEL_IN);

-               RMMsgContext requestRMMsgCtx = 
MsgInitializer.initializeMessage(reqMsgCtx);

-               MsgValidator.validateMessage(requestRMMsgCtx);

-               

-

+               RMMsgContext requestRMMsgCtx;

+        try {

+               requestRMMsgCtx = MsgInitializer.initializeMessage(reqMsgCtx);

+        }catch (RMException ex) {

+               throw new AxisFault ("Cant initialize the message");

+        }

                

+        //TODO change this to    IF==MSG_TYPE_APPLICATION

                
if(requestRMMsgCtx.getMessageType()!=Constants.MESSAGE_TYPE_CREATE_SEQ){

                        //set acknowledgement

-                       RMMsgCreator.createAckMessage (rmMsgCtx);       

+                       RMMsgCreator.addAckMessage(rmMsgCtx);

+                       

                }

                

        }


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=278907&r1=278906&r2=278907&view=diff
==============================================================================
--- 
webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java
 (original)
+++ 
webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java
 Mon Sep  5 21:03:11 2005
@@ -1,8 +1,18 @@
 /*

- * Created on Aug 29, 2005

+ * 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.

  *

- * TODO To change the template for this generated file go to

- * Window - Preferences - Java - Code Style - Code Templates

  */

 package org.apache.sandesha2.msgprocessors;

 

@@ -31,10 +41,22 @@
                Sequence sequence = (Sequence) 
rmMsgCtx.getMessagePart(Constants.MESSAGE_PART_SEQUENCE);

                String sequenceId = sequence.getIdentifier().getIdentifier();

                SequencePropertyBeanMgr mgr = new SequencePropertyBeanMgr 
(Constants.STORAGE_TYPE_IN_MEMORY);

-               SequencePropertyBean bean = (SequencePropertyBean) 
mgr.retrieve( sequenceId,Constants.SEQ_PROPERTY_RECEIVED_MSG_LIST);

-               System.out.println ("get --" + sequenceId + "--" + 
Constants.SEQ_PROPERTY_RECEIVED_MSG_LIST);

-               int i = 1;

-               ArrayList list = (ArrayList) bean.getValue();

-               System.out.println ("aaa is:" + list.get(0));

+               

+               SequencePropertyBean msgsBean = (SequencePropertyBean) 
mgr.retrieve( sequenceId,Constants.SEQ_PROPERTY_RECEIVED_MESSAGES);

+               SequencePropertyBean acksToBean = (SequencePropertyBean) 
mgr.retrieve( sequenceId,Constants.SEQ_PROPERTY_ACKS_TO);

+               

+               

+               String messagesStr =  (String) msgsBean.getValue();

+               String acksToStr = (String) acksToBean.getValue();

+       

+               System.out.println ("Messages received:" + 
Constants.SEQ_PROPERTY_RECEIVED_MESSAGES);

+               System.out.println ("Acks To:" + 
Constants.SEQ_PROPERTY_ACKS_TO);

+               

+               if (acksToStr==null || messagesStr==null)

+                       throw new MsgProcessorException ("Seqeunce properties 
are not set correctly");

+               

+               if (acksToStr!=Constants.WSA.NS_URI_ANONYMOUS) {

+                       //TODO Add async Ack

+               }

        }

 }


Modified: 
webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/MsgProcessorException.java
URL: 
http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/MsgProcessorException.java?rev=278907&r1=278906&r2=278907&view=diff
==============================================================================
--- 
webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/MsgProcessorException.java
 (original)
+++ 
webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/MsgProcessorException.java
 Mon Sep  5 21:03:11 2005
@@ -23,4 +23,7 @@
  */

 public class MsgProcessorException extends Exception {

 

+       public MsgProcessorException (String s) {

+               super (s);

+       }

 }


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=278907&r1=278906&r2=278907&view=diff
==============================================================================
--- 
webservices/sandesha/trunk/src/org/apache/sandesha2/msgreceivers/RMMessageReceiver.java
 (original)
+++ 
webservices/sandesha/trunk/src/org/apache/sandesha2/msgreceivers/RMMessageReceiver.java
 Mon Sep  5 21:03:11 2005
@@ -46,8 +46,10 @@
 import org.apache.sandesha2.Constants;

 import org.apache.sandesha2.MsgInitializer;

 import org.apache.sandesha2.MsgValidator;

+import org.apache.sandesha2.RMException;

 import org.apache.sandesha2.RMMsgContext;

 import org.apache.sandesha2.RMMsgCreator;

+import org.apache.sandesha2.SequenceMenager;

 import org.apache.sandesha2.storage.beanmanagers.SequencePropertyBeanMgr;

 import org.apache.sandesha2.storage.beans.SequencePropertyBean;

 import org.apache.sandesha2.wsrm.CreateSequence;

@@ -65,64 +67,52 @@
        public void setCreateSequence(MessageContext inMessage,

                        MessageContext outMessage) throws AxisFault {

 

-               System.out.println("RM Msg Receiver was called");

-               RMMsgContext rmMsgCtx = 
MsgInitializer.initializeMessage(inMessage);

-               MsgValidator.validateMessage(rmMsgCtx);

+               System.out.println("set create seq was called in RM Msg 
receiver");

+               

+               RMMsgContext rmMsgCtx = null;

+        try {

+               rmMsgCtx = MsgInitializer.initializeMessage(inMessage);

+        }catch (RMException ex) {

+               throw new AxisFault ("Cant initialize the message");

+        }

+

+        if (rmMsgCtx.getMessageType()!=Constants.MESSAGE_TYPE_CREATE_SEQ)

+               throw new AxisFault ("Wrong message type");

+        

+        RMMsgContext createSeqResponse = RMMsgCreator

+                                       .createCreateSeqResponseMsg(rmMsgCtx, 
outMessage);      

+               CreateSequenceResponse createSeqResPart = 
(CreateSequenceResponse) createSeqResponse.

+                                                       
getMessagePart(Constants.MESSAGE_PART_CREATE_SEQ_RESPONSE);

+                       

+               String newSequenceId = 
createSeqResPart.getIdentifier().getIdentifier();

+               if (newSequenceId==null)

+                       throw new AxisFault ("Internal error - Generated 
sequence id is null");

 

-               if (rmMsgCtx.getMessageType() == 
Constants.MESSAGE_TYPE_CREATE_SEQ) {

+               SequenceMenager.setUpNewSequence(newSequenceId);

 

-                       RMMsgContext createSeqResponse = RMMsgCreator

-                                       .createCreateSeqResponseMsg(rmMsgCtx, 
outMessage);

-                       

-                       CreateSequenceResponse createSeqResPart = 
(CreateSequenceResponse) createSeqResponse.

-                                                               
getMessagePart(Constants.MESSAGE_PART_CREATE_SEQ_RESPONSE);

-                       

-                       String newSequenceId = 
createSeqResPart.getIdentifier().getIdentifier();

-                       

-                       if (newSequenceId==null)

-                               throw new AxisFault ("Internal error - 
Generated sequence id is null");

-                       

-                       

-                       //TODO: put below to SequenceManager.setUpNewSequence 
();

-                       ArrayList arr;

-                       SequencePropertyBean seqPropBean = new 
SequencePropertyBean 
(newSequenceId,Constants.SEQ_PROPERTY_RECEIVED_MSG_LIST,arr = new ArrayList());

-                       SequencePropertyBeanMgr beanMgr = new 
SequencePropertyBeanMgr (Constants.STORAGE_TYPE_IN_MEMORY);

-                       System.out.println ("put --" + newSequenceId + "--" + 
Constants.SEQ_PROPERTY_RECEIVED_MSG_LIST);

-                       beanMgr.create(seqPropBean);

-                       

-                       arr.add("bbb");

-

-                       outMessage.setResponseWritten(true);

-               } else {

-                       outMessage.setResponseWritten(true);

-               }

+               outMessage.setResponseWritten(true);

 

        }

 

        public final void receive(MessageContext messgeCtx) throws AxisFault {

 

                System.out.println ("within RM Msg receiver");

-               RMMsgContext rmMsgCtx = 
MsgInitializer.initializeMessage(messgeCtx);

-               MsgValidator.validateMessage(rmMsgCtx);

+               

+               //intitializing the message.

+               RMMsgContext rmMsgCtx = null;

+        try {

+               rmMsgCtx = MsgInitializer.initializeMessage(messgeCtx);

+        }catch (RMException ex) {

+               throw new AxisFault ("Cant initialize the message");

+        }

 

                AbstractMessageReceiver msgReceiver = null;

-               if (rmMsgCtx.getMessageType() == 
Constants.MESSAGE_TYPE_CREATE_SEQ) {

-                       

-                       CreateSequence createSeqPart = (CreateSequence) 
rmMsgCtx.getMessagePart(Constants.MESSAGE_PART_CREATE_SEQ);

-                       if (createSeqPart==null)

-                               throw new AxisFault ("No create sequence part 
in create sequence message");

-                       

-                       //String acksTo = 
createSeqPart.getAcksTo().getEndPointReference().toString();

-                       String from = messgeCtx.getFrom().getAddress();

-                       if(from.equals(Constants.WSA.NS_URI_ANONYMOUS)) {

-                               msgReceiver = new RMInOutSyncMsgReceiver ();

-                       } else {

-                               msgReceiver = new RMInOutAsyncMsgReceiver ();

-                       }

-                       

+               

+               String replyTo = messgeCtx.getFrom().getAddress();

+               if((replyTo==null) || 
replyTo.equals(Constants.WSA.NS_URI_ANONYMOUS)) {

+                       msgReceiver = new RMInOutSyncMsgReceiver ();

                } else {

-                       //TODO: Check weather terminate

-                       msgReceiver = new RMInMsgReceiver ();

+                       msgReceiver = new RMInOutAsyncMsgReceiver ();

                }

                

                if(msgReceiver!=null) {

@@ -147,8 +137,12 @@
        private class RMInMsgReceiver extends AbstractInMessageReceiver {

                

                public void invokeBusinessLogic(MessageContext inMessage) 
throws AxisFault {

-                       RMMsgContext rmMsgCtx = 
MsgInitializer.initializeMessage(inMessage);

-                       MsgValidator.validateMessage(rmMsgCtx);

+                       RMMsgContext rmMsgCtx = null;

+               try {

+                       rmMsgCtx = MsgInitializer.initializeMessage(inMessage);

+               }catch (RMException ex) {

+                       throw new AxisFault ("Cant initialize the message");

+               }

                        

                        //TODO check for terminate sequence.

                        //TODO handle terminate sequence.

@@ -161,8 +155,12 @@
                

                public void invokeBusinessLogic(MessageContext inMessage, 
MessageContext outMessage) throws AxisFault {

                        

-                       RMMsgContext rmMsgCtx = 
MsgInitializer.initializeMessage(inMessage);

-                       MsgValidator.validateMessage(rmMsgCtx);

+                       RMMsgContext rmMsgCtx = null;

+               try {

+                       rmMsgCtx = MsgInitializer.initializeMessage(inMessage);

+               }catch (RMException ex) {

+                       throw new AxisFault ("Cant initialize the message");

+               }

                        

                        if 
(rmMsgCtx.getMessageType()==Constants.MESSAGE_TYPE_CREATE_SEQ) {

                                //TODO handle sync create seq.

@@ -177,8 +175,12 @@
                public void invokeBusinessLogic(MessageContext inMessage,

                                MessageContext outMessage, ServerCallback 
callback) throws AxisFault {

                        

-                       RMMsgContext rmMsgCtx = 
MsgInitializer.initializeMessage(inMessage);

-                       MsgValidator.validateMessage(rmMsgCtx);

+                       RMMsgContext rmMsgCtx = null;

+               try {

+                       rmMsgCtx = MsgInitializer.initializeMessage(inMessage);

+               }catch (RMException ex) {

+                       throw new AxisFault ("Cant initialize the message");

+               }

                        

                        if 
(rmMsgCtx.getMessageType()==Constants.MESSAGE_TYPE_CREATE_SEQ) {

                                //TODO handle async create seq.




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to