blackboard.platform.session
Interface BbSession


public interface BbSession

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

Since:
Bb 5.5
Version:
$Revision: 18 $ $Date: 4/08/03 10:55a $

Nested Class Summary
static class BbSession.Scope
          Inner class -- BbSession.Scope Enumeration.
 
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)
          Gets an attribute in this user's session that was originally defined to have a given scope.
 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()
          Returns the system time in milliseconds as specified by System.getTimeMillis() of when this session instance was created.
 java.lang.String getGlobalKey(java.lang.String name)
          Retrives a key with Scope == GLOBAL, 1 database hit (unless cached and updated asynchronously).
 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)
          Parses user context information encoded in the given request and returns a CourseContext or null if none exists.
 GroupContext lookupGroupContext(javax.servlet.http.HttpServletRequest request)
          Parses group context information encoded in the given request and returns a GroupContext or null if none exists.
 RequestContext lookupRequestContext(javax.servlet.http.HttpServletRequest request)
          Parses user context information encoded in the given request and returns a RequestContext or null if none exists.
 UserContext lookupUserContext(javax.servlet.http.HttpServletRequest request)
          Parses user context information encoded in the given request and returns a UserContext or null if none exists.
 java.lang.Object removeAttribute(java.lang.String name, BbSession.Scope scope)
          Removes any resources being held by this attribute, including memory or file storage.
 void setAttribute(java.lang.String name, java.lang.Object value, BbSession.Scope scope)
          Sets an attribute in this user's session for availability in the target scope.
 void setGlobalKey(java.lang.String name, java.lang.String value)
          Sets a key with Scope == GLOBAL, 1 database hit.
 

Method Detail

getBbSessionId

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


getBbSessionIdMd5

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


encodeSessionContext

public 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

public 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.

PersistenceException
InitializationException

encodeNavigationItemURL

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


getUserId

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


getUserName

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


isAuthenticated

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


lookupUserContext

public UserContext lookupUserContext(javax.servlet.http.HttpServletRequest request)
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

public RequestContext lookupRequestContext(javax.servlet.http.HttpServletRequest request)
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

public CourseContext lookupCourseContext(javax.servlet.http.HttpServletRequest request)
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

public GroupContext lookupGroupContext(javax.servlet.http.HttpServletRequest request)
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

public java.lang.String getGlobalKey(java.lang.String name)
                              throws PersistenceException
Retrives a key with Scope == GLOBAL, 1 database hit (unless cached and updated asynchronously). This maps to entries in the SESSION_INDS table.

PersistenceException

setGlobalKey

public void setGlobalKey(java.lang.String name,
                         java.lang.String value)
                  throws PersistenceException
Sets a key with Scope == GLOBAL, 1 database hit. This maps to entries in the SESSION_INDS table.

PersistenceException

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.Object value,
                         BbSession.Scope scope)
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

public java.lang.Object getAttribute(java.lang.String name,
                                     BbSession.Scope scope)
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

public java.lang.Object removeAttribute(java.lang.String name,
                                        BbSession.Scope scope)
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

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


getLastAccessTimeMillis

public 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.