|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--uk.org.ogsadai.sessions.SimpleSessionStreamManager
A simple SessionStreamManager
that retrieves data from
and inserts data onto output and input streams of the current
requests of sessions.
SessionStreamManager
Field Summary | |
private static int |
ALL_BLOCKS
A constant to indicate that all blocks of data should be read |
private static java.lang.String |
COPYRIGHT_NOTICE
Copyright statement. |
private static DAILogger |
LOG
Logger object for logging in this class |
private SessionManager |
mManager
The session manager containing the live sessions |
Constructor Summary | |
SimpleSessionStreamManager(SessionManager manager)
Creates a new instance that will use a specified session manager to retrieve the sessions and so allow access to the input and output streams of their current requests. |
Method Summary | |
java.lang.Object |
getBlock(SessionStreamID id)
Gets the next block of data available from the specified session output stream. |
private BlockReader |
getBlockReader(SessionStreamID id)
Gets the BlockReader for the identified session
output stream. |
private BlockWriter |
getBlockWriter(SessionStreamID id)
Gets the BlockWriter for the identified session
input 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. |
private Session |
getSession(SessionID sessionID)
Retrieves the specified session from the session manager. |
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. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final java.lang.String COPYRIGHT_NOTICE
private static final DAILogger LOG
private final SessionManager mManager
private static final int ALL_BLOCKS
Constructor Detail |
public SimpleSessionStreamManager(SessionManager manager)
manager
- Session manager.Method Detail |
public boolean hasSession(SessionID id) throws SessionLookupException
SessionStreamManager
hasSession
in interface SessionStreamManager
id
- The session identifier.
true
if the session exists
otherwise false
.
SessionLookupException
- if there is a problem in accessing
the session.public boolean hasInput(SessionStreamID id) throws SessionNotFoundException, SessionLookupException
SessionStreamManager
hasInput
in interface SessionStreamManager
id
- The session stream identifier for the input stream.
true
if the stream exists and is open,
otherwise false
.
SessionLookupException
- if there is a problem in accessing
the session.
SessionNotFoundException
- if the session in id
does not exist.public boolean hasOutput(SessionStreamID id) throws SessionNotFoundException, SessionLookupException
SessionStreamManager
If it exists but contains no more data then a
EngineConstants.NO_MORE_DATA
block will be
returned from the getBlock
and
getNBlocks
methods.
hasOutput
in interface SessionStreamManager
id
- The session stream identifier for the output stream.
true
if the stream exists and is open,
otherwise false
.
SessionLookupException
- if there is a problem in accessing
the session.
SessionNotFoundException
- if the session in id
does not exist.public java.lang.Object getFully(SessionStreamID id) throws SessionNotFoundException, SessionLookupException, SessionStreamNotFoundException, SessionStreamRequestNotProcessingException, SessionStreamIOException
SessionStreamManager
getFully
in interface SessionStreamManager
id
- The session stream identifier
Object
containing an aggregate of all the
blocks of data.
SessionLookupException
- if there is a problem in accessing
the session.
SessionNotFoundException
- if the session in id
does not exist.
SessionStreamIOException
- if there is a problem when
reading from the specified session stream.
SessionStreamRequestNotProcessingException
- if the request
to which the stream belongs has not started processing.
SessionStreamNotFoundException
- if there is no such
session or no such stream in the session.public java.lang.Object getNBlocks(SessionStreamID id, int numberOfBlocks) throws SessionNotFoundException, SessionLookupException, SessionStreamNotFoundException, SessionStreamRequestNotProcessingException, SessionStreamIOException
SessionStreamManager
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.
getNBlocks
in interface SessionStreamManager
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.
Object
containing an aggregate of a number of
blocks of data.
SessionLookupException
- if there is a problem in accessing
the session.
SessionStreamNotFoundException
- if there is no such
session or no such stream in the session.
SessionStreamIOException
- if there is a problem when
reading from the specified session stream.
SessionStreamRequestNotProcessingException
- if the request
to which the stream belongs has not started processing.
SessionNotFoundException
- if the session in id
does not exist.public java.lang.Object getBlock(SessionStreamID id) throws SessionNotFoundException, SessionLookupException, SessionStreamNotFoundException, SessionStreamRequestNotProcessingException, SessionStreamIOException
SessionStreamManager
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.
getBlock
in interface SessionStreamManager
id
- The session stream identifier.
Object
containing a single block of
data.
SessionNotFoundException
- if the session in id
does not exist.
SessionLookupException
- if there is a problem in accessing
the session.
SessionStreamIOException
- if there is a problem when
reading from the specified session stream.
SessionStreamRequestNotProcessingException
- if the request
to which the stream belongs has not started processing.
SessionStreamNotFoundException
- if there is no such
session or no such stream in the session.public void putBlock(SessionStreamID id, java.lang.Object data) throws SessionNotFoundException, SessionLookupException, SessionStreamNotFoundException, SessionStreamRequestNotProcessingException, SessionStreamClosedException
SessionStreamManager
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.
putBlock
in interface SessionStreamManager
id
- The session stream identifier.data
- The block of data.
SessionNotFoundException
- if the session in id
does not exist.
SessionLookupException
- if there is a problem in accessing
the session.
SessionStreamClosedException
- if the stream has already
been closed via provision of a no-more-data block.
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.public void putFully(SessionStreamID id, java.lang.Object data) throws SessionNotFoundException, SessionLookupException, SessionStreamNotFoundException, SessionStreamRequestNotProcessingException, SessionStreamClosedException
SessionStreamManager
putFully
in interface SessionStreamManager
id
- The session stream identifier.data
- The block containing all the data for the stream.
SessionStreamClosedException
- if the stream has already
been closed via provision of a no-more-data block.
SessionStreamRequestNotProcessingException
- if the request
to which the stream belongs has not started processing.
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.private Session getSession(SessionID sessionID) throws SessionNotFoundException, SessionLookupException
sessionID
- The session stream ID containing the session ID.
SessionNotFoundException
- if the session in id
does not exist.
SessionLookupException
- if there is a problem in accessing
the session.private BlockReader getBlockReader(SessionStreamID id) throws SessionNotFoundException, SessionLookupException, SessionStreamNotFoundException
BlockReader
for the identified session
output stream.
id
- The session containing the output stream.
BlockReader
.
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.private BlockWriter getBlockWriter(SessionStreamID id) throws SessionNotFoundException, SessionLookupException, SessionStreamNotFoundException
BlockWriter
for the identified session
input stream.
id
- The session and stream ID.
BlockWriter
.
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.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |