|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectsky.common.session.BaseSession
Base implementation of the Session interface. A session object is associated with a user for keeping track of user activity. Optionally, a session can have a maximum limit on the number of events that it can hold. Once the maximum limit on number of events is reached, the oldest events will be dropped to make space for new events. You may wish to derive your own Tracker class that will flush events to a database instead of dropping them. If maximum limit for number of events is -1, the session can hold an unlimited number of events (and thus consume an unlimited amount of memory).
$RCSfile: BaseSession.java,v $
$Revision: 1.2 $, $Date: 2005/04/24 03:14:00 $
| Field Summary | |
protected long |
_created
time at which this session was created. |
protected java.util.List |
_events
list used to store all the events. |
protected java.lang.String |
_id
unique id of this session. |
protected java.lang.String |
_ip
ip address from where user requests are coming. |
protected int |
_max
maximum number of events that this session can hold. |
protected int |
_num
number of events that this session is currently holding. |
protected long |
_updated
time at which this session was last accessed. |
| Constructor Summary | |
BaseSession(java.lang.String id,
java.lang.String ip,
int max)
Constructor |
|
| Method Summary | |
void |
addEvent(Event event)
Add an event to this session |
void |
clearEvents()
Clear all the events from this session. |
long |
getCreationTime()
Get the first time this session was used. |
java.util.Iterator |
getEvents()
Get an iterator to a list of events that is associated with this session. |
java.lang.String |
getId()
Get this sessions unique id |
java.lang.String |
getIp()
Get this sessions ip address. |
long |
getLastAccessedTime()
Get the last time this session was used. |
long |
getLifeTime()
Get the life time (duration) this session has been active for. |
void |
persistEvents()
Persist all the events from this session. |
java.lang.String |
toHTMLString()
HTML String representation of this session. |
java.lang.String |
toString()
String representation of this session. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected java.lang.String _id
protected java.lang.String _ip
protected long _created
protected long _updated
protected int _max
protected int _num
protected java.util.List _events
| Constructor Detail |
public BaseSession(java.lang.String id,
java.lang.String ip,
int max)
id - A unique id for identifying this user session.ip - Ip address of the end-user.max - Maximum number of events that this session will hold (if -1, then unlimited).| Method Detail |
public java.lang.String getId()
getId in interface Sessionpublic java.lang.String getIp()
getIp in interface Sessionpublic long getLastAccessedTime()
getLastAccessedTime in interface Sessionpublic long getCreationTime()
getCreationTime in interface Sessionpublic long getLifeTime()
getLifeTime in interface Sessionpublic java.util.Iterator getEvents()
getEvents in interface Sessionpublic void addEvent(Event event)
addEvent in interface Sessionpublic void clearEvents()
clearEvents in interface Sessionpublic void persistEvents()
persistEvents in interface Sessionpublic java.lang.String toString()
toString in interface Sessionpublic java.lang.String toHTMLString()
toHTMLString in interface Session
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||