You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fx-dev@ws.apache.org by ch...@apache.org on 2006/03/09 07:28:30 UTC
svn commit: r384448 - in
/webservices/sandesha/trunk/src/org/apache/sandesha2: ./ client/
client/reports/ handlers/ msgprocessors/ util/ workers/
Author: chamikara
Date: Wed Mar 8 22:28:27 2006
New Revision: 384448
URL: http://svn.apache.org/viewcvs?rev=384448&view=rev
Log:
Correcttions to the RM reporting functionality.
Big fixes
Added:
webservices/sandesha/trunk/src/org/apache/sandesha2/client/reports/
webservices/sandesha/trunk/src/org/apache/sandesha2/client/reports/RMReport.java
webservices/sandesha/trunk/src/org/apache/sandesha2/client/reports/SequenceReport.java
Modified:
webservices/sandesha/trunk/src/org/apache/sandesha2/AcknowledgementManager.java
webservices/sandesha/trunk/src/org/apache/sandesha2/Sandesha2Constants.java
webservices/sandesha/trunk/src/org/apache/sandesha2/TerminateManager.java
webservices/sandesha/trunk/src/org/apache/sandesha2/client/Sandesha2ClientAPI.java
webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaInHandler.java
webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqResponseMsgProcessor.java
webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/TerminateSeqMsgProcessor.java
webservices/sandesha/trunk/src/org/apache/sandesha2/util/FaultManager.java
webservices/sandesha/trunk/src/org/apache/sandesha2/util/SandeshaUtil.java
webservices/sandesha/trunk/src/org/apache/sandesha2/util/SequenceManager.java
webservices/sandesha/trunk/src/org/apache/sandesha2/workers/Sender.java
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/AcknowledgementManager.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/AcknowledgementManager.java?rev=384448&r1=384447&r2=384448&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/AcknowledgementManager.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/AcknowledgementManager.java Wed Mar 8 22:28:27 2006
@@ -162,29 +162,43 @@
* @param outGoingMessage
* @return
*/
- public static ArrayList getClientCompletedMessagesList (String sequenceIdentifier,ConfigurationContext configurationContext) throws SandeshaException {
- StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(configurationContext);
-
- SequencePropertyBeanMgr sequencePropertyBeanMgr = storageManager.getSequencePropretyBeanMgr();
-
+ public static ArrayList getClientCompletedMessagesList (String sequenceID,SequencePropertyBeanMgr seqPropMgr) throws SandeshaException {
+
//first trying to get it from the internal sequence id.
- SequencePropertyBean internalSequenceBean = sequencePropertyBeanMgr.retrieve(sequenceIdentifier,Sandesha2Constants.SequenceProperties.INTERNAL_SEQUENCE_ID);
+ SequencePropertyBean internalSequenceBean = seqPropMgr.retrieve(sequenceID,Sandesha2Constants.SequenceProperties.INTERNAL_SEQUENCE_ID);
String internalSequenceID = null;
if (internalSequenceBean!=null)
internalSequenceID = internalSequenceBean.getValue();
SequencePropertyBean completedMessagesBean = null;
if (internalSequenceID!=null)
- completedMessagesBean = sequencePropertyBeanMgr.retrieve(internalSequenceID,Sandesha2Constants.SequenceProperties.CLIENT_COMPLETED_MESSAGES);
+ completedMessagesBean = seqPropMgr.retrieve(internalSequenceID,Sandesha2Constants.SequenceProperties.CLIENT_COMPLETED_MESSAGES);
if (completedMessagesBean==null)
- completedMessagesBean = sequencePropertyBeanMgr.retrieve(sequenceIdentifier,Sandesha2Constants.SequenceProperties.CLIENT_COMPLETED_MESSAGES);
+ completedMessagesBean = seqPropMgr.retrieve(sequenceID,Sandesha2Constants.SequenceProperties.CLIENT_COMPLETED_MESSAGES);
+
+ ArrayList completedMsgList = null;
+ if (completedMessagesBean!=null) {
+ completedMsgList = SandeshaUtil.getArrayListFromString(completedMessagesBean.getValue());
+ } else {
+ String message = "Completed messages bean is null, for the sequence " + sequenceID;
+ throw new SandeshaException (message);
+ }
+
+ return completedMsgList;
+ }
+
+ public static ArrayList getServerCompletedMessagesList (String sequenceID,SequencePropertyBeanMgr seqPropMgr) throws SandeshaException {
+
+ SequencePropertyBean completedMessagesBean = null;
+
+ completedMessagesBean = seqPropMgr.retrieve(sequenceID,Sandesha2Constants.SequenceProperties.SERVER_COMPLETED_MESSAGES);
ArrayList completedMsgList = null;
if (completedMessagesBean!=null) {
completedMsgList = SandeshaUtil.getArrayListFromString(completedMessagesBean.getValue());
} else {
- String message = "Completed messages bean is null, for the sequence " + sequenceIdentifier;
+ String message = "Completed messages bean is null, for the sequence " + sequenceID;
throw new SandeshaException (message);
}
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/Sandesha2Constants.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/Sandesha2Constants.java?rev=384448&r1=384447&r2=384448&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/Sandesha2Constants.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/Sandesha2Constants.java Wed Mar 8 22:28:27 2006
@@ -272,12 +272,17 @@
String SEQUENCE_CLOSED = "SequenceClosed";
- String LAST_MESSAGE = "LastMessage";
+ 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
String HIGHEST_MSG_NO = "HighestMessageNumber";
+
+
}
public interface SOAPVersion {
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/TerminateManager.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/TerminateManager.java?rev=384448&r1=384447&r2=384448&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/TerminateManager.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/TerminateManager.java Wed Mar 8 22:28:27 2006
@@ -33,7 +33,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.sandesha2.client.Sandesha2ClientAPI;
-import org.apache.sandesha2.client.SequenceReport;
+import org.apache.sandesha2.client.reports.SequenceReport;
import org.apache.sandesha2.storage.StorageManager;
import org.apache.sandesha2.storage.Transaction;
import org.apache.sandesha2.storage.beanmanagers.CreateSeqBeanMgr;
@@ -191,10 +191,82 @@
StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(configContext);
+ SequencePropertyBeanMgr seqPropMgr = storageManager.getSequencePropretyBeanMgr();
+ SequencePropertyBean seqTerminatedBean = new SequencePropertyBean (sequenceID,Sandesha2Constants.SequenceProperties.SEQUENCE_TERMINATED,Sandesha2Constants.VALUE_TRUE);
+ seqPropMgr.insert(seqTerminatedBean);
+
+ cleanSendingSideData(configContext,sequenceID,serverSide);
+
+
+ }
+
+
+
+ private static void doUpdatesIfNeeded (String sequenceID, SequencePropertyBean propertyBean, SequencePropertyBeanMgr seqPropMgr) throws SandeshaException {
+ if (propertyBean.getName().equals(Sandesha2Constants.SequenceProperties.CLIENT_COMPLETED_MESSAGES)) {
+
+ //this value cannot be completely deleted since this data will be needed by SequenceReports
+ //so saving it with the sequenceID value being the out sequenceID.
+
+ SequencePropertyBean newBean = new SequencePropertyBean ();
+ newBean.setSequenceID(sequenceID);
+ newBean.setName(propertyBean.getName());
+ newBean.setValue(propertyBean.getValue());
+
+ seqPropMgr.insert(newBean);
+ //TODO amazingly this property does not seem to get deleted without following - in the hibernate impl
+ //(even though the lines efter current methodcall do this).
+ seqPropMgr.delete (propertyBean.getSequenceID(),propertyBean.getName());
+ }
+ }
+
+ private static boolean isProportyDeletable (String name) {
+ boolean deleatable = true;
+
+ if (Sandesha2Constants.SequenceProperties.TERMINATE_ADDED.equals(name))
+ deleatable = false;
+
+ if (Sandesha2Constants.SequenceProperties.NO_OF_OUTGOING_MSGS_ACKED.equals(name))
+ deleatable = false;
+
+ if (Sandesha2Constants.SequenceProperties.INTERNAL_SEQUENCE_ID.equals(name))
+ deleatable = false;
+
+ if (Sandesha2Constants.SequenceProperties.RM_SPEC_VERSION.equals(name))
+ deleatable = false;
+
+ if (Sandesha2Constants.SequenceProperties.SEQUENCE_TERMINATED.equals(name))
+ deleatable = false;
+
+ if (Sandesha2Constants.SequenceProperties.SEQUENCE_CLOSED.equals(name))
+ deleatable = false;
+
+ if (Sandesha2Constants.SequenceProperties.SEQUENCE_TIMED_OUT.equals(name))
+ deleatable = false;
+
+ return deleatable;
+ }
+
+ public static void timeOutSendingSideSequence (ConfigurationContext context,String sequenceID, boolean serverside) throws SandeshaException {
+ StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(context);
+
+ SequencePropertyBeanMgr seqPropMgr = storageManager.getSequencePropretyBeanMgr();
+ SequencePropertyBean seqTerminatedBean = new SequencePropertyBean (sequenceID,Sandesha2Constants.SequenceProperties.SEQUENCE_TIMED_OUT,Sandesha2Constants.VALUE_TRUE);
+ seqPropMgr.insert(seqTerminatedBean);
+
+
+ cleanSendingSideData(context,sequenceID,serverside);
+ }
+
+ private static void cleanSendingSideData (ConfigurationContext configContext,String sequenceID, boolean serverSide) throws SandeshaException {
+ StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(configContext);
+
SequencePropertyBeanMgr sequencePropertyBeanMgr = storageManager.getSequencePropretyBeanMgr();
SenderBeanMgr retransmitterBeanMgr = storageManager.getRetransmitterBeanMgr();
CreateSeqBeanMgr createSeqBeanMgr = storageManager.getCreateSeqBeanMgr();
+ SequencePropertyBean sequenceTerminatedBean = new SequencePropertyBean (sequenceID,Sandesha2Constants.SequenceProperties.SEQUENCE_TERMINATED,Sandesha2Constants.VALUE_TRUE);
+ sequencePropertyBeanMgr.insert(sequenceTerminatedBean);
if (!serverSide) {
//stpoing the listner for the client side.
@@ -214,7 +286,6 @@
}
}
}
-
}
SequencePropertyBean internalSequenceBean = sequencePropertyBeanMgr.retrieve(sequenceID,Sandesha2Constants.SequenceProperties.INTERNAL_SEQUENCE_ID);
@@ -258,43 +329,6 @@
}
SandeshaUtil.stopSenderForTheSequence(internalSequenceId);
-
- }
-
- private static void doUpdatesIfNeeded (String sequenceID, SequencePropertyBean propertyBean, SequencePropertyBeanMgr seqPropMgr) throws SandeshaException {
- if (propertyBean.getName().equals(Sandesha2Constants.SequenceProperties.CLIENT_COMPLETED_MESSAGES)) {
-
- //this value cannot be completely deleted since this data will be needed by SequenceReports
- //so saving it with the sequenceID value being the out sequenceID.
-
- SequencePropertyBean newBean = new SequencePropertyBean ();
- newBean.setSequenceID(sequenceID);
- newBean.setName(propertyBean.getName());
- newBean.setValue(propertyBean.getValue());
-
- seqPropMgr.insert(newBean);
- //TODO amazingly this property does not seem to get deleted without following - in the hibernate impl
- //(even though the lines efter current methodcall do this).
- seqPropMgr.delete (propertyBean.getSequenceID(),propertyBean.getName());
- }
- }
-
- private static boolean isProportyDeletable (String name) {
- boolean deleatable = true;
-
- if (Sandesha2Constants.SequenceProperties.TERMINATE_ADDED.equals(name))
- deleatable = false;
-
- if (Sandesha2Constants.SequenceProperties.NO_OF_OUTGOING_MSGS_ACKED.equals(name))
- deleatable = false;
-
- if (Sandesha2Constants.SequenceProperties.INTERNAL_SEQUENCE_ID.equals(name))
- deleatable = false;
-
- if (Sandesha2Constants.SequenceProperties.RM_SPEC_VERSION.equals(name))
- deleatable = false;
-
- return deleatable;
}
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/client/Sandesha2ClientAPI.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/client/Sandesha2ClientAPI.java?rev=384448&r1=384447&r2=384448&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/client/Sandesha2ClientAPI.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/client/Sandesha2ClientAPI.java Wed Mar 8 22:28:27 2006
@@ -17,38 +17,28 @@
package org.apache.sandesha2.client;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Iterator;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.ServiceClient;
import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.context.MessageContextConstants;
-import org.apache.axis2.description.TransportOutDescription;
-import org.apache.axis2.engine.AxisEngine;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.sandesha2.AcknowledgementManager;
-import org.apache.sandesha2.RMMsgContext;
import org.apache.sandesha2.Sandesha2Constants;
import org.apache.sandesha2.SandeshaException;
-import org.apache.sandesha2.SpecSpecificConstants;
-import org.apache.sandesha2.TerminateManager;
-import org.apache.sandesha2.msgprocessors.AcknowledgementProcessor;
+import org.apache.sandesha2.client.reports.RMReport;
+import org.apache.sandesha2.client.reports.SequenceReport;
import org.apache.sandesha2.storage.StorageManager;
import org.apache.sandesha2.storage.Transaction;
-import org.apache.sandesha2.storage.beanmanagers.SenderBeanMgr;
+import org.apache.sandesha2.storage.beanmanagers.CreateSeqBeanMgr;
+import org.apache.sandesha2.storage.beanmanagers.NextMsgBeanMgr;
import org.apache.sandesha2.storage.beanmanagers.SequencePropertyBeanMgr;
-import org.apache.sandesha2.storage.beans.SenderBean;
+import org.apache.sandesha2.storage.beans.CreateSeqBean;
+import org.apache.sandesha2.storage.beans.NextMsgBean;
import org.apache.sandesha2.storage.beans.SequencePropertyBean;
-import org.apache.sandesha2.transport.Sandesha2TransportOutDesc;
-import org.apache.sandesha2.util.RMMsgCreator;
import org.apache.sandesha2.util.SandeshaUtil;
import org.apache.sandesha2.util.SequenceManager;
-import com.sun.corba.se.internal.core.ServiceContext;
-
/**
* Contains all the Sandesha2Constants of Sandesha2.
* Please see sub-interfaces to see grouped data.
@@ -72,46 +62,153 @@
public static String VALUE_FALSE = "false";
public static SequenceReport getOutgoingSequenceReport (String internalSequenceID,ConfigurationContext configurationContext) throws SandeshaException {
- SequenceReport sequenceReport = new SequenceReport ();
+
+ SequenceReport sequenceReport = new SequenceReport ();
+ sequenceReport.setSequenceDirection(SequenceReport.SEQUENCE_DIRECTION_OUT);
StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(configurationContext);
- SequencePropertyBeanMgr seqpPropMgr = storageManager.getSequencePropretyBeanMgr();
+ SequencePropertyBeanMgr seqPropMgr = storageManager.getSequencePropretyBeanMgr();
+ CreateSeqBeanMgr createSeqMgr = storageManager.getCreateSeqBeanMgr();
Transaction reportTransaction = storageManager.getTransaction();
- SequencePropertyBean findBean = new SequencePropertyBean ();
- findBean.setName(Sandesha2Constants.SequenceProperties.INTERNAL_SEQUENCE_ID);
- findBean.setValue(internalSequenceID);
- SequencePropertyBean internalSequenceBean = seqpPropMgr.findUnique(findBean);
+ CreateSeqBean createSeqFindBean = new CreateSeqBean ();
+ createSeqFindBean.setInternalSequenceID(internalSequenceID);
+
+ CreateSeqBean createSeqBean = createSeqMgr.findUnique(createSeqFindBean);
+
+ if (createSeqBean==null) {
+ //check weather this is an terminated sequence.
+ if (isTerminatedSequence(internalSequenceID,seqPropMgr)) {
+ fillTerminatedOutgoingSequenceInfo (sequenceReport,internalSequenceID,seqPropMgr);
+
+ return sequenceReport;
+ }
+
+ if (isTimedOutSequence(internalSequenceID,seqPropMgr)) {
+ fillTimedoutOutgoingSequenceInfo (sequenceReport,internalSequenceID,seqPropMgr);
+
+ return sequenceReport;
+ }
+
+ String message = "Unrecorder internalSequenceID";
+ log.debug(message);
+ return null;
+ }
+
+ String outSequenceID = createSeqBean.getSequenceID();
+ if (outSequenceID==null) {
+ sequenceReport.setInternalSequenceID(internalSequenceID);
+ sequenceReport.setSequenceStatus(SequenceReport.SEQUENCE_STATUS_INITIAL);
+ sequenceReport.setSequenceDirection(SequenceReport.SEQUENCE_DIRECTION_OUT);
+
+ return sequenceReport;
+ }
+
+ sequenceReport.setSequenceStatus(SequenceReport.SEQUENCE_STATUS_ESTABLISHED);
+
+ fillOutgoingSequenceInfo(sequenceReport,outSequenceID,seqPropMgr);
+
+ reportTransaction.commit();
+
+ return sequenceReport;
+ }
+
+ private static boolean isTerminatedSequence (String internalSequenceID, SequencePropertyBeanMgr seqPropMgr) throws SandeshaException {
+ SequencePropertyBean internalSequenceFindBean = new SequencePropertyBean ();
+ internalSequenceFindBean.setValue(internalSequenceID);
+ internalSequenceFindBean.setName(Sandesha2Constants.SequenceProperties.INTERNAL_SEQUENCE_ID);
+
+ SequencePropertyBean internalSequenceBean = seqPropMgr.findUnique(internalSequenceFindBean);
if (internalSequenceBean==null) {
- log.debug("internal sequence bean is null.");
- throw new SandeshaException ("Data not available to give the sequence report");
+ String message = "Internal sequence Bean is not available for the given sequence";
+ log.debug (message);
+
+ return false;
+ }
+
+ String outSequenceID = internalSequenceBean.getSequenceID();
+
+ SequencePropertyBean sequenceTerminatedBean = seqPropMgr.retrieve(outSequenceID,Sandesha2Constants.SequenceProperties.SEQUENCE_TERMINATED);
+ if (sequenceTerminatedBean!=null && Sandesha2Constants.VALUE_TRUE.equals(sequenceTerminatedBean.getValue())) {
+ return true;
}
- String sequenceID = internalSequenceBean.getSequenceID();
+ return false;
- //finding the actual seq
- ArrayList completedMessageList = AcknowledgementManager.getClientCompletedMessagesList (sequenceID,configurationContext);
+ }
+
+ private static boolean isTimedOutSequence (String internalSequenceID, SequencePropertyBeanMgr seqPropMgr) throws SandeshaException {
+ SequencePropertyBean internalSequenceFindBean = new SequencePropertyBean ();
+ internalSequenceFindBean.setValue(internalSequenceID);
+ internalSequenceFindBean.setName(Sandesha2Constants.SequenceProperties.INTERNAL_SEQUENCE_ID);
- Iterator iter = completedMessageList.iterator();
- while (iter.hasNext()) {
- Long lng = new Long (Long.parseLong((String) iter.next()));
- sequenceReport.addCompletedMessage(lng);
+ SequencePropertyBean internalSequenceBean = seqPropMgr.findUnique(internalSequenceFindBean);
+ if (internalSequenceBean==null) {
+ String message = "Internal sequence Bean is not available for the given sequence";
+ log.debug (message);
+
+ return false;
}
- sequenceReport.setSequenceDirection(SequenceReport.SEQUENCE_DIRECTION_OUT);
- boolean completed = SequenceManager.isOutGoingSequenceCompleted(internalSequenceID,configurationContext);
- if (completed)
- sequenceReport.setSequenceStatus(SequenceReport.SEQUENCE_STATUS_COMPLETED);
+ String outSequenceID = internalSequenceBean.getSequenceID();
+
+ SequencePropertyBean sequenceTerminatedBean = seqPropMgr.retrieve(outSequenceID,Sandesha2Constants.SequenceProperties.SEQUENCE_TIMED_OUT);
+ if (sequenceTerminatedBean!=null && Sandesha2Constants.VALUE_TRUE.equals(sequenceTerminatedBean.getValue())) {
+ return true;
+ }
- //TODO complete
+ return false;
+ }
+
+ private static void fillTerminatedOutgoingSequenceInfo (SequenceReport report,String internalSequenceID,SequencePropertyBeanMgr seqPropMgr) throws SandeshaException {
+ SequencePropertyBean internalSequenceFindBean = new SequencePropertyBean ();
+ internalSequenceFindBean.setValue(internalSequenceID);
+ internalSequenceFindBean.setName(Sandesha2Constants.SequenceProperties.INTERNAL_SEQUENCE_ID);
+ SequencePropertyBean internalSequenceBean = seqPropMgr.findUnique(internalSequenceFindBean);
+ if (internalSequenceBean==null) {
+ String message = "Not a valid terminated sequence. Internal sequence Bean is not available for the given sequence";
+ log.debug (message);
+
+ throw new SandeshaException (message);
+ }
- reportTransaction.commit();
+ report.setSequenceStatus(SequenceReport.SEQUENCE_STATUS_TERMINATED);
- return sequenceReport;
+ String outSequenceID = internalSequenceBean.getSequenceID();
+ fillOutgoingSequenceInfo(report,outSequenceID,seqPropMgr);
}
+ private static void fillTimedoutOutgoingSequenceInfo (SequenceReport report,String internalSequenceID, SequencePropertyBeanMgr seqPropMgr) throws SandeshaException {
+ SequencePropertyBean internalSequenceFindBean = new SequencePropertyBean ();
+ internalSequenceFindBean.setValue(internalSequenceID);
+ internalSequenceFindBean.setName(Sandesha2Constants.SequenceProperties.INTERNAL_SEQUENCE_ID);
+
+ SequencePropertyBean internalSequenceBean = seqPropMgr.findUnique(internalSequenceFindBean);
+ if (internalSequenceBean==null) {
+ String message = "Not a valid timedOut sequence. Internal sequence Bean is not available for the given sequence";
+ log.debug (message);
+
+ throw new SandeshaException (message);
+ }
+
+ report.setSequenceStatus(SequenceReport.SEQUENCE_STATUS_TIMED_OUT);
+ String outSequenceID = internalSequenceBean.getSequenceID();
+ fillOutgoingSequenceInfo(report,outSequenceID,seqPropMgr);
+ }
+
+ private static void fillOutgoingSequenceInfo (SequenceReport report,String outSequenceID, SequencePropertyBeanMgr seqPropMgr) throws SandeshaException {
+ ArrayList completedMessageList = AcknowledgementManager.getClientCompletedMessagesList (outSequenceID,seqPropMgr);
+
+ Iterator iter = completedMessageList.iterator();
+ while (iter.hasNext()) {
+ Long lng = new Long (Long.parseLong((String) iter.next()));
+ report.addCompletedMessage(lng);
+ }
+ }
+
+
public static SequenceReport getOutgoingSequenceReport (String to, String sequenceKey,ConfigurationContext configurationContext) throws SandeshaException {
String internalSequenceID = SandeshaUtil.getInternalSequenceID (to,sequenceKey);
@@ -119,11 +216,14 @@
}
- public static SequenceReport getIncomingSequenceReport (String sequenceID,ConfigurationContext configurationContext) throws SandeshaException {
+ public static SequenceReport getIncomingSequenceReport (String sequenceID,ConfigurationContext configCtx) throws SandeshaException {
+
+ StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(configCtx);
+ SequencePropertyBeanMgr seqPropMgr = storageManager.getSequencePropretyBeanMgr();
SequenceReport sequenceReport = new SequenceReport ();
- ArrayList completedMessageList = AcknowledgementManager.getClientCompletedMessagesList (sequenceID,configurationContext);
+ ArrayList completedMessageList = AcknowledgementManager.getServerCompletedMessagesList (sequenceID,seqPropMgr);
Iterator iter = completedMessageList.iterator();
while (iter.hasNext()) {
@@ -132,18 +232,91 @@
}
sequenceReport.setSequenceDirection(SequenceReport.SEQUENCE_DIRECTION_IN);
- boolean completed = SequenceManager.isIncomingSequenceCompleted(sequenceID,configurationContext);
- if (completed)
- sequenceReport.setSequenceStatus(SequenceReport.SEQUENCE_STATUS_COMPLETED);
+
+ sequenceReport.setSequenceStatus(getServerSequenceStatus (sequenceID,storageManager));
+
+ return sequenceReport;
+ }
+
+ private static byte getServerSequenceStatus (String sequenceID,StorageManager storageManager) throws SandeshaException {
- //TODO complete
+ SequencePropertyBeanMgr seqPropMgr = storageManager.getSequencePropretyBeanMgr();
- return sequenceReport;
+ SequencePropertyBean terminatedBean = seqPropMgr.retrieve(sequenceID,Sandesha2Constants.SequenceProperties.SEQUENCE_TERMINATED);
+ if (terminatedBean!=null) {
+ return SequenceReport.SEQUENCE_STATUS_TERMINATED;
+ }
+
+ SequencePropertyBean timedOutBean = seqPropMgr.retrieve(sequenceID,Sandesha2Constants.SequenceProperties.SEQUENCE_TIMED_OUT);
+ if (timedOutBean!=null) {
+ return SequenceReport.SEQUENCE_STATUS_TIMED_OUT;
+ }
+
+ NextMsgBeanMgr nextMsgMgr = storageManager.getNextMsgBeanMgr();
+ NextMsgBean nextMsgBean = nextMsgMgr.retrieve(sequenceID);
+
+ if (nextMsgBean!=null) {
+ return SequenceReport.SEQUENCE_STATUS_ESTABLISHED;
+ }
+
+ throw new SandeshaException ("Unrecorded sequenceID");
}
- public static RMReport getRMReport1 () {
+ /**
+ * RM Report gives the details of incoming and outgoing sequences.
+ * The outgoing sequence have to pass the initial state (CS/CSR exchange) to be included in a RMReport
+ *
+ * @param configurationContext
+ * @return
+ * @throws SandeshaException
+ */
+ public static RMReport getRMReport (ConfigurationContext configurationContext) throws SandeshaException {
+
+ StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(configurationContext);
+ SequencePropertyBeanMgr seqPropMgr = storageManager.getSequencePropretyBeanMgr();
+
RMReport rmReport = new RMReport ();
+
+ SequencePropertyBean internalSequenceFindBean = new SequencePropertyBean ();
+ internalSequenceFindBean.setName(Sandesha2Constants.SequenceProperties.INTERNAL_SEQUENCE_ID);
+
+ Collection collection = seqPropMgr.find(internalSequenceFindBean);
+ Iterator iterator = collection.iterator();
+ while (iterator.hasNext()) {
+ SequencePropertyBean bean = (SequencePropertyBean) iterator.next();
+ String sequenceID = bean.getSequenceID();
+ rmReport.addToOutgoingSequenceList (sequenceID);
+ rmReport.addToOutgoingInternalSequenceMap(sequenceID,bean.getValue());
+
+ SequenceReport report = getOutgoingSequenceReport(bean.getValue(),configurationContext);
+
+ rmReport.addToNoOfCompletedMessagesMap(sequenceID ,report.getCompletedMessages().size());
+ rmReport.addToSequenceStatusMap(sequenceID ,report.getSequenceStatus());
+ }
+
+
+ //incoming sequences
+ SequencePropertyBean serverCompletedMsgsFindBean = new SequencePropertyBean ();
+ serverCompletedMsgsFindBean.setName(Sandesha2Constants.SequenceProperties.SERVER_COMPLETED_MESSAGES);
+
+ Collection serverCompletedMsgsBeans = seqPropMgr.find(serverCompletedMsgsFindBean);
+ Iterator iter = serverCompletedMsgsBeans.iterator();
+ while (iter.hasNext()) {
+ SequencePropertyBean serverCompletedMsgsBean = (SequencePropertyBean) iter.next();
+ String sequenceID = serverCompletedMsgsBean.getSequenceID();
+ rmReport.addToIncomingSequenceList(sequenceID);
+
+ SequenceReport sequenceReport = getIncomingSequenceReport(sequenceID,configurationContext);
+
+ rmReport.addToNoOfCompletedMessagesMap(sequenceID,sequenceReport.getCompletedMessages().size());
+ rmReport.addToSequenceStatusMap(sequenceID,sequenceReport.getSequenceStatus());
+ }
+
return rmReport;
+ }
+
+ public String InternalSequenceID (String to, String sequenceKey) {
+ return SandeshaUtil.getInternalSequenceID(to,sequenceKey);
}
Added: webservices/sandesha/trunk/src/org/apache/sandesha2/client/reports/RMReport.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/client/reports/RMReport.java?rev=384448&view=auto
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/client/reports/RMReport.java (added)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/client/reports/RMReport.java Wed Mar 8 22:28:27 2006
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.sandesha2.client.reports;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+
+/**
+ * @author Chamikara Jayalath <ch...@gmail.com>
+ */
+public class RMReport {
+
+ private ArrayList incomingSequenceList = null;
+ private ArrayList outgoingSequenceList = null;
+ private HashMap sequenceStatusMap = null;
+ private HashMap noOfCompletedMessagesMap = null;
+ private HashMap outgoingInternalSequenceIDMap = null;
+
+ public RMReport () {
+ incomingSequenceList = new ArrayList ();
+ outgoingSequenceList = new ArrayList ();
+ sequenceStatusMap = new HashMap ();
+ noOfCompletedMessagesMap = new HashMap ();
+ outgoingInternalSequenceIDMap = new HashMap ();
+ }
+
+ public long getCompletedMessagesCount(String sequenceID) {
+ Long lng = (Long) noOfCompletedMessagesMap.get(sequenceID);
+ if (lng==null)
+ return -1;
+
+ return lng.longValue();
+ }
+
+ public ArrayList getIncomingSequenceList() {
+ return incomingSequenceList;
+ }
+
+ public ArrayList getOutgoingSequenceList() {
+ return outgoingSequenceList;
+ }
+
+ public byte getSequenceStatusMap(String sequenceID) {
+ Byte status = (Byte) sequenceStatusMap.get(sequenceID);
+ if (status==null)
+ return SequenceReport.SEQUENCE_STATUS_UNKNOWN;
+
+ return status.byteValue();
+ }
+
+ public void addToIncomingSequenceList (String incomingSequenceID) {
+ incomingSequenceList.add(incomingSequenceID);
+ }
+
+ public void addToOutgoingSequenceList (String outSequenceID) {
+ outgoingSequenceList.add(outSequenceID);
+ }
+
+ public void addToNoOfCompletedMessagesMap (String id, long noOfMsgs) {
+ noOfCompletedMessagesMap.put(id, new Long (noOfMsgs));
+ }
+
+ public void addToSequenceStatusMap (String id, byte status) {
+ sequenceStatusMap.put(id, new Byte (status));
+ }
+
+ public String getInternalSequenceIdOfOutSequence (String outSequenceID) {
+ return (String) outgoingInternalSequenceIDMap.get(outSequenceID);
+ }
+
+ public void addToOutgoingInternalSequenceMap (String outSequenceID, String internalSequenceID) {
+ outgoingInternalSequenceIDMap.put(outSequenceID,outSequenceID);
+ }
+
+}
Added: webservices/sandesha/trunk/src/org/apache/sandesha2/client/reports/SequenceReport.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/client/reports/SequenceReport.java?rev=384448&view=auto
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/client/reports/SequenceReport.java (added)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/client/reports/SequenceReport.java Wed Mar 8 22:28:27 2006
@@ -0,0 +1,98 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package org.apache.sandesha2.client.reports;
+
+import java.util.ArrayList;
+
+/**
+ * @author Chamikara Jayalath <ch...@gmail.com>
+ */
+
+public class SequenceReport {
+
+ public static final byte SEQUENCE_STATUS_UNKNOWN = 0;
+ public static final byte SEQUENCE_STATUS_INITIAL = 1;
+ public static final byte SEQUENCE_STATUS_ESTABLISHED = 2;
+ public static final byte SEQUENCE_STATUS_TERMINATED = 3;
+ public static final byte SEQUENCE_STATUS_TIMED_OUT = 4;
+ private static final byte MAX_SEQUENCE_STATUS = 4;
+
+ public static final byte SEQUENCE_DIRECTION_UNKNOWN=0;
+ public static final byte SEQUENCE_DIRECTION_IN=1;
+ public static final byte SEQUENCE_DIRECTION_OUT=2;
+ private static final byte MAX_SEQUENCE_DIRECTION = 2;
+
+ private byte sequenceStatus = SEQUENCE_STATUS_UNKNOWN;
+ private byte sequenceDirection = SEQUENCE_DIRECTION_UNKNOWN;
+ private String sequenceID = null;
+ private String internalSequenceID = null; //only for outgoing sequences
+ private ArrayList completedMessages = null; //no of messages acked (both for incoming and outgoing)
+
+ public SequenceReport () {
+ completedMessages = new ArrayList ();
+ }
+
+ public void setSequenceStatus (byte sequenceStatus) {
+ if (sequenceStatus>=SEQUENCE_STATUS_UNKNOWN && sequenceStatus<=MAX_SEQUENCE_STATUS) {
+ this.sequenceStatus = sequenceStatus;
+ }
+ }
+
+ public void setSequenceDirection (byte sequenceDirection) {
+ if (sequenceDirection>=SEQUENCE_DIRECTION_UNKNOWN && sequenceDirection<=MAX_SEQUENCE_DIRECTION) {
+ this.sequenceDirection = sequenceDirection;
+ }
+ }
+
+ public byte getSequenceStatus () {
+ return sequenceStatus;
+ }
+
+ public byte getSequenceDirection () {
+ return sequenceDirection;
+ }
+
+ public String getSequenceID() {
+ return sequenceID;
+ }
+
+ public void setSequenceID(String sequenceID) {
+ this.sequenceID = sequenceID;
+ }
+
+ public ArrayList getCompletedMessages () {
+ return completedMessages;
+ }
+
+ public void addCompletedMessage (Long messageNo) {
+ completedMessages.add(messageNo);
+ }
+
+ public void setCompletedMessages (ArrayList completedMessages) {
+ this.completedMessages = completedMessages;
+ }
+
+ public String getInternalSequenceID() {
+ return internalSequenceID;
+ }
+
+ public void setInternalSequenceID(String internalSequenceID) {
+ this.internalSequenceID = internalSequenceID;
+ }
+
+
+}
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaInHandler.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaInHandler.java?rev=384448&r1=384447&r2=384448&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaInHandler.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaInHandler.java Wed Mar 8 22:28:27 2006
@@ -80,7 +80,7 @@
log.debug(message);
throw new AxisFault(message);
}
-
+
MsgProcessor msgProcessor = MsgProcessorFactory
.getMessageProcessor(rmMsgCtx.getMessageType());
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqResponseMsgProcessor.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqResponseMsgProcessor.java?rev=384448&r1=384447&r2=384448&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqResponseMsgProcessor.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqResponseMsgProcessor.java Wed Mar 8 22:28:27 2006
@@ -133,6 +133,9 @@
log.debug(message);
throw new SandeshaException(message);
}
+
+ createSeqBean.setSequenceID(newOutSequenceId);
+ createSeqMgr.update(createSeqBean);
//deleting the create sequence entry.
retransmitterMgr.delete(createSeqMsgId);
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/TerminateSeqMsgProcessor.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/TerminateSeqMsgProcessor.java?rev=384448&r1=384447&r2=384448&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/TerminateSeqMsgProcessor.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/TerminateSeqMsgProcessor.java Wed Mar 8 22:28:27 2006
@@ -116,6 +116,13 @@
Transaction terminateTransaction = storageManager.getTransaction();
TerminateManager.cleanReceivingSideOnTerminateMessage(context,sequenceId);
+
+
+ SequencePropertyBean terminatedBean = new SequencePropertyBean (
+ sequenceId,Sandesha2Constants.SequenceProperties.SEQUENCE_TERMINATED,Sandesha2Constants.VALUE_TRUE);
+
+ sequencePropertyBeanMgr.insert(terminatedBean);
+
terminateTransaction.commit();
SandeshaUtil.stopSenderForTheSequence(sequenceId);
@@ -125,7 +132,12 @@
Transaction lastUpdatedTransaction = storageManager.getTransaction();
SequenceManager.updateLastActivatedTime(sequenceId,context);
+
+
+
lastUpdatedTransaction.commit();
+
+
terminateSeqRMMsg.pause();
}
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/util/FaultManager.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/util/FaultManager.java?rev=384448&r1=384447&r2=384448&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/util/FaultManager.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/util/FaultManager.java Wed Mar 8 22:28:27 2006
@@ -218,7 +218,7 @@
CreateSeqBeanMgr createSeqMgr = storageManager.getCreateSeqBeanMgr();
int type = rmMessageContext.getMessageType();
- boolean validSequence = false;
+ boolean validSequence = true;
String reason = null;
if (type==Sandesha2Constants.MessageTypes.ACK ||
@@ -231,7 +231,7 @@
Collection coll = createSeqMgr.find(createSeqFindBean);
if (coll.size()==0) {
- validSequence = true;
+ validSequence = false;
}
} else {
@@ -241,14 +241,18 @@
Collection coll = mgr.retrieveAll();
Iterator it = coll.iterator();
+ boolean contains = false;
while (it.hasNext()) {
NextMsgBean nextMsgBean = (NextMsgBean) it.next();
String tempId = nextMsgBean.getSequenceID();
if (tempId.equals(sequenceID)) {
- validSequence = true;
+ contains = true;
break;
}
}
+
+ if (contains)
+ validSequence = true;
}
String rmNamespaceValue = rmMessageContext.getRMNamespaceValue();
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/util/SandeshaUtil.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/util/SandeshaUtil.java?rev=384448&r1=384447&r2=384448&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/util/SandeshaUtil.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/util/SandeshaUtil.java Wed Mar 8 22:28:27 2006
@@ -806,5 +806,25 @@
return specVersionBean.getValue();
}
-
+
+
+// public static boolean inNumberPresentInList (String list, long no) throws SandeshaException {
+//
+// }
+//
+// public static String putNumberToList (String list, long no) throws SandeshaException {
+// StringTokenizer tokenizer = new StringTokenizer (list,Sandesha2Constants.LIST_SEPERATOR);
+//
+// while (tokenizer.hasMoreElements()){
+// String element = tokenizer.nextToken();
+// String[] items = element.split(Sandesha2Constants.LIST_ITEM_SEPERATOR);
+// if (items.length!=1 && items.length!=2)
+// throw new SandeshaException ("Invalid string array");
+//
+//
+// }
+//
+// }
+
+
}
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/util/SequenceManager.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/util/SequenceManager.java?rev=384448&r1=384447&r2=384448&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/util/SequenceManager.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/util/SequenceManager.java Wed Mar 8 22:28:27 2006
@@ -8,6 +8,8 @@
import java.util.Collection;
+import javax.xml.namespace.QName;
+
import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.context.ConfigurationContext;
@@ -17,6 +19,8 @@
import org.apache.axis2.context.OperationContextFactory;
import org.apache.axis2.description.AxisOperation;
import org.apache.axis2.description.Parameter;
+import org.apache.axis2.description.TransportInDescription;
+import org.apache.axis2.engine.ListenerManager;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.sandesha2.RMMsgContext;
@@ -212,13 +216,35 @@
}
}
//Default value for acksTo is anonymous (this happens only for the client side)
- if (acksToBean==null) {
+ if (acksTo==null) {
acksTo = Sandesha2Constants.WSA.NS_URI_ANONYMOUS;
-
- EndpointReference acksToEPR = new EndpointReference(acksTo);
- acksToBean = new SequencePropertyBean(
+ }
+
+ acksToBean = new SequencePropertyBean(
internalSequenceId, Sandesha2Constants.SequenceProperties.ACKS_TO_EPR,
- acksToEPR.getAddress());
+ acksTo);
+
+ //start the in listner for the client side, if acksTo is not anonymous.
+ if (!firstAplicationMsgCtx.isServerSide() && !Sandesha2Constants.WSA.NS_URI_ANONYMOUS.equals(acksTo)) {
+
+ String transportInProtocol = firstAplicationMsgCtx.getOptions().getTransportInProtocol();
+ if (transportInProtocol==null) {
+ throw new SandeshaException ("You must mention the transport in protocol for getting async acknowledgement messages");
+ }
+
+ try {
+ ListenerManager listenerManager =
+ firstAplicationMsgCtx.getConfigurationContext().getListenerManager();
+ TransportInDescription transportIn = firstAplicationMsgCtx.getConfigurationContext().getAxisConfiguration().getTransportIn(new QName(transportInProtocol));
+ //if acksTo is not anonymous start the in-transport
+ if (!listenerManager.isListenerRunning(transportIn.getName().getLocalPart())) {
+ listenerManager.addListener(transportIn, false);
+ }
+ } catch (AxisFault e) {
+ throw new SandeshaException ("Could not stast the transport listner",e);
+ }
+
+
}
SequencePropertyBean msgsBean = new SequencePropertyBean();
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/workers/Sender.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/workers/Sender.java?rev=384448&r1=384447&r2=384448&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/workers/Sender.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/workers/Sender.java Wed Mar 8 22:28:27 2006
@@ -174,7 +174,7 @@
// do time out processing.
// TODO uncomment below line
- TerminateManager.terminateSendingSide(context,sequenceID, msgCtx.isServerSide());
+ TerminateManager.timeOutSendingSideSequence(context,sequenceID, msgCtx.isServerSide());
String message = "Sequence timed out";
log.debug(message);
---------------------------------------------------------------------
To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: sandesha-dev-help@ws.apache.org