|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--uk.org.ogsadai.sessions.impl.TransientSession | +--uk.org.ogsadai.sessions.impl.TransientInternalSession
A thread-safe InternalSession
implementation that
allows only one SessionParticipant
to join at a time.
Field Summary | |
private static java.lang.String |
COPYRIGHT_NOTICE
|
private static DAILogger |
LOG
|
private SessionEventDispatcher |
mDispatcher
|
private java.util.Map |
mExternalInputs
|
private java.util.Map |
mExternalOutputs
|
private SessionParticipant |
mParticipant
|
private Properties |
mProperties
|
private SessionSettings |
mSettings
|
private ProcessingStatus |
mStatus
|
Fields inherited from class uk.org.ogsadai.sessions.impl.TransientSession |
|
Constructor Summary | |
TransientInternalSession(SessionSettings settings,
java.util.Set attributes,
Properties properties)
Creates a new TransientInternalSession . |
Method Summary | |
void |
addExternalInput(java.lang.String name,
Pipe input)
Adds an external input session stream. |
void |
addExternalOutput(java.lang.String name,
Pipe output)
Adds an external output session stream. |
void |
addSessionListener(SessionListener listener)
Registers a session listener with the session. |
void |
admit(SessionParticipant participant)
Admits a new session participant to the session. |
void |
cleanUp()
Cleans up the session before it is made eligible for garbage collection. |
int |
countParticants()
Returns the number of session participants that are currently joined to the session. |
Pipe |
getExternalInput(java.lang.String name)
Gets the Pipe for the external input with the
specified name allowing data to be written into the pipe or
read from it. |
Pipe |
getExternalOutput(java.lang.String name)
Gets the Pipe for the external output with the
specified name allowing data to be written to it of read from
it. |
SessionID |
getID()
Returns the SessionID object identifying the
session. |
Properties |
getProperties()
Gets the set of data service resource properties that are available to this session. |
ProcessingStatus |
getRequestStatus()
Gets the session request processing status. |
SessionSettings |
getSettings()
Returns a SessionSettings object encapsulating the
settings for this session. |
boolean |
hasExternalInput(java.lang.String name)
Checks whether the context contains a Pipe for an
external input with the specified name. |
boolean |
hasExternalOutput(java.lang.String name)
Checks whether the context contains a Pipe for an
external output with the specified name. |
void |
release(SessionParticipant participant)
Releases the specified session participant from the session. |
void |
removeExternalInput(java.lang.String name)
Removes an external input session stream. |
void |
removeExternalOutput(java.lang.String name)
Removes an external output session stream. |
java.lang.String |
toString()
|
Methods inherited from class uk.org.ogsadai.sessions.impl.TransientSession |
containsAttribute, countAttributes, getAttribute, getAttributeNames, getAttributeValue, removeAttribute, setAttribute |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface uk.org.ogsadai.sessions.Session |
containsAttribute, countAttributes, getAttribute, getAttributeNames, getAttributeValue, removeAttribute, setAttribute |
Field Detail |
private static final java.lang.String COPYRIGHT_NOTICE
private static final DAILogger LOG
private final SessionEventDispatcher mDispatcher
private SessionParticipant mParticipant
private final SessionSettings mSettings
private final Properties mProperties
private final ProcessingStatus mStatus
private final java.util.Map mExternalOutputs
private final java.util.Map mExternalInputs
Constructor Detail |
public TransientInternalSession(SessionSettings settings, java.util.Set attributes, Properties properties) throws SessionCreationException
TransientInternalSession
.
settings
- The configuration settings for the sessionattributes
- The initial set of static session attributes for the session
to contain, or null
if there are none.properties
- Data service resource properties. Session participants may
may access and update these.
java.lang.IllegalArgumentException
- if settings
or
properties
are null
.
SessionCreationException
- if attributes
contains duplicate names.Method Detail |
public void addSessionListener(SessionListener listener)
InternalSession
addSessionListener
in interface InternalSession
listener
- The SessionListener
to register.public void admit(SessionParticipant participant) throws SessionJoinDeniedException, SessionJoinException
InternalSession
After this method has been invoked, the session participant is said to have joined the session.
admit
in interface InternalSession
participant
- The SessionParticipant
to join.
SessionJoinException
- if there is an internal problem that
occurs during the join.
SessionJoinDeniedException
- if there is an
application-specific reason why the participant is not allowed
to join.public void cleanUp()
InternalSession
cleanUp
in interface InternalSession
cleanUp
in class TransientSession
public int countParticants()
InternalSession
countParticants
in interface InternalSession
public SessionID getID()
Session
SessionID
object identifying the
session.
getID
in interface Session
getID
in class TransientSession
SessionID
public SessionSettings getSettings()
InternalSession
SessionSettings
object encapsulating the
settings for this session.
getSettings
in interface InternalSession
public void release(SessionParticipant participant)
InternalSession
After this method has been invoked, the session participant is said to have left the session. It must be responsible for no further interactions with the session. If the specified session participant is not currently a participant of this session then nothing happens.
release
in interface InternalSession
participant
- The SessionParticipant
to release.public java.lang.String toString()
toString
in class java.lang.Object
public Properties getProperties()
Session
Session participants, such as activities, may query, add and remove properties from this at runtime.
getProperties
in interface Session
Properties
objectpublic ProcessingStatus getRequestStatus()
Session
This is the status of the current request that is processing in the session.
getRequestStatus
in interface Session
ProcessingStatus
.public void addExternalInput(java.lang.String name, Pipe input) throws SessionStreamDuplicateException
Session
This is a Pipe
that can receive input data from an
external agent and be read from by an activity or session
participant.
addExternalInput
in interface Session
name
- The name of the session stream.input
- The pipe for the data.
SessionStreamDuplicateException
- if an external input
session stream with the same name has already been added to the
session.public void addExternalOutput(java.lang.String name, Pipe output) throws SessionStreamDuplicateException
Session
This is a Pipe
that can receive input data from an
activity or session participant. This data can then be read by
an external agent.
addExternalOutput
in interface Session
name
- The name of the session stream.output
- The pipe for the data.
SessionStreamDuplicateException
- if an external output
session stream with the same name has already been added to the
session.public boolean hasExternalInput(java.lang.String name)
Session
Pipe
for an
external input with the specified name.
hasExternalInput
in interface Session
name
- The name of the external input.
true
if the input exists, false
otherwise.public boolean hasExternalOutput(java.lang.String name)
Session
Pipe
for an
external output with the specified name.
hasExternalOutput
in interface Session
name
- The name of the external output.
true
if the output exists, false
otherwise.public Pipe getExternalOutput(java.lang.String name)
Session
Pipe
for the external output with the
specified name allowing data to be written to it of read from
it.
getExternalOutput
in interface Session
name
- The name of the external output.
Pipe
from which data can be read or
null
if there is no output with the specified
name.public Pipe getExternalInput(java.lang.String name)
Session
Pipe
for the external input with the
specified name allowing data to be written into the pipe or
read from it.
getExternalInput
in interface Session
name
- The name of the external input.
Pipe
to which data can be written or
null
if there is no input with the specified
name.public void removeExternalInput(java.lang.String name)
Session
After this method has returned the session stream will no longer be available to external agents.
removeExternalInput
in interface Session
name
- The name of the session stream. If no stream exists with this
name then no action is taken.public void removeExternalOutput(java.lang.String name)
Session
After this method has returned the session stream will no longer be available to external agents.
removeExternalOutput
in interface Session
name
- The name of the session stream. If no stream exists with this
name then no action is taken.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |