|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface SessionDAO
Data Access Object design pattern specification to enable Session
access to an
EIS (Enterprise Information System). It provides your four typical CRUD methods:
create(org.apache.shiro.session.Session)
, readSession(java.io.Serializable)
, update(org.apache.shiro.session.Session)
,
and delete(org.apache.shiro.session.Session)
.
getActiveSessions()
method exists as a support mechanism to pre-emptively orphaned sessions,
typically by ValidatingSessionManager
s), and should
be as efficient as possible, especially if there are thousands of active sessions. Large scale/high performance
implementations will often return a subset of the total active sessions and perform validation a little more
frequently, rather than return a massive set and infrequently validate.
Method Summary | |
---|---|
Serializable |
create(Session session)
Inserts a new Session record into the underling EIS (e.g. |
void |
delete(Session session)
Deletes the associated EIS record of the specified session . |
Collection<Session> |
getActiveSessions()
Returns all sessions in the EIS that are considered active, meaning all sessions that haven't been stopped/expired. |
Session |
readSession(Serializable sessionId)
Retrieves the session from the EIS uniquely identified by the specified sessionId . |
void |
update(Session session)
Updates (persists) data from a previously created Session instance in the EIS identified by {@link Session#getId() session.getId()} . |
Method Detail |
---|
Serializable create(Session session)
Session.getId()
method executed on the argument must return a valid session identifier. That is, the following should
always be true:
Serializable id = create( session ); id.equals( session.getId() ) == trueImplementations are free to throw any exceptions that might occur due to integrity violation constraints or other EIS related errors.
session
- the Session
object to create in the EIS.
Session
object.Session readSession(Serializable sessionId) throws UnknownSessionException
sessionId
.
sessionId
- the system-wide unique identifier of the Session object to retrieve from
the EIS.
sessionId
.
UnknownSessionException
- if there is no EIS record for any session with the
specified sessionId
void update(Session session) throws UnknownSessionException
{@link Session#getId() session.getId()}
. This effectively propagates
the data in the argument to the EIS record previously saved.
In addition to UnknownSessionException, implementations are free to throw any other
exceptions that might occur due to integrity violation constraints or other EIS related
errors.
session
- the Session to update
UnknownSessionException
- if no existing EIS session record exists with the
identifier of session.getSessionId()
void delete(Session session)
session
. If there never
existed a session EIS record with the identifier of
session.getId()
, then this method does nothing.
session
- the session to delete.Collection<Session> getActiveSessions()
null
.
lastAccessTime
.
SimpleSession
s were being stored):
select * from sessions s where s.lastAccessTimestamp < ? and s.stopTimestamp is nullwhere the
?
parameter is a date instance equal to 'now' minus the session timeout
(e.g. now - 30 minutes).
Session
s that are considered active, or an
empty collection or null
if there are no active sessions.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |