org.systinet.wasp.wsrm.sequence
Interface OneWaySequence

All Superinterfaces:
Sequence
All Known Subinterfaces:
InputSequence, OutputSequence

public interface OneWaySequence
extends Sequence

Ancestor of one-way sequences. These sequences are created and their WS-RM id (aka wireId) sent during reliable communication. There are two kinds of a one-way sequence: OutputSequence and InputSequence.

Since:
SSJ 6.5
Component:
WS Reliable Messaging Interfaces

Nested Class Summary
static class OneWaySequence.MessageState
          Enumeration representing the state of a single message in a sequence.
static class OneWaySequence.State
          Enumeration representing a sequence state.
 
Field Summary
static int UNKNOWN_LENGTH
          Unknown sequence length or message number.
 
Method Summary
 void abort()
          Aborts this sequence immediately; sequence gets to final OneWaySequence.State.BROKEN state and no more messages can be sent within it.
 java.util.Date getExpires()
          Returns the date when this sequence expires or null when it was not specified.
 long getLength()
          Returns the length of this sequence or UNKNOWN_LENGTH if the length is not known yet.
 OneWaySequence.MessageState getMessageState(long messageNumber)
          Returns the state of a message with the given message number (within this sequence).
 OneWaySequence.State getState()
          Returns the current state of this sequence.
 java.lang.String getWireId()
          WS-RM id that is sent on the wire.
 boolean isActive()
          Determines whether this sequence is in active state and should be used in processing.
 boolean isExpired()
          Determines, whether this sequence has expired.
 boolean isOutput()
          Returns true if this sequence is an output sequence.
 void setActive(boolean active)
          Sets this sequence to the active or inactive state.
 
Methods inherited from interface org.systinet.wasp.wsrm.sequence.Sequence
getID, setExpires
 

Field Detail

UNKNOWN_LENGTH

public static final int UNKNOWN_LENGTH
Unknown sequence length or message number.

See Also:
Constant Field Values
Method Detail

isOutput

public boolean isOutput()
Returns true if this sequence is an output sequence.

Returns:
true if this sequence is output.

getWireId

public java.lang.String getWireId()
WS-RM id that is sent on the wire.

Returns:
id that is sent on the wire.

getExpires

public java.util.Date getExpires()
Returns the date when this sequence expires or null when it was not specified.


getLength

public long getLength()
Returns the length of this sequence or UNKNOWN_LENGTH if the length is not known yet. The length of the output sequence is known either when it is explicitly set by OutputSequence.setLength(long) or when the method OutputSequence.finish() is called. In the latter case, an empty message marked as last is sent.
The length of the input sequence is known when the message marked as last arrives (note: if in-order delivery is not required, there can be more messages on their way).

Returns:
number of messages in complete sequence or UNKNOWN_LENGTH if the length can not be determined (yet).

getState

public OneWaySequence.State getState()
Returns the current state of this sequence.

Returns:
the OneWaySequence.State

getMessageState

public OneWaySequence.MessageState getMessageState(long messageNumber)
                                            throws SequenceException
Returns the state of a message with the given message number (within this sequence).

Returns:
the state of the message.
Throws:
SequenceException - if something goes wrong.
See Also:
InputSequence.getCurrentMessageNumber(), OneWaySequence.MessageState

isExpired

public boolean isExpired()
Determines, whether this sequence has expired. Note that the expired sequence can be in any state (see getState()).

Returns:
true if this sequence has expired (and so no more messages can be sent or received within it)

setActive

public void setActive(boolean active)
               throws SequenceException
Sets this sequence to the active or inactive state. When setting the active state, it inactivates the currently active sequence related to the same ServiceClient / ServiceEndpoint.

It is useful when there are several pending sequences at one time. Each newly created OneWaySequence is set active by default deactivating all other competing sequences (all sequences attached to one ServiceClient or ServiceEndpoint.

Throws:
SequenceException

isActive

public boolean isActive()
Determines whether this sequence is in active state and should be used in processing.


abort

public void abort()
           throws SequenceException
Aborts this sequence immediately; sequence gets to final OneWaySequence.State.BROKEN state and no more messages can be sent within it. There is no guarantee, which of those messages being in OneWaySequence.MessageState.NOT_DELIVERED state will be delivered after this sequence has been aborted.

Throws:
SequenceException - if sequence is expired or sequence is in OneWaySequence.State.BROKEN state or some DB operation fails