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_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(Logger log)
Creates a new Gateway instance
|
Gateway(Logger log,
CacheService cacheService)
Creates a new Gateway instance
|
Gateway(Logger log,
CacheService cacheService,
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
|
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()
Provides access to the
CacheService |
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 |
OMEROMetadataStoreClient |
getImportStore(SecurityContext ctx)
Creates or recycles the import store.
|
OMEROMetadataStoreClient |
getImportStore(SecurityContext ctx,
java.lang.String userName)
Creates or recycles the import store.
|
ExperimenterData |
getLoggedInUser()
Get the currently logged in user
|
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
PropertyChangeListener s |
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 |
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.
|
boolean |
joinSession()
Tries to rejoin the session.
|
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes a
PropertyChangeListener |
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
|
CmdCallbackI |
submit(SecurityContext ctx,
java.util.List<omero.cmd.Request> commands,
SecurityContext target)
Executes the commands.
|
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_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(Logger log, CacheService cacheService)
log
- A Logger
cacheService
- A CacheService
, can be null
public Gateway(Logger log, CacheService cacheService, java.util.concurrent.ExecutorService executorService, boolean executorShutdownOnDisconnect)
log
- A Logger
cacheService
- A CacheService
, can be null
executorService
- 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 LoginCredentials
ExperimenterData
who is logged inDSOutOfServiceException
- If the connection can't be establishedpublic ExperimenterData getLoggedInUser()
public void disconnect()
public boolean joinSession()
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 <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)
PropertyChangeListener
listener
- The listenerpublic void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
PropertyChangeListener
listener
- The listenerpublic java.beans.PropertyChangeListener[] getPropertyChangeListeners()
PropertyChangeListener
spublic CmdCallbackI submit(SecurityContext ctx, java.util.List<omero.cmd.Request> commands, SecurityContext target) throws java.lang.Throwable
ctx
- The SecurityContext
commands
- The commands to execute.target
- The target context is any.java.lang.Throwable
- If an error occurredpublic CmdCallbackI submit(SecurityContext ctx, omero.cmd.Request cmd) throws java.lang.Throwable
Request
to the serverctx
- The SecurityContext
cmd
- The Request
to submitCmdCallbackI
java.lang.Throwable
- If an error occurredpublic void closeImport(SecurityContext ctx, java.lang.String userName)
ctx
- The SecurityContext
userName
- The name of the user which import should be closedpublic ProcessCallbackI runScript(SecurityContext ctx, long scriptID, java.util.Map<java.lang.String,omero.RType> parameters) throws DSOutOfServiceException, omero.ServerError
ctx
- The SecurityContext
scriptID
- The ID of the scriptparameters
- Parameters for the scriptProcessCallbackI
DSOutOfServiceException
- If the connection is broken, or not logged inomero.ServerError
- If an error in the script execution occurredpublic CacheService getCacheService()
CacheService
public omero.grid.SharedResourcesPrx getSharedResources(SecurityContext ctx) throws DSOutOfServiceException
SharedResourcesPrx
service.ctx
- The SecurityContext
DSOutOfServiceException
- Thrown if the service cannot be initialized.public omero.api.IRenderingSettingsPrx getRenderingSettingsService(SecurityContext ctx) throws DSOutOfServiceException
IRenderingSettingsPrx
service.ctx
- The SecurityContext
DSOutOfServiceException
- Thrown if the service cannot be initialized.public omero.api.IRepositoryInfoPrx getRepositoryService(SecurityContext ctx) throws DSOutOfServiceException
IRepositoryInfoPrx
service.ctx
- The SecurityContext
DSOutOfServiceException
- Thrown if the service cannot be initialized.public omero.api.IScriptPrx getScriptService(SecurityContext ctx) throws DSOutOfServiceException
IScriptPrx
service.ctx
- The SecurityContext
DSOutOfServiceException
- Thrown if the service cannot be initialized.public omero.api.IContainerPrx getPojosService(SecurityContext ctx) throws DSOutOfServiceException
IContainerPrx
service.ctx
- The SecurityContext
DSOutOfServiceException
- Thrown if the service cannot be initialized.public omero.api.IQueryPrx getQueryService(SecurityContext ctx) throws DSOutOfServiceException
IQueryPrx
service.ctx
- The SecurityContext
DSOutOfServiceException
- Thrown if the service cannot be initialized.public omero.api.IUpdatePrx getUpdateService(SecurityContext ctx) throws DSOutOfServiceException
IUpdatePrx
service.ctx
- The SecurityContext
DSOutOfServiceException
- Thrown if the service cannot be initialized.public omero.api.IUpdatePrx getUpdateService(SecurityContext ctx, java.lang.String userName) throws DSOutOfServiceException
IUpdatePrx
service.ctx
- The SecurityContext
userName
- The usernameDSOutOfServiceException
- Thrown if the service cannot be initialized.public omero.api.IMetadataPrx getMetadataService(SecurityContext ctx) throws DSOutOfServiceException
IMetadataPrx
service.ctx
- The SecurityContext
DSOutOfServiceException
- Thrown if the service cannot be initialized.public omero.api.IRoiPrx getROIService(SecurityContext ctx) throws DSOutOfServiceException
IRoiPrx
service.ctx
- The SecurityContext
DSOutOfServiceException
- Thrown if the service cannot be initialized.public omero.api.IConfigPrx getConfigService(SecurityContext ctx) throws DSOutOfServiceException
IConfigPrx
service.ctx
- The SecurityContext
DSOutOfServiceException
- Thrown if the service cannot be initialized.public omero.api.ThumbnailStorePrx getThumbnailService(SecurityContext ctx) throws DSOutOfServiceException
ThumbnailStorePrx
service.ctx
- The SecurityContext
DSOutOfServiceException
- Thrown if the service cannot be initialized.public omero.api.ExporterPrx getExporterService(SecurityContext ctx) throws DSOutOfServiceException
ExporterPrx
service.ctx
- The SecurityContext
DSOutOfServiceException
- Thrown if the service cannot be initialized.public omero.api.RawFileStorePrx getRawFileService(SecurityContext ctx) throws DSOutOfServiceException
RawFileStorePrx
service.ctx
- The SecurityContext
DSOutOfServiceException
- Thrown if the service cannot be initialized.public omero.api.RawPixelsStorePrx getPixelsStore(SecurityContext ctx) throws DSOutOfServiceException
RawPixelsStorePrx
service.ctx
- The SecurityContext
DSOutOfServiceException
- Thrown if the service cannot be initialized.public omero.api.IPixelsPrx getPixelsService(SecurityContext ctx) throws DSOutOfServiceException
IPixelsPrx
service.ctx
- The SecurityContext
DSOutOfServiceException
- Thrown if the service cannot be initialized.public omero.api.SearchPrx getSearchService(SecurityContext ctx) throws DSOutOfServiceException
SearchPrx
service.ctx
- The SecurityContext
DSOutOfServiceException
- Thrown if the service cannot be initialized.public omero.api.IProjectionPrx getProjectionService(SecurityContext ctx) throws DSOutOfServiceException
IProjectionPrx
service.ctx
- The SecurityContext
DSOutOfServiceException
- Thrown if the service cannot be initialized.public omero.api.IAdminPrx getAdminService(SecurityContext ctx) throws DSOutOfServiceException
IAdminPrx
service.ctx
- The SecurityContext
DSOutOfServiceException
- Thrown if the service cannot be initialized.public omero.api.IAdminPrx getAdminService(SecurityContext ctx, boolean secure) throws DSOutOfServiceException
IAdminPrx
service.ctx
- The SecurityContext
secure
- Pass true
to have a secure admin service,
false
otherwise.DSOutOfServiceException
- Thrown if the service cannot be initialized.public OMEROMetadataStoreClient getImportStore(SecurityContext ctx) throws DSOutOfServiceException
ctx
- The SecurityContext
DSOutOfServiceException
- Thrown if the service cannot be initialized.public OMEROMetadataStoreClient getImportStore(SecurityContext ctx, java.lang.String userName) throws DSOutOfServiceException
ctx
- The SecurityContext
userName
- 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 SecurityContext
pixelsID
- 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 SecurityContext
name
- 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
SecurityContext
ctx
- The SecurityContext
DSOutOfServiceException
- If the connection is broken, or not logged inpublic void closeConnector(SecurityContext ctx)
SecurityContext
ctx
- The SecurityContext
public void closeService(SecurityContext ctx, omero.api.StatefulServiceInterfacePrx svc)
ctx
- The SecurityContext
svc
- The service to closepublic omero.api.RawPixelsStorePrx createPixelsStore(SecurityContext ctx) throws DSOutOfServiceException
RawPixelsStorePrx
ctx
- The SecurityContext
DSOutOfServiceException
- If the connection is broken, or not logged inpublic omero.api.ThumbnailStorePrx createThumbnailStore(SecurityContext ctx) throws DSOutOfServiceException
ThumbnailStorePrx
ctx
- The SecurityContext
DSOutOfServiceException
- If the connection is broken, or not logged inpublic boolean isAlive(SecurityContext ctx) throws DSOutOfServiceException
Connector
for a particular
SecurityContext
ctx
- The SecurityContext
true
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 SecurityContext
DSOutOfServiceException
- 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 SecurityContext
pixelsID
- The pixels idpublic omero.api.ITypesPrx getTypesService(SecurityContext ctx) throws DSOutOfServiceException
ITypesPrx
service.ctx
- The SecurityContext
DSOutOfServiceException
- 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 null
DSOutOfServiceException
- if the status query failedpublic void close() throws java.lang.Exception
close
in interface java.lang.AutoCloseable
java.lang.Exception
Version: 5.4.10-ice35-b105
Copyright © 2019 The University of Dundee & Open Microscopy Environment. All Rights Reserved.