Log4j 1.3alpha-6

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  java.lang.String name
          Name of this plugin.
 
Fields inherited from class org.apache.log4j.spi.ComponentBase
repository
 
Constructor Summary
PluginSkeleton()
           
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Adds a PropertyChangeListener that will be notified of all property changes.
 void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
          Adds a PropertyChangeListener to this instance which is notified only by changes of the property with name propertyName
protected  void firePropertyChange(java.beans.PropertyChangeEvent evt)
           
protected  void firePropertyChange(java.lang.String propertyName, boolean oldValue, boolean newValue)
           
protected  void firePropertyChange(java.lang.String propertyName, int oldValue, int newValue)
           
protected  void firePropertyChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)
           
 LoggerRepository getLoggerRepository()
          Gets the logger repository for this plugin.
 java.lang.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(java.beans.PropertyChangeListener listener)
          Removes a specific PropertyChangeListener from this instances registry that has been mapped to be notified of all property changes.
 void removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
          Removes a specific PropertyChangeListener from this instance's registry which has been previously registered to be notified of only a specific property change.
 void setLoggerRepository(LoggerRepository repository)
          Sets the logger repository used by this plugin and notifies an relevant PropertyChangeListeners registered.
 void setName(java.lang.String name)
          Sets the name of the plugin and notifies PropertyChangeListeners of the change
 
Methods inherited from class org.apache.log4j.spi.ComponentBase
getLogger
 
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
 
Methods inherited from interface org.apache.log4j.spi.OptionHandler
activateOptions
 

Field Detail

name

protected java.lang.String name
Name of this plugin.


active

protected boolean active
Constructor Detail

PluginSkeleton

public PluginSkeleton()
Method Detail

getName

public java.lang.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(java.lang.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
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(java.beans.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(java.lang.String propertyName,
                                            java.beans.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(java.beans.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(java.lang.String propertyName,
                                               java.beans.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(java.beans.PropertyChangeEvent evt)
Parameters:
evt -

firePropertyChange

protected final void firePropertyChange(java.lang.String propertyName,
                                        boolean oldValue,
                                        boolean newValue)
Parameters:
propertyName -
oldValue -
newValue -

firePropertyChange

protected final void firePropertyChange(java.lang.String propertyName,
                                        int oldValue,
                                        int newValue)
Parameters:
propertyName -
oldValue -
newValue -

firePropertyChange

protected final void firePropertyChange(java.lang.String propertyName,
                                        java.lang.Object oldValue,
                                        java.lang.Object newValue)
Parameters:
propertyName -
oldValue -
newValue -

Log4j 1.3alpha-6

Copyright 2000-2005 Apache Software Foundation.