public class Gateway
extends java.lang.Object
implements java.lang.AutoCloseable
| Modifier and Type | Field and Description | 
|---|---|
static java.lang.String | 
PROP_CONNECTOR_CLOSED
Property to indicate that a  
Connector has been closed | 
static java.lang.String | 
PROP_CONNECTOR_CREATED
Property to indicate that a  
Connector has been created | 
static java.lang.String | 
PROP_FACILITY_CLOSED
Property to indicate that a  
Facility has been closed | 
static java.lang.String | 
PROP_FACILITY_CREATED
Property to indicate that a  
Facility has been created | 
static java.lang.String | 
PROP_IMPORTSTORE_CLOSED
Property to indicate that an import store has been closed 
 | 
static java.lang.String | 
PROP_IMPORTSTORE_CREATED
Property to indicate that an import store has been created 
 | 
static java.lang.String | 
PROP_RENDERINGENGINE_CLOSED
Property to indicate that a rendering engine has been closed 
 | 
static java.lang.String | 
PROP_RENDERINGENGINE_CREATED
Property to indicate that a rendering engine has been created 
 | 
static java.lang.String | 
PROP_SESSION_CLOSED
Property to indicate that a session has been closed 
 | 
static java.lang.String | 
PROP_SESSION_CREATED
Property to indicate that a session has been created 
 | 
static java.lang.String | 
PROP_SESSION_DETACHED
Property to indicate that client got detached from a session 
 | 
static java.lang.String | 
PROP_STATEFUL_SERVICE_CLOSED
Property to indicate that a stateful service has been closed 
 | 
static java.lang.String | 
PROP_STATEFUL_SERVICE_CREATED
Property to indicate that a stateful service has been created 
 | 
static java.lang.String | 
PROP_STATELESS_SERVICE_CREATED
Property to indicate that a stateless service has been created 
 | 
| Constructor and Description | 
|---|
Gateway(omero.log.Logger log)
Creates a new Gateway instance 
 | 
Gateway(omero.log.Logger log,
       CacheService cacheService)
Deprecated. 
 
This constructor will be removed in future. Please
             use  
instead | 
Gateway(omero.log.Logger log,
       CacheService cacheService,
       java.util.concurrent.ExecutorService executorService,
       boolean executorShutdownOnDisconnect)
Deprecated. 
 
This constructor will be removed in future. Please
             use  
instead | 
Gateway(omero.log.Logger log,
       java.util.concurrent.ExecutorService executorService,
       boolean executorShutdownOnDisconnect)
Creates a new Gateway instance 
 | 
| Modifier and Type | Method and Description | 
|---|---|
void | 
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a  
PropertyChangeListener | 
java.lang.Boolean | 
canCreate(SecurityContext ctx)
Get the read-only status of the server. 
 | 
void | 
close()  | 
void | 
closeConnector(SecurityContext ctx)
Close a connector for a certain  
SecurityContext | 
void | 
closeImport(SecurityContext ctx,
           java.lang.String userName)
Close Import for a certain user 
 | 
void | 
closeService(SecurityContext ctx,
            omero.api.StatefulServiceInterfacePrx svc)
Close a service 
 | 
void | 
closeSessionOnExit(SecurityContext ctx,
                  boolean closeSession)
By default the session is closed if it was initialized
 by the gateway. 
 | 
ExperimenterData | 
connect(LoginCredentials c)
Connect to the server 
 | 
omero.api.RawPixelsStorePrx | 
createPixelsStore(SecurityContext ctx)
Create a  
RawPixelsStorePrx | 
omero.api.ThumbnailStorePrx | 
createThumbnailStore(SecurityContext ctx)
Create a  
ThumbnailStorePrx | 
void | 
disconnect()
Disconnects from the server 
 | 
omero.api.IAdminPrx | 
getAdminService(SecurityContext ctx)
Returns the  
IAdminPrx service. | 
omero.api.IAdminPrx | 
getAdminService(SecurityContext ctx,
               boolean secure)
Returns the  
IAdminPrx service. | 
CacheService | 
getCacheService()
Deprecated. 
 
This method will be removed in future. 
 | 
omero.api.IConfigPrx | 
getConfigService(SecurityContext ctx)
Returns the  
IConfigPrx service. | 
omero.gateway.Connector | 
getConnector(SecurityContext ctx)
Get a connector for a certain  
SecurityContext | 
omero.gateway.Connector | 
getConnector(SecurityContext ctx,
            boolean recreate,
            boolean permitNull)
Returns the connector corresponding to the passed context. 
 | 
omero.api.ExporterPrx | 
getExporterService(SecurityContext ctx)
Returns the  
ExporterPrx service. | 
<T extends Facility> | 
getFacility(java.lang.Class<T> type)
Get a  
Facility to perform further operations with the server | 
ome.formats.OMEROMetadataStoreClient | 
getImportStore(SecurityContext ctx)
Creates or recycles the import store. 
 | 
ome.formats.OMEROMetadataStoreClient | 
getImportStore(SecurityContext ctx,
              java.lang.String userName)
Creates or recycles the import store. 
 | 
ExperimenterData | 
getLoggedInUser()
Get the currently logged in user 
 | 
omero.log.Logger | 
getLogger()
Provides access to the  
Logger | 
omero.api.IMetadataPrx | 
getMetadataService(SecurityContext ctx)
Returns the  
IMetadataPrx service. | 
omero.api.IPixelsPrx | 
getPixelsService(SecurityContext ctx)
Returns the  
IPixelsPrx service. | 
omero.api.RawPixelsStorePrx | 
getPixelsStore(SecurityContext ctx)
Returns the  
RawPixelsStorePrx service. | 
omero.api.IContainerPrx | 
getPojosService(SecurityContext ctx)
Returns the  
IContainerPrx service. | 
omero.api.IProjectionPrx | 
getProjectionService(SecurityContext ctx)
Returns the  
IProjectionPrx service. | 
java.beans.PropertyChangeListener[] | 
getPropertyChangeListeners()
Get the  
PropertyChangeListeners | 
omero.api.IQueryPrx | 
getQueryService(SecurityContext ctx)
Returns the  
IQueryPrx service. | 
omero.api.RawFileStorePrx | 
getRawFileService(SecurityContext ctx)
Returns the  
RawFileStorePrx service. | 
java.util.Map<SecurityContext,java.util.Set<java.lang.Long>> | 
getRenderingEngines()
Returns the rendering engines to re-activate. 
 | 
omero.api.RenderingEnginePrx | 
getRenderingService(SecurityContext ctx,
                   long pixelsID)
Returns the  
Rendering service. | 
omero.api.IRenderingSettingsPrx | 
getRenderingSettingsService(SecurityContext ctx)
Returns the  
IRenderingSettingsPrx service. | 
omero.api.IRepositoryInfoPrx | 
getRepositoryService(SecurityContext ctx)
Returns the  
IRepositoryInfoPrx service. | 
omero.api.IRoiPrx | 
getROIService(SecurityContext ctx)
Returns the  
IRoiPrx service. | 
omero.api.IScriptPrx | 
getScriptService(SecurityContext ctx)
Returns the  
IScriptPrx service. | 
omero.api.SearchPrx | 
getSearchService(SecurityContext ctx)
Returns the  
SearchPrx service. | 
java.lang.String | 
getServerHost()
Get the hostname of the server the Gateway is connected to 
 | 
java.lang.String | 
getServerVersion()
Get the version of the server the Gateway is connected to 
 | 
java.lang.String | 
getSessionId(ExperimenterData user)
Get the ID of the current session 
 | 
omero.grid.SharedResourcesPrx | 
getSharedResources(SecurityContext ctx)
Returns the  
SharedResourcesPrx service. | 
omero.api.ThumbnailStorePrx | 
getThumbnailService(SecurityContext ctx)
Returns the  
ThumbnailStorePrx service. | 
omero.api.ITypesPrx | 
getTypesService(SecurityContext ctx)
Returns the  
ITypesPrx service. | 
omero.api.IUpdatePrx | 
getUpdateService(SecurityContext ctx)
Returns the  
IUpdatePrx service. | 
omero.api.IUpdatePrx | 
getUpdateService(SecurityContext ctx,
                java.lang.String userName)
Returns the  
IUpdatePrx service. | 
ExperimenterData | 
getUserDetails(SecurityContext ctx,
              java.lang.String name)
Get the user details of a certain user 
 | 
boolean | 
isAlive(SecurityContext ctx)
Checks if there is a  
Connector for a particular
 SecurityContext | 
boolean | 
isConnected()
Check if the Gateway is still connected to the server 
 | 
boolean | 
isNetworkUp(boolean useCachedValue)
Checks if the network interface is up. 
 | 
void | 
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes a  
PropertyChangeListener | 
omero.grid.ProcessCallbackI | 
runScript(SecurityContext ctx,
         long scriptID,
         java.util.Map<java.lang.String,omero.RType> parameters)
Run a script on the server 
 | 
void | 
shutDownDerivedConnector(SecurityContext ctx)
Shuts down the connectors created while creating/importing data for other
 users. 
 | 
void | 
shutdownRenderingEngine(SecurityContext ctx,
                       long pixelsID)
Shuts down the rendering engine 
 | 
<T> java.util.concurrent.Future<T> | 
submit(java.util.concurrent.Callable<T> task)
Submits an async task 
 | 
omero.cmd.CmdCallbackI | 
submit(SecurityContext ctx,
      java.util.List<omero.cmd.Request> commands,
      SecurityContext target)
Executes the commands. 
 | 
omero.cmd.CmdCallbackI | 
submit(SecurityContext ctx,
      omero.cmd.Request cmd)
Directly submit a  
Request to the server | 
public static final java.lang.String PROP_CONNECTOR_CREATED
Connector has been createdpublic static final java.lang.String PROP_CONNECTOR_CLOSED
Connector has been closedpublic static final java.lang.String PROP_SESSION_CREATED
public static final java.lang.String PROP_SESSION_CLOSED
public static final java.lang.String PROP_SESSION_DETACHED
public static final java.lang.String PROP_FACILITY_CREATED
Facility has been createdpublic static final java.lang.String PROP_FACILITY_CLOSED
Facility has been closedpublic static final java.lang.String PROP_IMPORTSTORE_CREATED
public static final java.lang.String PROP_IMPORTSTORE_CLOSED
public static final java.lang.String PROP_RENDERINGENGINE_CREATED
public static final java.lang.String PROP_RENDERINGENGINE_CLOSED
public static final java.lang.String PROP_STATEFUL_SERVICE_CREATED
public static final java.lang.String PROP_STATEFUL_SERVICE_CLOSED
public static final java.lang.String PROP_STATELESS_SERVICE_CREATED
public Gateway(omero.log.Logger log)
log - A Logger@Deprecated
public Gateway(omero.log.Logger log,
                           CacheService cacheService)
insteadlog - A LoggercacheService - A CacheService, can be null@Deprecated
public Gateway(omero.log.Logger log,
                           CacheService cacheService,
                           java.util.concurrent.ExecutorService executorService,
                           boolean executorShutdownOnDisconnect)
insteadlog - A LoggercacheService - A CacheService, can be nullexecutorService - A ExecutorService for handling asynchronous tasks, can
            be null (in which case the Java built-in cached
            thread pool will be used)executorShutdownOnDisconnect - Flag to indicate that executor threads should be shutdown on
            disconnect (only taken into account if an
            ExecutorService was provided; the default cached
            thread pool will be shut down by default)public Gateway(omero.log.Logger log,
               java.util.concurrent.ExecutorService executorService,
               boolean executorShutdownOnDisconnect)
log - A LoggerexecutorService - A ExecutorService for handling asynchronous tasks, can
            be null (in which case the Java built-in cached
            thread pool will be used)executorShutdownOnDisconnect - Flag to indicate that executor threads should be shutdown on
            disconnect (only taken into account if an
            ExecutorService was provided; the default cached
            thread pool will be shut down by default)public <T> java.util.concurrent.Future<T> submit(java.util.concurrent.Callable<T> task)
task - The taskpublic ExperimenterData connect(LoginCredentials c) throws DSOutOfServiceException
c - The LoginCredentialsExperimenterData who is logged inDSOutOfServiceException - If the connection can't be establishedpublic ExperimenterData getLoggedInUser()
public void disconnect()
public boolean isConnected()
public java.lang.String getSessionId(ExperimenterData user) throws DSOutOfServiceException
user - The user to get the session ID forDSOutOfServiceException - If the connection is broken, or not logged inpublic java.lang.String getServerVersion()
                                  throws DSOutOfServiceException
DSOutOfServiceException - If the connection is broken, or not logged inpublic java.lang.String getServerHost()
                               throws DSOutOfServiceException
DSOutOfServiceException - If the connection is broken, or not logged inpublic <T extends Facility> T getFacility(java.lang.Class<T> type) throws java.util.concurrent.ExecutionException
Facility to perform further operations with the serverpublic void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
PropertyChangeListenerlistener - The listenerpublic void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
PropertyChangeListenerlistener - The listenerpublic java.beans.PropertyChangeListener[] getPropertyChangeListeners()
PropertyChangeListenerspublic omero.cmd.CmdCallbackI submit(SecurityContext ctx, java.util.List<omero.cmd.Request> commands, SecurityContext target) throws java.lang.Throwable
ctx - The SecurityContextcommands - The commands to execute.target - The target context is any.java.lang.Throwable - If an error occurredpublic omero.cmd.CmdCallbackI submit(SecurityContext ctx, omero.cmd.Request cmd) throws java.lang.Throwable
Request to the serverctx - The SecurityContextcmd - The Request to submitCmdCallbackIjava.lang.Throwable - If an error occurredpublic void closeImport(SecurityContext ctx, java.lang.String userName)
ctx - The SecurityContextuserName - The name of the user which import should be closedpublic omero.grid.ProcessCallbackI runScript(SecurityContext ctx, long scriptID, java.util.Map<java.lang.String,omero.RType> parameters) throws DSOutOfServiceException, omero.ServerError
ctx - The SecurityContextscriptID - The ID of the scriptparameters - Parameters for the scriptProcessCallbackIDSOutOfServiceException - If the connection is broken, or not logged inomero.ServerError - If an error in the script execution occurredpublic omero.log.Logger getLogger()
Logger@Deprecated public CacheService getCacheService()
CacheServicepublic omero.grid.SharedResourcesPrx getSharedResources(SecurityContext ctx) throws DSOutOfServiceException
SharedResourcesPrx service.ctx - The SecurityContextDSOutOfServiceException - Thrown if the service cannot be initialized.public omero.api.IRenderingSettingsPrx getRenderingSettingsService(SecurityContext ctx) throws DSOutOfServiceException
IRenderingSettingsPrx service.ctx - The SecurityContextDSOutOfServiceException - Thrown if the service cannot be initialized.public omero.api.IRepositoryInfoPrx getRepositoryService(SecurityContext ctx) throws DSOutOfServiceException
IRepositoryInfoPrx service.ctx - The SecurityContextDSOutOfServiceException - Thrown if the service cannot be initialized.public omero.api.IScriptPrx getScriptService(SecurityContext ctx) throws DSOutOfServiceException
IScriptPrx service.ctx - The SecurityContextDSOutOfServiceException - Thrown if the service cannot be initialized.public omero.api.IContainerPrx getPojosService(SecurityContext ctx) throws DSOutOfServiceException
IContainerPrx service.ctx - The SecurityContextDSOutOfServiceException - Thrown if the service cannot be initialized.public omero.api.IQueryPrx getQueryService(SecurityContext ctx) throws DSOutOfServiceException
IQueryPrx service.ctx - The SecurityContextDSOutOfServiceException - Thrown if the service cannot be initialized.public omero.api.IUpdatePrx getUpdateService(SecurityContext ctx) throws DSOutOfServiceException
IUpdatePrx service.ctx - The SecurityContextDSOutOfServiceException - Thrown if the service cannot be initialized.public omero.api.IUpdatePrx getUpdateService(SecurityContext ctx, java.lang.String userName) throws DSOutOfServiceException
IUpdatePrx service.ctx - The SecurityContextuserName - The usernameDSOutOfServiceException - Thrown if the service cannot be initialized.public omero.api.IMetadataPrx getMetadataService(SecurityContext ctx) throws DSOutOfServiceException
IMetadataPrx service.ctx - The SecurityContextDSOutOfServiceException - Thrown if the service cannot be initialized.public omero.api.IRoiPrx getROIService(SecurityContext ctx) throws DSOutOfServiceException
IRoiPrx service.ctx - The SecurityContextDSOutOfServiceException - Thrown if the service cannot be initialized.public omero.api.IConfigPrx getConfigService(SecurityContext ctx) throws DSOutOfServiceException
IConfigPrx service.ctx - The SecurityContextDSOutOfServiceException - Thrown if the service cannot be initialized.public omero.api.ThumbnailStorePrx getThumbnailService(SecurityContext ctx) throws DSOutOfServiceException
ThumbnailStorePrx service.ctx - The SecurityContextDSOutOfServiceException - Thrown if the service cannot be initialized.public omero.api.ExporterPrx getExporterService(SecurityContext ctx) throws DSOutOfServiceException
ExporterPrx service.ctx - The SecurityContextDSOutOfServiceException - Thrown if the service cannot be initialized.public omero.api.RawFileStorePrx getRawFileService(SecurityContext ctx) throws DSOutOfServiceException
RawFileStorePrx service.ctx - The SecurityContextDSOutOfServiceException - Thrown if the service cannot be initialized.public omero.api.RawPixelsStorePrx getPixelsStore(SecurityContext ctx) throws DSOutOfServiceException
RawPixelsStorePrx service.ctx - The SecurityContextDSOutOfServiceException - Thrown if the service cannot be initialized.public omero.api.IPixelsPrx getPixelsService(SecurityContext ctx) throws DSOutOfServiceException
IPixelsPrx service.ctx - The SecurityContextDSOutOfServiceException - Thrown if the service cannot be initialized.public omero.api.SearchPrx getSearchService(SecurityContext ctx) throws DSOutOfServiceException
SearchPrx service.ctx - The SecurityContextDSOutOfServiceException - Thrown if the service cannot be initialized.public omero.api.IProjectionPrx getProjectionService(SecurityContext ctx) throws DSOutOfServiceException
IProjectionPrx service.ctx - The SecurityContextDSOutOfServiceException - Thrown if the service cannot be initialized.public omero.api.IAdminPrx getAdminService(SecurityContext ctx) throws DSOutOfServiceException
IAdminPrx service.ctx - The SecurityContextDSOutOfServiceException - Thrown if the service cannot be initialized.public omero.api.IAdminPrx getAdminService(SecurityContext ctx, boolean secure) throws DSOutOfServiceException
IAdminPrx service.ctx - The SecurityContextsecure - Pass true to have a secure admin service,
            false otherwise.DSOutOfServiceException - Thrown if the service cannot be initialized.public ome.formats.OMEROMetadataStoreClient getImportStore(SecurityContext ctx) throws DSOutOfServiceException
ctx - The SecurityContextDSOutOfServiceException - Thrown if the service cannot be initialized.public ome.formats.OMEROMetadataStoreClient getImportStore(SecurityContext ctx, java.lang.String userName) throws DSOutOfServiceException
ctx - The SecurityContextuserName - The usernameDSOutOfServiceException - Thrown if the service cannot be initialized.public omero.api.RenderingEnginePrx getRenderingService(SecurityContext ctx, long pixelsID) throws DSOutOfServiceException, omero.ServerError
Rendering service.ctx - The SecurityContextpixelsID - The pixels IDDSOutOfServiceException - Thrown if the service cannot be initialized.omero.ServerError - Thrown if the service cannot be initialized.public ExperimenterData getUserDetails(SecurityContext ctx, java.lang.String name) throws DSOutOfServiceException
ctx - The SecurityContextname - The name of the userDSOutOfServiceException - If the connection is broken, or not logged inpublic boolean isNetworkUp(boolean useCachedValue)
useCachedValue - Uses the result of the last check instead of really performing
            the test if the last check is not older than 5 secpublic omero.gateway.Connector getConnector(SecurityContext ctx) throws DSOutOfServiceException
SecurityContextctx - The SecurityContextDSOutOfServiceException - If the connection is broken, or not logged inpublic void closeConnector(SecurityContext ctx)
SecurityContextctx - The SecurityContextpublic void closeSessionOnExit(SecurityContext ctx, boolean closeSession)
connect().closeSession - Pass false to not close
                     the session on disconnectpublic void closeService(SecurityContext ctx, omero.api.StatefulServiceInterfacePrx svc)
ctx - The SecurityContextsvc - The service to closepublic omero.api.RawPixelsStorePrx createPixelsStore(SecurityContext ctx) throws DSOutOfServiceException
RawPixelsStorePrxctx - The SecurityContextDSOutOfServiceException - If the connection is broken, or not logged inpublic omero.api.ThumbnailStorePrx createThumbnailStore(SecurityContext ctx) throws DSOutOfServiceException
ThumbnailStorePrxctx - The SecurityContextDSOutOfServiceException - If the connection is broken, or not logged inpublic boolean isAlive(SecurityContext ctx) throws DSOutOfServiceException
Connector for a particular
 SecurityContextctx - The SecurityContexttrue if there is one, false otherwiseDSOutOfServiceException - If the connection is broken, or not logged inpublic omero.gateway.Connector getConnector(SecurityContext ctx, boolean recreate, boolean permitNull) throws DSOutOfServiceException
ctx - The security context.recreate - whether or not to allow the recreation of the
            Connector. A DSOutOfServiceException is thrown
            if this is set to false and no Connector is available.permitNull - whether or not to throw a DSOutOfServiceException if
            no Connector is available by the end of the execution.DSOutOfServiceException - If the connection is broken, or not logged inpublic void shutDownDerivedConnector(SecurityContext ctx) throws DSOutOfServiceException
ctx - The SecurityContextDSOutOfServiceException - If the connection is broken, or not logged inpublic java.util.Map<SecurityContext,java.util.Set<java.lang.Long>> getRenderingEngines()
public void shutdownRenderingEngine(SecurityContext ctx, long pixelsID)
ctx - The SecurityContextpixelsID - The pixels idpublic omero.api.ITypesPrx getTypesService(SecurityContext ctx) throws DSOutOfServiceException
ITypesPrx service.ctx - The SecurityContextDSOutOfServiceException - Thrown if the service cannot be initialized.public java.lang.Boolean canCreate(SecurityContext ctx) throws DSOutOfServiceException
ctx - the SecurityContext to use for the querytrue if the server is wholly in read-write mode,
         false if the server is wholly in read-only mode,
         otherwise nullDSOutOfServiceException - if the status query failedpublic void close()
           throws java.lang.Exception
close in interface java.lang.AutoCloseablejava.lang.Exception