Package net.sf.basedb.core
Class PluginExecutionRequest
- java.lang.Object
-
- net.sf.basedb.core.PluginRequest<Plugin>
-
- net.sf.basedb.core.PluginExecutionRequest
-
- All Implemented Interfaces:
Runnable
public final class PluginExecutionRequest extends PluginRequest<Plugin> implements Runnable
Executes a job. You will get an instance of this class when:- You want to execute a job:
Job.execute(ProgressReporter, String)
- Close your currently opened
DbControl
if you doesn't need it and you expect that the job takes a long time to execute. The job will open it's own connection(s) to the database. - Call
invoke()
to start executing of the job. - Check the
PluginResponse
and display a user-friendly message.
PluginRequest.done()
method, it is called automatically by the core once the job has finished executing.- Version:
- 2.0
- Author:
- Nicklas
- Last modified
- $Date: 2017-04-07 09:21:57 +0200 (fr, 07 apr 2017) $
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class net.sf.basedb.core.PluginRequest
PluginRequest.RequestImpl
-
-
Field Summary
Fields Modifier and Type Field Description private Job.ProgressReporterImpl
progress
private SignalReceiver
signalReceiver
-
Constructor Summary
Constructors Constructor Description PluginExecutionRequest(PluginRequest<? extends Plugin> copyFrom, String command)
PluginExecutionRequest(SessionControl sc, Plugin plugin, String command, PluginConfiguration pluginConfiguration, ParameterValuesImpl configurationParameters, Job job, ParameterValuesImpl jobParameters, PluginDefinition pluginDefinition)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PluginResponse
invoke()
Invoke the plugin and let it do it's work.void
registerSignalReceiver(SignalReceiver signalReceiver)
Register a signal receiver that will receive signals for this job.void
run()
(package private) void
setProgressReporter(Job.ProgressReporterImpl progress)
Initialise a progress reporter that the plugin can use to store progress information in the database.-
Methods inherited from class net.sf.basedb.core.PluginRequest
done, getCommand, getCurrentConfigurationParameterValues, getCurrentJobParameterValues, getCurrentParameterValue, getCurrentParameterValues, getJob, getPlugin, getSessionControl, registerParameters, saveParameters, setNextCommand, setParameterValue, setParameterValues
-
-
-
-
Field Detail
-
progress
private Job.ProgressReporterImpl progress
-
signalReceiver
private SignalReceiver signalReceiver
-
-
Constructor Detail
-
PluginExecutionRequest
PluginExecutionRequest(SessionControl sc, Plugin plugin, String command, PluginConfiguration pluginConfiguration, ParameterValuesImpl configurationParameters, Job job, ParameterValuesImpl jobParameters, PluginDefinition pluginDefinition)
-
PluginExecutionRequest
PluginExecutionRequest(PluginRequest<? extends Plugin> copyFrom, String command)
-
-
Method Detail
-
invoke
public PluginResponse invoke()
Description copied from class:PluginRequest
Invoke the plugin and let it do it's work. Note that this method doesn't throw any exceptions. If an exception occurs during the execution of a plugin, the response status will be set toResponse.Status.ERROR
and the error messages will be available in thePluginResponse.getMessage()
andPluginResponse.getErrorList()
methods.- Specified by:
invoke
in classPluginRequest<Plugin>
- Returns:
- A
PluginResponse
object
-
setProgressReporter
void setProgressReporter(Job.ProgressReporterImpl progress)
Initialise a progress reporter that the plugin can use to store progress information in the database. This object is only available while executing the plugin.
-
registerSignalReceiver
public void registerSignalReceiver(SignalReceiver signalReceiver)
Register a signal receiver that will receive signals for this job. The plug-in must implement theSignalTarget
interface and provide aSignalHandler
. If not, the job will not be registered with the signal receiver and it will not be possible to send signals to the job.- Parameters:
signalReceiver
- The signal recevier to use
-
-