Package net.sf.basedb.core
Class PluginRequest<P extends Plugin>
- java.lang.Object
-
- net.sf.basedb.core.PluginRequest<P>
-
- Direct Known Subclasses:
PluginConfigurationRequest
,PluginExecutionRequest
abstract class PluginRequest<P extends Plugin> extends Object
Configures or executes a plugin. You will get an instance of a subclass to this class when:- You want to configure a plugin:
PluginConfiguration.configure()
- You want to configure a job:
Job.configure(GuiContext)
- You want to execute a job:
Job.execute(ProgressReporter, String)
- Version:
- 2.0
- Author:
- Nicklas
- See Also:
PluginConfigurationRequest
,PluginExecutionRequest
- Last modified
- $Date$
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) class
PluginRequest.RequestImpl
An implementation of theRequest
interface that is passed to the plugin.
-
Field Summary
Fields Modifier and Type Field Description private String
command
private ParameterValuesImpl
configurationParameters
private Job
job
private ParameterValuesImpl
jobParameters
private Map<String,PluginParameter<?>>
parameterInfo
private P
plugin
private PluginConfiguration
pluginConfiguration
private PluginDefinition
pluginDefinition
private Map<String,List<?>>
requestParameters
private SessionControl
sc
private Serializable
state
-
Constructor Summary
Constructors Constructor Description PluginRequest(PluginRequest<? extends P> copyFrom, String command)
PluginRequest(SessionControl sc, P plugin, String command, PluginConfiguration pluginConfiguration, ParameterValuesImpl configurationParameters, Job job, ParameterValuesImpl jobParameters, PluginDefinition pluginDefinition)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
done()
Aborts the execution of the plugin.String
getCommand()
Get the command this request will issue to the plugin wheninvoke()
is called.List<?>
getCurrentConfigurationParameterValues(String name)
Get the values that are currently stored in the plugin configuration related to this request.List<?>
getCurrentJobParameterValues(String name)
Get the values that are currently stored in the job related to this request.Object
getCurrentParameterValue(String name)
List<?>
getCurrentParameterValues(String name)
Get the values that are currently stored in the job or plugin configuration related to this request.(package private) Job
getJob()
Get the job for the request or null if we are not configuring/executing a job.P
getPlugin()
Get the plugin object.SessionControl
getSessionControl()
abstract PluginResponse
invoke()
Invoke the plugin and let it do it's work.(package private) void
registerParameters(List<PluginParameter<?>> parameters)
Keep track of all parameters so that we can save label and description in theParameterValuesImpl.saveParameters(Job, Map)
method.(package private) void
saveParameters(DbControl dc, GuiContext context)
Save all parameters that have got values in this request/response session.(package private) void
setNextCommand(String command)
Sets the next command in a configuration sequence.void
setParameterValue(String name, Object value)
Set the value of a request parameter to a single value.void
setParameterValues(String name, List<?> values)
Set the value of a request parameter to a list of values.
-
-
-
Field Detail
-
sc
private final SessionControl sc
-
command
private String command
-
state
private final Serializable state
-
configurationParameters
private final ParameterValuesImpl configurationParameters
-
pluginConfiguration
private final PluginConfiguration pluginConfiguration
-
pluginDefinition
private final PluginDefinition pluginDefinition
-
jobParameters
private final ParameterValuesImpl jobParameters
-
parameterInfo
private final Map<String,PluginParameter<?>> parameterInfo
-
job
private final Job job
-
-
Constructor Detail
-
PluginRequest
PluginRequest(SessionControl sc, P plugin, String command, PluginConfiguration pluginConfiguration, ParameterValuesImpl configurationParameters, Job job, ParameterValuesImpl jobParameters, PluginDefinition pluginDefinition)
-
PluginRequest
PluginRequest(PluginRequest<? extends P> copyFrom, String command)
-
-
Method Detail
-
getSessionControl
public SessionControl getSessionControl()
- Returns:
- The SessionControl used in this request
- Since:
- 2.11
-
getCommand
public String getCommand()
Get the command this request will issue to the plugin wheninvoke()
is called.
-
setParameterValue
public void setParameterValue(String name, Object value)
Set the value of a request parameter to a single value. Normally a plugin validates the value using the information available in theRequestInformation
object.- Parameters:
name
- The name of the parametervalue
- The value of the parameter- See Also:
PluginConfigurationRequest.getRequestInformation()
-
setParameterValues
public void setParameterValues(String name, List<?> values)
Set the value of a request parameter to a list of values. Normally a plugin validates the value using the information available in theRequestInformation
object.- Parameters:
name
- The name of the parametervalues
- The values of the parameter- See Also:
PluginConfigurationRequest.getRequestInformation()
-
getCurrentParameterValues
public List<?> getCurrentParameterValues(String name)
Get the values that are currently stored in the job or plugin configuration related to this request. This method will first check the job and then the plugin configuration.- Parameters:
name
- The name of the parameter- Returns:
- The parameter values, or null if no parameter with the given name exists
-
getCurrentConfigurationParameterValues
public List<?> getCurrentConfigurationParameterValues(String name)
Get the values that are currently stored in the plugin configuration related to this request.- Parameters:
name
- The name of the parameter- Returns:
- The parameter values, or null if no parameter with the given name exists or if this request isn't associated with a plugin configuration
-
getCurrentJobParameterValues
public List<?> getCurrentJobParameterValues(String name)
Get the values that are currently stored in the job related to this request.- Parameters:
name
- The name of the parameter- Returns:
- The parameter values, or null if no parameter with the given name exists or if this request isn't associated with a job
-
invoke
public abstract PluginResponse invoke()
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.- Returns:
- A
PluginResponse
object
-
done
public void done()
Aborts the execution of the plugin.
-
registerParameters
void registerParameters(List<PluginParameter<?>> parameters)
Keep track of all parameters so that we can save label and description in theParameterValuesImpl.saveParameters(Job, Map)
method.
-
saveParameters
void saveParameters(DbControl dc, GuiContext context)
Save all parameters that have got values in this request/response session.
-
setNextCommand
void setNextCommand(String command)
Sets the next command in a configuration sequence.
-
getPlugin
public P getPlugin()
Get the plugin object.- Since:
- 2.6 (was not public before)
-
getJob
Job getJob()
Get the job for the request or null if we are not configuring/executing a job.- Since:
- 2.2
-
-