org.apache.sandesha.storage.dao
Interface ISandeshaDAO

All Known Implementing Classes:
SandeshaDatabaseDAO, SandeshaQueueDAO

public interface ISandeshaDAO

Author:
Chamikara Jayalath

Method Summary
 boolean addIncomingSequence(java.lang.String sequenceId)
          This adds a new entry in the storage to to hold messages of a perticular sequence that come in to the sandesha server/client
 void addLowPriorityMessage(RMMessageContext msg)
          Adds a low priority message to the storage (e.g.
 boolean addMessageToIncomingSequence(java.lang.String sequenceId, java.lang.Long msgNo, RMMessageContext rmMessageContext)
          This adds a incoming message to a area belonging to the given sequence in the queue.
 boolean addMessageToOutgoingSequence(java.lang.String sequenceId, RMMessageContext rmMessageContext)
          This adds the given message to the given sequence.
 void addOffer(java.lang.String msgID, java.lang.String offerID)
          Sets the offered incoming sequence, of a outgoing sequence.
 boolean addOutgoingSequence(java.lang.String sequenceId)
          This adds a entry in the storage for holding the messages of the given outgoing sequence.
 boolean addPriorityMessage(RMMessageContext message)
          Adds a priority message (e.g.
 void addRequestedSequence(java.lang.String seqId)
          When a server or client sends a create sequence, it will be marked from this method.
 void addSendMsgNo(java.lang.String seqId, long msgNo)
          The message will be added to a sent list (the list holds the messages that were sent at least once)
 RMMessageContext checkForResponseMessage(java.lang.String requestId, java.lang.String seqId)
          When the messageId of therequest message (e.g.
 void clear()
          clears the storage.
 java.lang.String getAcksTo(java.lang.String seqId)
          gets the acksTo value
 java.util.Set getAllReceivedMsgNumsOfIncomingSeq(java.lang.String sequenceId)
          This reutns a set of message numbers with all the message numbers of incoming sequence.
 java.lang.String getKeyFromIncomingSequenceId(java.lang.String incomingSeqID)
          The client side will not be able to have sequenceId as a key for storing request messages.
 java.lang.String getKeyFromOutgoingSequenceId(java.lang.String outgoingSeqID)
          This asks for the above key (the key used to hold messages) given the outgoing sequece id.
 long getLastIncomingMsgNo(java.lang.String seqId)
          Asks for the last message of the incoming sequence (if it has been received)
 RMMessageContext getNextLowPriorityMessageContextToSend()
          Asks the storage for the next low priority message (if there is any)
 RMMessageContext getNextMsgContextToProcess(java.lang.Object seq)
          This tries to get the next message to be sent from the given outgoing sequence If these is no message to be sent in the given sequence, null will be returned.
 long getNextOutgoingMessageNumber(java.lang.String sequenceId)
          This gives the next message number, outgoing storage of the given sequence esxpects.
 RMMessageContext getNextOutgoingMsgContextToSend()
          Gets the next possible message to be sent from the queue.
 RMMessageContext getNextPriorityMessageContextToSend()
          This checks the priority messages to see weather there is any one to be sent (either for the first time or a retransmission)
 java.lang.String getOffer(java.lang.String msgID)
          Gets the offered incoming sequence, of outgoing sequence.
 java.lang.Object getRandomSeqToProcess()
           
 java.lang.String getSequenceOfOutSequence(java.lang.String outsequenceId)
          this gives the seqId which is used to hold the messages of which the outsequence entry has been set to the value outsequenceId.
 boolean hasLastIncomingMsgReceived(java.lang.String seqId)
          Can be used to ckeck weather the last message has been received in the incoming sequence.
 boolean isAllIncommingTerminateReceived()
          Use this to check weather the terminate message of all sequences (incoming) has been received.
 boolean isAllOutgoingTerminateSent()
          Checks weather the terminate message of all out going sequences have been sent.
 boolean isIncomingMessageExists(java.lang.String sequenceId, java.lang.Long msgNo)
          This checks in the given incoming sequence to see weather a message of the given message no exists
 boolean isIncomingSequenceExists(java.lang.String sequenceId)
          This checks weather there is a entry for the given incoming sequence in the queue.
 boolean isIncommingTerminateReceived(java.lang.String seqId)
           
 boolean isOutgoingSequenceExists(java.lang.String sequenceId)
          Checks weather a entry for the given outgoing sequence exists in the queue.
 boolean isOutgoingTerminateSent(java.lang.String seqId)
           
 boolean isRequestedSeqPresent(java.lang.String seqId)
          Check weather the given sequence id is one of the requested once (see 'addRequestedSequence')
 boolean isSentMsg(java.lang.String seqId, long msgNo)
          Asks from the storage weather the given message has been sent at least once
 void markOutgoingMessageToDelete(java.lang.String sequenceId, java.lang.Long msgNumber)
          This outgoing message will be marked as deleted.
 void removeAllAcks(java.lang.String sequenceID)
           
 void removeCreateSequenceMsg(java.lang.String messageId)
          This checks the priority queue for a message if given messageid and moves it to the bin
 java.lang.String searchForSequenceId(java.lang.String messageId)
          Tries to give the sequence id of the outgoing message with the given message id
 void sendAck(java.lang.String sequenceId)
           
 void setAckReceived(java.lang.String seqId, long msgNo)
          Tells to the rtorage that the given message of given sequence was acked.
 void setAcksTo(java.lang.String seqId, java.lang.String acksTo)
          Set the acks to of the given sequence.
 void setOutSequence(java.lang.String sequenceId, java.lang.String outSequenceId)
          This sets the outgoing sequence.
 void setOutSequenceApproved(java.lang.String sequenceID, boolean approved)
          This sets a flag in the queue to indicate that the outSequence of the perticular message set (stored with the id seqId) has been set correctly.
 void setTerminateReceived(java.lang.String seqId)
          Sets a incoming sequence of messages as terminate received.
 void setTerminateSend(java.lang.String seqId)
          Sets this after sending the terminate sequence message.
 void updateFinalMessageArrivedTime(java.lang.String sequenceID)
           
 

Method Detail

addIncomingSequence

public boolean addIncomingSequence(java.lang.String sequenceId)
This adds a new entry in the storage to to hold messages of a perticular sequence that come in to the sandesha server/client


addOutgoingSequence

public boolean addOutgoingSequence(java.lang.String sequenceId)
This adds a entry in the storage for holding the messages of the given outgoing sequence.


addPriorityMessage

public boolean addPriorityMessage(RMMessageContext message)
Adds a priority message (e.g. create seq) to the queue. These will be sent before other messages like application requests.


getNextPriorityMessageContextToSend

public RMMessageContext getNextPriorityMessageContextToSend()
This checks the priority messages to see weather there is any one to be sent (either for the first time or a retransmission)


addMessageToIncomingSequence

public boolean addMessageToIncomingSequence(java.lang.String sequenceId,
                                            java.lang.Long msgNo,
                                            RMMessageContext rmMessageContext)
This adds a incoming message to a area belonging to the given sequence in the queue.


addMessageToOutgoingSequence

public boolean addMessageToOutgoingSequence(java.lang.String sequenceId,
                                            RMMessageContext rmMessageContext)
This adds the given message to the given sequence.


isIncomingSequenceExists

public boolean isIncomingSequenceExists(java.lang.String sequenceId)
This checks weather there is a entry for the given incoming sequence in the queue.


isOutgoingSequenceExists

public boolean isOutgoingSequenceExists(java.lang.String sequenceId)
Checks weather a entry for the given outgoing sequence exists in the queue.


isIncomingMessageExists

public boolean isIncomingMessageExists(java.lang.String sequenceId,
                                       java.lang.Long msgNo)
This checks in the given incoming sequence to see weather a message of the given message no exists


getNextMsgContextToProcess

public RMMessageContext getNextMsgContextToProcess(java.lang.Object seq)
This tries to get the next message to be sent from the given outgoing sequence If these is no message to be sent in the given sequence, null will be returned.


getNextOutgoingMsgContextToSend

public RMMessageContext getNextOutgoingMsgContextToSend()
Gets the next possible message to be sent from the queue.


getRandomSeqToProcess

public java.lang.Object getRandomSeqToProcess()

getAllReceivedMsgNumsOfIncomingSeq

public java.util.Set getAllReceivedMsgNumsOfIncomingSeq(java.lang.String sequenceId)
This reutns a set of message numbers with all the message numbers of incoming sequence.


setOutSequence

public void setOutSequence(java.lang.String sequenceId,
                           java.lang.String outSequenceId)
This sets the outgoing sequence. Here seqId is the entry in the queue that we hope to hold the messages of a perticular sequence. outseqid is the actual sequence id (i.e. uuid). That will be set within the wsrm:sequence field of this message. (remember that we may not have received this actual outgoing sequence id by the time we start to store outgoing messages).


setOutSequenceApproved

public void setOutSequenceApproved(java.lang.String sequenceID,
                                   boolean approved)
This sets a flag in the queue to indicate that the outSequence of the perticular message set (stored with the id seqId) has been set correctly. The value in outSequence may be wrong before the sender gets the create seq. response. After getting this and after setting the out sequence correctly using the previous method, this flag will be set to true. Only then these messages thould be send to the sender.


getSequenceOfOutSequence

public java.lang.String getSequenceOfOutSequence(java.lang.String outsequenceId)
this gives the seqId which is used to hold the messages of which the outsequence entry has been set to the value outsequenceId.


removeCreateSequenceMsg

public void removeCreateSequenceMsg(java.lang.String messageId)
This checks the priority queue for a message if given messageid and moves it to the bin


getNextOutgoingMessageNumber

public long getNextOutgoingMessageNumber(java.lang.String sequenceId)
This gives the next message number, outgoing storage of the given sequence esxpects. Actually this will be used by storage managers to obtain the message number that should be put to the next application message.


checkForResponseMessage

public RMMessageContext checkForResponseMessage(java.lang.String requestId,
                                                java.lang.String seqId)
When the messageId of therequest message (e.g. from relates to) and the sequence id is given this will give the response message.


searchForSequenceId

public java.lang.String searchForSequenceId(java.lang.String messageId)
Tries to give the sequence id of the outgoing message with the given message id


markOutgoingMessageToDelete

public void markOutgoingMessageToDelete(java.lang.String sequenceId,
                                        java.lang.Long msgNumber)
This outgoing message will be marked as deleted. i.e. it will not be re-transmitted


setAckReceived

public void setAckReceived(java.lang.String seqId,
                           long msgNo)
Tells to the rtorage that the given message of given sequence was acked.


addLowPriorityMessage

public void addLowPriorityMessage(RMMessageContext msg)
Adds a low priority message to the storage (e.g. terminate sequence). These messages are axpected to be sent after sending all the other messages of the given sequence (but it is not a must)


getNextLowPriorityMessageContextToSend

public RMMessageContext getNextLowPriorityMessageContextToSend()
Asks the storage for the next low priority message (if there is any)


addSendMsgNo

public void addSendMsgNo(java.lang.String seqId,
                         long msgNo)
The message will be added to a sent list (the list holds the messages that were sent at least once)


isSentMsg

public boolean isSentMsg(java.lang.String seqId,
                         long msgNo)
Asks from the storage weather the given message has been sent at least once


hasLastIncomingMsgReceived

public boolean hasLastIncomingMsgReceived(java.lang.String seqId)
Can be used to ckeck weather the last message has been received in the incoming sequence.


getLastIncomingMsgNo

public long getLastIncomingMsgNo(java.lang.String seqId)
Asks for the last message of the incoming sequence (if it has been received)


addRequestedSequence

public void addRequestedSequence(java.lang.String seqId)
When a server or client sends a create sequence, it will be marked from this method. But the actual resources will be allocated only when the first message arrives.


isRequestedSeqPresent

public boolean isRequestedSeqPresent(java.lang.String seqId)
Check weather the given sequence id is one of the requested once (see 'addRequestedSequence')


getKeyFromIncomingSequenceId

public java.lang.String getKeyFromIncomingSequenceId(java.lang.String incomingSeqID)
The client side will not be able to have sequenceId as a key for storing request messages. Since it may be not known when the user adds first message. This asks for that key, giving sequence id of incoming messages.


getKeyFromOutgoingSequenceId

public java.lang.String getKeyFromOutgoingSequenceId(java.lang.String outgoingSeqID)
This asks for the above key (the key used to hold messages) given the outgoing sequece id.


setTerminateSend

public void setTerminateSend(java.lang.String seqId)
Sets this after sending the terminate sequence message.


setTerminateReceived

public void setTerminateReceived(java.lang.String seqId)
Sets a incoming sequence of messages as terminate received.


isAllOutgoingTerminateSent

public boolean isAllOutgoingTerminateSent()
Checks weather the terminate message of all out going sequences have been sent.


isAllIncommingTerminateReceived

public boolean isAllIncommingTerminateReceived()
Use this to check weather the terminate message of all sequences (incoming) has been received.


setAcksTo

public void setAcksTo(java.lang.String seqId,
                      java.lang.String acksTo)
Set the acks to of the given sequence.


getAcksTo

public java.lang.String getAcksTo(java.lang.String seqId)
gets the acksTo value


addOffer

public void addOffer(java.lang.String msgID,
                     java.lang.String offerID)
Sets the offered incoming sequence, of a outgoing sequence.


getOffer

public java.lang.String getOffer(java.lang.String msgID)
Gets the offered incoming sequence, of outgoing sequence.


clear

public void clear()
clears the storage.


isOutgoingTerminateSent

public boolean isOutgoingTerminateSent(java.lang.String seqId)

isIncommingTerminateReceived

public boolean isIncommingTerminateReceived(java.lang.String seqId)

updateFinalMessageArrivedTime

public void updateFinalMessageArrivedTime(java.lang.String sequenceID)

sendAck

public void sendAck(java.lang.String sequenceId)

removeAllAcks

public void removeAllAcks(java.lang.String sequenceID)