Author: gatfora
Date: Wed Dec 20 10:03:44 2006
New Revision: 489161

URL: http://svn.apache.org/viewvc?view=rev&rev=489161
Log:
Move the highestIn properties to the RMDBean

Modified:
    
webservices/sandesha/trunk/java/src/org/apache/sandesha2/Sandesha2Constants.java
    
webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/SequenceProcessor.java
    
webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/TerminateSeqMsgProcessor.java
    
webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beans/RMDBean.java

Modified: 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/Sandesha2Constants.java
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/Sandesha2Constants.java?view=diff&rev=489161&r1=489160&r2=489161
==============================================================================
--- 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/Sandesha2Constants.java
 (original)
+++ 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/Sandesha2Constants.java
 Wed Dec 20 10:03:44 2006
@@ -274,16 +274,12 @@
 
                String REPLY_TO_EPR = "ReplyToEPR";
 
-               String APP_MSG_PROCESSOR_LIST = "AppMsgProcessorList";
-
                String OUT_CREATE_SEQUENCE_SENT = "OutCreateSeqSent";
 
                String NEXT_MESSAGE_NUMBER = "NextMsgNo";
 
                String INCOMING_SEQUENCE_LIST = "IncomingSequenceList";
 
-               String CHECK_RESPONSE = "CheckResponse";
-
                String OFFERED_SEQUENCE = "OfferedSequence";
 
                String TERMINATE_ADDED = "TerminateAdded";
@@ -296,8 +292,6 @@
                
                String TRANSPORT_TO = "TransportTo";
                
-               String OUT_SEQ_ACKSTO = "OutSequenceAcksTo";
-               
                String SEQUENCE_CLOSED = "SequenceClosed";
                
                String SEQUENCE_CLOSED_CLIENT = "SequenceClosedClient"; 
//indicates the client has sent a close sequence
@@ -305,15 +299,6 @@
                String SEQUENCE_TERMINATED = "SequenceTerminated";
                
                String SEQUENCE_TIMED_OUT = "SequenceTimedOut";
-               
-//             String LAST_MESSAGE = "LastMessage";
-
-               String REQUEST_SIDE_SEQUENCE_ID = "RequestSideSequenceID";      
        //used only at the server side
-               
-               // A pair of properties to keep track of the highest received 
message
-               // for an inbound sequence.
-               String HIGHEST_IN_MSG_NUMBER = "HighestInMsgNumber";
-               String HIGHEST_IN_MSG_ID = "HighestInMsgId";
                
                // Once an inbound sequence is closed, or we receive a message 
with the
                // 'LastMessage' marker, we record the message id of the 
highest message

Modified: 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/SequenceProcessor.java
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/SequenceProcessor.java?view=diff&rev=489161&r1=489160&r2=489161
==============================================================================
--- 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/SequenceProcessor.java
 (original)
+++ 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/SequenceProcessor.java
 Wed Dec 20 10:03:44 2006
@@ -151,17 +151,19 @@
                        throw new SandeshaException(message);
                }
 
-               String key = SandeshaUtil.getUUID(); // key to store the 
message.
+               // Pause the messages bean if not the right message to invoke.
+               RMDBeanMgr mgr = storageManager.getRMDBeanMgr();
+               RMDBean bean = mgr.retrieve(sequenceId);
+
+               if (bean == null) {
+                       throw new 
SandeshaException(SandeshaMessageHelper.getMessage(SandeshaMessageKeys.cannotFindSequence,
+                                       sequenceId));
+               }
 
+               String key = SandeshaUtil.getUUID(); // key to store the 
message.
                // updating the Highest_In_Msg_No property which gives the 
highest
                // message number retrieved from this sequence.
-               String highetsInMsgNoStr = 
SandeshaUtil.getSequenceProperty(propertyKey,
-                               
Sandesha2Constants.SequenceProperties.HIGHEST_IN_MSG_NUMBER, storageManager);
-
-               long highestInMsgNo = 0;
-               if (highetsInMsgNoStr != null) {
-                       highestInMsgNo = Long.parseLong(highetsInMsgNoStr);
-               }
+               long highestInMsgNo = bean.getHighestInMessageNumber();
 
                if (msgNo > highestInMsgNo) {
                        // If WS-Addressing is turned off there may not be a 
message id written into the SOAP
@@ -172,18 +174,11 @@
                                messageId = SandeshaUtil.getUUID();
                                msgCtx.setMessageID(messageId);
                        }
-                       SequencePropertyBean highestMsgNoBean = new 
SequencePropertyBean(propertyKey,
-                                       
Sandesha2Constants.SequenceProperties.HIGHEST_IN_MSG_NUMBER, 
Long.toString(msgNo));
-                       SequencePropertyBean highestMsgIdBean = new 
SequencePropertyBean(propertyKey,
-                                       
Sandesha2Constants.SequenceProperties.HIGHEST_IN_MSG_ID, messageId);
-
-                       if (highetsInMsgNoStr != null) {
-                               seqPropMgr.update(highestMsgNoBean);
-                               seqPropMgr.update(highestMsgIdBean);
-                       } else {
-                               seqPropMgr.insert(highestMsgNoBean);
-                               seqPropMgr.insert(highestMsgIdBean);
-                       }
+                       
+                       bean.setHighestInMessageId(messageId);
+                       bean.setHighestInMessageNumber(msgNo);
+                       // Update the bean
+                       mgr.update(bean);
                }
 
                String messagesStr = "";
@@ -217,17 +212,6 @@
                        seqPropMgr.update(msgsBean);
                }
 
-               // Pause the messages bean if not the right message to invoke.
-               RMDBeanMgr mgr = storageManager.getRMDBeanMgr();
-               RMDBean bean = mgr.retrieve(sequenceId);
-
-               if (bean == null) {
-                       throw new 
SandeshaException(SandeshaMessageHelper.getMessage(SandeshaMessageKeys.cannotFindSequence,
-                                       sequenceId));
-               }
-
-               InvokerBeanMgr storageMapMgr = 
storageManager.getInvokerBeanMgr();
-
                // inorder invocation is still a global property
                boolean inOrderInvocation = SandeshaUtil.getPropertyBean(
                                
msgCtx.getConfigurationContext().getAxisConfiguration()).isInOrder();
@@ -238,6 +222,8 @@
                
rmMsgCtx.setProperty(Sandesha2Constants.MessageContextProperties.MESSAGE_NUMBER,new
 Long (msgNo));
                
                if (inOrderInvocation && !msgNoPresentInList) {
+
+                       InvokerBeanMgr storageMapMgr = 
storageManager.getInvokerBeanMgr();
 
                        // saving the message.
                        try {

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=489161&r1=489160&r2=489161
==============================================================================
--- 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/TerminateSeqMsgProcessor.java
 (original)
+++ 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/TerminateSeqMsgProcessor.java
 Wed Dec 20 10:03:44 2006
@@ -39,7 +39,9 @@
 import org.apache.sandesha2.security.SecurityManager;
 import org.apache.sandesha2.security.SecurityToken;
 import org.apache.sandesha2.storage.StorageManager;
+import org.apache.sandesha2.storage.beanmanagers.RMDBeanMgr;
 import org.apache.sandesha2.storage.beanmanagers.SequencePropertyBeanMgr;
+import org.apache.sandesha2.storage.beans.RMDBean;
 import org.apache.sandesha2.storage.beans.SequencePropertyBean;
 import org.apache.sandesha2.util.AcknowledgementManager;
 import org.apache.sandesha2.util.FaultManager;
@@ -164,19 +166,10 @@
 
                SequencePropertyBeanMgr seqPropMgr = 
storageManager.getSequencePropertyBeanMgr();
 
-               String highestImMsgNumberStr = 
SandeshaUtil.getSequenceProperty(requestSidesequencePropertyKey,
-                               
Sandesha2Constants.SequenceProperties.HIGHEST_IN_MSG_NUMBER, storageManager);
-               String highestImMsgId = 
SandeshaUtil.getSequenceProperty(requestSidesequencePropertyKey,
-                               
Sandesha2Constants.SequenceProperties.HIGHEST_IN_MSG_ID, storageManager);
-
-               long highestInMsgNo = 0;
-               if (highestImMsgNumberStr != null) {
-                       if (highestImMsgId == null)
-                               throw new 
SandeshaException(SandeshaMessageHelper.getMessage(
-                                               
SandeshaMessageKeys.highestMsgIdNotStored, sequenceId));
+               RMDBeanMgr mgr = storageManager.getRMDBeanMgr();
+               RMDBean bean = mgr.retrieve(sequenceId);
 
-                       highestInMsgNo = Long.parseLong(highestImMsgNumberStr);
-               }
+               long highestInMsgNo = bean.getHighestInMessageNumber();
 
                // following will be valid only for the server side, since the 
obtained
                // int. seq ID is only valid there.
@@ -193,9 +186,9 @@
                        } else {
                                // Mark up the highest inbound message as if it 
had the last message flag on it.
                                // 
-                               String inMsgId = highestImMsgId;
+                               String inMsgId = bean.getHighestInMessageId();
                                SequencePropertyBean lastInMsgBean = new 
SequencePropertyBean(requestSidesequencePropertyKey,
-                                               
Sandesha2Constants.SequenceProperties.LAST_IN_MSG_ID, highestImMsgId);
+                                               
Sandesha2Constants.SequenceProperties.LAST_IN_MSG_ID, 
bean.getHighestInMessageId());
                                seqPropMgr.insert(lastInMsgBean);
                                
                                // If an outbound message has already gone out 
with that relatesTo, then we can terminate

Modified: 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beans/RMDBean.java
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beans/RMDBean.java?view=diff&rev=489161&r1=489160&r2=489161
==============================================================================
--- 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beans/RMDBean.java
 (original)
+++ 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/storage/beans/RMDBean.java
 Wed Dec 20 10:03:44 2006
@@ -50,6 +50,11 @@
         */
        private String referenceMessageKey;
        
+       private long highestInMessageNumber = 0;
+       
+       private String highestInMessageId;
+       
+       
 
        public RMDBean() {
 
@@ -106,6 +111,22 @@
                this.referenceMessageKey = referenceMessageKey;
        }
        
+       public String getHighestInMessageId() {
+       return highestInMessageId;
+  }
+
+       public void setHighestInMessageId(String highestInMessageId) {
+       this.highestInMessageId = highestInMessageId;
+  }
+
+       public long getHighestInMessageNumber() {
+       return highestInMessageNumber;
+  }
+
+       public void setHighestInMessageNumber(long highestInMessageNumber) {
+       this.highestInMessageNumber = highestInMessageNumber;
+  }
+       
        public String toString() {
                StringBuffer result = new StringBuffer();
                result.append(this.getClass().getName());
@@ -113,6 +134,9 @@
                result.append("\nNext Msg # : "); 
result.append(nextMsgNoToProcess);
                result.append("\nPolling    : "); result.append(pollingMode);
                result.append("\nRef Msg Key: "); 
result.append(referenceMessageKey);
+               result.append("\nHishestInMessageNumber: "); 
result.append(highestInMessageNumber);
+               result.append("\nHishestInMessageKey: "); 
result.append(highestInMessageId);
                return result.toString();
        }
+
 }



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

Reply via email to