Package net.sf.basedb.core
Class PluginConfigurationRequest
- java.lang.Object
-
- net.sf.basedb.core.PluginRequest<InteractivePlugin>
-
- net.sf.basedb.core.PluginConfigurationRequest
-
public final class PluginConfigurationRequest extends PluginRequest<InteractivePlugin>
Configures a plugin or job. You will get an instance of this class when:- You want to configure a plugin:
PluginConfiguration.configure()
- You want to configure a job:
Job.configure(GuiContext)
- Call the
getRequestInformation()
method to find out which parameters the plugin or job wants. - Display a user interface for entering the parameter values or get the parameters from somewhere else.
- Set the parameter values with the
PluginRequest.setParameterValue(String, Object)
orPluginRequest.setParameterValues(String, List)
methods. - Call
invoke()
to let the plugin check the parameters and store them in the database. - Check the
PluginResponse.getStatus()
method and repeat the steps if needed, or display an error message. In case of an error in the parameters, ask for new parameters and retry. - Commit the changes using
DbControl.commit()
.
DbControl.disconnect()
andDbControl.reconnect()
to conserve database resources. You must not close or commit theDbControl
until the configuration is completed.Note 2! If the returned status of a plugin is
Response.Status.DONE
after an invokation, thePlugin.done()
method is called to let the plugin clean up resources. If a client application wants to abort earlier it should use thePluginRequest.done()
method in this class.- Version:
- 2.0
- Author:
- Nicklas
- Last modified
- $Date: 2015-04-21 09:59:42 +0200 (ti, 21 apr 2015) $
- You want to configure a plugin:
-
-
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 boolean
allowImmediateExecution
private GuiContext
context
private boolean
dryRun
private Job.ProgressReporterImpl
progress
-
Constructor Summary
Constructors Constructor Description PluginConfigurationRequest(SessionControl sc, InteractivePlugin plugin, String command, PluginConfiguration pluginConfiguration, ParameterValuesImpl configurationParameters, Job job, ParameterValuesImpl jobParameters, GuiContext context, PluginDefinition pluginDefinition, boolean allowImmediateExecution)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GuiContext
getGuiContext()
Get the context of the client application when this configuration request was created.RequestInformation
getRequestInformation()
Get the request information object containing information about the parameters needed for the plugin.PluginResponse
invoke()
Invoke the plugin and let it do it's work.(package private) void
setProgressReporter(Job.ProgressReporterImpl progress)
-
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
-
context
private GuiContext context
-
progress
private Job.ProgressReporterImpl progress
-
allowImmediateExecution
private boolean allowImmediateExecution
-
dryRun
private boolean dryRun
-
-
Constructor Detail
-
PluginConfigurationRequest
PluginConfigurationRequest(SessionControl sc, InteractivePlugin plugin, String command, PluginConfiguration pluginConfiguration, ParameterValuesImpl configurationParameters, Job job, ParameterValuesImpl jobParameters, GuiContext context, PluginDefinition pluginDefinition, boolean allowImmediateExecution)
-
-
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<InteractivePlugin>
- Returns:
- A
PluginResponse
object
-
getRequestInformation
public RequestInformation getRequestInformation() throws BaseException
Get the request information object containing information about the parameters needed for the plugin.- Returns:
- A
RequestInformation
object - Throws:
BaseException
- If there is an error
-
getGuiContext
public GuiContext getGuiContext()
Get the context of the client application when this configuration request was created.
-
setProgressReporter
void setProgressReporter(Job.ProgressReporterImpl progress)
-
-