public class SessionManager extends java.lang.Object implements SessionService
SessionService
.Constructor and Description |
---|
SessionManager(OmeroEnv env)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
boolean |
close(java.net.URI omeroHostAndPort,
java.lang.String sessionKey)
Closes the specified session.
|
java.util.Optional<java.lang.String> |
create(java.net.URI omeroHostAndPort,
java.lang.String username,
java.lang.String password)
Starts a new session for the specified user.
|
java.util.Optional<java.lang.String> |
createAndKeepAlive(java.net.URI omeroHostAndPort,
java.lang.String username,
java.lang.String password,
java.time.Duration howLong)
Starts a new session for the specified user and keeps it alive for a
given amount of time.
|
boolean |
keepAlive(java.net.URI omeroHostAndPort,
java.lang.String sessionKey)
Issues a keep-alive command for the specified session.
|
public SessionManager(OmeroEnv env)
env
- the service environment.public java.util.Optional<java.lang.String> create(java.net.URI omeroHostAndPort, java.lang.String username, java.lang.String password)
SessionService
create
in interface SessionService
omeroHostAndPort
- detail the server to connect to.username
- the login name of the user this session is for.password
- the password of the user this session is for.public boolean keepAlive(java.net.URI omeroHostAndPort, java.lang.String sessionKey)
SessionService
keepAlive
in interface SessionService
omeroHostAndPort
- detail the server to connect to.sessionKey
- the session ID.true
if the command succeeded, false
otherwise.public boolean close(java.net.URI omeroHostAndPort, java.lang.String sessionKey)
SessionService
close
in interface SessionService
omeroHostAndPort
- detail the server to connect to.sessionKey
- the session ID.true
if the command succeeded, false
otherwise.public java.util.Optional<java.lang.String> createAndKeepAlive(java.net.URI omeroHostAndPort, java.lang.String username, java.lang.String password, java.time.Duration howLong)
SessionService
createAndKeepAlive
in interface SessionService
omeroHostAndPort
- detail the server to connect to.username
- the login name of the user this session is for.password
- the password of the user this session is for.howLong
- how long from now to keep the session alive.