Package fr.igred.omero.client
Interface ConnectionHandler
-
- All Known Subinterfaces:
Client
- All Known Implementing Classes:
GatewayWrapper
public interface ConnectionHandlerInterface to handle the connection to an OMERO server through aGatewayfor a given user and in a specificSecurityContext.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default voidconnect(java.lang.String hostname, int port, java.lang.String sessionId)Connects to OMERO using a session ID.default voidconnect(java.lang.String hostname, int port, java.lang.String username, char[] password)Connects the user to OMERO.default voidconnect(java.lang.String hostname, int port, java.lang.String username, char[] password, java.lang.Long groupID)Connects the user to OMERO.voidconnect(LoginCredentials credentials)Connects the user to OMERO.voiddisconnect()Disconnects the userSecurityContextgetCtx()Returns the currentSecurityContext.default longgetCurrentGroupId()Gets the current group ID.GatewaygetGateway()Returns theGatewayused for the connection.default longgetId()Gets the user id.default OMEROMetadataStoreClientgetImportStore()Creates or recycles the import store.default java.lang.StringgetSessionId()Get the ID of the current sessionExperimentergetUser()Returns the current user.default booleanisConnected()Check if the client is still connected to the serverConnectionHandlersudo(java.lang.String username)Returns a ConnectionHandler associated with the given username.voidswitchGroup(long groupId)Change the current group used by the current user;
-
-
-
Method Detail
-
getUser
Experimenter getUser()
Returns the current user.- Returns:
- See above.
-
getCtx
SecurityContext getCtx()
Returns the currentSecurityContext.- Returns:
- See above
-
getId
default long getId()
Gets the user id.- Returns:
- The user ID.
-
getCurrentGroupId
default long getCurrentGroupId()
Gets the current group ID.- Returns:
- The group ID.
-
getSessionId
default java.lang.String getSessionId() throws ServiceExceptionGet the ID of the current session- Returns:
- See above
- Throws:
ServiceException- If the connection is broken, or not logged in
-
isConnected
default boolean isConnected()
Check if the client is still connected to the server- Returns:
- See above.
-
connect
default void connect(java.lang.String hostname, int port, java.lang.String sessionId) throws ServiceExceptionConnects to OMERO using a session ID.- Parameters:
hostname- Name of the host.port- Port used by OMERO.sessionId- The session ID.- Throws:
ServiceException- Cannot connect to OMERO.
-
connect
default void connect(java.lang.String hostname, int port, java.lang.String username, char[] password, java.lang.Long groupID) throws ServiceExceptionConnects the user to OMERO.Uses the argument to connect to the gateway.
Connects to the group specified in the argument.
- Parameters:
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.- Throws:
ServiceException- Cannot connect to OMERO.
-
connect
default void connect(java.lang.String hostname, int port, java.lang.String username, char[] password) throws ServiceExceptionConnects the user to OMERO.Uses the argument to connect to the gateway.
Connects to the default group of the user.
- Parameters:
hostname- Name of the host.port- Port used by OMERO.username- Username of the user.password- Password of the user.- Throws:
ServiceException- Cannot connect to OMERO.
-
connect
void connect(LoginCredentials credentials) throws ServiceException
Connects the user to OMERO. Gets the SecurityContext and the BrowseFacility.- Parameters:
credentials- User credentials.- Throws:
ServiceException- Cannot connect to OMERO.
-
disconnect
void disconnect()
Disconnects the user
-
switchGroup
void switchGroup(long groupId)
Change the current group used by the current user;- Parameters:
groupId- The group ID.
-
getImportStore
default OMEROMetadataStoreClient getImportStore() throws ServiceException
Creates or recycles the import store.- Returns:
- See above.
- Throws:
ServiceException- Cannot connect to OMERO.
-
sudo
ConnectionHandler sudo(java.lang.String username) throws ServiceException, AccessException, java.util.concurrent.ExecutionException
Returns a ConnectionHandler associated with the given username.All actions realized with the returned ConnectionHandler will be considered as his.
The user calling this function needs to have administrator rights.
- Parameters:
username- The user name.- Returns:
- The connection and context corresponding to the new user.
- Throws:
ServiceException- Cannot connect to OMERO.AccessException- Cannot access data.java.util.concurrent.ExecutionException- A Facility can't be retrieved or instantiated.java.util.NoSuchElementException- The requested user does not exist.
-
-