| java.lang.Object org.openharmonise.rm.sessions.Session
Session | public class Session implements DataStoreObject,Publishable(Code) | | Represents a user session within the system, with an
associated timeout value.
Through the implementation of Publishable a user
can log in and out, i.e. create and delete sessions, in a web
session.
author: Michael Bell version: $Revision: 1.3 $ |
Method Summary | |
protected int | calculateLagTime(int timeout) Calls getLagPercent() to calculate lagtime as a percentage of timeout. | public void | delete() Removes session from the database and cache. | public static String | generateSessionId() Generates a SessionId with default number of characters. | public String | getDBTableName() | public int | getId() | public ColumnRef | getInstanceColumnRef(String sColumn, boolean bIsHist) | protected ColumnRef | getInstanceColumnRef(String sColumn) Returns a ColumnRef corresponding to the column given. | public JoinConditions | getInstanceJoinConditions(String sObjectTag, boolean bIsOuter) | protected int | getLagPercent() Retrieves lag percent set in harmonise.prop file. | public String | getSessionId() Returns the id of this session. | public String | getTagName() | public User | getUser() Returns the user associated with this session. | protected boolean | isDefaultUser() Tests whether the User associated with this Session
is the system default User . | protected boolean | isLagTimedOut() Checks lagtime against current time. | protected boolean | isTimedOut() Compares timeout variable against current time, removing session from
database if true. | protected boolean | logoff(Element logoff_tag, String sessId) Attempts to log off user. | protected User | logon(Element logon, State state) Tries to log on and return the user with username and password
found in the state. | public void | populate(Element xmlElement, State state) | public List | processResultSet(CachedResultSet resultSet, SelectStatement select) | public List | processResultSet(CachedResultSet resultSet, SelectStatement select, int limit) | public void | processState(State state, int nTimeout) Gets session id from state and if found validates against object session id. | public Element | publish(HarmoniseOutput output) Returns a Session tag with a session id attribute. | public Element | publish(Template template, HarmoniseOutput output, State state) | public Element | publish(Element topEl, HarmoniseOutput output, State state) | public void | recordEvent(LogEvent event) Records an event. | public void | registerHttpRequest(HttpServletRequest request) Register the servlet request with the session so the session has access to request info. | public static String | removeSessionIdPrefix(String sSessId) Removes session id prefix if found.
For example:D_hHk1IsvRlfC1iksMH6lt becomes hHk1IsvRlfC1iksMH6lt
Note: Used to save session id in the database and cache.
Parameters: sSessId - session id. | public void | save() Saves session id, user key and timeout values to database. | protected void | setDefaultUser(boolean defaultUser) Sets default user boolean. | protected void | setDetailsFromId(String sSessId) Populates session details from database. | protected void | setLagTime(int nTimeout) Fills lag time variable by calling calculateLagTime(nTimeout)
and adding this value to the current time. | protected void | setTimeout(int nTimeout) Fills timeout variable by adding timeout to the current time. | public String | toString() | protected void | updateTimeout(int nTimeout) Checks timeout for session. | protected void | updateUser(User user) Sets User member variable to user passed in. |
CLMN_SESSION_DATE | final protected static String CLMN_SESSION_DATE(Code) | | |
CLMN_SESSION_ID | final protected static String CLMN_SESSION_ID(Code) | | |
CLMN_SESSION_TIMEOUT | final protected static String CLMN_SESSION_TIMEOUT(Code) | | |
CLMN_USER_ID | final protected static String CLMN_USER_ID(Code) | | |
DEFAULT_TIMEOUT_PNAME | final public static String DEFAULT_TIMEOUT_PNAME(Code) | | |
DEFAULT_USER_ID | protected int DEFAULT_USER_ID(Code) | | |
DEFAULT_USER_PREFIX | public static String DEFAULT_USER_PREFIX(Code) | | |
LAG_PERCENT_PNAME | public static String LAG_PERCENT_PNAME(Code) | | |
LOGGED_IN_USER_PREFIX | public static String LOGGED_IN_USER_PREFIX(Code) | | |
m_bDefaultUser | protected boolean m_bDefaultUser(Code) | | |
m_bTimedOut | protected boolean m_bTimedOut(Code) | | |
m_nLagPercent | protected int m_nLagPercent(Code) | | |
m_nTimeout | protected int m_nTimeout(Code) | | |
calculateLagTime | protected int calculateLagTime(int timeout) throws ConfigException(Code) | | Calls getLagPercent() to calculate lagtime as a percentage of timeout.
Parameters: timeout - lagtime lagtime in minutes. throws: ConfigException - |
generateSessionId | public static String generateSessionId()(Code) | | Generates a SessionId with default number of characters.
int the session id generated |
getSessionId | public String getSessionId()(Code) | | Returns the id of this session.
session id variable. |
isDefaultUser | protected boolean isDefaultUser()(Code) | | Tests whether the User associated with this Session
is the system default User .
true or false. |
isLagTimedOut | protected boolean isLagTimedOut()(Code) | | Checks lagtime against current time.
|
isTimedOut | protected boolean isTimedOut() throws SessionException(Code) | | Compares timeout variable against current time, removing session from
database if true.
true or false. throws: SessionException - |
logon | protected User logon(Element logon, State state) throws SessionException(Code) | | Tries to log on and return the user with username and password
found in the state. Sets default user flag to false.
Parameters: logon - Parameters: state - User throws: SessionException - |
processState | public void processState(State state, int nTimeout) throws SessionException(Code) | | Gets session id from state and if found validates against object session id.
Checks for log off, switching session id prefix to default if logging off.
Updates timeout, throwing error if timed out unless default user.
Checks for log on, logging on user if found and switching session id prefix to logged on.
If no session id was found in the state, initialize(user, nTimeout) is called.
Otherwise, updateUser(user) is called.
exception: SessionException - Parameters: state - Parameters: nTimeout - |
registerHttpRequest | public void registerHttpRequest(HttpServletRequest request)(Code) | | Register the servlet request with the session so the session has access to request info.
|
removeSessionIdPrefix | public static String removeSessionIdPrefix(String sSessId)(Code) | | Removes session id prefix if found.
For example:D_hHk1IsvRlfC1iksMH6lt becomes hHk1IsvRlfC1iksMH6lt
Note: Used to save session id in the database and cache.
Parameters: sSessId - session id. session id without prefix. |
setDefaultUser | protected void setDefaultUser(boolean defaultUser)(Code) | | Sets default user boolean.
Parameters: defaultUser - true or false. |
setLagTime | protected void setLagTime(int nTimeout) throws ConfigException(Code) | | Fills lag time variable by calling calculateLagTime(nTimeout)
and adding this value to the current time.
Parameters: nTimeout - timeout in minutes. throws: ConfigException - |
setTimeout | protected void setTimeout(int nTimeout)(Code) | | Fills timeout variable by adding timeout to the current time.
Parameters: nTimeout - timeout in minutes. |
updateTimeout | protected void updateTimeout(int nTimeout) throws SessionException(Code) | | Checks timeout for session. Calls updateSession() if ok.
throws: SessionException - if timed out, unless default user |
|
|