Package fr.igred.omero
Class GatewayWrapper
java.lang.Object
fr.igred.omero.GatewayWrapper
- Direct Known Subclasses:
Browser
Basic class, contains the gateway, the security context, and multiple facilities.
Allows the user to connect to OMERO and browse through all the data accessible to the user.
-
Constructor Summary
ModifierConstructorDescriptionprotected
GatewayWrapper
(Gateway gateway, SecurityContext ctx, ExperimenterWrapper user) Abstract constructor of the GatewayWrapper class. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Closes the import store.void
Connects to OMERO using a session ID.void
Connects the user to OMERO.void
Connects the user to OMERO.void
connect
(LoginCredentials cred) Connects the user to OMERO.void
deleteFile
(Long id) Deletes a file from OMEROvoid
deleteFiles
(Long... ids) Deletes files from OMERO.void
Disconnects the userfindByQuery
(String query) Finds objects on OMERO through a database query.Gets theAdminFacility
to use admin specific function.Gets theBrowseFacility
used to access the data from OMERO.getCtx()
Contains the permissions of the user in the group.long
Gets the current group ID.getDm()
Gets theDataManagerFacility
to handle/write data on OMERO.Returns the Gateway.long
getId()
Gets the user id.Creates or recycles the import store.Gets theMetadataFacility
used to retrieve annotations from OMERO.omero.api.IQueryPrx
Returns theIQueryPrx
used to find objects on OMERO.Gets theROIFacility
used to manipulate ROIs from OMERO.Get the ID of the current sessionGets theTablesFacility
used to manipulate tables on OMERO.getUser()
Returns the current user.boolean
Check if the client is still connected to the serverSaves an object on OMERO.void
switchGroup
(long groupId) Change the current group used by the current user;toString()
Overridden to return the host name, the group ID, the username and the connection status.
-
Constructor Details
-
GatewayWrapper
Abstract constructor of the GatewayWrapper class.Null arguments will be replaced with default empty objects.
- Parameters:
gateway
- The Gateway.ctx
- The Security Context.user
- The connected user.
-
-
Method Details
-
getGateway
Returns the Gateway.- Returns:
- The Gateway.
-
getUser
Returns the current user.- Returns:
- The current user.
-
getCtx
Contains the permissions of the user in the group.- Returns:
- the
SecurityContext
of the user.
-
getId
public long getId()Gets the user id.- Returns:
- The user ID.
-
getCurrentGroupId
public long getCurrentGroupId()Gets the current group ID.- Returns:
- The group ID.
-
getSessionId
Get the ID of the current session- Returns:
- See above
- Throws:
ServiceException
- If the connection is broken, or not logged in
-
isConnected
public boolean isConnected()Check if the client is still connected to the server- Returns:
- See above.
-
connect
Connects 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
public void connect(String hostname, int port, String username, char[] password, Long groupID) throws ServiceException Connects 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
public void connect(String hostname, int port, String username, char[] password) throws ServiceException Connects 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
Connects the user to OMERO. Gets the SecurityContext and the BrowseFacility.- Parameters:
cred
- User credential.- Throws:
ServiceException
- Cannot connect to OMERO.
-
disconnect
public void disconnect()Disconnects the user -
switchGroup
public void switchGroup(long groupId) Change the current group used by the current user;- Parameters:
groupId
- The group ID.
-
getBrowseFacility
Gets theBrowseFacility
used to access the data from OMERO.- Returns:
- See above.
- Throws:
ExecutionException
- A Facility can't be retrieved or instantiated.
-
getQueryService
Returns theIQueryPrx
used to find objects on OMERO.- Returns:
- See above.
- Throws:
ServiceException
- Cannot connect to OMERO.
-
getMetadata
Gets theMetadataFacility
used to retrieve annotations from OMERO.- Returns:
- See above.
- Throws:
ExecutionException
- If the MetadataFacility can't be retrieved or instantiated.
-
getDm
Gets theDataManagerFacility
to handle/write data on OMERO. A- Returns:
- See above.
- Throws:
ExecutionException
- If the DataManagerFacility can't be retrieved or instantiated.
-
getRoiFacility
Gets theROIFacility
used to manipulate ROIs from OMERO.- Returns:
- See above.
- Throws:
ExecutionException
- If the ROIFacility can't be retrieved or instantiated.
-
getTablesFacility
Gets theTablesFacility
used to manipulate tables on OMERO.- Returns:
- See above.
- Throws:
ExecutionException
- If the TablesFacility can't be retrieved or instantiated.
-
getAdminFacility
Gets theAdminFacility
to use admin specific function.- Returns:
- See above.
- Throws:
ExecutionException
- If the AdminFacility can't be retrieved or instantiated.
-
getImportStore
Creates or recycles the import store.- Returns:
- See above.
- Throws:
ServiceException
- Cannot connect to OMERO.
-
closeImport
public void closeImport()Closes the import store. -
findByQuery
Finds objects on OMERO through a database query.- Parameters:
query
- The database query.- Returns:
- A list of OMERO objects.
- Throws:
ServiceException
- Cannot connect to OMERO.OMEROServerError
- Server error.
-
save
Saves an object on OMERO.- Parameters:
object
- The OMERO object.- Returns:
- The saved OMERO object
- Throws:
ServiceException
- Cannot connect to OMERO.AccessException
- Cannot access data.ExecutionException
- A Facility can't be retrieved or instantiated.
-
deleteFile
public void deleteFile(Long id) throws ServiceException, AccessException, ExecutionException, OMEROServerError, InterruptedException Deletes a file from OMERO- Parameters:
id
- ID of the file to delete.- Throws:
ServiceException
- Cannot connect to OMERO.AccessException
- Cannot access data.ExecutionException
- A Facility can't be retrieved or instantiated.OMEROServerError
- Server error.InterruptedException
- If block(long) does not return.
-
deleteFiles
public void deleteFiles(Long... ids) throws ServiceException, AccessException, ExecutionException, OMEROServerError, InterruptedException Deletes files from OMERO.- Parameters:
ids
- List of files IDs to delete.- Throws:
ServiceException
- Cannot connect to OMERO.AccessException
- Cannot access data.ExecutionException
- A Facility can't be retrieved or instantiated.OMEROServerError
- Server error.InterruptedException
- If block(long) does not return.
-
toString
Overridden to return the host name, the group ID, the username and the connection status.
-