Class AbstractIOSupport

java.lang.Object
net.sf.basedb.core.plugin.AbstractPlugin
net.sf.basedb.plugins.executor.AbstractIOSupport
All Implemented Interfaces:
InteractivePlugin, Plugin, IOSupport
Direct Known Subclasses:
BaseFileExporterSupport, BaseFileImporterSupport, BfsExporterSupport, BfsImporterSupport, FileOnlyImporterSupport

public abstract class AbstractIOSupport extends AbstractPlugin implements IOSupport
Abstract base class that is useful for plug-ins that need to implement the IOSupport interface and don't want to be visible as standalone plug-ins.
Since:
2.15
Author:
nicklas
See Also:
Last modified
$Date $
  • Field Details

  • Constructor Details

    • AbstractIOSupport

      public AbstractIOSupport()
  • Method Details

    • supportsConfigurations

      public boolean supportsConfigurations()
      Description copied from class: AbstractPlugin
      Returns TRUE, since that is how the plugins used to work before this method was introduced.
      Specified by:
      supportsConfigurations in interface Plugin
      Overrides:
      supportsConfigurations in class AbstractPlugin
      Returns:
      Always FALSE
    • requiresConfiguration

      public boolean requiresConfiguration()
      Description copied from class: AbstractPlugin
      Returns FALSE, since that is how the plugins used to work before this method was introduced.
      Specified by:
      requiresConfiguration in interface Plugin
      Overrides:
      requiresConfiguration in class AbstractPlugin
      Returns:
      Always FALSE
    • getGuiContexts

      public Set<GuiContext> getGuiContexts()
      Description copied from interface: InteractivePlugin
      Get a set containing all items that the plugin handles. Ie. if the plugin imports reporters, return a set containing Item.REPORTER. This information is used by client applications to put the plugin in the proper place in the user interface.
      Specified by:
      getGuiContexts in interface InteractivePlugin
      Returns:
      Always null
    • isInContext

      public String isInContext(GuiContext context, Object item)
      Description copied from interface: InteractivePlugin
      Check if the plugin can be used on the specified object. The item is either a BasicItem or BasicData object, or null if called from a list context. A client application should only call this method for contexts matching one of the contexts in the set returned by the InteractivePlugin.getGuiContexts() method. For GuiContext.Type.ITEM contexts an item of the correct type should be passed as a parameter.

      The plug-in can response with a null value indicating success, a warning-level message or throw an exception to indicate an error-level message. Client application should normally only show error-level messages to users, unless the user has requested to see warning messages.

      NOTE! Before BASE 2.4 all messages were treated as error-level messages.

      Specified by:
      isInContext in interface InteractivePlugin
      Parameters:
      context - The current context of the client application, it is one of the values found in set returned by InteractivePlugin.getGuiContexts()
      item - The currently active item, it's type should match the GuiContext.getItem() type, or null if the context is a list context
      Returns:
      Always null
    • run

      public void run(Request request, Response response, ProgressReporter progress)
      Accepts the IOSupport.COMMAND_EXECUTE_IO_JOB command. The default implementation starts a new transaction and then calls performIO(DbControl, ProgressReporter) which should be implemented by the subclass.
      Specified by:
      run in interface Plugin
      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
    • getShortName

      public String getShortName()
      A default implementation to maintain backwards compatibility. Plug-ins that want to return a different short name should override this method.
      Specified by:
      getShortName in interface IOSupport
      Returns:
      The name of the plugin (eg. PluginDefinition.getName())
      Since:
      2.16
    • init

      public void init(SessionControl sc, ParameterValues configuration, ParameterValues job, ExternalProgramExecutor executor)
      Description copied from interface: IOSupport
      Replaces the regular plug-in initialisation method. When the plug-in is used as part of the external executor this method is used instead of Plugin.init(SessionControl, ParameterValues, ParameterValues).
      Specified by:
      init in interface IOSupport
      executor - The external executor plug-in
    • performIO

      protected abstract String performIO(DbControl dc, ProgressReporter progress) throws IOException
      Perform the IO operation.
      Parameters:
      dc - A DbControl that can be used by the subclass
      progress - An optional progress reporter
      Returns:
      A message that is returned as to the external program executor
      Throws:
      IOException
    • getExecutor

      protected ExternalProgramExecutor getExecutor()
      Get the external program executor that invoked the plug-in.