blackboard.platform.session
Interface BbSession


public interface BbSession

BbSession. See blackboard.apps.bb5.session for implementation classes.

Since:
Bb 5.5
Version:
$Revision: #1 $ $Date: 2005/06/27 $

Nested Class Summary
static class BbSession.Scope
          Deprecated. All attributes are stored in Global scope, since the alternate scopes were never properly implemented
 
Method Summary
 java.lang.String encodeNavigationItemURL(javax.servlet.http.HttpServletRequest request, java.lang.String url)
          Performs url parse/replace operation for navigation item specific entities.
 java.lang.String encodeSessionContext(java.lang.String url)
          Encodes this session's id on the given url as a request parameter formatted as "?
 java.lang.String encodeTemplateUrl(javax.servlet.http.HttpServletRequest request, java.lang.String url)
          Encodes context information on the given url as required by the template based format.
 java.lang.Object getAttribute(java.lang.String name, BbSession.Scope scope)
          Deprecated. Use HttpSession for private attributes (visible only to the calling webapp). Use getGlobalKey() for global attributes (visible across all webapps).
 int getBbSessionId()
          Returns the Blackboard assigned unique id for this user's session.
 java.lang.String getBbSessionIdMd5()
          Returns the Blackboard assigned unique id for this user's session as an MD5 hashed string.
 long getCreateTimeMillis()
          Deprecated. The session creation time is not stored in the database. Local "in memory" time is meaningless since sessions can be opened on multiple machines in a load balanced scenario.
 java.lang.String getGlobalKey(java.lang.String name)
          Retrieves a key that was stored for global use.
 long getLastAccessTimeMillis()
          Returns the system time in milliseconds as specified by System.getTimeMillis() of when this session instance was last accessed.
 Id getUserId()
          Returns the Id of the user associated with this session.
 java.lang.String getUserName()
          Returns the system login name of the user associated with this session.
 boolean isAuthenticated()
          Returns true if the associated user has been authenticated.
 CourseContext lookupCourseContext(javax.servlet.http.HttpServletRequest request)
          Deprecated. The return object is not part of the public API and has been removed from use.
 GroupContext lookupGroupContext(javax.servlet.http.HttpServletRequest request)
          Deprecated. The return object is not part of the public API and has been removed from use.
 RequestContext lookupRequestContext(javax.servlet.http.HttpServletRequest request)
          Deprecated. The return object is not part of the public API and has been removed from use.
 UserContext lookupUserContext(javax.servlet.http.HttpServletRequest request)
          Deprecated. The return object is not part of the public API and has been removed from use.
 java.lang.Object removeAttribute(java.lang.String name, BbSession.Scope scope)
          Deprecated. This method has no meaning since the corresponding set/get are not implemented.
 void setAttribute(java.lang.String name, java.lang.Object value, BbSession.Scope scope)
          Deprecated. Use HttpSession for private attributes (visible only to the calling webapp). Use setGlobalKey() for global attributes (visible across all webapps).
 void setGlobalKey(java.lang.String name, java.lang.String value)
          Sets a key for global use.
 

Method Detail

getBbSessionId

int getBbSessionId()
Returns the Blackboard assigned unique id for this user's session.


getBbSessionIdMd5

java.lang.String getBbSessionIdMd5()
Returns the Blackboard assigned unique id for this user's session as an MD5 hashed string.


encodeSessionContext

java.lang.String encodeSessionContext(java.lang.String url)
Encodes this session's id on the given url as a request parameter formatted as "?bbsession_id=MD5hashstring".


encodeTemplateUrl

java.lang.String encodeTemplateUrl(javax.servlet.http.HttpServletRequest request,
                                   java.lang.String url)
                                   throws PersistenceException,
                                          InitializationException
Encodes context information on the given url as required by the template based format.

Throws:
PersistenceException
InitializationException

encodeNavigationItemURL

java.lang.String encodeNavigationItemURL(javax.servlet.http.HttpServletRequest request,
                                         java.lang.String url)
Performs url parse/replace operation for navigation item specific entities.


getUserId

Id getUserId()
Returns the Id of the user associated with this session.


getUserName

java.lang.String getUserName()
Returns the system login name of the user associated with this session.


isAuthenticated

boolean isAuthenticated()
Returns true if the associated user has been authenticated.


lookupUserContext

UserContext lookupUserContext(javax.servlet.http.HttpServletRequest request)
Deprecated. The return object is not part of the public API and has been removed from use.

Parses user context information encoded in the given request and returns a UserContext or null if none exists. This method can be used to retrieve a context encoded via UserContext.encodeUserContext( String ).


lookupRequestContext

RequestContext lookupRequestContext(javax.servlet.http.HttpServletRequest request)
Deprecated. The return object is not part of the public API and has been removed from use.

Parses user context information encoded in the given request and returns a RequestContext or null if none exists. This method can be used to retrieve a context encoded via RequestContext.encodeRequestContext( String ).


lookupCourseContext

CourseContext lookupCourseContext(javax.servlet.http.HttpServletRequest request)
Deprecated. The return object is not part of the public API and has been removed from use.

Parses user context information encoded in the given request and returns a CourseContext or null if none exists. This method can be used to retrieve a context encoded via CourseContext.encodeCourseContext( String ).


lookupGroupContext

GroupContext lookupGroupContext(javax.servlet.http.HttpServletRequest request)
Deprecated. The return object is not part of the public API and has been removed from use.

Parses group context information encoded in the given request and returns a GroupContext or null if none exists. This method can be used to retrieve a context encoded via GroupContext.encodeGroupContext( String ).


getGlobalKey

java.lang.String getGlobalKey(java.lang.String name)
                              throws PersistenceException
Retrieves a key that was stored for global use. On first access, all keys are loaded. If another process writes a key after the first call to this session's getGlobalKey() those changes are not seen.

Parameters:
name - Name of the key to retrieve
Returns:
Value of the specified key. This may be null if no key by that name exists
Throws:
PersistenceException - thrown if the keys could not be loaded from the database

setGlobalKey

void setGlobalKey(java.lang.String name,
                  java.lang.String value)
                  throws PersistenceException
Sets a key for global use. This method will result in a database roundtrip, and should be used sparingly, for performance reasons.

Parameters:
name - Name of the key to set
value - Value of the key to set
Throws:
PersistenceException - thrown if the key could not be written

setAttribute

void setAttribute(java.lang.String name,
                  java.lang.Object value,
                  BbSession.Scope scope)
Deprecated. Use HttpSession for private attributes (visible only to the calling webapp). Use setGlobalKey() for global attributes (visible across all webapps).

Sets an attribute in this user's session for availability in the target scope. This method should only be used in specific cases, since most session functionality will be provided to a webapp via the standard HttpSession.


getAttribute

java.lang.Object getAttribute(java.lang.String name,
                              BbSession.Scope scope)
Deprecated. Use HttpSession for private attributes (visible only to the calling webapp). Use getGlobalKey() for global attributes (visible across all webapps).

Gets an attribute in this user's session that was originally defined to have a given scope. This method should only be used in specific cases, since most session functionality will be provided to a webapp via the standard HttpSession.


removeAttribute

java.lang.Object removeAttribute(java.lang.String name,
                                 BbSession.Scope scope)
Deprecated. This method has no meaning since the corresponding set/get are not implemented.

Removes any resources being held by this attribute, including memory or file storage. This method should only be used in specific cases, since most session functionality will be provided to a webapp via the standard HttpSession.


getCreateTimeMillis

long getCreateTimeMillis()
Deprecated. The session creation time is not stored in the database. Local "in memory" time is meaningless since sessions can be opened on multiple machines in a load balanced scenario.

Returns the system time in milliseconds as specified by System.getTimeMillis() of when this session instance was created.

Returns:
-1 in all cases

getLastAccessTimeMillis

long getLastAccessTimeMillis()
Returns the system time in milliseconds as specified by System.getTimeMillis() of when this session instance was last accessed. Can be used by other services to asychronously check if the user has been logged out of the database.



Copyright © 2003 Blackboard, Inc. All Rights Reserved.