Last update: 2011-06-23

org.proteios.core.plugin
Interface Plugin

All Known Subinterfaces:
AutoDetectingImporter, InteractivePlugin
All Known Implementing Classes:
AbstractPlugin

public interface Plugin

This interface must be implemented by all plugins to Proteios. A plugin must also define a default public no-argument constructor.

When a plugin is installed into Proteios the core will use the following sequence to store all meta-information about the plugin in the database:

  1. Create a plugin object, using the default constructor
  2. Call the getMainType() and getAbout() methods
  3. Check if the plugin inmplements the InteractivePlugin and if it does, call the InteractivePlugin.getGuiContexts() method.
  4. Check which other interfaces the plugin implements, and link to PluginType as appropriate

When a plugin is executed using a the request/response scheme the core will use the following sequence:

  1. Create a plugin object, using the default constructor
  2. Call the init(SessionControl, ParameterValues, ParameterValues) method which gives the plugin access to it's configuration and job-specific parameters
  3. Call the run(Request, Response, ProgressReporter) method to let the plugin do it's work
  4. Call done() to let the plugin clean up after itself
  5. After done has been called, the plugin instance is not reused again

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

    Nested Class Summary
    static class Plugin.MainType
               
     
    Method Summary
     void done()
              This method is called when the core is finished with the plugin object.
     About getAbout()
              Get information about the plugin, such as name, version, authors, etc.
     Plugin.MainType getMainType()
              Get the type of the plugin.
     void init(SessionControl sc, ParameterValues configuration, ParameterValues job)
              This method is called right after the plugin object has been constructed to pass the configuration and job parameters to the plugin.
     void run(Request request, Response response, ProgressReporter progress)
              Run the plugin.
     

    Method Detail

    getMainType

    Plugin.MainType getMainType()
    Get the type of the plugin. This method must always return the same value.

    Returns:
    One of the defined types

    getAbout

    About getAbout()
    Get information about the plugin, such as name, version, authors, etc.

    Returns:
    An About object

    init

    void init(SessionControl sc,
              ParameterValues configuration,
              ParameterValues job)
              throws BaseException
    This method is called right after the plugin object has been constructed to pass the configuration and job parameters to the plugin. The ParameterValues parameters can be null if no parameters exists.

    Parameters:
    sc - A SessionControl object that the plugin can use to communicate with the core.
    configuration - The configuration parameters for the plugin
    job - The job parameters for the plugin
    Throws:
    BaseException - if there is an error.

    run

    void run(Request request,
             Response response,
             ProgressReporter progress)
    Run the plugin. If a progress reporter object is passed it is recommended that the plugin makes use of it.

    Parameters:
    request - Request object with the command and parameters
    response - Response object in for the plugin to response through
    progress - A ProgressReporter where the plugin can report its progess, can be null

    done

    void done()
    This method is called when the core is finished with the plugin object. The plugin should clean up and close any resources it has aquired.


    Last update: 2011-06-23