Class PluginInstallationProcessor

java.lang.Object
net.sf.basedb.util.extensions.manager.processor.PluginInstallationProcessor
All Implemented Interfaces:
ExtensionsFileProcessor

public class PluginInstallationProcessor
extends Object
implements ExtensionsFileProcessor
File processor implementation that load and install plug-ins.
Since:
3.0
Author:
Nicklas
Last modified
$Date$
  • Field Details

    • log

      private static final org.slf4j.Logger log
    • dc

      private final DbControl dc
    • loader

      private final XmlLoader loader
    • results

      private final ProcessResults results
    • numFiles

      private int numFiles
    • numError

      private int numError
    • numTotalPlugins

      private int numTotalPlugins
  • Constructor Details

    • PluginInstallationProcessor

      public PluginInstallationProcessor​(DbControl dc, ProcessResults results)
      Create a new processor.
      Parameters:
      dc - Optional DbControl to use when installing plug-ins (if not given, only the information from the XML files are loaded, the plug-ins are not installed)
  • Method Details

    • begin

      public void begin​(ExtensionsManager manager, int numFiles)
      Description copied from interface: ExtensionsFileProcessor
      Called by the extensions manager before the processing starts.
      Specified by:
      begin in interface ExtensionsFileProcessor
      Parameters:
      manager - The manager that is executing the action
      numFiles - The number of extension files that is going to be processed this time
    • processFile

      public void processFile​(ExtensionsManager manager, ExtensionsFile.WriteableExtensionsFile wFile)
      Description copied from interface: ExtensionsFileProcessor
      Called by the extensions manager for each extensions file that it manages. The order of the files is generally not predicatable and may change from one invokation to the next.

      If the processor throws an exception the manager will abort processing and call ExtensionsFileProcessor.done(ExtensionsManager, Throwable). Error that are related to a specific file should be catched by the processor and registered by calling .......

      If all files was processed without exceptions the manager will call ExtensionsFileProcessor.done(ExtensionsManager).

      Note that the file is read-only to begin with. If the processor wants to call any write-operation the file must be opened by calling ExtensionsFile.WriteableExtensionsFile.open(). It is recommended that the processor calls ExtensionsFile.WriteableExtensionsFile.close() once it is done writing.

      Specified by:
      processFile in interface ExtensionsFileProcessor
      Parameters:
      manager - The manager that is executing the action
      wFile - The file to be processed
    • done

      public void done​(ExtensionsManager manager)
      Description copied from interface: ExtensionsFileProcessor
      Called by the extensions manager after a successful completion of the processing.
      Specified by:
      done in interface ExtensionsFileProcessor
      Parameters:
      manager - The manager that is executing the action
    • done

      public void done​(ExtensionsManager manager, Throwable t)
      Description copied from interface: ExtensionsFileProcessor
      Called by the extensions manager if an exception was thrown by the processor.
      Specified by:
      done in interface ExtensionsFileProcessor
      Parameters:
      manager - The manager that is executing the action
      t - The exception
    • getXmlLoader

      public XmlLoader getXmlLoader()
      Get the loader the processor is using for parsing xml files with plug-in definitions.
    • getProcessResults

      public ProcessResults getProcessResults()
    • getNumFiles

      public int getNumFiles()
      Get the number of files that was successfully processed.
    • getNumError

      public int getNumError()
      Get the number of files that was had an error.
    • getNumPlugins

      public int getNumPlugins()
      Get the total number of plug-in installed or updated by the processor.