2.17.2: 2011-06-17

net.sf.basedb.core
Class PluginExecutionRequest

java.lang.Object
  extended by net.sf.basedb.core.PluginRequest<Plugin>
      extended by 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:

  1. You want to execute a job: Job.execute(ProgressReporter, String)
You should use the following protocol:
  1. 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.
  2. Call invoke() to start executing of the job.
  3. 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) $

Nested Class Summary
 
Nested classes/interfaces inherited from class net.sf.basedb.core.PluginRequest
PluginRequest.RequestImpl
 
Field Summary
private  Job.ProgressReporterImpl progress
           
private  SignalReceiver signalReceiver
           
 
Constructor Summary
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
 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 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

2.17.2: 2011-06-17