ome.services.sessions
Class SessionBean

java.lang.Object
  extended by ome.services.sessions.SessionBean
All Implemented Interfaces:
ISession, ServiceInterface

@Transactional
public class SessionBean
extends Object
implements ISession

Implementation of ISession. Is merely a wrapper around the SessionManager Spring-singleton.

Since:
3.0-Beta3
Author:
Josh Moore, josh at glencoesoftware.com

Constructor Summary
SessionBean(SessionManager mgr, Executor ex, CurrentDetails cd)
           
 
Method Summary
 int closeSession(ome.model.meta.Session session)
          Closes session and releases all resources.
 ome.model.meta.Session createSession(Principal principal, String credentials)
          Creates a new session and returns it to the user.
 ome.model.meta.Session createSessionWithTimeout(Principal principal, long milliseconds)
          Allows an admin to create a Session for the give Principal
 ome.model.meta.Session createSessionWithTimeouts(Principal principal, long timeToLiveMilliseconds, long timeToIdleMilliseconds)
          Allows an admin to create a Session for the give Principal
 ome.model.meta.Session createUserSession(long timeToLiveMs, long timeToIdleMs, String defaultGroup)
          Allows a user to open up another session for him/herself with the given defaults without needing to re-enter password.
 Object getInput(String session, String key)
          Retrieves an entry from the given session's input environment.
 Set<String> getInputKeys(String session)
          Retrieves all keys in the sesson's input environment.
 Map<String,Object> getInputs(String session)
          Retrieves all inputs from the given session's input environment.
 List<ome.model.meta.Session> getMyOpenAgentSessions(String agent)
          Like ISession.getMyOpenSessions() but returns only those sessions with the given agent string.
 List<ome.model.meta.Session> getMyOpenClientSessions()
          Like ISession.getMyOpenSessions() but returns only those sessions started by official OMERO clients.
 List<ome.model.meta.Session> getMyOpenSessions()
          Returns a list of open sessions for the current user.
 Object getOutput(String session, String key)
          Retrieves an entry from the session's output environment.
 Set<String> getOutputKeys(String session)
          Retrieves all keys in the sesson's output environment.
 Map<String,Object> getOutputs(String session)
          Retrieves all outputs from the given session's input environment.
 int getReferenceCount(String sessionUuid)
          Retrieves the current reference count for the given uuid.
 Class<? extends ServiceInterface> getServiceInterface()
           
 ome.model.meta.Session getSession(String sessionUuid)
          Retrieves the session associated with this uuid, updating the last access time as well.
 void setInput(String session, String key, Object object)
          Places an entry in the given session's input environment.
 void setOutput(String session, String key, Object object)
          Places an entry in the given session's output environment.
 ome.model.meta.Session updateSession(ome.model.meta.Session session)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SessionBean

public SessionBean(SessionManager mgr,
                   Executor ex,
                   CurrentDetails cd)
Method Detail

getServiceInterface

public Class<? extends ServiceInterface> getServiceInterface()

createUserSession

public ome.model.meta.Session createUserSession(long timeToLiveMs,
                                                long timeToIdleMs,
                                                String defaultGroup)
Description copied from interface: ISession
Allows a user to open up another session for him/herself with the given defaults without needing to re-enter password.

Specified by:
createUserSession in interface ISession

createSessionWithTimeout

public ome.model.meta.Session createSessionWithTimeout(Principal principal,
                                                       long milliseconds)
Description copied from interface: ISession
Allows an admin to create a Session for the give Principal

Specified by:
createSessionWithTimeout in interface ISession
Parameters:
principal - Non-null Principal with the target user's name
milliseconds - The time that this Session has until destruction. This is useful to override the server default so that an initial delay before the user is given the token will not be construed as idle time. A value less than 1 will cause the default max timeToLive to be used; but timeToIdle will be disabled.

createSessionWithTimeouts

public ome.model.meta.Session createSessionWithTimeouts(Principal principal,
                                                        long timeToLiveMilliseconds,
                                                        long timeToIdleMilliseconds)
Description copied from interface: ISession
Allows an admin to create a Session for the give Principal

Specified by:
createSessionWithTimeouts in interface ISession
Parameters:
principal - Non-null Principal with the target user's name
timeToIdleMilliseconds - The time that this Session can remain idle before being destroyed. Setting the value to 0 will prevent idleness based destruction.

createSession

public ome.model.meta.Session createSession(Principal principal,
                                            String credentials)
Description copied from interface: ISession
Creates a new session and returns it to the user.

Specified by:
createSession in interface ISession

getSession

public ome.model.meta.Session getSession(String sessionUuid)
Description copied from interface: ISession
Retrieves the session associated with this uuid, updating the last access time as well. Throws a RemovedSessionException if not present, or a SessionTimeoutException if expired. This method can be used as a Session ping.

Specified by:
getSession in interface ISession

getReferenceCount

public int getReferenceCount(String sessionUuid)
Description copied from interface: ISession
Retrieves the current reference count for the given uuid. Has the same semantics as ISession.getSession(String).

Specified by:
getReferenceCount in interface ISession

updateSession

public ome.model.meta.Session updateSession(ome.model.meta.Session session)

closeSession

public int closeSession(ome.model.meta.Session session)
Description copied from interface: ISession
Closes session and releases all resources. It is preferred that all clients call this method as soon as possible to free memory, but it is possible to not call close, and rejoin a session later. The current reference count for the session is returned. If the session does not exist, -1. If this call caused the death of the session, then -2.

Specified by:
closeSession in interface ISession

getMyOpenSessions

public List<ome.model.meta.Session> getMyOpenSessions()
Description copied from interface: ISession
Returns a list of open sessions for the current user. The list is ordered by session creation time, so that the last item was created last.

Specified by:
getMyOpenSessions in interface ISession

getMyOpenAgentSessions

public List<ome.model.meta.Session> getMyOpenAgentSessions(String agent)
Description copied from interface: ISession
Like ISession.getMyOpenSessions() but returns only those sessions with the given agent string.

Specified by:
getMyOpenAgentSessions in interface ISession

getMyOpenClientSessions

public List<ome.model.meta.Session> getMyOpenClientSessions()
Description copied from interface: ISession
Like ISession.getMyOpenSessions() but returns only those sessions started by official OMERO clients.

Specified by:
getMyOpenClientSessions in interface ISession

getInput

public Object getInput(String session,
                       String key)
Description copied from interface: ISession
Retrieves an entry from the given session's input environment.

Specified by:
getInput in interface ISession

getOutput

public Object getOutput(String session,
                        String key)
Description copied from interface: ISession
Retrieves an entry from the session's output environment.

Specified by:
getOutput in interface ISession

setInput

public void setInput(String session,
                     String key,
                     Object object)
Description copied from interface: ISession
Places an entry in the given session's input environment. If the value is null, the key will be removed.

Specified by:
setInput in interface ISession

setOutput

public void setOutput(String session,
                      String key,
                      Object object)
Description copied from interface: ISession
Places an entry in the given session's output environment. If the value is null, the key will be removed.

Specified by:
setOutput in interface ISession

getInputKeys

public Set<String> getInputKeys(String session)
Description copied from interface: ISession
Retrieves all keys in the sesson's input environment.

Specified by:
getInputKeys in interface ISession
Returns:

getOutputKeys

public Set<String> getOutputKeys(String session)
Description copied from interface: ISession
Retrieves all keys in the sesson's output environment.

Specified by:
getOutputKeys in interface ISession

getInputs

public Map<String,Object> getInputs(String session)
Description copied from interface: ISession
Retrieves all inputs from the given session's input environment.

Specified by:
getInputs in interface ISession

getOutputs

public Map<String,Object> getOutputs(String session)
Description copied from interface: ISession
Retrieves all outputs from the given session's input environment.

Specified by:
getOutputs in interface ISession


OmeroJava Api

Version: 4.3.3-00d1137e-b2894

Copyright © 2009 The University of Dundee. All Rights Reserved.