2.17.2: 2011-06-17

net.sf.basedb.core.plugin
Interface Plugin

All Known Subinterfaces:
AnalysisFilterPlugin, AnnotationSetterPlugin, AutoDetectingImporter, ConfigureByExample, FileUnpacker, ImmediateDownloadExporter, InteractivePlugin, IOSupport, WrappedConfigureByExample
All Known Implementing Classes:
AbstractAnalysisPlugin, AbstractExporterPlugin, AbstractFileUnpacker, AbstractFlatFileImporter, AbstractIOSupport, AbstractItemImporter, AbstractPlugin, AnnotationFlatFileImporter, ArrayBatchImporter, ArrayDesignImporter, ArraySlideImporter, Base1PluginExecuter, BaseFileExporterPlugin, BaseFileExporterSupport, BaseFileImporterSupport, BfsExporterPlugin, BfsExporterSupport, BfsImporterSupport, BioAssaySetExporter, BioPlateImporter, BioSourceImporter, CdfFileReporterImporter, ExternalProgramExecutor, ExtractImporter, FileOnlyImporterSupport, FormulaFilter, GalExporter, HelpExporter, HelpImporter, HybridizationImporter, IlluminaRawDataImporter, IntensityCalculatorPlugin, JepExtraValueCalculator, JepIntensityTransformer, LabeledExtractImporter, LowessNormalization, ManualTransformCreator, MedianRatioNormalization, PackedFileExporter, PlateFlatFileImporter, PlateMappingExporter, PlateMappingImporter, PluginConfigurationExporter, PluginConfigurationImporter, PrintMapFlatFileImporter, RawBioAssayImporter, RawDataFlatFileImporter, ReporterFlatFileImporter, ReporterMapFlatFileImporter, SampleImporter, ScanImporter, SimpleExport, SpotImageCreator, TarFileUnpacker, ZipFileUnpacker

public interface Plugin

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

When a plugin is installed into BASE 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$

    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.
     Collection<Permissions> getPermissions()
              Get the permissions this plugin requires to function as expected.
     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.
     boolean requiresConfiguration()
              Return TRUE if the plugin requires a configuration when executing a job.
     void run(Request request, Response response, ProgressReporter progress)
              Run the plugin.
     boolean supportsConfigurations()
              Return TRUE if the plugin supports different configurations when executing a job.
     

    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

    supportsConfigurations

    boolean supportsConfigurations()
    Return TRUE if the plugin supports different configurations when executing a job.

    Returns:
    TRUE or FALSE

    requiresConfiguration

    boolean requiresConfiguration()
    Return TRUE if the plugin requires a configuration when executing a job. The core will not start a job without a configuration if this method returns TRUE. Note! If the supportsConfigurations() method returns FALSE, the return value of this method is expected to also be FALSE.

    Returns:
    TRUE or FALSE

    getPermissions

    Collection<Permissions> getPermissions()
    Get the permissions this plugin requires to function as expected. The plugin may specify permissions that is always granted to the plugin even if the logged in user doesn't have that permission and permissions that are only granted if the logged in user has the required permission. Permissions that are not specified are always denied. If null or an empty collection is returned, the permissions are not used and the plugin will always get the same permissions as the logged in user.

    Returns:
    A collection of permissions or null to not use permissions

    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.


    2.17.2: 2011-06-17