Package org.apache.log4j.plugins
Class PluginSkeleton
java.lang.Object
org.apache.log4j.spi.ComponentBase
org.apache.log4j.plugins.PluginSkeleton
- Direct Known Subclasses:
Receiver
A convienent abstract class for plugin subclasses that implements
the basic methods of the Plugin interface. Subclasses are required
to implement the isActive(), activateOptions(), and shutdown()
methods.
Developers are not required to subclass PluginSkeleton to develop their own plugins (they are only required to implement the Plugin interface), but it provides a convenient base class to start from.
Contributors: Nicko Cadell-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
Active state of plugin.protected String
Name of this plugin.private PropertyChangeSupport
This is a delegate that does all the PropertyChangeListener support.Fields inherited from class org.apache.log4j.spi.ComponentBase
repository
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal void
Add property change listener.final void
addPropertyChangeListener
(String propertyName, PropertyChangeListener listener) Add property change listener for one property only.protected final void
Fire a property change event to appropriate listeners.protected final void
firePropertyChange
(String propertyName, boolean oldValue, boolean newValue) Fire property change event to appropriate listeners.protected final void
firePropertyChange
(String propertyName, int oldValue, int newValue) Fire property change event to appropriate listeners.protected final void
firePropertyChange
(String propertyName, Object oldValue, Object newValue) Fire property change event to appropriate listeners.org.apache.log4j.spi.LoggerRepository
Gets the logger repository for this plugin.getName()
Gets the name of the plugin.boolean
isActive()
Returns whether this plugin is Active or not.boolean
isEquivalent
(Plugin testPlugin) Returns true if the plugin has the same name and logger repository as the testPlugin passed in.final void
Remove property change listener.final void
removePropertyChangeListener
(String propertyName, PropertyChangeListener listener) Remove property change listener on a specific property.void
setLoggerRepository
(org.apache.log4j.spi.LoggerRepository repository) Sets the logger repository used by this plugin and notifies a relevant PropertyChangeListeners registered.void
Sets the name of the plugin and notifies PropertyChangeListeners of the change.Methods inherited from class org.apache.log4j.spi.ComponentBase
getLogger, getNonFloodingLogger, resetErrorCount
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.log4j.spi.OptionHandler
activateOptions
-
Field Details
-
name
Name of this plugin. -
active
protected boolean activeActive state of plugin. -
propertySupport
This is a delegate that does all the PropertyChangeListener support.
-
-
Constructor Details
-
PluginSkeleton
protected PluginSkeleton()Construct new instance.
-
-
Method Details
-
getName
Gets the name of the plugin. -
setName
Sets the name of the plugin and notifies PropertyChangeListeners of the change. -
getLoggerRepository
public org.apache.log4j.spi.LoggerRepository getLoggerRepository()Gets the logger repository for this plugin.- Specified by:
getLoggerRepository
in interfacePlugin
- Overrides:
getLoggerRepository
in classComponentBase
- Returns:
- LoggerRepository the logger repository this plugin will affect.
-
setLoggerRepository
public void setLoggerRepository(org.apache.log4j.spi.LoggerRepository repository) Sets the logger repository used by this plugin and notifies a relevant PropertyChangeListeners registered. This repository will be used by the plugin functionality.- Specified by:
setLoggerRepository
in interfaceComponent
- Specified by:
setLoggerRepository
in interfacePlugin
- Overrides:
setLoggerRepository
in classComponentBase
- Parameters:
repository
- the logger repository that this plugin should affect.
-
isActive
public boolean isActive()Returns whether this plugin is Active or not. -
isEquivalent
Returns true if the plugin has the same name and logger repository as the testPlugin passed in.- Specified by:
isEquivalent
in interfacePlugin
- Parameters:
testPlugin
- The plugin to test equivalency against.- Returns:
- Returns true if testPlugin is considered to be equivalent.
-
addPropertyChangeListener
Add property change listener.- Specified by:
addPropertyChangeListener
in interfacePlugin
- Parameters:
listener
- listener.
-
addPropertyChangeListener
Add property change listener for one property only.- Specified by:
addPropertyChangeListener
in interfacePlugin
- Parameters:
propertyName
- property name.listener
- listener.
-
removePropertyChangeListener
Remove property change listener.- Specified by:
removePropertyChangeListener
in interfacePlugin
- Parameters:
listener
- listener.
-
removePropertyChangeListener
public final void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) Remove property change listener on a specific property.- Specified by:
removePropertyChangeListener
in interfacePlugin
- Parameters:
propertyName
- property name.listener
- listener.
-
firePropertyChange
Fire a property change event to appropriate listeners.- Parameters:
evt
- change event.
-
firePropertyChange
Fire property change event to appropriate listeners.- Parameters:
propertyName
- property name.oldValue
- old value.newValue
- new value.
-
firePropertyChange
Fire property change event to appropriate listeners.- Parameters:
propertyName
- property name.oldValue
- old value.newValue
- new value.
-
firePropertyChange
Fire property change event to appropriate listeners.- Parameters:
propertyName
- property name.oldValue
- old value.newValue
- new value.
-