Class PluginManager
- java.lang.Object
-
- org.apache.logging.log4j.core.config.plugins.util.PluginManager
-
public class PluginManager extends java.lang.ObjectLoads and manages all the plugins.
-
-
Constructor Summary
Constructors Constructor Description PluginManager(java.lang.String category)Constructs a PluginManager for the plugin category name given.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static voidaddPackage(java.lang.String p)Adds a package name to be scanned for plugins.static voidaddPackages(java.util.Collection<java.lang.String> packages)Adds a list of package names to be scanned for plugins.voidcollectPlugins()Locates all the plugins.voidcollectPlugins(java.util.List<java.lang.String> packages)Locates all the plugins including search of specific packages.java.util.Map<java.lang.String,PluginType<?>>getPlugins()Returns all the matching plugins.PluginType<?>getPluginType(java.lang.String name)Returns the type of a specified plugin.static voidmain(java.lang.String[] args)Deprecated.UsePluginProcessorinstead.
-
-
-
Method Detail
-
main
@Deprecated public static void main(java.lang.String[] args)
Deprecated.UsePluginProcessorinstead. To do so, simply includelog4j-corein your dependencies and make sure annotation processing is not disabled. By default, supported Java compilers will automatically use that plugin processor providedlog4j-coreis on the classpath.Process annotated plugins.
-
addPackage
public static void addPackage(java.lang.String p)
Adds a package name to be scanned for plugins. Must be invoked prior to plugins being collected.- Parameters:
p- The package name. Ignored ifnullor empty.
-
addPackages
public static void addPackages(java.util.Collection<java.lang.String> packages)
Adds a list of package names to be scanned for plugins. Convenience method foraddPackage(String).- Parameters:
packages- collection of package names to add. Empty and null package names are ignored.
-
getPluginType
public PluginType<?> getPluginType(java.lang.String name)
Returns the type of a specified plugin.- Parameters:
name- The name of the plugin.- Returns:
- The plugin's type.
-
getPlugins
public java.util.Map<java.lang.String,PluginType<?>> getPlugins()
Returns all the matching plugins.- Returns:
- A Map containing the name of the plugin and its type.
-
collectPlugins
public void collectPlugins()
Locates all the plugins.
-
collectPlugins
public void collectPlugins(java.util.List<java.lang.String> packages)
Locates all the plugins including search of specific packages. Warns about name collisions.- Parameters:
packages- the list of packages to scan for plugins- Since:
- 2.1
-
-