Author: chamikara
Date: Wed Sep 13 02:38:51 2006
New Revision: 442919

URL: http://svn.apache.org/viewvc?view=rev&rev=442919
Log:
Updated some MessageProcessors and related classes to use to correct pattern of 
handling seuuencePropertyKeys. 
(The correct pattern is to get it from the SandeshaUtil.getSequenceProperty 
method.)


Modified:
    webservices/sandesha/trunk/java/src/org/apache/sandesha2/RMMsgContext.java
    
webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/AckRequestedProcessor.java
    
webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java
    
webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/CloseSequenceProcessor.java
    
webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/TerminateSeqMsgProcessor.java
    
webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/AcknowledgementManager.java
    
webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/RMMsgCreator.java
    
webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/SandeshaUtil.java
    
webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/SequenceManager.java
    
webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/TerminateManager.java
    
webservices/sandesha/trunk/java/src/org/apache/sandesha2/workers/InvokerWorker.java

Modified: 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/RMMsgContext.java
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/RMMsgContext.java?view=diff&rev=442919&r1=442918&r2=442919
==============================================================================
--- webservices/sandesha/trunk/java/src/org/apache/sandesha2/RMMsgContext.java 
(original)
+++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/RMMsgContext.java 
Wed Sep 13 02:38:51 2006
@@ -332,4 +332,14 @@
                
                this.addressingNamespaceValue = addressingNamespaceValue;
        }
+       
+       /**
+        * This will return the sequenceId if it could be derived from the SOAP 
envelope, in the
+        * message initiation.
+        * 
+        * @return
+        */
+       public String getGeneratedSequenceId () {
+               return (String) 
msgContext.getProperty(Sandesha2Constants.MessageContextProperties.SEQUENCE_ID);
+       }
 }

Modified: 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/AckRequestedProcessor.java
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/AckRequestedProcessor.java?view=diff&rev=442919&r1=442918&r2=442919
==============================================================================
--- 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/AckRequestedProcessor.java
 (original)
+++ 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/AckRequestedProcessor.java
 Wed Sep 13 02:38:51 2006
@@ -80,7 +80,7 @@
 
                MessageContext msgContext = rmMsgCtx.getMessageContext();
 
-               String sequenceID = 
ackRequested.getIdentifier().getIdentifier();
+               String sequenceId = 
ackRequested.getIdentifier().getIdentifier();
 
                ConfigurationContext configurationContext = 
rmMsgCtx.getMessageContext().getConfigurationContext();
 
@@ -89,8 +89,12 @@
 
                SequencePropertyBeanMgr seqPropMgr = 
storageManager.getSequencePropertyBeanMgr();
 
+               //not getting the sequencePropertyKey from the usual method 
since the ackRequest may be embedded in a message
+               //of a different sequence. (usua method 
SandeshaUtil.getSequencePropertyKey)
+               String sequencePropertyKey = sequenceId;
+               
                // Check that the sender of this AckRequest holds the correct 
token
-               SequencePropertyBean tokenBean = 
seqPropMgr.retrieve(sequenceID, 
Sandesha2Constants.SequenceProperties.SECURITY_TOKEN);
+               SequencePropertyBean tokenBean = 
seqPropMgr.retrieve(sequencePropertyKey, 
Sandesha2Constants.SequenceProperties.SECURITY_TOKEN);
                if(tokenBean != null) {
                        SecurityManager secManager = 
SandeshaUtil.getSecurityManager(configurationContext);
                        SecurityToken token = 
secManager.recoverSecurityToken(tokenBean.getValue());
@@ -100,7 +104,7 @@
                }
 
                // Setting the ack depending on AcksTo.
-               SequencePropertyBean acksToBean = 
seqPropMgr.retrieve(sequenceID,
+               SequencePropertyBean acksToBean = 
seqPropMgr.retrieve(sequencePropertyKey,
                                
Sandesha2Constants.SequenceProperties.ACKS_TO_EPR);
 
                EndpointReference acksTo = new 
EndpointReference(acksToBean.getValue());
@@ -148,7 +152,7 @@
 
                ackMsgCtx.setTo(acksTo);
                ackMsgCtx.setReplyTo(msgContext.getTo());
-               RMMsgCreator.addAckMessage(ackRMMsgCtx, sequenceID, 
storageManager);
+               
RMMsgCreator.addAckMessage(ackRMMsgCtx,sequencePropertyKey,sequenceId, 
storageManager);
                ackRMMsgCtx.getMessageContext().setServerSide(true);
                
ackMsgCtx.setProperty(AddressingConstants.WS_ADDRESSING_VERSION, msgContext
                                
.getProperty(AddressingConstants.WS_ADDRESSING_VERSION)); // TODO
@@ -158,7 +162,7 @@
                                                                                
                                                                        // the
                                                                                
                                                                        // 
RMMsgCreator
 
-               String addressingNamespaceURI = 
SandeshaUtil.getSequenceProperty(sequenceID,
+               String addressingNamespaceURI = 
SandeshaUtil.getSequenceProperty(sequencePropertyKey,
                                
Sandesha2Constants.SequenceProperties.ADDRESSING_NAMESPACE_VALUE, 
storageManager);
                String anonymousURI = 
SpecSpecificConstants.getAddressingAnonymousURI(addressingNamespaceURI);
 
@@ -204,7 +208,7 @@
                        ackBean.setMessageContextRefKey(key);
                        ackBean.setMessageID(ackMsgCtx.getMessageID());
                        ackBean.setReSend(false);
-                       ackBean.setSequenceID(sequenceID);
+                       ackBean.setSequenceID(sequenceId);
 
                        // this will be set to true in the sender.
                        ackBean.setSend(true);
@@ -269,7 +273,7 @@
                                throw new SandeshaException(e.getMessage());
                        }
 
-                       
SandeshaUtil.startSenderForTheSequence(configurationContext, sequenceID);
+                       
SandeshaUtil.startSenderForTheSequence(configurationContext, sequenceId);
 
                        msgContext.pause();
 

Modified: 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java?view=diff&rev=442919&r1=442918&r2=442919
==============================================================================
--- 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java
 (original)
+++ 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java
 Wed Sep 13 02:38:51 2006
@@ -47,6 +47,7 @@
 import org.apache.sandesha2.i18n.SandeshaMessageKeys;
 import org.apache.sandesha2.security.SecurityManager;
 import org.apache.sandesha2.security.SecurityToken;
+import org.apache.sandesha2.storage.SandeshaStorageException;
 import org.apache.sandesha2.storage.StorageManager;
 import org.apache.sandesha2.storage.beanmanagers.CreateSeqBeanMgr;
 import org.apache.sandesha2.storage.beanmanagers.InvokerBeanMgr;
@@ -373,6 +374,8 @@
                if (log.isDebugEnabled())
                        log.debug("Enter: 
ApplicationMsgProcessor::sendAckIfNeeded");
 
+               String sequencePropertyKey = 
SandeshaUtil.getSequencePropertyKey(rmMsgCtx);
+               
                Sequence sequence = (Sequence) 
rmMsgCtx.getMessagePart(Sandesha2Constants.MessageParts.SEQUENCE);
                String sequenceId = sequence.getIdentifier().getIdentifier();
                ConfigurationContext configCtx = 
rmMsgCtx.getMessageContext().getConfigurationContext();
@@ -387,7 +390,7 @@
                        rmMsgCtx.addSOAPEnvelope();
                }
 
-               RMMsgContext ackRMMessage = 
AcknowledgementManager.generateAckMessage(rmMsgCtx, sequenceId, storageManager);
+               RMMsgContext ackRMMessage = 
AcknowledgementManager.generateAckMessage(rmMsgCtx, sequencePropertyKey 
,sequenceId, storageManager);
 
                AxisEngine engine = new AxisEngine(configCtx);
 
@@ -506,7 +509,7 @@
                if (internalSequenceId!=null)
                        
rmMsgCtx.setProperty(Sandesha2Constants.MessageContextProperties.INTERNAL_SEQUENCE_ID,internalSequenceId);
 
-               String propertyKey = 
SandeshaUtil.getSequencePropertyKey(rmMsgCtx);
+               String sequencePropertyKey = 
SandeshaUtil.getSequencePropertyKey(rmMsgCtx);
 
                /*
                 * checking weather the user has given the messageNumber (most 
of the
@@ -527,7 +530,7 @@
                }
 
                // the message number that was last used.
-               long systemMessageNumber = getPreviousMsgNo(configContext, 
internalSequenceId, storageManager);
+               long systemMessageNumber = getPreviousMsgNo(configContext, 
sequencePropertyKey, storageManager);
 
                // The number given by the user has to be larger than the last 
stored
                // number.
@@ -560,19 +563,19 @@
 
                // saving the used message number
                if (!dummyMessage)
-                       setNextMsgNo(configContext, internalSequenceId, 
messageNumber, storageManager);
+                       setNextMsgNo(configContext, sequencePropertyKey, 
messageNumber, storageManager);
 
                // set this as the response highest message.
-               SequencePropertyBean responseHighestMsgBean = new 
SequencePropertyBean(internalSequenceId,
+               SequencePropertyBean responseHighestMsgBean = new 
SequencePropertyBean(sequencePropertyKey,
                                
Sandesha2Constants.SequenceProperties.HIGHEST_OUT_MSG_NUMBER, new 
Long(messageNumber).toString());
                seqPropMgr.insert(responseHighestMsgBean);
 
                if (lastMessage) {
 
-                       SequencePropertyBean responseHighestMsgKeyBean = new 
SequencePropertyBean(internalSequenceId,
+                       SequencePropertyBean responseHighestMsgKeyBean = new 
SequencePropertyBean(sequencePropertyKey,
                                        
Sandesha2Constants.SequenceProperties.HIGHEST_OUT_MSG_KEY, storageKey);
 
-                       SequencePropertyBean responseLastMsgKeyBean = new 
SequencePropertyBean(internalSequenceId,
+                       SequencePropertyBean responseLastMsgKeyBean = new 
SequencePropertyBean(sequencePropertyKey,
                                        
Sandesha2Constants.SequenceProperties.LAST_OUT_MESSAGE_NO, new 
Long(messageNumber).toString());
 
                        seqPropMgr.insert(responseHighestMsgKeyBean);
@@ -581,13 +584,13 @@
 
                boolean sendCreateSequence = false;
 
-               SequencePropertyBean outSeqBean = 
seqPropMgr.retrieve(internalSequenceId,
+               SequencePropertyBean outSeqBean = 
seqPropMgr.retrieve(sequencePropertyKey,
                                
Sandesha2Constants.SequenceProperties.OUT_SEQUENCE_ID);
 
                // setting async ack endpoint for the server side. (if present)
                if (serverSide) {
-                       String incomingSequenceID = 
SandeshaUtil.getServerSideIncomingSeqIdFromInternalSeqId(internalSequenceId);
-                       SequencePropertyBean incomingToBean = 
seqPropMgr.retrieve(incomingSequenceID,
+//                     String incomingSequenceID = 
SandeshaUtil.getServerSideIncomingSeqIdFromInternalSeqId(internalSequenceId);
+                       SequencePropertyBean incomingToBean = 
seqPropMgr.retrieve(sequencePropertyKey,
                                        
Sandesha2Constants.SequenceProperties.TO_EPR);
                        if (incomingToBean != null) {
                                String incomingTo = incomingToBean.getValue();
@@ -612,10 +615,13 @@
                        }
 
                        RMMsgContext requestRMMsgCtx = 
MsgInitializer.initializeMessage(requestMessageContext);
+                       
                        Sequence sequence = (Sequence) 
requestRMMsgCtx.getMessagePart(Sandesha2Constants.MessageParts.SEQUENCE);
-
                        String requestSequenceID = 
sequence.getIdentifier().getIdentifier();
-                       SequencePropertyBean specVersionBean = 
seqPropMgr.retrieve(requestSequenceID,
+                       
+                       String requestSideSequencePropertyKey = 
SandeshaUtil.getSequencePropertyKey(requestRMMsgCtx);
+                       
+                       SequencePropertyBean specVersionBean = 
seqPropMgr.retrieve(requestSideSequencePropertyKey,
                                        
Sandesha2Constants.SequenceProperties.RM_SPEC_VERSION);
                        if (specVersionBean == null) {
                                throw new 
SandeshaException(SandeshaMessageHelper.getMessage(
@@ -647,7 +653,7 @@
 
                        // if fist message - setup the sending side sequence - 
both for the
                        // server and the client sides
-                       SequenceManager.setupNewClientSequence(msgContext, 
internalSequenceId, specVersion, storageManager);
+                       SequenceManager.setupNewClientSequence(msgContext, 
sequencePropertyKey, specVersion, storageManager);
                }
 
                ServiceContext serviceContext = msgContext.getServiceContext();
@@ -655,15 +661,15 @@
 
                // SENDING THE CREATE SEQUENCE.
                if (sendCreateSequence) {
-                       SequencePropertyBean responseCreateSeqAdded = 
seqPropMgr.retrieve(internalSequenceId,
+                       SequencePropertyBean responseCreateSeqAdded = 
seqPropMgr.retrieve(sequencePropertyKey,
                                        
Sandesha2Constants.SequenceProperties.OUT_CREATE_SEQUENCE_SENT);
 
-                       String addressingNamespaceURI = 
SandeshaUtil.getSequenceProperty(internalSequenceId,
+                       String addressingNamespaceURI = 
SandeshaUtil.getSequenceProperty(sequencePropertyKey,
                                        
Sandesha2Constants.SequenceProperties.ADDRESSING_NAMESPACE_VALUE, 
storageManager);
                        String anonymousURI = 
SpecSpecificConstants.getAddressingAnonymousURI(addressingNamespaceURI);
 
                        if (responseCreateSeqAdded == null) {
-                               responseCreateSeqAdded = new 
SequencePropertyBean(internalSequenceId,
+                               responseCreateSeqAdded = new 
SequencePropertyBean(sequencePropertyKey,
                                                
Sandesha2Constants.SequenceProperties.OUT_CREATE_SEQUENCE_SENT, "true");
                                seqPropMgr.insert(responseCreateSeqAdded);
 
@@ -700,14 +706,24 @@
                                        if (transportIn == null)
                                                transportIn = 
org.apache.axis2.Constants.TRANSPORT_HTTP;
                                } else if (acksTo == null && serverSide) {
-                                       String incomingSequencId = SandeshaUtil
-                                                       
.getServerSideIncomingSeqIdFromInternalSeqId(internalSequenceId);
-                                       SequencePropertyBean bean = 
seqPropMgr.retrieve(incomingSequencId,
-                                                       
Sandesha2Constants.SequenceProperties.REPLY_TO_EPR);
-                                       if (bean != null) {
-                                               EndpointReference acksToEPR = 
new EndpointReference(bean.getValue());
-                                               if (acksToEPR != null)
-                                                       acksTo = (String) 
acksToEPR.getAddress();
+//                                     String incomingSequencId = SandeshaUtil
+//                                                     
.getServerSideIncomingSeqIdFromInternalSeqId(internalSequenceId);
+                                       
+                                       try {
+                                               MessageContext 
requestMsgContext = 
operationContext.getMessageContext(OperationContextFactory.MESSAGE_LABEL_IN_VALUE);
+                                               RMMsgContext 
requestRMMsgContext = MsgInitializer.initializeMessage(requestMsgContext);
+                                               
+                                               String 
requestSideSequencePropertyKey = 
SandeshaUtil.getSequencePropertyKey(requestRMMsgContext);
+                                               
+                                               SequencePropertyBean bean = 
seqPropMgr.retrieve(requestSideSequencePropertyKey,
+                                                               
Sandesha2Constants.SequenceProperties.REPLY_TO_EPR);
+                                               if (bean != null) {
+                                                       EndpointReference 
acksToEPR = new EndpointReference(bean.getValue());
+                                                       if (acksToEPR != null)
+                                                               acksTo = 
(String) acksToEPR.getAddress();
+                                               }
+                                       } catch (AxisFault e) {
+                                               throw new SandeshaException (e);
                                        }
                                } else if (anonymousURI.equals(acksTo)) {
                                        // set transport in.
@@ -716,7 +732,7 @@
                                                // TODO
                                        }
                                }
-                               addCreateSequenceMessage(rmMsgCtx, 
internalSequenceId, acksTo, storageManager);
+                               addCreateSequenceMessage(rmMsgCtx, 
sequencePropertyKey ,internalSequenceId, acksTo, storageManager);
                        }
                }
 
@@ -783,7 +799,7 @@
                        log.debug("Exit: 
ApplicationMsgProcessor::processOutMessage");
        }
 
-       private void addCreateSequenceMessage(RMMsgContext applicationRMMsg, 
String internalSequenceId, String acksTo,
+       private void addCreateSequenceMessage(RMMsgContext applicationRMMsg, 
String sequencePropertyKey, String internalSequenceId, String acksTo,
                        StorageManager storageManager) throws SandeshaException 
{
 
                if (log.isDebugEnabled())
@@ -793,7 +809,7 @@
                ConfigurationContext configCtx = 
applicationMsg.getConfigurationContext();
 
                // generating a new create sequeuce message.
-               RMMsgContext createSeqRMMessage = 
RMMsgCreator.createCreateSeqMsg(applicationRMMsg, internalSequenceId, acksTo,
+               RMMsgContext createSeqRMMessage = 
RMMsgCreator.createCreateSeqMsg(applicationRMMsg, sequencePropertyKey, acksTo,
                                storageManager);
 
                createSeqRMMessage.setFlow(MessageContext.OUT_FLOW);
@@ -810,7 +826,7 @@
 
                        SequencePropertyBean offeredSequenceBean = new 
SequencePropertyBean();
                        
offeredSequenceBean.setName(Sandesha2Constants.SequenceProperties.OFFERED_SEQUENCE);
-                       
offeredSequenceBean.setSequencePropertyKey(internalSequenceId);
+                       
offeredSequenceBean.setSequencePropertyKey(sequencePropertyKey);
                        offeredSequenceBean.setValue(offeredSequenceId);
 
                        seqPropMgr.insert(offeredSequenceBean);
@@ -836,7 +852,7 @@
                
                createSeqMgr.insert(createSeqBean);
 
-               String addressingNamespaceURI = 
SandeshaUtil.getSequenceProperty(internalSequenceId,
+               String addressingNamespaceURI = 
SandeshaUtil.getSequenceProperty(sequencePropertyKey,
                                
Sandesha2Constants.SequenceProperties.ADDRESSING_NAMESPACE_VALUE, 
storageManager);
                String anonymousURI = 
SpecSpecificConstants.getAddressingAnonymousURI(addressingNamespaceURI);
 
@@ -850,7 +866,7 @@
                createSeqEntry.setMessageContextRefKey(key);
                createSeqEntry.setTimeToSend(System.currentTimeMillis());
                createSeqEntry.setMessageID(createSeqRMMessage.getMessageId());
-               createSeqEntry.setInternalSequenceID(internalSequenceId);
+               createSeqEntry.setInternalSequenceID(sequencePropertyKey);
                // this will be set to true in the sender
                createSeqEntry.setSend(true);
 
@@ -1093,14 +1109,14 @@
                        log.debug("Exit: 
ApplicationMsgProcessor::processResponseMessage");
        }
 
-       private long getPreviousMsgNo(ConfigurationContext context, String 
internalSequenceId, StorageManager storageManager)
+       private long getPreviousMsgNo(ConfigurationContext context, String 
sequencePropertyKey, StorageManager storageManager)
                        throws SandeshaException {
                if (log.isDebugEnabled())
-                       log.debug("Enter: 
ApplicationMsgProcessor::getPreviousMsgNo, " + internalSequenceId);
+                       log.debug("Enter: 
ApplicationMsgProcessor::getPreviousMsgNo, " + sequencePropertyKey);
 
                SequencePropertyBeanMgr seqPropMgr = 
storageManager.getSequencePropertyBeanMgr();
 
-               SequencePropertyBean nextMsgNoBean = 
seqPropMgr.retrieve(internalSequenceId,
+               SequencePropertyBean nextMsgNoBean = 
seqPropMgr.retrieve(sequencePropertyKey,
                                
Sandesha2Constants.SequenceProperties.NEXT_MESSAGE_NUMBER);
 
                long nextMsgNo = -1;
@@ -1115,11 +1131,11 @@
                return nextMsgNo;
        }
 
-       private void setNextMsgNo(ConfigurationContext context, String 
internalSequenceId, long msgNo,
+       private void setNextMsgNo(ConfigurationContext context, String 
sequencePropertyKey, long msgNo,
                        StorageManager storageManager) throws SandeshaException 
{
 
                if (log.isDebugEnabled())
-                       log.debug("Enter: 
ApplicationMsgProcessor::setNextMsgNo, " + internalSequenceId + ", " + msgNo);
+                       log.debug("Enter: 
ApplicationMsgProcessor::setNextMsgNo, " + sequencePropertyKey + ", " + msgNo);
 
                if (msgNo <= 0) {
                        String message = 
SandeshaMessageHelper.getMessage(SandeshaMessageKeys.msgNumberMustBeLargerThanZero,
 Long
@@ -1129,14 +1145,14 @@
 
                SequencePropertyBeanMgr seqPropMgr = 
storageManager.getSequencePropertyBeanMgr();
 
-               SequencePropertyBean nextMsgNoBean = 
seqPropMgr.retrieve(internalSequenceId,
+               SequencePropertyBean nextMsgNoBean = 
seqPropMgr.retrieve(sequencePropertyKey,
                                
Sandesha2Constants.SequenceProperties.NEXT_MESSAGE_NUMBER);
 
                boolean update = true;
                if (nextMsgNoBean == null) {
                        update = false;
                        nextMsgNoBean = new SequencePropertyBean();
-                       
nextMsgNoBean.setSequencePropertyKey(internalSequenceId);
+                       
nextMsgNoBean.setSequencePropertyKey(sequencePropertyKey);
                        
nextMsgNoBean.setName(Sandesha2Constants.SequenceProperties.NEXT_MESSAGE_NUMBER);
                }
 

Modified: 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/CloseSequenceProcessor.java
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/CloseSequenceProcessor.java?view=diff&rev=442919&r1=442918&r2=442919
==============================================================================
--- 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/CloseSequenceProcessor.java
 (original)
+++ 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/CloseSequenceProcessor.java
 Wed Sep 13 02:38:51 2006
@@ -64,14 +64,15 @@
 
                MessageContext msgCtx = rmMsgCtx.getMessageContext();
 
-               String sequenceID = 
closeSequence.getIdentifier().getIdentifier();
-
+               String sequenceId = 
closeSequence.getIdentifier().getIdentifier();
+               String sequencePropertyKey = 
SandeshaUtil.getSequencePropertyKey(rmMsgCtx);
+               
                StorageManager storageManager = 
SandeshaUtil.getSandeshaStorageManager(configCtx, configCtx
                                .getAxisConfiguration());
                SequencePropertyBeanMgr sequencePropMgr = 
storageManager.getSequencePropertyBeanMgr();
                
                // Check that the sender of this CloseSequence holds the 
correct token
-               SequencePropertyBean tokenBean = 
sequencePropMgr.retrieve(sequenceID, 
Sandesha2Constants.SequenceProperties.SECURITY_TOKEN);
+               SequencePropertyBean tokenBean = 
sequencePropMgr.retrieve(sequenceId, 
Sandesha2Constants.SequenceProperties.SECURITY_TOKEN);
                if(tokenBean != null) {
                        SecurityManager secManager = 
SandeshaUtil.getSecurityManager(msgCtx.getConfigurationContext());
                        OMElement body = msgCtx.getEnvelope().getBody();
@@ -80,7 +81,7 @@
                }
 
                FaultManager faultManager = new FaultManager();
-               RMMsgContext faultMessageContext = 
faultManager.checkForUnknownSequence(rmMsgCtx, sequenceID, storageManager);
+               RMMsgContext faultMessageContext = 
faultManager.checkForUnknownSequence(rmMsgCtx, sequenceId, storageManager);
                if (faultMessageContext != null) {
                        ConfigurationContext configurationContext = 
msgCtx.getConfigurationContext();
                        AxisEngine engine = new 
AxisEngine(configurationContext);
@@ -97,13 +98,13 @@
                }
 
                SequencePropertyBean sequenceClosedBean = new 
SequencePropertyBean();
-               sequenceClosedBean.setSequencePropertyKey(sequenceID);
+               sequenceClosedBean.setSequencePropertyKey(sequencePropertyKey);
                
sequenceClosedBean.setName(Sandesha2Constants.SequenceProperties.SEQUENCE_CLOSED);
                sequenceClosedBean.setValue(Sandesha2Constants.VALUE_TRUE);
 
                sequencePropMgr.insert(sequenceClosedBean);
 
-               RMMsgContext ackRMMsgCtx = 
AcknowledgementManager.generateAckMessage(rmMsgCtx, sequenceID, storageManager);
+               RMMsgContext ackRMMsgCtx = 
AcknowledgementManager.generateAckMessage(rmMsgCtx, sequencePropertyKey, 
sequenceId, storageManager);
 
                MessageContext ackMsgCtx = ackRMMsgCtx.getMessageContext();
 
@@ -154,7 +155,7 @@
                        engine.send(closeSequenceResponseMsg);
                } catch (AxisFault e) {
                        String message = 
SandeshaMessageHelper.getMessage(SandeshaMessageKeys.couldNotSendTerminateResponse,
-                                       sequenceID, e.toString());
+                                       sequenceId, e.toString());
                        throw new SandeshaException(message, e);
                }
 

Modified: 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/TerminateSeqMsgProcessor.java
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/TerminateSeqMsgProcessor.java?view=diff&rev=442919&r1=442918&r2=442919
==============================================================================
--- 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/TerminateSeqMsgProcessor.java
 (original)
+++ 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/TerminateSeqMsgProcessor.java
 Wed Sep 13 02:38:51 2006
@@ -95,13 +95,15 @@
                        log.debug(message);
                        throw new SandeshaException(message);
                }
+               
+               String sequencePropertyKey = 
SandeshaUtil.getSequencePropertyKey(terminateSeqRMMsg);
 
                ConfigurationContext context = 
terminateSeqMsg.getConfigurationContext();
                StorageManager storageManager = 
SandeshaUtil.getSandeshaStorageManager(context,context.getAxisConfiguration());
                SequencePropertyBeanMgr sequencePropertyBeanMgr = 
storageManager.getSequencePropertyBeanMgr();
                
                // Check that the sender of this TerminateSequence holds the 
correct token
-               SequencePropertyBean tokenBean = 
sequencePropertyBeanMgr.retrieve(sequenceId, 
Sandesha2Constants.SequenceProperties.SECURITY_TOKEN);
+               SequencePropertyBean tokenBean = 
sequencePropertyBeanMgr.retrieve(sequencePropertyKey, 
Sandesha2Constants.SequenceProperties.SECURITY_TOKEN);
                if(tokenBean != null) {
                        SecurityManager secManager = 
SandeshaUtil.getSecurityManager(context);
                        OMElement body = 
terminateSeqRMMsg.getSOAPEnvelope().getBody();
@@ -129,7 +131,7 @@
 
 
                SequencePropertyBean terminateReceivedBean = new 
SequencePropertyBean();
-               terminateReceivedBean.setSequencePropertyKey(sequenceId);
+               
terminateReceivedBean.setSequencePropertyKey(sequencePropertyKey);
                
terminateReceivedBean.setName(Sandesha2Constants.SequenceProperties.TERMINATE_RECEIVED);
                terminateReceivedBean.setValue("true");
 
@@ -137,13 +139,13 @@
 
                // add the terminate sequence response if required.
                if 
(SpecSpecificConstants.isTerminateSequenceResponseRequired(terminateSeqRMMsg.getRMSpecVersion()))
-                       addTerminateSequenceResponse(terminateSeqRMMsg, 
sequenceId, storageManager);
+                       addTerminateSequenceResponse(terminateSeqRMMsg, 
sequencePropertyKey, sequenceId, storageManager);
 
-               setUpHighestMsgNumbers(context, storageManager, sequenceId, 
terminateSeqRMMsg);
+               setUpHighestMsgNumbers(context, 
storageManager,sequencePropertyKey, sequenceId, terminateSeqRMMsg);
 
-               TerminateManager.cleanReceivingSideOnTerminateMessage(context, 
sequenceId, storageManager);
+               TerminateManager.cleanReceivingSideOnTerminateMessage(context, 
sequencePropertyKey, sequenceId, storageManager);
 
-               SequencePropertyBean terminatedBean = new 
SequencePropertyBean(sequenceId,
+               SequencePropertyBean terminatedBean = new 
SequencePropertyBean(sequencePropertyKey,
                                
Sandesha2Constants.SequenceProperties.SEQUENCE_TERMINATED, 
Sandesha2Constants.VALUE_TRUE);
 
                sequencePropertyBeanMgr.insert(terminatedBean);
@@ -151,7 +153,7 @@
                // removing an entry from the listener
                String transport = 
terminateSeqMsg.getTransportIn().getName().getLocalPart();
 
-               SequenceManager.updateLastActivatedTime(sequenceId, 
storageManager);
+               SequenceManager.updateLastActivatedTime(sequencePropertyKey, 
storageManager);
 
                terminateSeqMsg.pause();
 
@@ -160,31 +162,34 @@
        }
 
        private void setUpHighestMsgNumbers(ConfigurationContext configCtx, 
StorageManager storageManager,
-                       String sequenceID, RMMsgContext terminateRMMsg) throws 
SandeshaException {
+                       String requestSidesequencePropertyKey, String 
sequenceId, RMMsgContext terminateRMMsg) throws SandeshaException {
 
                if (log.isDebugEnabled())
-                       log.debug("Enter: 
TerminateSeqMsgProcessor::setUpHighestMsgNumbers, " + sequenceID);
+                       log.debug("Enter: 
TerminateSeqMsgProcessor::setUpHighestMsgNumbers, " + sequenceId);
 
                SequencePropertyBeanMgr seqPropMgr = 
storageManager.getSequencePropertyBeanMgr();
 
-               String highestImMsgNumberStr = 
SandeshaUtil.getSequenceProperty(sequenceID,
+               String highestImMsgNumberStr = 
SandeshaUtil.getSequenceProperty(requestSidesequencePropertyKey,
                                
Sandesha2Constants.SequenceProperties.HIGHEST_IN_MSG_NUMBER, storageManager);
-               String highestImMsgKey = 
SandeshaUtil.getSequenceProperty(sequenceID,
+               String highestImMsgKey = 
SandeshaUtil.getSequenceProperty(requestSidesequencePropertyKey,
                                
Sandesha2Constants.SequenceProperties.HIGHEST_IN_MSG_KEY, storageManager);
 
                long highestInMsgNo = 0;
                if (highestImMsgNumberStr != null) {
                        if (highestImMsgKey == null)
                                throw new 
SandeshaException(SandeshaMessageHelper.getMessage(
-                                               
SandeshaMessageKeys.highestMsgKeyNotStored, sequenceID));
+                                               
SandeshaMessageKeys.highestMsgKeyNotStored, sequenceId));
 
                        highestInMsgNo = Long.parseLong(highestImMsgNumberStr);
                }
 
                // following will be valid only for the server side, since the 
obtained
                // int. seq ID is only valid there.
-               String responseSideInternalSequenceID = 
SandeshaUtil.getOutgoingSideInternalSequenceID(sequenceID);
-
+               String responseSideInternalSequenceId = 
SandeshaUtil.getOutgoingSideInternalSequenceID(sequenceId);
+               
+               //sequencePropertyKey is equal to the internalSequenceId for 
the outgoing sequence.
+               String responseSideSequencePropertyKey = 
responseSideInternalSequenceId;
+               
                long highestOutMsgNo = 0;
                try {
                        boolean addResponseSideTerminate = false;
@@ -193,7 +198,7 @@
                        } else {
 
                                // setting the last in message property
-                               SequencePropertyBean lastInMsgBean = new 
SequencePropertyBean(sequenceID,
+                               SequencePropertyBean lastInMsgBean = new 
SequencePropertyBean(requestSidesequencePropertyKey,
                                                
Sandesha2Constants.SequenceProperties.LAST_IN_MESSAGE_NO, 
highestImMsgNumberStr);
                                seqPropMgr.insert(lastInMsgBean);
 
@@ -222,7 +227,7 @@
                                                // considered as the last out 
message.
                                                highestOutMsgNo = 
seqPartOfOutMsg.getMessageNumber().getMessageNumber();
                                                SequencePropertyBean 
highestOutMsgBean = new SequencePropertyBean(
-                                                               
responseSideInternalSequenceID,
+                                                               
responseSideSequencePropertyKey ,
                                                                
Sandesha2Constants.SequenceProperties.LAST_OUT_MESSAGE_NO, new 
Long(highestOutMsgNo)
                                                                                
.toString());
 
@@ -234,16 +239,16 @@
 
                        // If all the out message have been acked, add the 
outgoing
                        // terminate seq msg.
-                       String outgoingSqunceID = 
SandeshaUtil.getSequenceProperty(responseSideInternalSequenceID,
+                       String outgoingSqunceID = 
SandeshaUtil.getSequenceProperty(responseSideSequencePropertyKey,
                                        
Sandesha2Constants.SequenceProperties.OUT_SEQUENCE_ID, storageManager);
-                       if (addResponseSideTerminate && highestOutMsgNo > 0 && 
responseSideInternalSequenceID != null
+                       if (addResponseSideTerminate && highestOutMsgNo > 0 && 
responseSideSequencePropertyKey != null
                                        && outgoingSqunceID != null) {
-                               boolean allAcked = 
SandeshaUtil.isAllMsgsAckedUpto(highestOutMsgNo, responseSideInternalSequenceID,
+                               boolean allAcked = 
SandeshaUtil.isAllMsgsAckedUpto(highestOutMsgNo, 
responseSideSequencePropertyKey,
                                                storageManager);
 
                                if (allAcked)
                                        
TerminateManager.addTerminateSequenceMessage(terminateRMMsg, outgoingSqunceID,
-                                                       
responseSideInternalSequenceID, storageManager);
+                                                       
responseSideSequencePropertyKey, storageManager);
                        }
                } catch (AxisFault e) {
                        throw new SandeshaException(e);
@@ -252,11 +257,11 @@
                        log.debug("Exit: 
TerminateSeqMsgProcessor::setUpHighestMsgNumbers");
        }
 
-       private void addTerminateSequenceResponse(RMMsgContext 
terminateSeqRMMsg, String sequenceID,
+       private void addTerminateSequenceResponse(RMMsgContext 
terminateSeqRMMsg, String sequencePropertyKey,String sequenceId,
                        StorageManager storageManager) throws SandeshaException 
{
 
                if (log.isDebugEnabled())
-                       log.debug("Enter: 
TerminateSeqMsgProcessor::addTerminateSequenceResponse, " + sequenceID);
+                       log.debug("Enter: 
TerminateSeqMsgProcessor::addTerminateSequenceResponse, " + sequenceId);
 
                MessageContext terminateSeqMsg = 
terminateSeqRMMsg.getMessageContext();
                ConfigurationContext configCtx = 
terminateSeqMsg.getConfigurationContext();
@@ -272,8 +277,8 @@
                RMMsgContext terminateSeqResponseRMMsg = 
RMMsgCreator.createTerminateSeqResponseMsg(terminateSeqRMMsg,
                                outMessage, storageManager);
 
-               RMMsgContext ackRMMessage = 
AcknowledgementManager.generateAckMessage(terminateSeqRMMsg, sequenceID,
-                               storageManager);
+               RMMsgContext ackRMMessage = 
AcknowledgementManager.generateAckMessage(terminateSeqRMMsg, 
sequencePropertyKey, 
+                               sequenceId,     storageManager);
                
                Iterator iter = 
ackRMMessage.getMessageParts(Sandesha2Constants.MessageParts.SEQ_ACKNOWLEDGEMENT);
                
@@ -309,7 +314,7 @@
                        throw new SandeshaException(message, e);
                }
 
-               String addressingNamespaceURI = 
SandeshaUtil.getSequenceProperty(sequenceID,
+               String addressingNamespaceURI = 
SandeshaUtil.getSequenceProperty(sequencePropertyKey,
                                
Sandesha2Constants.SequenceProperties.ADDRESSING_NAMESPACE_VALUE, 
storageManager);
                String anonymousURI = 
SpecSpecificConstants.getAddressingAnonymousURI(addressingNamespaceURI);
 

Modified: 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/AcknowledgementManager.java
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/AcknowledgementManager.java?view=diff&rev=442919&r1=442918&r2=442919
==============================================================================
--- 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/AcknowledgementManager.java
 (original)
+++ 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/AcknowledgementManager.java
 Wed Sep 13 02:38:51 2006
@@ -190,7 +190,7 @@
                return completedMsgList;
        }
 
-       public static RMMsgContext generateAckMessage(RMMsgContext 
referenceRMMessage, String sequenceID,
+       public static RMMsgContext generateAckMessage(RMMsgContext 
referenceRMMessage, String sequencePropertyKey ,String sequenceId,
                        StorageManager storageManager) throws SandeshaException 
{
 
                MessageContext referenceMsg = 
referenceRMMessage.getMessageContext();
@@ -199,7 +199,7 @@
                SequencePropertyBeanMgr seqPropMgr = 
storageManager.getSequencePropertyBeanMgr();
 
                // Setting the ack depending on AcksTo.
-               SequencePropertyBean acksToBean = 
seqPropMgr.retrieve(sequenceID,
+               SequencePropertyBean acksToBean = 
seqPropMgr.retrieve(sequencePropertyKey,
                                
Sandesha2Constants.SequenceProperties.ACKS_TO_EPR);
 
                EndpointReference acksTo = new 
EndpointReference(acksToBean.getValue());
@@ -256,11 +256,11 @@
                ackMsgCtx.setTo(acksTo);
 
                // adding the SequenceAcknowledgement part.
-               RMMsgCreator.addAckMessage(ackRMMsgCtx, sequenceID, 
storageManager);
+               RMMsgCreator.addAckMessage(ackRMMsgCtx, sequencePropertyKey 
,sequenceId, storageManager);
 
                ackMsgCtx.setProperty(MessageContext.TRANSPORT_IN, null);
 
-               String addressingNamespaceURI = 
SandeshaUtil.getSequenceProperty(sequenceID,
+               String addressingNamespaceURI = 
SandeshaUtil.getSequenceProperty(sequencePropertyKey,
                                
Sandesha2Constants.SequenceProperties.ADDRESSING_NAMESPACE_VALUE, 
storageManager);
                String anonymousURI = 
SpecSpecificConstants.getAddressingAnonymousURI(addressingNamespaceURI);
 
@@ -307,7 +307,7 @@
                        ackBean.setMessageContextRefKey(key);
                        ackBean.setMessageID(ackMsgCtx.getMessageID());
                        ackBean.setReSend(false);
-                       ackBean.setSequenceID(sequenceID);
+                       ackBean.setSequenceID(sequencePropertyKey);
 
                        // this will be set to true in the sender.
                        ackBean.setSend(true);
@@ -361,7 +361,7 @@
                        ackMsgCtx.setTransportOut(new 
Sandesha2TransportOutDesc());
                        RMMsgContext ackRMMessageCtx = 
MsgInitializer.initializeMessage(ackMsgCtx);
 
-                       
SandeshaUtil.startSenderForTheSequence(configurationContext, sequenceID);
+                       
SandeshaUtil.startSenderForTheSequence(configurationContext, sequenceId);
                        return ackRMMessageCtx;
                }
        }

Modified: 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/RMMsgCreator.java
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/RMMsgCreator.java?view=diff&rev=442919&r1=442918&r2=442919
==============================================================================
--- 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/RMMsgCreator.java 
(original)
+++ 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/RMMsgCreator.java 
Wed Sep 13 02:38:51 2006
@@ -199,7 +199,7 @@
         * @return
         * @throws SandeshaException
         */
-       public static RMMsgContext createCreateSeqMsg(RMMsgContext 
applicationRMMsg, String internalSequenceId,
+       public static RMMsgContext createCreateSeqMsg(RMMsgContext 
applicationRMMsg, String sequencePropertyKey,
                        String acksTo, StorageManager storageManager) throws 
SandeshaException {
 
                MessageContext applicationMsgContext = 
applicationRMMsg.getMessageContext();
@@ -253,13 +253,13 @@
 
                RMMsgContext createSeqRMMsg = new 
RMMsgContext(createSeqmsgContext);
 
-               String rmVersion = 
SandeshaUtil.getRMVersion(internalSequenceId, storageManager);
+               String rmVersion = 
SandeshaUtil.getRMVersion(sequencePropertyKey, storageManager);
                if (rmVersion == null)
                        throw new 
SandeshaException(SandeshaMessageHelper.getMessage(SandeshaMessageKeys.cannotDecideRMVersion));
 
                String rmNamespaceValue = 
SpecSpecificConstants.getRMNamespaceValue(rmVersion);
 
-               String addressingNamespaceValue = 
SandeshaUtil.getSequenceProperty(internalSequenceId,
+               String addressingNamespaceValue = 
SandeshaUtil.getSequenceProperty(sequencePropertyKey,
                                
Sandesha2Constants.SequenceProperties.ADDRESSING_NAMESPACE_VALUE, 
storageManager);
 
                CreateSequence createSequencePart = new 
CreateSequence(rmNamespaceValue, addressingNamespaceValue);
@@ -278,9 +278,9 @@
                        }
                }
 
-               SequencePropertyBean replyToBean = 
seqPropMgr.retrieve(internalSequenceId,
+               SequencePropertyBean replyToBean = 
seqPropMgr.retrieve(sequencePropertyKey,
                                
Sandesha2Constants.SequenceProperties.REPLY_TO_EPR);
-               SequencePropertyBean toBean = 
seqPropMgr.retrieve(internalSequenceId,
+               SequencePropertyBean toBean = 
seqPropMgr.retrieve(sequencePropertyKey,
                                Sandesha2Constants.SequenceProperties.TO_EPR);
 
                if (toBean == null || toBean.getValue() == null)
@@ -330,9 +330,9 @@
                }
 
                
createSeqRMMsg.setAction(SpecSpecificConstants.getCreateSequenceAction(SandeshaUtil.getRMVersion(
-                               internalSequenceId, storageManager)));
+                               sequencePropertyKey, storageManager)));
                
createSeqRMMsg.setSOAPAction(SpecSpecificConstants.getCreateSequenceSOAPAction(SandeshaUtil.getRMVersion(
-                               internalSequenceId, storageManager)));
+                               sequencePropertyKey, storageManager)));
 
                finalizeCreation(applicationMsgContext, createSeqmsgContext);
 
@@ -619,9 +619,9 @@
         * @param sequenceId
         * @throws SandeshaException
         */
-       public static void addAckMessage(RMMsgContext applicationMsg, String 
sequenceId, StorageManager storageManager)
+       public static void addAckMessage(RMMsgContext applicationMsg, String 
sequencePropertyKey ,String sequenceId, StorageManager storageManager)
                        throws SandeshaException {
-
+               
                SOAPFactory factory = 
SOAPAbstractFactory.getSOAPFactory(SandeshaUtil.getSOAPVersion(applicationMsg
                                .getSOAPEnvelope()));
 
@@ -634,7 +634,7 @@
 
                ConfigurationContext ctx = 
applicationMsg.getMessageContext().getConfigurationContext();
 
-               String rmVersion = SandeshaUtil.getRMVersion(sequenceId, 
storageManager);
+               String rmVersion = 
SandeshaUtil.getRMVersion(sequencePropertyKey, storageManager);
                if (rmVersion == null)
                        throw new 
SandeshaException(SandeshaMessageHelper.getMessage(SandeshaMessageKeys.cannotDecideRMVersion));
 
@@ -647,7 +647,7 @@
 
                SequencePropertyBeanMgr seqPropMgr = 
storageManager.getSequencePropertyBeanMgr();
 
-               SequencePropertyBean seqBean = seqPropMgr.retrieve(sequenceId,
+               SequencePropertyBean seqBean = 
seqPropMgr.retrieve(sequencePropertyKey,
                                
Sandesha2Constants.SequenceProperties.SERVER_COMPLETED_MESSAGES);
                String msgNoList = (String) seqBean.getValue();
 
@@ -658,7 +658,7 @@
                        sequenceAck.addAcknowledgementRanges(ackRange);
                }
 
-               SequencePropertyBean sequenceClosedBean = 
seqPropMgr.retrieve(sequenceId,
+               SequencePropertyBean sequenceClosedBean = 
seqPropMgr.retrieve(sequencePropertyKey,
                                
Sandesha2Constants.SequenceProperties.SEQUENCE_CLOSED);
 
                if (sequenceClosedBean != null && 
Sandesha2Constants.VALUE_TRUE.equals(sequenceClosedBean.getValue())) {

Modified: 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/SandeshaUtil.java
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/SandeshaUtil.java?view=diff&rev=442919&r1=442918&r2=442919
==============================================================================
--- 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/SandeshaUtil.java 
(original)
+++ 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/SandeshaUtil.java 
Wed Sep 13 02:38:51 2006
@@ -855,10 +855,10 @@
                        return sequencePropertyBean.getValue();
        }
 
-       public static boolean isAllMsgsAckedUpto(long highestInMsgNo, String 
internalSequenceID,
+       public static boolean isAllMsgsAckedUpto(long highestInMsgNo, String 
sequencePropertyKey,
                        StorageManager storageManager) throws SandeshaException 
{
 
-               String clientCompletedMessages = 
getSequenceProperty(internalSequenceID,
+               String clientCompletedMessages = 
getSequenceProperty(sequencePropertyKey,
                                
Sandesha2Constants.SequenceProperties.CLIENT_COMPLETED_MESSAGES, 
storageManager);
                ArrayList ackedMsgsList = 
getArrayListFromString(clientCompletedMessages);
 

Modified: 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/SequenceManager.java
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/SequenceManager.java?view=diff&rev=442919&r1=442918&r2=442919
==============================================================================
--- 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/SequenceManager.java
 (original)
+++ 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/SequenceManager.java
 Wed Sep 13 02:38:51 2006
@@ -154,7 +154,7 @@
 
        }
 
-       public static void setupNewClientSequence(MessageContext 
firstAplicationMsgCtx, String internalSequenceId,
+       public static void setupNewClientSequence(MessageContext 
firstAplicationMsgCtx, String sequencePropertyKey,
                        String specVersion, StorageManager storageManager) 
throws SandeshaException {
 
                ConfigurationContext configurationContext = 
firstAplicationMsgCtx.getConfigurationContext();
@@ -191,7 +191,7 @@
                                                                                
                                                                        // with
                                                                                
                                                                        // 
addressing.
 
-               SequencePropertyBean addressingNamespaceBean = new 
SequencePropertyBean(internalSequenceId,
+               SequencePropertyBean addressingNamespaceBean = new 
SequencePropertyBean(sequencePropertyKey,
                                
Sandesha2Constants.SequenceProperties.ADDRESSING_NAMESPACE_VALUE, 
addressingNamespace);
                seqPropMgr.insert(addressingNamespaceBean);
 
@@ -206,7 +206,7 @@
                        throw new SandeshaException(message);
                }
 
-               SequencePropertyBean toBean = new 
SequencePropertyBean(internalSequenceId,
+               SequencePropertyBean toBean = new 
SequencePropertyBean(sequencePropertyKey,
                                Sandesha2Constants.SequenceProperties.TO_EPR, 
toEPR.getAddress());
                SequencePropertyBean replyToBean = null;
                SequencePropertyBean acksToBean = null;
@@ -238,9 +238,9 @@
                                                                                
                                                                // req
                                                                                
                                                                // msg.
                                if (replyToEPR != null) {
-                                       replyToBean = new 
SequencePropertyBean(internalSequenceId,
+                                       replyToBean = new 
SequencePropertyBean(sequencePropertyKey,
                                                        
Sandesha2Constants.SequenceProperties.REPLY_TO_EPR, replyToEPR.getAddress());
-                                       acksToBean = new 
SequencePropertyBean(internalSequenceId,
+                                       acksToBean = new 
SequencePropertyBean(sequencePropertyKey,
                                                        
Sandesha2Constants.SequenceProperties.ACKS_TO_EPR, replyToEPR.getAddress());
                                } else {
                                        String message = 
SandeshaMessageHelper.getMessage(SandeshaMessageKeys.toEPRNotValid, null);
@@ -260,7 +260,7 @@
                        acksTo = anonymousURI;
                }
 
-               acksToBean = new SequencePropertyBean(internalSequenceId, 
Sandesha2Constants.SequenceProperties.ACKS_TO_EPR,
+               acksToBean = new SequencePropertyBean(sequencePropertyKey, 
Sandesha2Constants.SequenceProperties.ACKS_TO_EPR,
                                acksTo);
 
                // start the in listner for the client side, if acksTo is not 
anonymous.
@@ -288,7 +288,7 @@
                }
 
                SequencePropertyBean msgsBean = new SequencePropertyBean();
-               msgsBean.setSequencePropertyKey(internalSequenceId);
+               msgsBean.setSequencePropertyKey(sequencePropertyKey);
                
msgsBean.setName(Sandesha2Constants.SequenceProperties.CLIENT_COMPLETED_MESSAGES);
                msgsBean.setValue("");
 
@@ -304,7 +304,7 @@
                String transportTo = (String) 
firstAplicationMsgCtx.getProperty(MessageContextConstants.TRANSPORT_URL);
                if (transportTo != null) {
                        SequencePropertyBean transportToBean = new 
SequencePropertyBean();
-                       
transportToBean.setSequencePropertyKey(internalSequenceId);
+                       
transportToBean.setSequencePropertyKey(sequencePropertyKey);
                        
transportToBean.setName(Sandesha2Constants.SequenceProperties.TRANSPORT_TO);
                        transportToBean.setValue(transportTo);
 
@@ -313,15 +313,15 @@
 
                // setting the spec version for the client side.
                SequencePropertyBean specVerionBean = new 
SequencePropertyBean();
-               specVerionBean.setSequencePropertyKey(internalSequenceId);
+               specVerionBean.setSequencePropertyKey(sequencePropertyKey);
                
specVerionBean.setName(Sandesha2Constants.SequenceProperties.RM_SPEC_VERSION);
                specVerionBean.setValue(specVersion);
                seqPropMgr.insert(specVerionBean);
 
                // updating the last activated time.
-               updateLastActivatedTime(internalSequenceId, storageManager);
+               updateLastActivatedTime(sequencePropertyKey, storageManager);
 
-               SandeshaUtil.startSenderForTheSequence(configurationContext, 
internalSequenceId);
+               SandeshaUtil.startSenderForTheSequence(configurationContext, 
sequencePropertyKey);
 
                
                updateClientSideListnerIfNeeded(firstAplicationMsgCtx, 
anonymousURI);
@@ -406,13 +406,13 @@
         * @param configContext
         * @throws SandeshaException
         */
-       public static void updateLastActivatedTime(String propertyKey, 
StorageManager storageManager)
+       public static void updateLastActivatedTime(String sequencePropertyKey, 
StorageManager storageManager)
                        throws SandeshaException {
                // Transaction lastActivatedTransaction =
                // storageManager.getTransaction();
                SequencePropertyBeanMgr sequencePropertyBeanMgr = 
storageManager.getSequencePropertyBeanMgr();
 
-               SequencePropertyBean lastActivatedBean = 
sequencePropertyBeanMgr.retrieve(propertyKey,
+               SequencePropertyBean lastActivatedBean = 
sequencePropertyBeanMgr.retrieve(sequencePropertyKey,
                                
Sandesha2Constants.SequenceProperties.LAST_ACTIVATED_TIME);
 
                boolean added = false;
@@ -420,7 +420,7 @@
                if (lastActivatedBean == null) {
                        added = true;
                        lastActivatedBean = new SequencePropertyBean();
-                       lastActivatedBean.setSequencePropertyKey(propertyKey);
+                       
lastActivatedBean.setSequencePropertyKey(sequencePropertyKey);
                        
lastActivatedBean.setName(Sandesha2Constants.SequenceProperties.LAST_ACTIVATED_TIME);
                }
 

Modified: 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/TerminateManager.java
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/TerminateManager.java?view=diff&rev=442919&r1=442918&r2=442919
==============================================================================
--- 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/TerminateManager.java
 (original)
+++ 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/TerminateManager.java
 Wed Sep 13 02:38:51 2006
@@ -73,7 +73,7 @@
         * @param sequenceID
         * @throws SandeshaException
         */
-       public static void 
cleanReceivingSideOnTerminateMessage(ConfigurationContext configContext, String 
sequenceID,
+       public static void 
cleanReceivingSideOnTerminateMessage(ConfigurationContext configContext, String 
sequencePropertyKey ,String sequenceId,
                        StorageManager storageManager) throws SandeshaException 
{
                // clean senderMap
 
@@ -83,14 +83,14 @@
 
                if (!inOrderInvocation) {
                        // there is no invoking by Sandesha2. So clean 
invocations storages.
-                       cleanReceivingSideAfterInvocation(configContext, 
sequenceID, storageManager);
+                       cleanReceivingSideAfterInvocation(configContext, 
sequencePropertyKey, sequenceId, storageManager);
                }
 
-               String cleanStatus = (String) 
receivingSideCleanMap.get(sequenceID);
+               String cleanStatus = (String) 
receivingSideCleanMap.get(sequenceId);
                if (cleanStatus != null && 
CLEANED_AFTER_INVOCATION.equals(cleanStatus))
-                       completeTerminationOfReceivingSide(configContext, 
sequenceID, storageManager);
+                       completeTerminationOfReceivingSide(configContext, 
sequencePropertyKey, sequenceId, storageManager);
                else {
-                       receivingSideCleanMap.put(sequenceID, 
CLEANED_ON_TERMINATE_MSG);
+                       receivingSideCleanMap.put(sequenceId, 
CLEANED_ON_TERMINATE_MSG);
                }
        }
 
@@ -103,13 +103,13 @@
         * @param sequenceID
         * @throws SandeshaException
         */
-       public static void 
cleanReceivingSideAfterInvocation(ConfigurationContext configContext, String 
sequenceID,
+       public static void 
cleanReceivingSideAfterInvocation(ConfigurationContext configContext, String 
sequencePropertyKey ,String sequenceId,
                        StorageManager storageManager) throws SandeshaException 
{
                InvokerBeanMgr storageMapBeanMgr = 
storageManager.getStorageMapBeanMgr();
 
                // removing storageMap entries
                InvokerBean findStorageMapBean = new InvokerBean();
-               findStorageMapBean.setSequenceID(sequenceID);
+               findStorageMapBean.setSequenceID(sequenceId);
                findStorageMapBean.setInvoked(true);
                Collection collection = 
storageMapBeanMgr.find(findStorageMapBean);
                Iterator iterator = collection.iterator();
@@ -126,11 +126,11 @@
 
                }
 
-               String cleanStatus = (String) 
receivingSideCleanMap.get(sequenceID);
+               String cleanStatus = (String) 
receivingSideCleanMap.get(sequenceId);
                if (cleanStatus != null && 
CLEANED_ON_TERMINATE_MSG.equals(cleanStatus))
-                       completeTerminationOfReceivingSide(configContext, 
sequenceID, storageManager);
+                       completeTerminationOfReceivingSide(configContext, 
sequencePropertyKey, sequenceId, storageManager);
                else {
-                       receivingSideCleanMap.put(sequenceID, 
CLEANED_AFTER_INVOCATION);
+                       receivingSideCleanMap.put(sequenceId, 
CLEANED_AFTER_INVOCATION);
                }
        }
 
@@ -139,14 +139,14 @@
         * methods.
         * 
         */
-       private static void 
completeTerminationOfReceivingSide(ConfigurationContext configContext, String 
sequenceID,
+       private static void 
completeTerminationOfReceivingSide(ConfigurationContext configContext, String 
sequencePropertyKey,String sequenceId,
                        StorageManager storageManager) throws SandeshaException 
{
                InvokerBeanMgr storageMapBeanMgr = 
storageManager.getStorageMapBeanMgr();
                NextMsgBeanMgr nextMsgBeanMgr = 
storageManager.getNextMsgBeanMgr();
 
                // removing nextMsgMgr entries
                NextMsgBean findNextMsgBean = new NextMsgBean();
-               findNextMsgBean.setSequenceID(sequenceID);
+               findNextMsgBean.setSequenceID(sequenceId);
                Collection collection = nextMsgBeanMgr.find(findNextMsgBean);
                Iterator iterator = collection.iterator();
                while (iterator.hasNext()) {
@@ -155,17 +155,17 @@
                }
 
                // removing the HighestInMessage entry.
-               String highestInMessageKey = 
SandeshaUtil.getSequenceProperty(sequenceID,
+               String highestInMessageKey = 
SandeshaUtil.getSequenceProperty(sequencePropertyKey,
                                
Sandesha2Constants.SequenceProperties.HIGHEST_IN_MSG_KEY, storageManager);
                if (highestInMessageKey != null) {
                        
storageManager.removeMessageContext(highestInMessageKey);
                }
 
-               removeReceivingSideProperties(configContext, sequenceID, 
storageManager);
+               removeReceivingSideProperties(configContext, 
sequencePropertyKey, sequenceId, storageManager);
        }
 
-       private static void removeReceivingSideProperties(ConfigurationContext 
configContext, String sequenceID,
-                       StorageManager storageManager) throws SandeshaException 
{
+       private static void removeReceivingSideProperties(ConfigurationContext 
configContext, String sequencePropertyKey, 
+                       String sequenceId, StorageManager storageManager) 
throws SandeshaException {
                SequencePropertyBeanMgr sequencePropertyBeanMgr = 
storageManager.getSequencePropertyBeanMgr();
                SequencePropertyBean allSequenceBean = 
sequencePropertyBeanMgr.retrieve(
                                
Sandesha2Constants.SequenceProperties.ALL_SEQUENCES,
@@ -175,7 +175,7 @@
                        log.debug("AllSequence bean is null");
 
                        ArrayList allSequenceList = 
SandeshaUtil.getArrayListFromString(allSequenceBean.getValue());
-                       allSequenceList.remove(sequenceID);
+                       allSequenceList.remove(sequenceId);
 
                        // updating
                        allSequenceBean.setValue(allSequenceList.toString());

Modified: 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/workers/InvokerWorker.java
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/workers/InvokerWorker.java?view=diff&rev=442919&r1=442918&r2=442919
==============================================================================
--- 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/workers/InvokerWorker.java
 (original)
+++ 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/workers/InvokerWorker.java
 Wed Sep 13 02:38:51 2006
@@ -55,6 +55,8 @@
                        msgToInvoke = 
storageManager.retrieveMessageContext(messageContextKey, configurationContext);
                        RMMsgContext rmMsg = 
MsgInitializer.initializeMessage(msgToInvoke);
 
+                       String sequencePropertyKey = 
SandeshaUtil.getSequencePropertyKey(rmMsg);
+                       
                        //endint the transaction before invocation.
                        transaction.commit();
                                
@@ -130,7 +132,7 @@
                                Sequence sequence = (Sequence) rmMsg
                                                
.getMessagePart(Sandesha2Constants.MessageParts.SEQUENCE);
                                if (sequence.getLastMessage() != null) {
-                                       
TerminateManager.cleanReceivingSideAfterInvocation(configurationContext, 
sequenceId, storageManager);
+                                       
TerminateManager.cleanReceivingSideAfterInvocation(configurationContext, 
sequencePropertyKey, sequenceId, storageManager);
                                        // exit from current iteration. (since 
an entry
                                        // was removed)
                                        



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

Reply via email to