|
|||||||||||
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
A thread-safe Session
implementation that stores session attributes in memory.
Field Summary | |
private static java.lang.String |
COPYRIGHT_NOTICE |
private java.util.Map |
mAttributes |
Constructor Summary | |
TransientSession() |
Method Summary | |
void |
cleanUp() Internal method to remove all session attributes from the session. |
boolean |
containsAttribute(javax.xml.namespace.QName name) Indicates whether or not the session contains a session attribute with the specified name. |
int |
countAttributes() Returns the number of session attributes contained in the session. |
private void |
ensureChangeable(javax.xml.namespace.QName name) Ensures that the specified attribute is changable, and if not raises an exception. |
SessionAttribute |
getAttribute(javax.xml.namespace.QName name) Gets the session attribute for the given name or null if no such attribute exists. |
java.util.Set |
getAttributeNames() Returns a set of the names of the session attributes contained in the session. |
java.lang.Object |
getAttributeValue(javax.xml.namespace.QName name) Gets the actual value of the session attribute with the given name. |
abstract SessionID |
getID() Returns the SessionID object identifying the session. |
void |
removeAttribute(javax.xml.namespace.QName name) Removes a named session attribute from the session unless it is a static session attribute. |
void |
setAttribute(SessionAttribute property) Sets the specified session attribute, storing it in the session. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface uk.org.ogsadai.sessions.Session |
addExternalInput, addExternalOutput, getExternalInput, getExternalOutput, getProperties, getRequestStatus, hasExternalInput, hasExternalOutput, removeExternalInput, removeExternalOutput |
Field Detail |
private static final java.lang.String COPYRIGHT_NOTICE
private final java.util.Map mAttributes
Constructor Detail |
public TransientSession()
Method Detail |
public abstract SessionID getID()
Session
SessionID
object identifying the session.
getID
in interface Session
SessionID
public boolean containsAttribute(javax.xml.namespace.QName name)
Session
containsAttribute
in interface Session
name
- The name of the session attribute as a QName
.true
if the session attribute exists, false
otherwise.public int countAttributes()
Session
countAttributes
in interface Session
public SessionAttribute getAttribute(javax.xml.namespace.QName name)
Session
null
if no such attribute exists.
getAttribute
in interface Session
name
- The name of the session attribute as a QName
.null
.public java.util.Set getAttributeNames()
Session
getAttributeNames
in interface Session
QName
objects.public java.lang.Object getAttributeValue(javax.xml.namespace.QName name)
Session
Session attributes encapsulate a name-value pair, so this method is provided as a convenient way to access the session attribute value directly. It is equivalent to getSessionAttribute().getValue()
.
getAttributeValue
in interface Session
name
- The name of the session attribute as a QName
.Object
that is the session attribute value or null
if the attribute does not exist (or the attribute value is actually null
).public void removeAttribute(javax.xml.namespace.QName name) throws StaticSessionAttrException
Session
Static session attributes are identified by the false
return value of their isChangable
method. If the named session attribute does not exist then no action is taken.
removeAttribute
in interface Session
name
- The QName
of the session attribute to remove.StaticSessionAttrException
- If name
identifies a static session attribute.public void setAttribute(SessionAttribute property) throws StaticSessionAttrException
Session
If an attribute with the same name already exists, then the existing attribute is overwritten, unless it is a static session attribute. Static session attributes cannot be overwritten.
setAttribute
in interface Session
property
- The SessionAttribute
to store in the session.StaticSessionAttrException
- If name
identifies a static session attribute.private void ensureChangeable(javax.xml.namespace.QName name) throws StaticSessionAttrException
name
- Attribute name.StaticSessionAttrException
- if the attribute is not changable.public void cleanUp()
Note that this includes the static session attributes and the session should not be used again afterwards.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |