Package org.int4.dirk.plugins
Class PluginManager
- java.lang.Object
-
- org.int4.dirk.plugins.PluginManager
-
public class PluginManager extends java.lang.ObjectManagesPlugins, registering them with aCandidateRegistrywhen loaded and removing them when unloaded.
-
-
Constructor Summary
Constructors Constructor Description PluginManager(ComponentScannerFactory componentScannerFactory, org.int4.dirk.api.CandidateRegistry registry)Constructs a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PluginloadPlugin(java.net.URL... urls)Loads classes from a plugin defined by a Module.PluginloadPluginAndScan(java.lang.String... packageNamePrefixes)Scans the given package prefixes and creates aPluginfor any annotated types located during the scan.PluginloadPluginAndScan(java.net.URL... urls)Loads jars at the givenURLs, scans for annotated types and creates aPlugin.voidunload(Plugin plugin)Attempts to unload the given plugin.
-
-
-
Constructor Detail
-
PluginManager
public PluginManager(ComponentScannerFactory componentScannerFactory, org.int4.dirk.api.CandidateRegistry registry)
Constructs a new instance. ACandidateRegistrymust be provided where types part of aPlugincan be registered and unregistered.- Parameters:
componentScannerFactory- aComponentScannerFactory, cannot benullregistry- aCandidateRegistry, cannot benull
-
-
Method Detail
-
loadPluginAndScan
public Plugin loadPluginAndScan(java.lang.String... packageNamePrefixes) throws org.int4.dirk.api.definition.AutoDiscoveryException, org.int4.dirk.api.definition.DefinitionException, org.int4.dirk.api.definition.DependencyException
Scans the given package prefixes and creates aPluginfor any annotated types located during the scan.- Parameters:
packageNamePrefixes- a list of packages to scan- Returns:
- a
Plugin, nevernull - Throws:
org.int4.dirk.api.definition.AutoDiscoveryException- when auto discovery fails to find all required typesorg.int4.dirk.api.definition.DefinitionException- when a definition problem was encounteredorg.int4.dirk.api.definition.DependencyException- when dependencies between registered types cannot be resolved
-
loadPluginAndScan
public Plugin loadPluginAndScan(java.net.URL... urls) throws org.int4.dirk.api.definition.AutoDiscoveryException, org.int4.dirk.api.definition.DefinitionException, org.int4.dirk.api.definition.DependencyException
Loads jars at the givenURLs, scans for annotated types and creates aPlugin.- Parameters:
urls- a list ofURLs to load and scan- Returns:
- a
Plugin, nevernull - Throws:
org.int4.dirk.api.definition.AutoDiscoveryException- when auto discovery fails to find all required typesorg.int4.dirk.api.definition.DefinitionException- when a definition problem was encounteredorg.int4.dirk.api.definition.DependencyException- when dependencies between registered types cannot be resolved
-
unload
public void unload(Plugin plugin) throws org.int4.dirk.api.definition.AutoDiscoveryException, org.int4.dirk.api.definition.DefinitionException, org.int4.dirk.api.definition.DependencyException
Attempts to unload the given plugin. This may fail if not all types can be removed for the underlyingCandidateRegistry.- Parameters:
plugin- aPluginto unload, cannot benull- Throws:
org.int4.dirk.api.definition.AutoDiscoveryException- when auto discovery fails to find all required typesorg.int4.dirk.api.definition.DefinitionException- when a definition problem was encounteredorg.int4.dirk.api.definition.DependencyException- when dependencies between registered types cannot be resolved
-
loadPlugin
public Plugin loadPlugin(java.net.URL... urls) throws org.int4.dirk.api.definition.AutoDiscoveryException, org.int4.dirk.api.definition.DefinitionException, org.int4.dirk.api.definition.DependencyException
Loads classes from a plugin defined by a Module.- Parameters:
urls- one or more jar files- Returns:
- a
Plugin, nevernull - Throws:
org.int4.dirk.api.definition.AutoDiscoveryException- when auto discovery fails to find all required typesorg.int4.dirk.api.definition.DefinitionException- when a definition problem was encounteredorg.int4.dirk.api.definition.DependencyException- when dependencies between registered types cannot be resolved
-
-