Last update: 2011-06-23

org.proteios.core
Class PluginConfigurationRequest

java.lang.Object
  extended by org.proteios.core.PluginConfigurationRequest

public final class PluginConfigurationRequest
extends Object

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 setParameterValue(String, Object) or 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 done() method in this class.

    Version:
    2.0
    Author:
    Nicklas
    Last modified
    $Date: 2009-04-09 08:48:11 +0200 (Thu, 09 Apr 2009) $

    Method Summary
     void done()
              Aborts the execution of the plugin.
     String getCommand()
              Get the command this request will issue to the plugin when invoke() is called.
     List<?> getCurrentConfigurationParameterValues(String name)
               
     List<?> getCurrentJobParameterValues(String name)
               
     List<?> getCurrentParameterValues(String name)
               
     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.
     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.
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Method Detail

    invoke

    public 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 to Response.Status.ERROR and the error messages will be available in the PluginResponse.getMessage() and PluginResponse.getErrorList() methods.

    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.


    getCommand

    public String getCommand()
    Get the command this request will issue to the plugin when invoke() 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 the RequestInformation object.

    Parameters:
    name - The name of the parameter
    value - The value of the parameter
    See Also:
    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 the RequestInformation object.

    Parameters:
    name - The name of the parameter
    values - The values of the parameter
    See Also:
    getRequestInformation()

    getCurrentParameterValues

    public List<?> getCurrentParameterValues(String name)

    getCurrentConfigurationParameterValues

    public List<?> getCurrentConfigurationParameterValues(String name)

    getCurrentJobParameterValues

    public List<?> getCurrentJobParameterValues(String name)

    done

    public void done()
    Aborts the execution of the plugin.


    Last update: 2011-06-23