|
WPI GDC CMS 0.0.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.wpi.gdc.cms.main.Session
This class represents the current CMS session. Sessions are basically separate instances of a CMS, allowing multiple CMS to be run in one Java Virtual Machine. Sessions are created via a String that should be specified via the given page/servlet's configuration. The CMS system then either returns the already existing Session based on that Core object or instead loads the Session.
Field Summary | |
protected java.util.HashMap |
dataSources
Data sources relating to this session. |
protected DBEngine |
engine
The database engine used to load objects for this session. |
protected Icon[] |
icons
Icons from the database (icons are loaded on session creation and are always available). |
protected Topic[] |
topics
Topics from the database (topics are loaded on session creation and are always available). |
protected java.util.HashMap |
users
Cache of user objects. |
Method Summary | |
boolean |
checkUserExists(int id)
Returns false. |
boolean |
checkUserExists(User user)
Returns false. |
User |
getAuthenticatedUser(java.lang.String hash)
Loads the user associated with the authentication token or returns null if either the user does not exist or the authentication failed. |
java.lang.Class |
getDataSource(java.lang.String name)
Gets the data source associated with the given string, or null if there is no source for the given name. |
DBEngine |
getDBEngine()
Retrieves the database engine. |
Icon |
getIcon(int id)
Get an icon based on the ID for the Icon. |
protected org.apache.log.Logger |
getLogger()
|
static Session |
getSession(java.lang.String sessionID)
Obtains a session based on the session ID. |
Topic |
getTopic(int id)
Get a topic based on the ID for the Topic. |
Topic[] |
getTopics()
Retreives all the topic items. |
User |
getUser(int id)
Gets a user based on the given ID - returns null
if the user doesn't exist. |
User |
getUser(java.lang.String username)
Gets a user based on the given username - returns null
if the user doesn't exist. |
java.lang.String |
hashUser(User user)
Creates an athentication token for a User object, used to reobtain the user of subsequent calls. |
static void |
loadConfiguration(java.io.File confFile)
|
static void |
loadConfiguration(java.lang.String confFile)
Loads a given configuration file. |
void |
setLogger(org.apache.log.Logger logger)
|
User |
validateUser(java.lang.String username,
java.lang.String password)
Validates the username/password pair, returning the user if the username and password are valid. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected DBEngine engine
protected java.util.HashMap dataSources
protected java.util.HashMap users
protected Topic[] topics
protected Icon[] icons
Method Detail |
public static void loadConfiguration(java.lang.String confFile) throws ConfigParseException, java.io.IOException
public static void loadConfiguration(java.io.File confFile) throws ConfigParseException, java.io.IOException
public static Session getSession(java.lang.String sessionID)
loadConfiguration(java.io.File)
then the default session
will be returned. (The default session can also be accessed directly via
the session ID "<DEFAULT>
".)sessionID
- the session ID for the session to retrieve.public boolean checkUserExists(User user)
user
- the user account to checkpublic boolean checkUserExists(int id)
public User getUser(int id) throws DatabaseException
null
if the user doesn't exist.id
- the user IDnull
if the user doesn't existDatabaseException
- if the user could not be loaded.public User getUser(java.lang.String username) throws DatabaseException
null
if the user doesn't exist.username
- the user's usernamenull
if the user doesn't existDatabaseException
- if the user could not be loaded.public java.lang.Class getDataSource(java.lang.String name)
public DBEngine getDBEngine()
public java.lang.String hashUser(User user)
THIS IS NOT SECURE YET.
The athentication token is currently just the User ID.
user
- The user to create a token for.getAuthenticatedUser(java.lang.String)
public User getAuthenticatedUser(java.lang.String hash)
THIS IS NOT SECURE YET.
The athentication token is currently just the User ID.
hash
- The authentication token.hashUser(User)
public User validateUser(java.lang.String username, java.lang.String password)
username
- The username.password
- The password.public Icon getIcon(int id)
id
- the ID of the icon (the ID must be positive)java.lang.IllegalArgumentException
- if the id is less than 0public Topic getTopic(int id)
id
- the ID of the icon (the ID must be positive)java.lang.IllegalArgumentException
- if the id is less than 0public Topic[] getTopics()
protected org.apache.log.Logger getLogger()
public void setLogger(org.apache.log.Logger logger)
setLogger
in interface org.apache.avalon.framework.logger.Loggable
|
WPI GDC CMS 0.0.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |