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)
You should use the following protocol:
- 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.
Note! You do not have to call the PluginRequest.done()
method, it is called
automatically by the core once the job has finished executing.
- Version:
- 2.0
- Author:
- Nicklas
- Last modified
- $Date: 2010-09-21 09:29:35 +0200 (Tue, 21 Sep 2010) $
Methods inherited from class net.sf.basedb.core.PluginRequest |
done, getCommand, getCurrentConfigurationParameterValues, getCurrentJobParameterValues, getCurrentParameterValue, getCurrentParameterValues, getJob, getPlugin, getSessionControl, registerParameters, saveParameters, setNextCommand, setParameterValue, setParameterValues |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
progress
private Job.ProgressReporterImpl progress
signalReceiver
private SignalReceiver signalReceiver
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)
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 to
Response.Status.ERROR
and
the error messages will be available in the
PluginResponse.getMessage()
and
PluginResponse.getErrorList()
methods.
- Specified by:
invoke
in class PluginRequest<Plugin>
- Returns:
- A
PluginResponse
object
run
public void run()
- Specified by:
run
in interface Runnable
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 the
SignalTarget
interface
and provide a SignalHandler
. 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