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.protectedGatewayWrapper(Gateway gateway, SecurityContext ctx, Experimenter user)Constructor of the GatewayWrapper class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidconnect(LoginCredentials credentials)Connects the user to OMERO.voiddisconnect()Disconnects the userSecurityContextgetCtx()Contains the permissions of the user in the group.GatewaygetGateway()Returns the Gateway.ExperimentergetUser()Returns the current user.Clientsudo(java.lang.String username)Returns a Client associated with the given username.voidswitchGroup(long groupId)Change the current group used by the current user;java.lang.StringtoString()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:
getGatewayin interfaceConnectionHandler- Returns:
- The Gateway.
-
getUser
public Experimenter getUser()
Returns the current user.- Specified by:
getUserin interfaceConnectionHandler- Returns:
- The current user.
-
getCtx
public SecurityContext getCtx()
Contains the permissions of the user in the group.- Specified by:
getCtxin interfaceAdminManager- Specified by:
getCtxin interfaceBrowser- Specified by:
getCtxin interfaceConnectionHandler- Specified by:
getCtxin interfaceDataManager- Returns:
- the
SecurityContextof the user.
-
connect
public void connect(LoginCredentials credentials) throws ServiceException
Connects the user to OMERO. Gets the SecurityContext and the BrowseFacility.- Specified by:
connectin interfaceConnectionHandler- Parameters:
credentials- User credentials.- Throws:
ServiceException- Cannot connect to OMERO.
-
disconnect
public void disconnect()
Disconnects the user- Specified by:
disconnectin interfaceConnectionHandler
-
switchGroup
public void switchGroup(long groupId)
Change the current group used by the current user;- Specified by:
switchGroupin 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:
sudoin interfaceClient- Specified by:
sudoin 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:
toStringin classjava.lang.Object- Returns:
- See above.
-
-