public interface ConnectionHandler
Gateway
for a given user and in a specific
SecurityContext
.Modifier and Type | Method and Description |
---|---|
void |
connect(LoginCredentials credentials)
Connects the user to OMERO.
|
default void |
connect(String hostname,
int port,
String sessionId)
Connects to OMERO using a session ID.
|
default void |
connect(String hostname,
int port,
String username,
char[] password)
Connects the user to OMERO.
|
default void |
connect(String hostname,
int port,
String username,
char[] password,
Long groupID)
Connects the user to OMERO.
|
void |
disconnect()
Disconnects the user
|
SecurityContext |
getCtx()
Returns the current
SecurityContext . |
default long |
getCurrentGroupId()
Gets the current group ID.
|
Gateway |
getGateway()
Returns the
Gateway used for the connection. |
default long |
getId()
Gets the user id.
|
default OMEROMetadataStoreClient |
getImportStore()
Creates or recycles the import store.
|
default String |
getSessionId()
Get the ID of the current session
|
Experimenter |
getUser()
Returns the current user.
|
default boolean |
isConnected()
Check if the client is still connected to the server
|
ConnectionHandler |
sudo(String username)
Returns a ConnectionHandler associated with the given username.
|
void |
switchGroup(long groupId)
Change the current group used by the current user;
|
Experimenter getUser()
SecurityContext getCtx()
SecurityContext
.default long getId()
default long getCurrentGroupId()
default String getSessionId() throws ServiceException
ServiceException
- If the connection is broken, or not logged indefault boolean isConnected()
default void connect(String hostname, int port, String sessionId) throws ServiceException
hostname
- Name of the host.port
- Port used by OMERO.sessionId
- The session ID.ServiceException
- Cannot connect to OMERO.default void connect(String hostname, int port, String username, char[] password, Long groupID) throws ServiceException
Uses the argument to connect to the gateway.
Connects to the group specified in the argument.
hostname
- Name of the host.port
- Port used by OMERO.username
- Username of the user.password
- Password of the user.groupID
- ID of the group to connect.ServiceException
- Cannot connect to OMERO.default void connect(String hostname, int port, String username, char[] password) throws ServiceException
Uses the argument to connect to the gateway.
Connects to the default group of the user.
hostname
- Name of the host.port
- Port used by OMERO.username
- Username of the user.password
- Password of the user.ServiceException
- Cannot connect to OMERO.void connect(LoginCredentials credentials) throws ServiceException
credentials
- User credentials.ServiceException
- Cannot connect to OMERO.void disconnect()
void switchGroup(long groupId)
groupId
- The group ID.default OMEROMetadataStoreClient getImportStore() throws ServiceException, AccessException
ServiceException
- Cannot connect to OMERO.AccessException
- Cannot access data.ConnectionHandler sudo(String username) throws ServiceException, AccessException, ExecutionException
All actions realized with the returned ConnectionHandler will be considered as his.
The user calling this function needs to have administrator rights.
username
- The user name.ServiceException
- Cannot connect to OMERO.AccessException
- Cannot access data.ExecutionException
- A Facility can't be retrieved or instantiated.NoSuchElementException
- The requested user does not exist.Copyright © 2020–2023 GReD. All rights reserved.