Package fr.gouv.vitam.worker.core.plugin

# Class PluginLoader

java.lang.Object
fr.gouv.vitam.worker.core.plugin.PluginLoader

public class PluginLoader extends Object
load all the plugins according to plugins.json file.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `PluginLoader()`
  create instance with the default configuration file

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `contains(String pluginId)`
  test if a plugin is present
  `Map<String,ActionHandler>`
  `loadAllPlugins()`
  load All the plugins, and return a Map an instance of each plugin WARNING : plugins are not thread safe
  `void`
  `loadConfiguration()`
  load the configuration file containing the list of plugins.
  `ActionHandler`
  `newInstance(String pluginId)`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### PluginLoader

    public PluginLoader() throws IllegalPathException
    create instance with the default configuration file
    Throws:
      `IllegalPathException`

- ## Method Details

  - ### loadConfiguration

    public void loadConfiguration() throws FileNotFoundException, InvalidParseOperationException, PluginNotFoundException
    load the configuration file containing the list of plugins. file is a json format.

    Example :

         {
           "CHECK_DIGEST": {
             "className": "fr.gouv.vitam.worker.core.plugin.CheckConformityActionPlugin",
             "propertiesFile": "check_conformity_plugin.properties"
           }
         }

    Throws:
      `FileNotFoundException` - if file is not found
      `InvalidParseOperationException` - if file cannot be parsed
      `PluginNotFoundException` - if the plugin is not found in the classpath

  - ### contains

    public boolean contains(String pluginId)
    test if a plugin is present
    Parameters:
      `pluginId` - id plugin
    Returns:
      true if present, false otherwise

  - ### newInstance

    public ActionHandler newInstance(String pluginId) throws InvocationPluginException, PluginNotFoundException
    Parameters:
      `pluginId` - id of a plugin
    Returns:
      an new instance of a plugin
    Throws:
      `InvocationPluginException` - the plugin cannot be instanciate.
      `PluginNotFoundException` - the plugin is not present

  - ### loadAllPlugins

    public Map<String,ActionHandler> loadAllPlugins() throws InvocationPluginException
    load All the plugins, and return a Map an instance of each plugin WARNING : plugins are not thread safe
    Returns:
      list of all plugins
    Throws:
      `InvocationPluginException` - if a plugin cannot be instance