org.sakaiproject.component.kernel.session
Class SessionComponent.MyLittleSession

java.lang.Object
  extended byorg.sakaiproject.component.kernel.session.SessionComponent.MyLittleSession
All Implemented Interfaces:
ContextSession, HttpSession, ToolSession
Enclosing class:
SessionComponent

public class SessionComponent.MyLittleSession
extends Object
implements ToolSession, ContextSession, HttpSession

Entity: ToolSession, ContextSession (and even HttpSession)


Field Summary
protected  long m_accessed
          Time last accessed (via getSession()).
protected  Map m_attributes
          Hold attributes in a Map.
protected  long m_created
          The creation time of the session.
protected  String m_id
          The session id.
protected  String m_littleId
          The tool placement / context id.
protected  Session m_session
          The sakai session in which I live.
 
Constructor Summary
SessionComponent.MyLittleSession(Session s, String id)
           
 
Method Summary
protected  void bind(String name, Object value)
          Bind the value if it's a SessionBindingListener.
 void clearAttributes()
          Remove and unbind all attributes in the session.
 boolean equals(Object obj)
          
 Object getAttribute(String name)
          Returns the object bound with the specified name in this session, or null if no object is bound under the name.
 Enumeration getAttributeNames()
          Returns an Enumeration of String objects containing the names of all the objects bound to this session.
 String getContextId()
          Returns a string containing the context identifier for this session.
 long getCreationTime()
          Returns the time when this session was created, measured in milliseconds since midnight January 1, 1970 GMT.
 String getId()
          Returns a string containing the unique identifier assigned to this session.
 long getLastAccessedTime()
          Returns the last time the client sent a request associated with this tool session, as the number of milliseconds since midnight January 1, 1970 GMT.
 int getMaxInactiveInterval()
           
 String getPlacementId()
          Returns a string containing the tool placement identifier for this session.
 ServletContext getServletContext()
           
 HttpSessionContext getSessionContext()
           
 String getUserEid()
          Return the enterprise id of the user associated with this session.
 String getUserId()
          Return the authenticated user id associated with this session.
 Object getValue(String arg0)
           
 String[] getValueNames()
           
 int hashCode()
          
 void invalidate()
           
 boolean isNew()
           
 void putValue(String arg0, Object arg1)
           
 void removeAttribute(String name)
          Removes the object bound with the specified name from this session.
 void removeValue(String arg0)
           
protected  void setAccessed()
          Mark the session as just accessed.
 void setAttribute(String name, Object value)
          Binds an object to this session, using the name specified.
 void setMaxInactiveInterval(int arg0)
           
protected  void unBind(String name, Object value)
          Unbind the value if it's a SessionBindingListener.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_attributes

protected Map m_attributes
Hold attributes in a Map. TODO: ConcurrentHashMap may be better for multiple writers


m_created

protected long m_created
The creation time of the session.


m_id

protected String m_id
The session id.


m_littleId

protected String m_littleId
The tool placement / context id.


m_session

protected Session m_session
The sakai session in which I live.


m_accessed

protected long m_accessed
Time last accessed (via getSession()).

Constructor Detail

SessionComponent.MyLittleSession

public SessionComponent.MyLittleSession(Session s,
                                        String id)
Method Detail

getAttribute

public Object getAttribute(String name)
Description copied from interface: ToolSession
Returns the object bound with the specified name in this session, or null if no object is bound under the name.

Specified by:
getAttribute in interface ToolSession
Parameters:
name - a string specifying the name of the object
Returns:
the object with the specified name

getAttributeNames

public Enumeration getAttributeNames()
Description copied from interface: ToolSession
Returns an Enumeration of String objects containing the names of all the objects bound to this session.

Specified by:
getAttributeNames in interface ToolSession
Returns:
an Enumeration of String objects specifying the names of all the objects bound to this session

getCreationTime

public long getCreationTime()
Description copied from interface: ToolSession
Returns the time when this session was created, measured in milliseconds since midnight January 1, 1970 GMT.

Specified by:
getCreationTime in interface ToolSession
Returns:
a long specifying when this session was created, expressed in milliseconds since 1/1/1970 GMT

getId

public String getId()
Description copied from interface: ToolSession
Returns a string containing the unique identifier assigned to this session.

Specified by:
getId in interface ToolSession
Returns:
a string specifying the identifier assigned to this session

getLastAccessedTime

public long getLastAccessedTime()
Description copied from interface: ToolSession
Returns the last time the client sent a request associated with this tool session, as the number of milliseconds since midnight January 1, 1970 GMT.

Actions that your application takes, such as getting or setting a value associated with the session, do not affect the access time.

Specified by:
getLastAccessedTime in interface ToolSession
Returns:
a long representing the last time the client sent a request associated with this session, expressed in milliseconds since 1/1/1970 GMT

getPlacementId

public String getPlacementId()
Description copied from interface: ToolSession
Returns a string containing the tool placement identifier for this session.

Specified by:
getPlacementId in interface ToolSession
Returns:
a string specifying the tool placement identifier for this session.

getContextId

public String getContextId()
Description copied from interface: ContextSession
Returns a string containing the context identifier for this session.

Specified by:
getContextId in interface ContextSession
Returns:
a string specifying the context identifier for this session.

clearAttributes

public void clearAttributes()
Description copied from interface: ToolSession
Remove and unbind all attributes in the session.

Specified by:
clearAttributes in interface ToolSession

setAccessed

protected void setAccessed()
Mark the session as just accessed.


removeAttribute

public void removeAttribute(String name)
Description copied from interface: ToolSession
Removes the object bound with the specified name from this session. If the session does not have an object bound with the specified name, this method does nothing.

After this method executes, and if the object implements SessionBindingListener, Sakai calls SessionBindingListener.valueUnbound.

Specified by:
removeAttribute in interface ToolSession
Parameters:
name - the name of the object to remove from this session

setAttribute

public void setAttribute(String name,
                         Object value)
Description copied from interface: ToolSession
Binds an object to this session, using the name specified. If an object of the same name is already bound to the session, the object is replaced.

After this method executes, and if the new object implements SessionBindingListener, Sakai calls SessionBindingListener.valueBound.

If an object was already bound to this session of this name that implements SessionBindingListener, its SessionBindingListener.valueUnbound method is called.

If the value passed in is null, this has the same effect as calling removeAttribute().

Specified by:
setAttribute in interface ToolSession
Parameters:
name - the name to which the object is bound; cannot be null
value - the object to be bound

equals

public boolean equals(Object obj)


hashCode

public int hashCode()


unBind

protected void unBind(String name,
                      Object value)
Unbind the value if it's a SessionBindingListener. Also does the HTTP unbinding if it's a HttpSessionBindingListener.

Parameters:
name - The attribute name bound.
value - The bond value.

bind

protected void bind(String name,
                    Object value)
Bind the value if it's a SessionBindingListener. Also does the HTTP binding if it's a HttpSessionBindingListener.

Parameters:
name - The attribute name bound.
value - The bond value.

getUserEid

public String getUserEid()
Description copied from interface: ToolSession
Return the enterprise id of the user associated with this session.

Specified by:
getUserEid in interface ToolSession
Returns:
The enterprise id of the user associated with this session.

getUserId

public String getUserId()
Description copied from interface: ToolSession
Return the authenticated user id associated with this session.

Specified by:
getUserId in interface ToolSession
Returns:
The authenticated user id associated with this session.

getServletContext

public ServletContext getServletContext()
Specified by:
getServletContext in interface HttpSession

setMaxInactiveInterval

public void setMaxInactiveInterval(int arg0)
Specified by:
setMaxInactiveInterval in interface HttpSession

getMaxInactiveInterval

public int getMaxInactiveInterval()
Specified by:
getMaxInactiveInterval in interface HttpSession

getSessionContext

public HttpSessionContext getSessionContext()
Specified by:
getSessionContext in interface HttpSession

getValue

public Object getValue(String arg0)
Specified by:
getValue in interface HttpSession

getValueNames

public String[] getValueNames()
Specified by:
getValueNames in interface HttpSession

putValue

public void putValue(String arg0,
                     Object arg1)
Specified by:
putValue in interface HttpSession

removeValue

public void removeValue(String arg0)
Specified by:
removeValue in interface HttpSession

invalidate

public void invalidate()
Specified by:
invalidate in interface HttpSession

isNew

public boolean isNew()
Specified by:
isNew in interface HttpSession