Package fr.gouv.vitam.worker.core.plugin
Class PluginLoader
- java.lang.Object
-
- fr.gouv.vitam.worker.core.plugin.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 presentjava.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 safevoid
loadConfiguration()
load the configuration file containing the list of plugins.ActionHandler
newInstance(java.lang.String pluginId)
-
-
-
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 foundInvalidParseOperationException
- if file cannot be parsedPluginNotFoundException
- 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
-
newInstance
public ActionHandler newInstance(java.lang.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 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
-
-