org.apache.log4j.plugins
Class PluginSkeleton
java.lang.Object
|
+--org.apache.log4j.spi.ComponentBase
|
+--org.apache.log4j.plugins.PluginSkeleton
- All Implemented Interfaces:
- Component, OptionHandler, Plugin
- Direct Known Subclasses:
- Receiver
- public abstract class PluginSkeleton
- extends ComponentBase
- implements Plugin
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
- Since:
- 1.3
- Author:
- Mark Womack , Paul Smith
Field Summary |
protected boolean |
active
|
protected String |
name
Name of this plugin. |
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.plugins.Plugin |
shutdown |
name
protected String name
- Name of this plugin.
active
protected boolean active
PluginSkeleton
public PluginSkeleton()
getName
public String getName()
- Gets the name of the plugin.
- Specified by:
getName
in interface Plugin
- Returns:
- String the name of the plugin.
setName
public void setName(String name)
- Sets the name of the plugin and notifies PropertyChangeListeners of the change
- Specified by:
setName
in interface Plugin
- Parameters:
name
- the name of the plugin to set.
getLoggerRepository
public LoggerRepository getLoggerRepository()
- Gets the logger repository for this plugin.
- Specified by:
getLoggerRepository
in interface Plugin
- Overrides:
getLoggerRepository
in class ComponentBase
- Returns:
- LoggerRepository the logger repository this plugin will affect.
setLoggerRepository
public void setLoggerRepository(LoggerRepository repository)
- Sets the logger repository used by this plugin and notifies an relevant PropertyChangeListeners registered. This
repository will be used by the plugin functionality.
- Specified by:
setLoggerRepository
in interface Plugin
- Overrides:
setLoggerRepository
in class ComponentBase
- Parameters:
repository
- the logger repository that this plugin should affect.
isActive
public boolean isActive()
- Returns whether this plugin is Active or not
- Specified by:
isActive
in interface Plugin
- Returns:
- true/false
isEquivalent
public boolean isEquivalent(Plugin testPlugin)
- Returns true if the plugin has the same name and logger repository as the
testPlugin passed in.
- Specified by:
isEquivalent
in interface Plugin
- Parameters:
testPlugin
- The plugin to test equivalency against.- Returns:
- Returns true if testPlugin is considered to be equivalent.
addPropertyChangeListener
public final void addPropertyChangeListener(PropertyChangeListener listener)
- Description copied from interface:
Plugin
- Adds a PropertyChangeListener that will be notified of all property
changes.
- Specified by:
addPropertyChangeListener
in interface Plugin
- Parameters:
listener
-
addPropertyChangeListener
public final void addPropertyChangeListener(String propertyName,
PropertyChangeListener listener)
- Description copied from interface:
Plugin
- Adds a PropertyChangeListener to this instance which is
notified only by changes of the property with name propertyName
- Specified by:
addPropertyChangeListener
in interface Plugin
- Parameters:
propertyName
- listener
-
removePropertyChangeListener
public final void removePropertyChangeListener(PropertyChangeListener listener)
- Description copied from interface:
Plugin
- Removes a specific PropertyChangeListener from this instances
registry that has been mapped to be notified of all property
changes.
- Specified by:
removePropertyChangeListener
in interface Plugin
- Parameters:
listener
-
removePropertyChangeListener
public final void removePropertyChangeListener(String propertyName,
PropertyChangeListener listener)
- Description copied from interface:
Plugin
- Removes a specific PropertyChangeListener from this instance's
registry which has been previously registered to be notified
of only a specific property change.
- Specified by:
removePropertyChangeListener
in interface Plugin
- Parameters:
propertyName
- listener
-
firePropertyChange
protected final void firePropertyChange(PropertyChangeEvent evt)
- Parameters:
evt
-
firePropertyChange
protected final void firePropertyChange(String propertyName,
boolean oldValue,
boolean newValue)
- Parameters:
propertyName
- oldValue
- newValue
-
firePropertyChange
protected final void firePropertyChange(String propertyName,
int oldValue,
int newValue)
- Parameters:
propertyName
- oldValue
- newValue
-
firePropertyChange
protected final void firePropertyChange(String propertyName,
Object oldValue,
Object newValue)
- Parameters:
propertyName
- oldValue
- newValue
-
Copyright © 2000-2006 Apache Software Foundation.
Licensed under the Apache License, Version 2.0.