org.apache.logging.log4j.core.config.plugins
Class PluginManager

java.lang.Object
  extended by org.apache.logging.log4j.core.config.plugins.PluginManager

public class PluginManager
extends Object

Component that loads and manages all the plugins.


Nested Class Summary
static class PluginManager.PluginTest
          A Test that checks to see if each class is annotated with a specific annotation.
 
Constructor Summary
PluginManager(String type)
          Constructor that takes only a type name.
PluginManager(String type, Class clazz)
          Constructor that takes a type name and a Class.
 
Method Summary
static void addPackage(String p)
          Adds a package name to be scanned for plugins.
 void collectPlugins()
          Locates all the plugins.
 void collectPlugins(boolean preLoad, String pkgs)
          Collects plugins, optionally obtaining them from a preload map.
 Map<String,PluginType> getPlugins()
          Returns all the matching plugins.
 PluginType getPluginType(String name)
          Returns the type of a specified plugin.
static void main(String[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PluginManager

public PluginManager(String type)
Constructor that takes only a type name.

Parameters:
type - The type name.

PluginManager

public PluginManager(String type,
                     Class clazz)
Constructor that takes a type name and a Class.

Parameters:
type - The type that must be matched.
clazz - The Class each match must be an instance of.
Method Detail

main

public static void main(String[] args)
                 throws Exception
Throws:
Exception

addPackage

public static void addPackage(String p)
Adds a package name to be scanned for plugins. Must be invoked prior to plugins being collected.

Parameters:
p - The package name.

getPluginType

public PluginType getPluginType(String name)
Returns the type of a specified plugin.

Parameters:
name - The name of the plugin.
Returns:
The plugin's type.

getPlugins

public Map<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(boolean preLoad,
                           String pkgs)
Collects plugins, optionally obtaining them from a preload map.

Parameters:
preLoad - if true, plugins will be obtained from the preload map.
pkgs - A comma separated list of package names to scan for plugins. If null the default Log4j package name will be used.


Copyright © 1999-2012 Apache Software Foundation. All Rights Reserved. Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, and the Apache Logging project logo are trademarks of The Apache Software Foundation.