Class PluginManager


  • public class PluginManager
    extends Object
    Loads and manages all the plugins.
    • Constructor Detail

      • PluginManager

        public PluginManager​(String category)
        Constructs a PluginManager for the plugin category name given.
        Parameters:
        category - The plugin category name.
    • Method Detail

      • main

        @Deprecated
        public static void main​(String[] args)
        Deprecated.
        Use PluginProcessor instead. To do so, simply include log4j-core in your dependencies and make sure annotation processing is not disabled. By default, supported Java compilers will automatically use that plugin processor provided log4j-core is on the classpath.
        Process annotated plugins.
      • 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. Ignored if null or empty.
      • addPackages

        public static void addPackages​(Collection<String> packages)
        Adds a list of package names to be scanned for plugins. Convenience method for addPackage(String).
        Parameters:
        packages - collection of package names to add. Empty and null package names are ignored.
      • 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​(List<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