|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.basedb.core.plugin.AbstractPlugin net.sf.basedb.core.plugin.AbstractAnalysisPlugin net.sf.basedb.plugins.executor.ExternalProgramExecutor
public class ExternalProgramExecutor
Nested Class Summary | |
---|---|
(package private) static class |
ExternalProgramExecutor.RequestWrapper
|
(package private) static class |
ExternalProgramExecutor.ResponseWrapper
|
Nested classes/interfaces inherited from interface net.sf.basedb.core.plugin.Plugin |
---|
Plugin.MainType |
Field Summary | |
---|---|
private static About |
about
|
private static String |
COMMAND_CONFIGURE_EXTERNAL_PARAMETERS
|
private RequestInformation |
configureExportImportPluginParameters
|
private RequestInformation |
configureExternalParameters
|
private RequestInformation |
configureJob
|
private RequestInformation |
configurePlugin
|
private IOSupport |
exporter
|
private IOSupport |
importer
|
private Set<File> |
knownFiles
Files that are known to exists in the working directory. |
static String |
NAMESPACE_EXPORTER
The namespace for the exporter plug-in parameters. |
static String |
NAMESPACE_EXTERNAL
The namespace for the external program parameters. |
static String |
NAMESPACE_IMPORTER
The namespace for the importer plug-in parameters. |
static String |
PARAMETER_DEBUG_MODE
Parameter name for debug mode flag. |
static String |
PARAMETER_EXPORTER_CLASS
Parameter name for the class that has been selected as the exporter. |
static String |
PARAMETER_EXTERNAL_CMDLINE
Parameter name for the command line options to the external program. |
static String |
PARAMETER_EXTERNAL_PARAMETERS
Parameter name for the xml holding the parameter definitions to the external program. |
static String |
PARAMETER_EXTERNAL_PATH
Parameter name for the path to the external program. |
static String |
PARAMETER_IMPORTER_CLASS
Parameter name for the class that has been selected as the importer. |
static String |
PARAMETER_NUM_CHANNELS
Parameter name for the required number of channels. |
static String |
PARAMETER_RAW_DATA_TYPE
Parameter name for the required raw data type. |
static String |
PARAMETER_SOURCE_BIOASSSAYSET
Parameter name for the source bioassay set. |
static String |
PARAMETER_SOURCE_TRANSFORM
Parameter name for the required intensity transform of the source bioassay set. |
private ThreadSignalHandler |
signalHandler
|
private File |
workDir
Temporary working directory at runtime. |
Fields inherited from class net.sf.basedb.core.plugin.AbstractAnalysisPlugin |
---|
CHILD_DESCRIPTION, CHILD_NAME, CONTEXT_BIOASSAYS, CONTEXT_BIOASSAYSET, defaultGuiContexts, nameType, optionalNameType, SOURCE_BIOASSAYS, SOURCE_BIOASSAYSET, TRANSFORMATION_NAME |
Fields inherited from class net.sf.basedb.core.plugin.AbstractPlugin |
---|
annotationSection, configuration, COPY_ANNOTATIONS, job, OVERWRITE_ANNOTATIONS, sc |
Constructor Summary | |
---|---|
ExternalProgramExecutor()
|
Method Summary | |
---|---|
private void |
addParametersWithNamespace(List<PluginParameter<?>> to,
List<PluginParameter<?>> from,
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. |
File |
createFile(String name)
Create a new file in the working directory. |
protected IOSupport |
createInstance(DbControl dc,
PluginDefinition plugin,
String namespace,
boolean runtime)
Create and initialize a plug-in instance for the given plug-in definition. |
protected File |
createTemporaryWorkingDirectory()
Create a temporary working directory in the local file system. |
About |
getAbout()
Get information about the plugin, such as name, version, authors, etc. |
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 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. |
List<ParameterDefinition> |
getParameterDefinitions(boolean validate)
Get the current program parameter definitions. |
List<ProgramParameter> |
getProgramParameters()
Get all program parameters and their values. |
RequestInformation |
getRequestInformation(GuiContext context,
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. |
File |
getWorkingDirectory()
Get the current working directory were data files for the external program are stored. |
List<File> |
inspectWorkingDirectory()
Check the working directory for new files. |
String |
isInContext(GuiContext context,
Object item)
Check that the item is a bioassayset and that the logged in user has permission to use the current experiment. |
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(String program,
String cmdLine,
File workDir,
String stdin,
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. |
Methods inherited from class net.sf.basedb.core.plugin.AbstractAnalysisPlugin |
---|
getChildDescriptionParameter, getChildNameParameter, getCurrentExperiment, getGuiContexts, getMainType, getSourceBioAssays, getSourceBioAssaySet, getSourceBioAssaySetParameter, getSourceBioAssaysParameter, getTransformationName, getTransformationNameParameter, restrictSource |
Methods inherited from class net.sf.basedb.core.plugin.AbstractPlugin |
---|
checkInterrupted, cloneParameterWithDefaultValue, closeLogFile, createLogFile, done, getCopyAnnotationsParmeter, getCurrentConfiguration, getCurrentJob, getJobOrConfigurationValue, getOverwriteAnnotationsParameters, getPermissions, init, log, log, storeValue, storeValue, storeValues, validateRequestParameters |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface net.sf.basedb.core.plugin.InteractivePlugin |
---|
getGuiContexts |
Methods inherited from interface net.sf.basedb.core.plugin.Plugin |
---|
done, getMainType, getPermissions, init |
Field Detail |
---|
public static final String PARAMETER_EXTERNAL_PATH
public static final String PARAMETER_EXTERNAL_CMDLINE
public static final String PARAMETER_EXTERNAL_PARAMETERS
public static final String PARAMETER_IMPORTER_CLASS
public static final String PARAMETER_EXPORTER_CLASS
public static final String PARAMETER_DEBUG_MODE
public static final String PARAMETER_RAW_DATA_TYPE
public static final String PARAMETER_NUM_CHANNELS
public static final String PARAMETER_SOURCE_TRANSFORM
Enum.name()
) stored in the plug-in
configuration.
public static final String PARAMETER_SOURCE_BIOASSSAYSET
public static final String NAMESPACE_EXPORTER
public static final String NAMESPACE_IMPORTER
public static final String NAMESPACE_EXTERNAL
private static final About about
private static final String COMMAND_CONFIGURE_EXTERNAL_PARAMETERS
private ThreadSignalHandler signalHandler
private RequestInformation configurePlugin
private RequestInformation configureExternalParameters
private RequestInformation configureJob
private RequestInformation configureExportImportPluginParameters
private File workDir
private Set<File> knownFiles
private IOSupport exporter
private IOSupport importer
Constructor Detail |
---|
public ExternalProgramExecutor()
Method Detail |
---|
public About getAbout()
Plugin
getAbout
in interface Plugin
About
objectpublic 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 String isInContext(GuiContext context, Object item)
AbstractAnalysisPlugin
isInContext
in interface InteractivePlugin
isInContext
in class AbstractAnalysisPlugin
context
- Current guicontextitem
- The item to check.
public RequestInformation getRequestInformation(GuiContext context, 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 command
RequestInformation
for the command
BaseException
- 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 access
AbstractAnalysisPlugin.getSourceBioAssaySet(DbControl)
public File getWorkingDirectory()
public List<File> inspectWorkingDirectory()
public List<ParameterDefinition> getParameterDefinitions(boolean validate)
public List<ProgramParameter> getProgramParameters()
public File createFile(String name) throws IOException
name
- The name of the file to create
IOException
protected File createTemporaryWorkingDirectory() throws IOException
IOException
protected void runExporter(Request request, Response response, ProgressReporter progress)
protected void runImporter(Request request, Response response, ProgressReporter progress)
protected void runExternalProgram(String program, String cmdLine, File workDir, String stdin, 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 account
protected 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 account
protected IOSupport createInstance(DbControl dc, PluginDefinition plugin, 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 account
private RequestInformation getConfigurePluginParameters()
private RequestInformation getConfigureExportImportPluginParameters()
private RequestInformation getConfigureExternalParameters()
private RequestInformation getConfigureJobParameters()
private List<PluginParameter<?>> getExernalPluginParameters(DbControl dc, BioAssaySet source)
private void addParametersWithNamespace(List<PluginParameter<?>> to, List<PluginParameter<?>> from, 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
|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |