Package ome.api
Interface ISession
-
- All Superinterfaces:
ServiceInterface
public interface ISession extends ServiceInterface
Start here:Session
creation service for OMERO. Access to all other services is dependent upon a properly created and still activeSession
. Thesession's
uuid
can be considered a capability token, or temporary single use password. Simply by possessing it the client has access to all information available to theSession
. Note: Both the RMIServiceFactory
as well as the Iceomero.api.ServiceFactoryPrx
useISession
to acquire aSession
. In the RMI case, theISession
instance is the first remote proxy accessed. In the Ice case, Glacier2 contactsISession
itself and returns a ServiceFactory remote proxy. From both ServiceFactory instances, it is possible but not necessary to accessISession
.- Since:
- 3.0-Beta3
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description int
closeSession(ome.model.meta.Session session)
Closes session and releases all resources.ome.model.meta.Session
createSession(Principal principal, java.lang.String credentials)
Creates a new session and returns it to the user.ome.model.meta.Session
createSessionWithTimeout(Principal principal, long timeToLiveMilliseconds)
Allows an admin to create aSession
for the givePrincipal
ome.model.meta.Session
createSessionWithTimeouts(Principal principal, long timeToLiveMilliseconds, long timeToIdleMilliseconds)
Allows an admin to create aSession
for the givePrincipal
ome.model.meta.Session
createUserSession(long timeToLiveMilliseconds, long timeToIdleMillisecond, java.lang.String defaultGroup)
Allows a user to open up another session for him/herself with the given defaults without needing to re-enter password.java.lang.Object
getInput(java.lang.String session, java.lang.String key)
Retrieves an entry from the givensession's
input environment.java.util.Set<java.lang.String>
getInputKeys(java.lang.String session)
Retrieves all keys in thesession's
input environment.java.util.Map<java.lang.String,java.lang.Object>
getInputs(java.lang.String session)
Retrieves all inputs from the givensession's
input environment.java.util.List<ome.model.meta.Session>
getMyOpenAgentSessions(java.lang.String agent)
LikegetMyOpenSessions()
but returns only those sessions with the given agent string.java.util.List<ome.model.meta.Session>
getMyOpenClientSessions()
LikegetMyOpenSessions()
but returns only those sessions started by official OMERO clients.java.util.List<ome.model.meta.Session>
getMyOpenSessions()
Returns a list of open sessions for the current user.java.lang.Object
getOutput(java.lang.String session, java.lang.String key)
Retrieves an entry from thesession's
output environment.java.util.Set<java.lang.String>
getOutputKeys(java.lang.String session)
Retrieves all keys in thesesson's
output environment.java.util.Map<java.lang.String,java.lang.Object>
getOutputs(java.lang.String session)
Retrieves all outputs from the givensession's
input environment.int
getReferenceCount(java.lang.String sessionUuid)
Retrieves the current reference count for the given uuid.ome.model.meta.Session
getSession(java.lang.String sessionUuid)
Retrieves the session associated with this uuid, updating the last access time as well.void
setInput(java.lang.String session, java.lang.String key, java.lang.Object objection)
Places an entry in the givensession's
input environment.void
setOutput(java.lang.String session, java.lang.String key, java.lang.Object objection)
Places an entry in the givensession's
output environment.
-
-
-
Method Detail
-
createUserSession
ome.model.meta.Session createUserSession(long timeToLiveMilliseconds, long timeToIdleMillisecond, java.lang.String defaultGroup)
Allows a user to open up another session for him/herself with the given defaults without needing to re-enter password.
-
createSessionWithTimeout
ome.model.meta.Session createSessionWithTimeout(Principal principal, long timeToLiveMilliseconds)
Allows an admin to create aSession
for the givePrincipal
- Parameters:
principal
- Non-nullPrincipal
with the target user's nametimeToLiveMilliseconds
- The time that thisSession
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
-
createSessionWithTimeouts
ome.model.meta.Session createSessionWithTimeouts(Principal principal, long timeToLiveMilliseconds, long timeToIdleMilliseconds)
Allows an admin to create aSession
for the givePrincipal
- Parameters:
principal
- Non-nullPrincipal
with the target user's nametimeToLiveMilliseconds
- The time that thisSession
has until destruction. Setting the value to 0 will prevent destruction unless the session remains idle.timeToIdleMilliseconds
- The time that thisSession
can remain idle before being destroyed. Setting the value to 0 will prevent idleness
-
createSession
ome.model.meta.Session createSession(Principal principal, java.lang.String credentials)
Creates a new session and returns it to the user.- Throws:
ome.conditions.ApiUsageException
- if principal is nullome.conditions.SecurityViolation
- if the password check fails
-
getSession
ome.model.meta.Session getSession(java.lang.String sessionUuid)
Retrieves the session associated with this uuid, updating the last access time as well. Throws aRemovedSessionException
if not present, or aSessionTimeoutException
if expired. This method can be used as aSession
ping.
-
getReferenceCount
int getReferenceCount(java.lang.String sessionUuid)
Retrieves the current reference count for the given uuid. Has the same semantics asgetSession(String)
.
-
closeSession
int closeSession(ome.model.meta.Session session)
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.
-
getMyOpenSessions
java.util.List<ome.model.meta.Session> getMyOpenSessions()
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.
-
getMyOpenAgentSessions
java.util.List<ome.model.meta.Session> getMyOpenAgentSessions(java.lang.String agent)
LikegetMyOpenSessions()
but returns only those sessions with the given agent string.
-
getMyOpenClientSessions
java.util.List<ome.model.meta.Session> getMyOpenClientSessions()
LikegetMyOpenSessions()
but returns only those sessions started by official OMERO clients.
-
getInput
java.lang.Object getInput(java.lang.String session, java.lang.String key)
Retrieves an entry from the givensession's
input environment.
-
getInputKeys
java.util.Set<java.lang.String> getInputKeys(java.lang.String session)
Retrieves all keys in thesession's
input environment.- Parameters:
session
-- Returns:
- a
Set
of keys
-
getInputs
java.util.Map<java.lang.String,java.lang.Object> getInputs(java.lang.String session)
Retrieves all inputs from the givensession's
input environment.
-
setInput
void setInput(java.lang.String session, java.lang.String key, java.lang.Object objection)
Places an entry in the givensession's
input environment. If the value is null, the key will be removed.
-
getOutputKeys
java.util.Set<java.lang.String> getOutputKeys(java.lang.String session)
Retrieves all keys in thesesson's
output environment.
-
getOutput
java.lang.Object getOutput(java.lang.String session, java.lang.String key)
Retrieves an entry from thesession's
output environment.
-
getOutputs
java.util.Map<java.lang.String,java.lang.Object> getOutputs(java.lang.String session)
Retrieves all outputs from the givensession's
input environment.
-
setOutput
void setOutput(java.lang.String session, java.lang.String key, java.lang.Object objection)
Places an entry in the givensession's
output environment. If the value is null, the key will be removed.
-
-