Class PluginLoader


  • public class PluginLoader
    extends java.lang.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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean contains​(java.lang.String pluginId)
      test if a plugin is present
      java.util.Map<java.lang.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​(java.lang.String pluginId)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PluginLoader

        public PluginLoader()
                     throws java.io.IOException
        create instance with the default configuration file
        Throws:
        java.io.IOException
    • Method Detail

      • loadConfiguration

        public void loadConfiguration()
                               throws java.io.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:
        java.io.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​(java.lang.String pluginId)
        test if a plugin is present
        Parameters:
        pluginId - id plugin
        Returns:
        true if present, false otherwise
      • loadAllPlugins

        public java.util.Map<java.lang.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