public class ExternalProgramExecutor extends AbstractAnalysisPlugin implements InteractivePlugin, SignalTarget
Modifier and Type | Class and Description |
---|---|
(package private) static class |
ExternalProgramExecutor.RequestWrapper |
(package private) static class |
ExternalProgramExecutor.ResponseWrapper |
Plugin.MainType
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
COMMAND_CONFIGURE_EXTERNAL_PARAMETERS |
private RequestInformation |
configureExportImportPluginParameters |
private RequestInformation |
configureExternalParameters |
private RequestInformation |
configureJob |
private RequestInformation |
configurePlugin |
private IOSupport |
exporter |
private IOSupport |
importer |
private java.util.Set<java.io.File> |
knownFiles
Files that are known to exists in the working directory.
|
static java.lang.String |
NAMESPACE_EXPORTER
The namespace for the exporter plug-in parameters.
|
static java.lang.String |
NAMESPACE_EXTERNAL
The namespace for the external program parameters.
|
static java.lang.String |
NAMESPACE_IMPORTER
The namespace for the importer plug-in parameters.
|
static java.lang.String |
PARAMETER_DEBUG_MODE
Parameter name for debug mode flag.
|
static java.lang.String |
PARAMETER_EXPORTER_CLASS
Parameter name for the class that has been selected as the exporter.
|
static java.lang.String |
PARAMETER_EXTERNAL_CMDLINE
Parameter name for the command line options to the external program.
|
static java.lang.String |
PARAMETER_EXTERNAL_PARAMETERS
Parameter name for the xml holding the parameter definitions to
the external program.
|
static java.lang.String |
PARAMETER_EXTERNAL_PATH
Parameter name for the path to the external program.
|
static java.lang.String |
PARAMETER_IMPORTER_CLASS
Parameter name for the class that has been selected as the importer.
|
static java.lang.String |
PARAMETER_NUM_CHANNELS
Parameter name for the required number of channels.
|
static java.lang.String |
PARAMETER_RAW_DATA_TYPE
Parameter name for the required raw data type.
|
static java.lang.String |
PARAMETER_SOURCE_BIOASSSAYSET
Parameter name for the source bioassay set.
|
static java.lang.String |
PARAMETER_SOURCE_TRANSFORM
Parameter name for the required intensity transform of the source bioassay set.
|
private ThreadSignalHandler |
signalHandler |
private java.io.File |
workDir
Temporary working directory at runtime.
|
CHILD_DESCRIPTION, CHILD_NAME, CONTEXT_BIOASSAYS, CONTEXT_BIOASSAYSET, CONTEXT_DERIVEDBIOASSAY, defaultGuiContexts, nameType, optionalNameType, SOURCE_BIOASSAYS, SOURCE_BIOASSAYSET, SOURCE_DERIVEDBIOASSAY, TRANSFORMATION_NAME
annotationSection, configuration, COPY_ANNOTATIONS, job, OVERWRITE_ANNOTATIONS, sc
Constructor and Description |
---|
ExternalProgramExecutor() |
Modifier and Type | Method and Description |
---|---|
private void |
addParametersWithNamespace(java.util.List<PluginParameter<?>> to,
java.util.List<PluginParameter<?>> from,
java.lang.String namespace)
Add more parameters to a list of parameters with a different
namespace.
|
void |
configure(GuiContext context,
Request request,
Response response)
Configure the plugin.
|
java.io.File |
createFile(java.lang.String name)
Create a new file in the working directory.
|
protected IOSupport |
createInstance(DbControl dc,
PluginDefinition plugin,
java.lang.String namespace,
boolean runtime)
Create and initialize a plug-in instance for the given plug-in
definition.
|
protected java.io.File |
createTemporaryWorkingDirectory()
Create a temporary working directory in the local file
system.
|
private RequestInformation |
getConfigureExportImportPluginParameters() |
private RequestInformation |
getConfigureExternalParameters() |
private RequestInformation |
getConfigureJobParameters() |
private RequestInformation |
getConfigurePluginParameters() |
BioAssaySet |
getCurrentBioAssaySet(DbControl dc)
Get the bioassay set that is used as the source for the job.
|
private java.util.List<PluginParameter<?>> |
getExernalPluginParameters(DbControl dc,
BioAssaySet source) |
protected IOSupport |
getExporter(DbControl dc,
boolean forceNew,
boolean runtime)
Get an instance of the exporter plug-in.
|
protected IOSupport |
getImporter(DbControl dc,
boolean forceNew,
boolean runtime)
Get an instance of the importer plug-in.
|
java.util.List<ParameterDefinition> |
getParameterDefinitions(boolean validate)
Get the current program parameter definitions.
|
java.util.List<ProgramParameter> |
getProgramParameters()
Get all program parameters and their values.
|
RequestInformation |
getRequestInformation(GuiContext context,
java.lang.String command)
This method will return the
RequestInformation for a given command, i.e. |
SignalHandler |
getSignalHandler()
Get the signal handler that is handling signals on behalf of this
object.
|
java.io.File |
getWorkingDirectory()
Get the current working directory were data files for the
external program are stored.
|
java.util.List<java.io.File> |
inspectWorkingDirectory()
Check the working directory for new files.
|
java.lang.String |
isInContext(GuiContext context,
java.lang.Object item)
Check that the item is a bioassayset/derived bioassay and that the
logged in user has permission to use the current item.
|
boolean |
requiresConfiguration()
Returns FALSE, since that is how the plugins used to work before this method
was introduced.
|
void |
run(Request request,
Response response,
ProgressReporter progress)
Run the plugin.
|
protected void |
runExporter(Request request,
Response response,
ProgressReporter progress)
Execute the exporter plug-in using the supplied parameters.
|
protected void |
runExternalProgram(java.lang.String program,
java.lang.String cmdLine,
java.io.File workDir,
java.lang.String stdin,
java.lang.String stdout,
ProgressReporter progress)
Run the external program.
|
protected void |
runImporter(Request request,
Response response,
ProgressReporter progress)
Execute the importer plug-in using the supplied parameters.
|
boolean |
supportsConfigurations()
Returns TRUE, since that is how the plugins used to work before this method
was introduced.
|
getChildDescriptionParameter, getChildNameParameter, getCurrentDerivedBioAssay, getCurrentExperiment, getGuiContexts, getMainType, getSourceBioAssays, getSourceBioAssaySet, getSourceBioAssaySetParameter, getSourceBioAssaysParameter, getSourceDerivedBioAssay, getSourceDerivedBioAssayParameter, getTransformationName, getTransformationNameParameter, restrictSource
cloneParameterWithDefaultValue, closeLogFile, createLogFile, done, getCopyAnnotationsParmeter, getCurrentConfiguration, getCurrentJob, getJobOrConfigurationValue, getOverwriteAnnotationsParameters, getPermissions, init, log, log, storeValue, storeValue, storeValues, validateRequestParameters
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getGuiContexts
done, getMainType, getPermissions, init
public static final java.lang.String PARAMETER_EXTERNAL_PATH
public static final java.lang.String PARAMETER_EXTERNAL_CMDLINE
public static final java.lang.String PARAMETER_EXTERNAL_PARAMETERS
public static final java.lang.String PARAMETER_IMPORTER_CLASS
public static final java.lang.String PARAMETER_EXPORTER_CLASS
public static final java.lang.String PARAMETER_DEBUG_MODE
public static final java.lang.String PARAMETER_RAW_DATA_TYPE
public static final java.lang.String PARAMETER_NUM_CHANNELS
public static final java.lang.String PARAMETER_SOURCE_TRANSFORM
Enum.name()
) stored in the plug-in
configuration.public static final java.lang.String PARAMETER_SOURCE_BIOASSSAYSET
public static final java.lang.String NAMESPACE_EXPORTER
public static final java.lang.String NAMESPACE_IMPORTER
public static final java.lang.String NAMESPACE_EXTERNAL
private static final java.lang.String COMMAND_CONFIGURE_EXTERNAL_PARAMETERS
private ThreadSignalHandler signalHandler
private RequestInformation configurePlugin
private RequestInformation configureExternalParameters
private RequestInformation configureJob
private RequestInformation configureExportImportPluginParameters
private java.io.File workDir
private java.util.Set<java.io.File> knownFiles
private IOSupport exporter
private IOSupport importer
public boolean supportsConfigurations()
AbstractPlugin
supportsConfigurations
in interface Plugin
supportsConfigurations
in class AbstractPlugin
public boolean requiresConfiguration()
AbstractPlugin
requiresConfiguration
in interface Plugin
requiresConfiguration
in class AbstractPlugin
public void run(Request request, Response response, ProgressReporter progress)
Plugin
run
in interface Plugin
request
- Request object with the command and parametersresponse
- Response object in for the plugin to response
throughprogress
- A ProgressReporter
where the plugin can report
its progess, can be nullpublic SignalHandler getSignalHandler()
SignalTarget
getSignalHandler
in interface SignalTarget
public java.lang.String isInContext(GuiContext context, java.lang.Object item)
AbstractAnalysisPlugin
isInContext
in interface InteractivePlugin
isInContext
in class AbstractAnalysisPlugin
context
- Current guicontextitem
- The item to check.public RequestInformation getRequestInformation(GuiContext context, java.lang.String command) throws BaseException
InteractivePlugin
RequestInformation
for a given command, i.e.
the list of parameters and some nice help text.getRequestInformation
in interface InteractivePlugin
context
- The current context of the client application,
it is one of the values found in set returned by InteractivePlugin.getGuiContexts()
command
- The commandRequestInformation
for the commandBaseException
- if there is an errorpublic void configure(GuiContext context, Request request, Response response)
InteractivePlugin
InteractivePlugin.getRequestInformation(GuiContext, String)
.configure
in interface InteractivePlugin
context
- The current context of the client application,
it is one of the values found in set returned by InteractivePlugin.getGuiContexts()
request
- Request object with the command and parametersresponse
- Response object in for the plugin to response
throughpublic BioAssaySet getCurrentBioAssaySet(DbControl dc)
getCurrentBioAssaySet
in class AbstractAnalysisPlugin
dc
- The DbControl to use for database accessAbstractAnalysisPlugin.getSourceBioAssaySet(DbControl)
public java.io.File getWorkingDirectory()
public java.util.List<java.io.File> inspectWorkingDirectory()
public java.util.List<ParameterDefinition> getParameterDefinitions(boolean validate)
public java.util.List<ProgramParameter> getProgramParameters()
public java.io.File createFile(java.lang.String name) throws java.io.IOException
name
- The name of the file to createjava.io.IOException
protected java.io.File createTemporaryWorkingDirectory() throws java.io.IOException
java.io.IOException
protected void runExporter(Request request, Response response, ProgressReporter progress)
protected void runImporter(Request request, Response response, ProgressReporter progress)
protected void runExternalProgram(java.lang.String program, java.lang.String cmdLine, java.io.File workDir, java.lang.String stdin, java.lang.String stdout, ProgressReporter progress)
program
- The path to the external programworkDir
- The active working directorystdin
- If given, the named file within the working directory
should be piped to the standard input of the external program.stdout
- If given, output from the external program should be
piped the named file. If not given any output from the program
needs to be read and discardedprotected IOSupport getExporter(DbControl dc, boolean forceNew, boolean runtime)
dc
- A DbControl to use for database accessforceNew
- If TRUE a new instance must always be created, otherwise
an already existing instance may be re-usedruntime
- TRUE if the importer is created at runtime, which
means that job agent configuration must be taking into accountprotected IOSupport getImporter(DbControl dc, boolean forceNew, boolean runtime)
dc
- A DbControl to use for database accessforceNew
- If TRUE a new instance must always be created, otherwise
an already existing instance may be re-usedruntime
- TRUE if the importer is created at runtime, which
means that job agent configuration must be taking into accountprotected IOSupport createInstance(DbControl dc, PluginDefinition plugin, java.lang.String namespace, boolean runtime)
plugin
- The plug-in definition we should instantiatenamespace
- The namespace, or null to not wrap the parameters
in a namespaceruntime
- TRUE if the importer is created at runtime, which
means that job agent configuration must be taking into accountprivate RequestInformation getConfigurePluginParameters()
private RequestInformation getConfigureExportImportPluginParameters()
private RequestInformation getConfigureExternalParameters()
private RequestInformation getConfigureJobParameters()
private java.util.List<PluginParameter<?>> getExernalPluginParameters(DbControl dc, BioAssaySet source)
private void addParametersWithNamespace(java.util.List<PluginParameter<?>> to, java.util.List<PluginParameter<?>> from, java.lang.String namespace)
to
- The parameters list to add the parameters tofrom
- The parameters list to copy parameters fromnamespace
- The namespace to use for the added parameter