2.17.2: 2011-06-17

net.sf.basedb.core
Class PluginConfigurationRequest

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

  1. You want to configure a plugin: PluginConfiguration.configure()
  2. You want to configure a job: Job.configure(GuiContext)
You should use the following protocol:
  1. Call the getRequestInformation() method to find out which parameters the plugin or job wants.
  2. Display a user interface for entering the parameter values or get the parameters from somewhere else.
  3. Set the parameter values with the PluginRequest.setParameterValue(String, Object) or PluginRequest.setParameterValues(String, List) methods.
  4. Call invoke() to let the plugin check the parameters and store them in the database.
  5. 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.
  6. Commit the changes using DbControl.commit(). Note 1! If the above procedure includes waiting for user input (which it normally does) you should also use DbControl.disconnect() and DbControl.reconnect() to conserve database resources. You must not close or commit the DbControl until the configuration is completed.

    Note 2! If the returned status of a plugin is Response.Status.DONE after an invokation, the Plugin.done() method is called to let the plugin clean up resources. If a client application wants to abort earlier it should use the PluginRequest.done() method in this class.

    Version:
    2.0
    Author:
    Nicklas
    Last modified
    $Date: 2009-04-06 14:52:39 +0200 (Mon, 06 Apr 2009) $

    Nested Class Summary
     
    Nested classes/interfaces inherited from class net.sf.basedb.core.PluginRequest
    PluginRequest.RequestImpl
     
    Field Summary
    private  boolean allowImmediateExecution
               
    private  GuiContext context
               
    private  boolean dryRun
               
    private  Job.ProgressReporterImpl progress
               
     
    Constructor Summary
    PluginConfigurationRequest(SessionControl sc, InteractivePlugin plugin, String command, PluginConfiguration pluginConfiguration, ParameterValuesImpl configurationParameters, Job job, ParameterValuesImpl jobParameters, GuiContext context, PluginDefinition pluginDefinition, boolean allowImmediateExecution)
               
     
    Method Summary
     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
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

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

    2.17.2: 2011-06-17