uk.org.ogsadai.sessions
Interface SessionStreamManager

All Known Implementing Classes:
SimpleSessionStreamManager

public interface SessionStreamManager

The interface through which session input and output streams can be written to and read from.

Author:
The OGSA-DAI Project Team

Method Summary
 java.lang.Object getBlock(SessionStreamID id)
          Gets the next block of data available from the specified session output stream.
 java.lang.Object getFully(SessionStreamID id)
          Gets an aggregate of all the data from the specified session output stream.
 java.lang.Object getNBlocks(SessionStreamID id, int numberOfBlocks)
          Gets an aggregate of a number of available blocks of data from a session output stream.
 boolean hasInput(SessionStreamID id)
          Determines whether or not an input stream with the specified identity exists and is open for writing to.
 boolean hasOutput(SessionStreamID id)
          Determines whether or not an output stream with the specified identity exists.
 boolean hasSession(SessionID id)
          Determines whether or not a session with the specified identity exists.
 void putBlock(SessionStreamID id, java.lang.Object data)
          Puts a block of data onto a specified session stream.
 void putFully(SessionStreamID id, java.lang.Object data)
          Puts a block containing all the input data for a specified session stream into the stream and then closes the stream for further input.
 

Method Detail

hasSession

public boolean hasSession(SessionID id)
                   throws SessionLookupException
Determines whether or not a session with the specified identity exists.

Parameters:
id - The session identifier.
Returns:
true if the session exists otherwise false.
Throws:
SessionLookupException - if there is a problem in accessing the session.

hasInput

public boolean hasInput(SessionStreamID id)
                 throws SessionNotFoundException,
                        SessionLookupException
Determines whether or not an input stream with the specified identity exists and is open for writing to.

Parameters:
id - The session stream identifier for the input stream.
Returns:
true if the stream exists and is open, otherwise false.
Throws:
SessionNotFoundException - if the session in id does not exist.
SessionLookupException - if there is a problem in accessing the session.

hasOutput

public boolean hasOutput(SessionStreamID id)
                  throws SessionNotFoundException,
                         SessionLookupException
Determines whether or not an output stream with the specified identity exists.

If it exists but contains no more data then a EngineConstants.NO_MORE_DATA block will be returned from the getBlock and getNBlocks methods.

Parameters:
id - The session stream identifier for the output stream.
Returns:
true if the stream exists and is open, otherwise false.
Throws:
SessionNotFoundException - if the session in id does not exist.
SessionLookupException - if there is a problem in accessing the session.

getBlock

public java.lang.Object getBlock(SessionStreamID id)
                          throws SessionNotFoundException,
                                 SessionLookupException,
                                 SessionStreamNotFoundException,
                                 SessionStreamRequestNotProcessingException,
                                 SessionStreamIOException
Gets the next block of data available from the specified session output stream.

To indicate to the caller that no more data is available, a no-more-data block - a qualified name {http://ogsadai.org.uk/namespaces/2005/10/properties}NoMoreData (see the constant uk.org.ogsadai.engine.EngineConstants.NO_MORE_DATA) can be expected to be provided by this method after retrieval of the final block of data.

Parameters:
id - The session stream identifier.
Returns:
an Object containing a single block of data.
Throws:
SessionNotFoundException - if the session in id does not exist.
SessionLookupException - if there is a problem in accessing the session.
SessionStreamNotFoundException - if there is no such session or no such stream in the session.
SessionStreamRequestNotProcessingException - if the request to which the stream belongs has not started processing.
SessionStreamIOException - if there is a problem when reading from the specified session stream.

getFully

public java.lang.Object getFully(SessionStreamID id)
                          throws SessionNotFoundException,
                                 SessionLookupException,
                                 SessionStreamNotFoundException,
                                 SessionStreamRequestNotProcessingException,
                                 SessionStreamIOException
Gets an aggregate of all the data from the specified session output stream.

Parameters:
id - The session stream identifier
Returns:
an Object containing an aggregate of all the blocks of data.
Throws:
SessionNotFoundException - if the session in id does not exist.
SessionLookupException - if there is a problem in accessing the session.
SessionStreamNotFoundException - if there is no such session or no such stream in the session.
SessionStreamRequestNotProcessingException - if the request to which the stream belongs has not started processing.
SessionStreamIOException - if there is a problem when reading from the specified session stream.

getNBlocks

public java.lang.Object getNBlocks(SessionStreamID id,
                                   int numberOfBlocks)
                            throws SessionNotFoundException,
                                   SessionLookupException,
                                   SessionStreamNotFoundException,
                                   SessionStreamRequestNotProcessingException,
                                   SessionStreamIOException
Gets an aggregate of a number of available blocks of data from a session output stream.

To indicate to the caller that no more data is available, a no-more-data block - a qualified name {http://ogsadai.org.uk/namespaces/2005/10/properties}NoMoreData (see the constant uk.org.ogsadai.engine.EngineConstants.NO_MORE_DATA) can be expected to be provided by this method after retrieval of the final block of data.

Parameters:
id - The session stream identifier.
numberOfBlocks - The number of blocks to attempt to aggregate. If less than this number are contained in the stream then an aggregate of the maximum available will be returned.
Returns:
an Object containing an aggregate of a number of blocks of data.
Throws:
SessionNotFoundException - if the session in id does not exist.
SessionLookupException - if there is a problem in accessing the session.
SessionStreamNotFoundException - if there is no such session or no such stream in the session.
SessionStreamRequestNotProcessingException - if the request to which the stream belongs has not started processing.
SessionStreamIOException - if there is a problem when reading from the specified session stream.

putBlock

public void putBlock(SessionStreamID id,
                     java.lang.Object data)
              throws SessionNotFoundException,
                     SessionLookupException,
                     SessionStreamNotFoundException,
                     SessionStreamRequestNotProcessingException,
                     SessionStreamClosedException
Puts a block of data onto a specified session stream.

To indicate that no more data is available, a no-more-data block - a qualified name {"http://ogsadai.org.uk/namespaces/2005/10/properties"}NoMoreData (see the constant uk.org.ogsadai.engine.EngineConstants.NO_MORE_DATA) should be provided to this method after putting the final block of data.

Parameters:
id - The session stream identifier.
data - The block of data.
Throws:
SessionNotFoundException - if the session in id does not exist.
SessionLookupException - if there is a problem in accessing the session.
SessionStreamNotFoundException - if there is no such session or no such stream in the session.
SessionStreamRequestNotProcessingException - if the request to which the stream belongs has not started processing.
SessionStreamClosedException - if the stream has already been closed via provision of a no-more-data block.

putFully

public void putFully(SessionStreamID id,
                     java.lang.Object data)
              throws SessionNotFoundException,
                     SessionLookupException,
                     SessionStreamNotFoundException,
                     SessionStreamRequestNotProcessingException,
                     SessionStreamClosedException
Puts a block containing all the input data for a specified session stream into the stream and then closes the stream for further input.

Parameters:
id - The session stream identifier.
data - The block containing all the data for the stream.
Throws:
SessionNotFoundException - if the session in id does not exist.
SessionLookupException - if there is a problem in accessing the session.
SessionStreamNotFoundException - if there is no such session or no such stream in the session.
SessionStreamRequestNotProcessingException - if the request to which the stream belongs has not started processing.
SessionStreamClosedException - if the stream has already been closed via provision of a no-more-data block.