public abstract class PluginSkeleton extends ComponentBase implements Plugin
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 CadellModifier and Type | Field and Description |
---|---|
protected boolean |
active
Active state of plugin.
|
protected String |
name
Name of this plugin.
|
repository
Modifier | Constructor and Description |
---|---|
protected |
PluginSkeleton()
Construct new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeListener(PropertyChangeListener listener)
Add property change listener.
|
void |
addPropertyChangeListener(String propertyName,
PropertyChangeListener listener)
Add property change listener for one property only.
|
protected void |
firePropertyChange(PropertyChangeEvent evt)
Fire a property change event to appropriate listeners.
|
protected void |
firePropertyChange(String propertyName,
boolean oldValue,
boolean newValue)
Fire property change event to appropriate listeners.
|
protected void |
firePropertyChange(String propertyName,
int oldValue,
int newValue)
Fire property change event to appropriate listeners.
|
protected void |
firePropertyChange(String propertyName,
Object oldValue,
Object newValue)
Fire property change event to appropriate listeners.
|
org.apache.log4j.spi.LoggerRepository |
getLoggerRepository()
Gets the logger repository for this plugin.
|
String |
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.
|
void |
removePropertyChangeListener(PropertyChangeListener listener)
Remove property change listener.
|
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 |
setName(String newName)
Sets the name of the plugin and notifies
PropertyChangeListeners of the change.
|
getLogger, getNonFloodingLogger, resetErrorCount
protected String name
protected boolean active
public String getName()
public void setName(String newName)
public org.apache.log4j.spi.LoggerRepository getLoggerRepository()
getLoggerRepository
in interface Plugin
getLoggerRepository
in class ComponentBase
public void setLoggerRepository(org.apache.log4j.spi.LoggerRepository repository)
setLoggerRepository
in interface Plugin
setLoggerRepository
in interface Component
setLoggerRepository
in class ComponentBase
repository
- the logger repository that this plugin should affect.public boolean isActive()
public boolean isEquivalent(Plugin testPlugin)
isEquivalent
in interface Plugin
testPlugin
- The plugin to test equivalency against.public final void addPropertyChangeListener(PropertyChangeListener listener)
addPropertyChangeListener
in interface Plugin
listener
- listener.public final void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
addPropertyChangeListener
in interface Plugin
propertyName
- property name.listener
- listener.public final void removePropertyChangeListener(PropertyChangeListener listener)
removePropertyChangeListener
in interface Plugin
listener
- listener.public final void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
removePropertyChangeListener
in interface Plugin
propertyName
- property name.listener
- listener.protected final void firePropertyChange(PropertyChangeEvent evt)
evt
- change event.protected final void firePropertyChange(String propertyName, boolean oldValue, boolean newValue)
propertyName
- property name.oldValue
- old value.newValue
- new value.protected final void firePropertyChange(String propertyName, int oldValue, int newValue)
propertyName
- property name.oldValue
- old value.newValue
- new value.Copyright © 2002-2017 Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache Chainsaw, Chainsaw, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.