|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jwall.web.audit.session.AbstractSessionTracker
public abstract class AbstractSessionTracker
This class is an abstract implementation of a simple session tracker and provides the basis for the tracker HeuristicSessionTracker and CookieSessionTracker.
| Field Summary | |
|---|---|
protected java.util.Hashtable<java.lang.String,Session> |
activeSessions
|
protected long |
sessionTimeOut
|
protected java.util.List<Session> |
timedOutSessions
|
protected int |
type
|
| Constructor Summary | |
|---|---|
AbstractSessionTracker()
This creates a new instance of this class which is based on the default timeout of 2 hours ( = 7200000 ms ). |
|
AbstractSessionTracker(long timeout)
This initializes the tracker with the given session-timeout. |
|
| Method Summary | |
|---|---|
void |
eventArrived(AuditEvent event)
This method tracks an AuditEvent object and creates a session if none existed yet. |
protected void |
expireSession(Session s)
Remove the session from the hash of active sessions and store it in the list of timed-out sessions. |
abstract java.lang.String |
extractKey(AuditEvent evt)
This method extracts the key-feature from an event which is used to identify the session that this event is related to. |
protected Session |
getSession(java.lang.String sessionId)
This method returns the session with the given session-id. |
java.util.Collection<Session> |
getSessions()
This method returns all the sessions (active and timed-out) that have been created by the session-tracker. |
long |
getSessionTimeOut()
Returns the session-timeout that is used by this tracker. |
boolean |
isExpired(Session s,
AuditEvent event)
This method is used to check a session for expiration according to the date of the given audit-event. |
void |
reset()
This method simply resets the session-tracker to the initial state which holds no sessions. |
void |
setSessionTimeOut(long s)
This method is used to set the session-timeout. |
void |
setStrictSessions(boolean b)
In a strict session the session-id is presumed to be created by the server-side application. |
java.lang.String |
toString()
This method returns a string of all events grouped by their session-id. |
boolean |
usesStrictSessions()
Returns true, if the tracker only produces strict sessions. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected long sessionTimeOut
protected java.util.Hashtable<java.lang.String,Session> activeSessions
protected java.util.List<Session> timedOutSessions
protected int type
| Constructor Detail |
|---|
public AbstractSessionTracker()
public AbstractSessionTracker(long timeout)
timeout - The session-timeout in seconds.| Method Detail |
|---|
public void eventArrived(AuditEvent event)
eventArrived in interface AuditEventListenereventArrived in interface SessionTrackerevent - The AuditEvent instance that is to be associated with a session.protected void expireSession(Session s)
s - The session to expire.protected Session getSession(java.lang.String sessionId)
sessionId - The id of the session that is to be retrieved.
null if the
session is inactive or does not exist at all.public java.util.Collection<Session> getSessions()
getSessions in interface SessionTrackerpublic void reset()
reset in interface SessionTracker
public boolean isExpired(Session s,
AuditEvent event)
s - The session that is to be checked.event - The event which defines the current date.
true if the sessions' last access-time is no longer that
a period of X seconds away from the events date. Here X is the session-timeout
defined for this session-tracker.public void setSessionTimeOut(long s)
setSessionTimeOut in interface SessionTrackers - The number of seconds after which a session is to be timed out.public long getSessionTimeOut()
getSessionTimeOut in interface SessionTrackerpublic void setStrictSessions(boolean b)
setStrictSessions in interface SessionTrackerb - Wether this tracker should only track strict sessions.public boolean usesStrictSessions()
SessionTrackertrue, if the tracker only produces strict sessions.
usesStrictSessions in interface SessionTrackerpublic abstract java.lang.String extractKey(AuditEvent evt)
evt - The event from which to extract the session-id.
public java.lang.String toString()
toString in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||