Package fr.igred.omero.client
Class GatewayWrapper
- java.lang.Object
-
- fr.igred.omero.client.GatewayWrapper
-
- All Implemented Interfaces:
AdminManager
,Browser
,Client
,ConnectionHandler
,DataManager
public class GatewayWrapper extends java.lang.Object implements Client
Allows the user to connect to OMERO and browse through all the data accessible to the user.Contains the gateway, the security context, and the current user.
-
-
Constructor Summary
Constructors Modifier Constructor Description GatewayWrapper()
Constructor of the GatewayWrapper class.protected
GatewayWrapper(Gateway gateway, SecurityContext ctx, Experimenter user)
Constructor of the GatewayWrapper class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
connect(LoginCredentials credentials)
Connects the user to OMERO.void
disconnect()
Disconnects the userSecurityContext
getCtx()
Contains the permissions of the user in the group.Gateway
getGateway()
Returns the Gateway.Experimenter
getUser()
Returns the current user.Client
sudo(java.lang.String username)
Returns a Client associated with the given username.void
switchGroup(long groupId)
Change the current group used by the current user;java.lang.String
toString()
Overridden to return the host name, the group ID, the username and the connection status.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface fr.igred.omero.client.AdminManager
getGroup, getUser
-
Methods inherited from interface fr.igred.omero.client.Browser
findByQuery, getDataset, getDatasets, getDatasets, getDatasets, getDatasets, getFolder, getFolders, getFolders, getImage, getImages, getImages, getImages, getImages, getImages, getImagesLike, getImagesWithKey, getImagesWithKeyValuePair, getMapAnnotation, getMapAnnotations, getMapAnnotations, getMapAnnotations, getPlate, getPlates, getPlates, getPlates, getProject, getProjects, getProjects, getProjects, getProjects, getScreen, getScreens, getScreens, getScreens, getTag, getTags, getTags, getWell, getWells, getWells, getWells, loadFolders
-
Methods inherited from interface fr.igred.omero.client.Client
getAdminFacility, getBrowseFacility, getDMFacility, getMetadataFacility, getQueryService, getRoiFacility, getTablesFacility
-
Methods inherited from interface fr.igred.omero.client.ConnectionHandler
connect, connect, connect, getCurrentGroupId, getId, getImportStore, getSessionId, isConnected
-
Methods inherited from interface fr.igred.omero.client.DataManager
delete, delete, delete, delete, delete, deleteFile, save
-
-
-
-
Constructor Detail
-
GatewayWrapper
public GatewayWrapper()
Constructor of the GatewayWrapper class. Initializes the gateway.
-
GatewayWrapper
protected GatewayWrapper(Gateway gateway, SecurityContext ctx, Experimenter user)
Constructor of the GatewayWrapper class.Null arguments will be replaced with default empty objects.
- Parameters:
gateway
- TheGateway
.ctx
- The security context.user
- The user.
-
-
Method Detail
-
getGateway
public Gateway getGateway()
Returns the Gateway.- Specified by:
getGateway
in interfaceConnectionHandler
- Returns:
- The Gateway.
-
getUser
public Experimenter getUser()
Returns the current user.- Specified by:
getUser
in interfaceConnectionHandler
- Returns:
- The current user.
-
getCtx
public SecurityContext getCtx()
Contains the permissions of the user in the group.- Specified by:
getCtx
in interfaceAdminManager
- Specified by:
getCtx
in interfaceBrowser
- Specified by:
getCtx
in interfaceConnectionHandler
- Specified by:
getCtx
in interfaceDataManager
- Returns:
- the
SecurityContext
of the user.
-
connect
public void connect(LoginCredentials credentials) throws ServiceException
Connects the user to OMERO. Gets the SecurityContext and the BrowseFacility.- Specified by:
connect
in interfaceConnectionHandler
- Parameters:
credentials
- User credentials.- Throws:
ServiceException
- Cannot connect to OMERO.
-
disconnect
public void disconnect()
Disconnects the user- Specified by:
disconnect
in interfaceConnectionHandler
-
switchGroup
public void switchGroup(long groupId)
Change the current group used by the current user;- Specified by:
switchGroup
in interfaceConnectionHandler
- Parameters:
groupId
- The group ID.
-
sudo
public Client sudo(java.lang.String username) throws ServiceException, AccessException, java.util.concurrent.ExecutionException
Returns a Client associated with the given username.All actions realized with the returned Client will be considered as his.
The user calling this function needs to have administrator rights.
- Specified by:
sudo
in interfaceClient
- Specified by:
sudo
in interfaceConnectionHandler
- 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.
-
toString
public java.lang.String toString()
Overridden to return the host name, the group ID, the username and the connection status.- Overrides:
toString
in classjava.lang.Object
- Returns:
- See above.
-
-