|
JSecurity | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jsecurity.session.mgt.AbstractSessionManager
public abstract class AbstractSessionManager
| Field Summary | |
|---|---|
protected Collection<SessionListener> |
listeners
|
| Constructor Summary | |
|---|---|
AbstractSessionManager()
|
|
| Method Summary | |
|---|---|
void |
add(SessionListener listener)
|
protected Session |
beforeInvalidNotification(Session session)
Returns the session instance to use to pass to registered SessionListeners for notification
that the session has been invalidated (stopped or expired). |
protected abstract Session |
createSession(InetAddress originatingHost)
|
protected abstract Session |
doGetSession(Serializable sessionId)
|
Object |
getAttribute(Serializable sessionId,
Object key)
Returns the object bound to the specified session identified by the specified key. |
Collection<Object> |
getAttributeKeys(Serializable sessionId)
Returns the keys of all the attributes stored under the session identified by sessionId. |
InetAddress |
getHostAddress(Serializable sessionId)
Returns the IP address of the host where the session was started, if known. |
Date |
getLastAccessTime(Serializable sessionId)
Returns the time the Session identified by the specified sessionId last interacted with the system. |
protected Session |
getSession(Serializable sessionId)
|
Date |
getStartTimestamp(Serializable sessionId)
Returns the time the Session identified by the specified sessionId was started in the system. |
long |
getTimeout(Serializable sessionId)
Returns the time in milliseconds that the specified session may remain idle before expiring. |
boolean |
isValid(Serializable sessionId)
Returns true if the session is valid (it exists and is not stopped nor expired), false otherwise. |
protected void |
notifyExpiration(Session session)
|
protected void |
notifyStart(Session session)
|
protected void |
notifyStop(Session session)
|
protected void |
onChange(Session s)
|
protected void |
onExpiration(Session session)
|
protected void |
onStop(Session session)
|
boolean |
remove(SessionListener listener)
|
Object |
removeAttribute(Serializable sessionId,
Object key)
Removes (unbinds) the object bound to this session under the specified key name. |
void |
setAttribute(Serializable sessionId,
Object key,
Object value)
Binds the specified value to the specified session uniquely identified by the specifed key name. |
void |
setSessionListeners(Collection<SessionListener> listeners)
|
void |
setTimeout(Serializable sessionId,
long maxIdleTimeInMillis)
Sets the time in milliseconds that the specified session may remain idle before expiring. |
Serializable |
start(InetAddress originatingHost)
Starts a new session within the system for the host with the specified originating IP address. |
void |
stop(Serializable sessionId)
Explicitly stops the session identified by sessionId, thereby releasing all associated resources. |
protected void |
stop(Session session)
|
void |
touch(Serializable sessionId)
Updates the last accessed time of the session identified by sessionId. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Collection<SessionListener> listeners
| Constructor Detail |
|---|
public AbstractSessionManager()
| Method Detail |
|---|
public void setSessionListeners(Collection<SessionListener> listeners)
setSessionListeners in interface SessionListenerRegistrarpublic void add(SessionListener listener)
add in interface SessionListenerRegistrarpublic boolean remove(SessionListener listener)
remove in interface SessionListenerRegistrar
public Serializable start(InetAddress originatingHost)
throws HostUnauthorizedException,
IllegalArgumentException
SessionManagerNote: see the
SessionFactory.init(InetAddress) method
about the implications of using InetAddresses in access control policies.
start in interface SessionManageroriginatingHost - the originating host InetAddress of the external party
(user, 3rd party product, etc) that is attempting to interact with the system.
HostUnauthorizedException - if the host specified is not allowed to start sessions.
IllegalArgumentException - if the host specified is not valid.SessionFactory.start(InetAddress)protected Session beforeInvalidNotification(Session session)
SessionListeners for notification
that the session has been invalidated (stopped or expired).
The default implementation returns an
ImmutableProxiedSession instance to ensure
that the specified session argument is not modified by any listeners.
session - the Session object being invalidated.
Session instance to use to pass to registered SessionListeners for
notification.protected void notifyStart(Session session)
protected void notifyStop(Session session)
protected void notifyExpiration(Session session)
public Date getStartTimestamp(Serializable sessionId)
SessionManager
getStartTimestamp in interface SessionManagersessionId - the system identifier for the session of interest.
Session.getStartTimestamp()public Date getLastAccessTime(Serializable sessionId)
SessionManager
getLastAccessTime in interface SessionManagersessionId - the system identifier for the session of interest
Session.getLastAccessTime(),
Session.touch()
public long getTimeout(Serializable sessionId)
throws InvalidSessionException
SessionManager
getTimeout in interface SessionManagersessionId - the system identifier of the session of interest.
InvalidSessionException - if the session has been stopped or expired prior to calling this method.
public void setTimeout(Serializable sessionId,
long maxIdleTimeInMillis)
throws InvalidSessionException
SessionManager
setTimeout in interface SessionManagersessionId - the system identifier of the session of interest.maxIdleTimeInMillis - the time in milliseconds that the specified session may remain idle before expiring.
InvalidSessionException - if the session has been stopped or expired prior to calling this method.
public void touch(Serializable sessionId)
throws InvalidSessionException
SessionManagersessionId. This
can be used to explicitly ensure that a session does not time out.
touch in interface SessionManagersessionId - the id of the session to update.
InvalidSessionException - if the session has been stopped or expired prior to calling this method.Session.touch()public InetAddress getHostAddress(Serializable sessionId)
SessionManagernull
getHostAddress in interface SessionManagersessionId - the id of the session to query.
null.init( InetAddress originatingHost )
public void stop(Serializable sessionId)
throws InvalidSessionException
SessionManager
stop in interface SessionManagersessionId - the system identfier of the system to destroy.
InvalidSessionException - if the session has stopped or expired prior to calling
this method.Session.stop()protected void stop(Session session)
protected void onStop(Session session)
protected void onExpiration(Session session)
public Collection<Object> getAttributeKeys(Serializable sessionId)
SessionManager
getAttributeKeys in interface SessionManagersessionId - the system identifier of the system to access.
Session.getAttributeKeys()
public Object getAttribute(Serializable sessionId,
Object key)
throws InvalidSessionException
SessionManager
getAttribute in interface SessionManagersessionId - the system identifier of the session of interestkey - the unique name of the object bound to the specified session
InvalidSessionException - if the specified session has stopped or expired prior to calling this method.Session.getAttribute(Object key)
public void setAttribute(Serializable sessionId,
Object key,
Object value)
throws InvalidSessionException
SessionManagerIf the value parameter is null, it has the same effect as if the
SessionManager.removeAttribute(Serializable sessionId, Object key) method was called.
setAttribute in interface SessionManagersessionId - the system identifier of the session of interestkey - the name under which the value object will be bound in this sessionvalue - the object to bind in this session.
InvalidSessionException - if the specified session has stopped or expired prior to calling this method.Session.setAttribute(Object key, Object value)
public Object removeAttribute(Serializable sessionId,
Object key)
throws InvalidSessionException
SessionManager
removeAttribute in interface SessionManagersessionId - the system identifier of the session of interestkey - the name uniquely identifying the object to remove
InvalidSessionException - if the specified session has stopped or expired prior to calling this method.Session.removeAttribute(Object key)
protected Session getSession(Serializable sessionId)
throws InvalidSessionException
InvalidSessionExceptionpublic boolean isValid(Serializable sessionId)
SessionManager
isValid in interface SessionManagersessionId - the id of the session to check
protected void onChange(Session s)
protected abstract Session doGetSession(Serializable sessionId)
throws InvalidSessionException
InvalidSessionException
protected abstract Session createSession(InetAddress originatingHost)
throws HostUnauthorizedException,
IllegalArgumentException
HostUnauthorizedException
IllegalArgumentException
|
JSecurity | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||