Class LocalOperations
- java.lang.Object
-
- com.iplanet.dpro.session.operations.strategies.LocalOperations
-
- All Implemented Interfaces:
SessionOperations
public class LocalOperations extends Object implements SessionOperations
Handles sessions that are stored in CTS.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addSessionListener(Session session, String url)
Add a session listener notification url.boolean
checkSessionExists(SessionID sessionId)
Check whether a session identified by {code sessionId} can be retrieved.String
deferenceRestrictedID(Session session, SessionID restrictedID)
Given a restricted token, returns the SSOTokenID of the master token can only be used if the requester is an app tokenvoid
destroy(Session requester, Session session)
Destroy the Session using the SessionService.Collection<PartialSession>
getMatchingSessions(CrestQuery crestQuery)
Returns partial sessions from the session service backend that matches the provided CREST query.String
getRestrictedTokenId(SessionID masterSessionId, TokenRestriction restriction)
Returns the restricted tokenSessionInfo
getSessionInfo(SessionID sessionID, boolean reset)
Get the Session Info Object from the Session ID.SearchResults<SessionInfo>
getValidSessions(Session s, String pattern)
Gets all valid Internal Sessions, depending on the value of the user's preferences.void
logout(Session session)
Performs the logout operation on the Session.SessionInfo
refresh(Session session, boolean reset)
Fetches the SessionInfo from the SessionService.Session
resolveSession(SessionID sessionID)
Retrieves the Session from the Session ID.void
setExternalProperty(SSOToken clientToken, SessionID sessionId, String name, String value)
Sets an external property in the session.void
setProperty(Session session, String name, String value)
Sets the property using the SessionService.void
timeout(InternalSession session, SessionEventType eventType)
Timeout the Internal Session.
-
-
-
Method Detail
-
refresh
public SessionInfo refresh(Session session, boolean reset) throws SessionException
Fetches the SessionInfo from the SessionService.- Specified by:
refresh
in interfaceSessionOperations
- Parameters:
session
- The Session to update.reset
- If true, then update the last modified timestamp of the Session.- Returns:
- Null if there was an error locating the Session, otherwise non null.
- Throws:
SessionException
-
destroy
public void destroy(Session requester, Session session) throws SessionException
Destroy the Session using the SessionService.- Specified by:
destroy
in interfaceSessionOperations
- Parameters:
requester
- The requester's non null session used to authorize the destroy operation.session
- The non null session to destroy.- Throws:
SessionException
- If there was an error while deleting the token.
-
timeout
public void timeout(InternalSession session, SessionEventType eventType)
Timeout the Internal Session.Calling this method leads to the Internal Session's state being updated and both timeout and destroy events being emitted.
However, as CTS Worker tasks are responsible for token deletion, this method will not attempt to delete the session's CTS token from persistent storage.
- Parameters:
session
- The InternalSession to time out.eventType
- The type of time out event (must be eitherSessionEventType.MAX_TIMEOUT
orSessionEventType.IDLE_TIMEOUT
.
-
setProperty
public void setProperty(Session session, String name, String value) throws SessionException
Sets the property using the SessionService. Assigns the property to the Session.- Specified by:
setProperty
in interfaceSessionOperations
- Parameters:
session
- The session to perform the set on.name
- Non null name of the property.value
- Non null value.- Throws:
SessionException
- SessionException if the session reached its maximum session time, or the session was destroyed, or there was an error during communication with session service, or if the property name or value was null.
-
getSessionInfo
public SessionInfo getSessionInfo(SessionID sessionID, boolean reset) throws SessionException
Description copied from interface:SessionOperations
Get the Session Info Object from the Session ID.- Specified by:
getSessionInfo
in interfaceSessionOperations
- Parameters:
sessionID
- the Session Id of the required Session Info.reset
- if true will cause the last access time on the session to be updated.- Returns:
- a Session Info object for the required session.
- Throws:
SessionException
- if the session could not be accessed.
-
addSessionListener
public void addSessionListener(Session session, String url) throws SessionException
Description copied from interface:SessionOperations
Add a session listener notification url. The url will receive a notification when session change events occur.- Specified by:
addSessionListener
in interfaceSessionOperations
- Parameters:
session
- the session to listen to.url
- the listener notification url- Throws:
SessionException
- if the session could not be accessed.
-
checkSessionExists
public boolean checkSessionExists(SessionID sessionId) throws SessionException
Description copied from interface:SessionOperations
Check whether a session identified by {code sessionId} can be retrieved.- Specified by:
checkSessionExists
in interfaceSessionOperations
- Parameters:
sessionId
- the session ID to check.- Returns:
- returns true if the session is local
- Throws:
SessionException
- if the session could not be accessed.
-
getRestrictedTokenId
public String getRestrictedTokenId(SessionID masterSessionId, TokenRestriction restriction) throws SessionException
Returns the restricted token- Specified by:
getRestrictedTokenId
in interfaceSessionOperations
- Parameters:
masterSessionId
- master session idrestriction
- TokenRestriction Object- Returns:
- restricted token id
- Throws:
SessionException
-
deferenceRestrictedID
public String deferenceRestrictedID(Session session, SessionID restrictedID) throws SessionException
Description copied from interface:SessionOperations
Given a restricted token, returns the SSOTokenID of the master token can only be used if the requester is an app token- Specified by:
deferenceRestrictedID
in interfaceSessionOperations
- Parameters:
session
- Must be an app tokenrestrictedID
- The SSOTokenID of the restricted token- Returns:
- The SSOTokenID string of the master token
- Throws:
SessionException
- If the master token cannot be de-referenced
-
setExternalProperty
public void setExternalProperty(SSOToken clientToken, SessionID sessionId, String name, String value) throws SessionException
Description copied from interface:SessionOperations
Sets an external property in the session. If the property is protected then it will throw a SessionException.- Specified by:
setExternalProperty
in interfaceSessionOperations
- Parameters:
clientToken
- SSO Token of the client setting external property.sessionId
- The Id of the session to set the property onname
- the name of the propertyvalue
- the new value of the property- Throws:
SessionException
- If the Session could not be accessed or the property is protected.
-
logout
public void logout(Session session) throws SessionException
Description copied from interface:SessionOperations
Performs the logout operation on the Session. This operation is intended to destroy the Session and perform any appropriate Session related logic.- Specified by:
logout
in interfaceSessionOperations
- Parameters:
session
- Session to logout.- Throws:
SessionException
-
resolveSession
public Session resolveSession(SessionID sessionID) throws SessionException
Description copied from interface:SessionOperations
Retrieves the Session from the Session ID.- Specified by:
resolveSession
in interfaceSessionOperations
- Parameters:
sessionID
- the ID of the session to resolve- Returns:
- the Session Object
- Throws:
SessionException
- if the session could not be accessed.
-
getValidSessions
public SearchResults<SessionInfo> getValidSessions(Session s, String pattern) throws SessionException
Gets all valid Internal Sessions, depending on the value of the user's preferences.- Specified by:
getValidSessions
in interfaceSessionOperations
- Parameters:
s
-pattern
- The pattern to use to match the sessions.- Returns:
- The list of sessioninfos found, capped based on time and quantity.
- Throws:
SessionException
-
getMatchingSessions
public Collection<PartialSession> getMatchingSessions(CrestQuery crestQuery) throws SessionException
Description copied from interface:SessionOperations
Returns partial sessions from the session service backend that matches the provided CREST query. The resultset size is limited by the session service's "iplanet-am-session-max-session-list-size" attribute. The returned sessions are only "partial" sessions, meaning that they do not represent the full session state.- Specified by:
getMatchingSessions
in interfaceSessionOperations
- Parameters:
crestQuery
- The CREST query based on which we should look for matching sessions.- Returns:
- The collection of matching partial sessions.
- Throws:
SessionException
- If the request fails.
-
-