Class PluginRegistry
java.lang.Object
org.apache.log4j.plugins.PluginRegistry
This is a registry for Plugin instances. It provides methods to
start and stop plugin objects individually and to stop all
plugins for a repository.
- Author:
- Mark Womack, Paul Smith
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a plugin to the plugin registry.voidAdds a PluginListener to this registry to be notified of PluginEvents.Get logger repository.Returns all the plugins for a given repository.getPlugins(Class pluginClass) Returns all the plugins for a given repository that are instances of a certain class.booleanpluginNameExists(String name) Returns true if the specified name is already taken by an existing Plugin registered within the scope of the specified LoggerRepository.voidRemoves a particular PluginListener from this registry such that it will no longer be notified of PluginEvents.voidStops all plugins in the given logger repository.stopPlugin(String pluginName) Stops a plugin by plugin name and repository.
-
Constructor Details
-
PluginRegistry
Creates a new instance.- Parameters:
repository- logger repository.
-
-
Method Details
-
getLoggerRepository
-
pluginNameExists
Returns true if the specified name is already taken by an existing Plugin registered within the scope of the specified LoggerRepository.- Parameters:
name- The name to check the repository for- Returns:
- true if the name is already in use, otherwise false
-
addPlugin
Adds a plugin to the plugin registry. If a plugin with the same name exists already, it is shutdown and removed.- Parameters:
plugin- the plugin to add.
-
getPlugins
-
getPlugins
-
stopPlugin
-
stopAllPlugins
public void stopAllPlugins()Stops all plugins in the given logger repository. -
addPluginListener
Adds a PluginListener to this registry to be notified of PluginEvents.- Parameters:
l- PluginListener to add to this registry
-
removePluginListener
Removes a particular PluginListener from this registry such that it will no longer be notified of PluginEvents.- Parameters:
l- PluginListener to remove
-