Errai 3.0.1-SNAPSHOT

org.jboss.errai.bus.server.cluster
Class IntrabusQueueSession

java.lang.Object
  extended by org.jboss.errai.bus.server.cluster.IntrabusQueueSession
All Implemented Interfaces:
QueueSession

public class IntrabusQueueSession
extends Object
implements QueueSession

Author:
Mike Brock

Field Summary
static QueueSession INSTANCE
           
 
Method Summary
 void addSessionEndListener(SessionEndListener listener)
          Registers a listener that will notified when this session ends.
 boolean endSession()
          Closes this session and notifies the SessionEndListeners (optional operation; not all QueueSession implementations are closeable).
<T> T
getAttribute(Class<T> type, String attribute)
          Returns the value associated with the given key.
 Collection<String> getAttributeNames()
          Returns the names of all attributes within this session.
 String getParentSessionId()
          Returns the ID of the session this QueueSession wraps.
 String getSessionId()
          Returns the ID of this session, which uniquely identifies it within the scope of this client (or server for a server side session).
 boolean hasAttribute(String attribute)
          Returns true if the specified attribute exists.
 boolean isValid()
           
 Object removeAttribute(String attribute)
          Removes the specified attribute from this session.
 void setAttribute(String attribute, Object value)
          Associates the given value with the given key, replacing the existing value, if any, for the key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static final QueueSession INSTANCE
Method Detail

getSessionId

public String getSessionId()
Description copied from interface: QueueSession
Returns the ID of this session, which uniquely identifies it within the scope of this client (or server for a server side session). This is not the ID of the underlying wrapped session (for example, it is not a Servlet Session ID).

Specified by:
getSessionId in interface QueueSession
Returns:
the session id, which is unique within the confines of the present client (or server). Never null.

getParentSessionId

public String getParentSessionId()
Description copied from interface: QueueSession
Returns the ID of the session this QueueSession wraps. In the case of a wrapper around an HTTP Session, this method would return the HTTP Session ID.

Specified by:
getParentSessionId in interface QueueSession
Returns:
the session ID from the underlying communication layer, or a unique ID synthesized by the framework for communication layers that don't have unique session ID's of their own. Never null.

endSession

public boolean endSession()
Description copied from interface: QueueSession
Closes this session and notifies the SessionEndListeners (optional operation; not all QueueSession implementations are closeable).

Specified by:
endSession in interface QueueSession
Returns:
true, if this session was closed and listeners have been notified. In the case of a QueueSession that does not implement this operation, listeners are not notified and this method returns false.

setAttribute

public void setAttribute(String attribute,
                         Object value)
Description copied from interface: QueueSession
Associates the given value with the given key, replacing the existing value, if any, for the key.

See the class-level documentation for a note on the scope of these attributes.

Specified by:
setAttribute in interface QueueSession
Parameters:
attribute - the name (key) of the attribute. Not null.
value - new value for attribute. Null is permitted.

getAttribute

public <T> T getAttribute(Class<T> type,
                          String attribute)
Description copied from interface: QueueSession
Returns the value associated with the given key.

See the class-level documentation for a note on the scope of these attributes.

Specified by:
getAttribute in interface QueueSession
Type Parameters:
T - the type
Parameters:
type - the type to attempt to cast the attribute's value to
attribute - the name (key) of the attribute. Not null.
Returns:
the value of the attribute, as the specified type. Returns null if the attribute's value is null, or if no such attribute exists. Use QueueSession.hasAttribute(String) to test for the existence of a null-valued attribute.

getAttributeNames

public Collection<String> getAttributeNames()
Description copied from interface: QueueSession
Returns the names of all attributes within this session.

See the class-level documentation for a note on the scope of these attributes.

Specified by:
getAttributeNames in interface QueueSession
Returns:
collection of attribute names.

hasAttribute

public boolean hasAttribute(String attribute)
Description copied from interface: QueueSession
Returns true if the specified attribute exists.

See the class-level documentation for a note on the scope of these attributes.

Specified by:
hasAttribute in interface QueueSession
Parameters:
attribute - the attribute name to search for.
Returns:
true if it exists, otherwise false

removeAttribute

public Object removeAttribute(String attribute)
Description copied from interface: QueueSession
Removes the specified attribute from this session.

See the class-level documentation for a note on the scope of these attributes.

Specified by:
removeAttribute in interface QueueSession
Parameters:
attribute - the name of the attribute to remove.
Returns:
the attribute value previously associated with the given name (which may be null). Returns null in case the attribute did not exist.

addSessionEndListener

public void addSessionEndListener(SessionEndListener listener)
Description copied from interface: QueueSession
Registers a listener that will notified when this session ends.

Specified by:
addSessionEndListener in interface QueueSession
Parameters:
listener - the listener to be notified at session end.

isValid

public boolean isValid()
Specified by:
isValid in interface QueueSession

Errai 3.0.1-SNAPSHOT

Copyright © 2013-2014 JBoss, a division of Red Hat. All Rights Reserved.