Added: logging/site/trunk/docs/log4j/companions/component/xref/org/apache/log4j/plugins/PluginEvent.html URL: http://svn.apache.org/viewvc/logging/site/trunk/docs/log4j/companions/component/xref/org/apache/log4j/plugins/PluginEvent.html?view=auto&rev=558355 ============================================================================== --- logging/site/trunk/docs/log4j/companions/component/xref/org/apache/log4j/plugins/PluginEvent.html (added) +++ logging/site/trunk/docs/log4j/companions/component/xref/org/apache/log4j/plugins/PluginEvent.html Sat Jul 21 10:20:56 2007 @@ -0,0 +1,60 @@ + + + +PluginEvent xref + + + +
View Javadoc
+
+1   /*
+2    * Licensed to the Apache Software Foundation (ASF) under one or more
+3    * contributor license agreements.  See the NOTICE file distributed with
+4    * this work for additional information regarding copyright ownership.
+5    * The ASF licenses this file to You under the Apache License, Version 2.0
+6    * (the "License"); you may not use this file except in compliance with
+7    * the License.  You may obtain a copy of the License at
+8    *
+9    *      http://www.apache.org/licenses/LICENSE-2.0
+10   *
+11   * Unless required by applicable law or agreed to in writing, software
+12   * distributed under the License is distributed on an "AS IS" BASIS,
+13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+14   * See the License for the specific language governing permissions and
+15   * limitations under the License.
+16   */
+17  
+18  package org.apache.log4j.plugins;
+19  
+20  import java.util.EventObject;
+21  
+22  
+23  /***
+24   * All Plugin events are encapsulated in this class, which
+25   * simply contains the source Plugin, but may in future include more
+26   * information.
+27   *
+28   * @author Paul Smith
+29   */
+30  public class PluginEvent extends EventObject {
+31      /***
+32       * @param source The source plugin of the event
+33       */
+34      PluginEvent(final Plugin source) {
+35          super(source);
+36      }
+37  
+38      /***
+39       * Returns the source Plugin of this event, which is simple
+40       * the getSource() method casted to Plugin for convenience.
+41       *
+42       * @return Plugin source of this event
+43       */
+44      public Plugin getPlugin() {
+45          return (Plugin) getSource();
+46    }
+47  }
+
+
+ + Propchange: logging/site/trunk/docs/log4j/companions/component/xref/org/apache/log4j/plugins/PluginEvent.html ------------------------------------------------------------------------------ svn:mime-type = text/html Added: logging/site/trunk/docs/log4j/companions/component/xref/org/apache/log4j/plugins/PluginListener.html URL: http://svn.apache.org/viewvc/logging/site/trunk/docs/log4j/companions/component/xref/org/apache/log4j/plugins/PluginListener.html?view=auto&rev=558355 ============================================================================== --- logging/site/trunk/docs/log4j/companions/component/xref/org/apache/log4j/plugins/PluginListener.html (added) +++ logging/site/trunk/docs/log4j/companions/component/xref/org/apache/log4j/plugins/PluginListener.html Sat Jul 21 10:20:56 2007 @@ -0,0 +1,56 @@ + + + +PluginListener xref + + + +
View Javadoc
+
+1   /*
+2    * Licensed to the Apache Software Foundation (ASF) under one or more
+3    * contributor license agreements.  See the NOTICE file distributed with
+4    * this work for additional information regarding copyright ownership.
+5    * The ASF licenses this file to You under the Apache License, Version 2.0
+6    * (the "License"); you may not use this file except in compliance with
+7    * the License.  You may obtain a copy of the License at
+8    *
+9    *      http://www.apache.org/licenses/LICENSE-2.0
+10   *
+11   * Unless required by applicable law or agreed to in writing, software
+12   * distributed under the License is distributed on an "AS IS" BASIS,
+13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+14   * See the License for the specific language governing permissions and
+15   * limitations under the License.
+16   */
+17  
+18  /*
+19   */
+20  package org.apache.log4j.plugins;
+21  
+22  import java.util.EventListener;
+23  
+24  
+25  /***
+26   * PluginListeners are notified when plugins are started or stopped
+27   * by the PluginRegistry.
+28   *
+29   * @author Paul Smith (psmith@apache.org)
+30   */
+31  public interface PluginListener extends EventListener {
+32      /***
+33       * Notification that plugin has started.
+34       * @param e event
+35       */
+36    void pluginStarted(PluginEvent e);
+37  
+38      /***
+39       * Notification that plugin has stopped.
+40       * @param e event
+41       */
+42    void pluginStopped(PluginEvent e);
+43  }
+
+
+ + Propchange: logging/site/trunk/docs/log4j/companions/component/xref/org/apache/log4j/plugins/PluginListener.html ------------------------------------------------------------------------------ svn:mime-type = text/html Added: logging/site/trunk/docs/log4j/companions/component/xref/org/apache/log4j/plugins/PluginRegistry.html URL: http://svn.apache.org/viewvc/logging/site/trunk/docs/log4j/companions/component/xref/org/apache/log4j/plugins/PluginRegistry.html?view=auto&rev=558355 ============================================================================== --- logging/site/trunk/docs/log4j/companions/component/xref/org/apache/log4j/plugins/PluginRegistry.html (added) +++ logging/site/trunk/docs/log4j/companions/component/xref/org/apache/log4j/plugins/PluginRegistry.html Sat Jul 21 10:20:56 2007 @@ -0,0 +1,317 @@ + + + +PluginRegistry xref + + + +
View Javadoc
+
+1   /*
+2    * Licensed to the Apache Software Foundation (ASF) under one or more
+3    * contributor license agreements.  See the NOTICE file distributed with
+4    * this work for additional information regarding copyright ownership.
+5    * The ASF licenses this file to You under the Apache License, Version 2.0
+6    * (the "License"); you may not use this file except in compliance with
+7    * the License.  You may obtain a copy of the License at
+8    *
+9    *      http://www.apache.org/licenses/LICENSE-2.0
+10   *
+11   * Unless required by applicable law or agreed to in writing, software
+12   * distributed under the License is distributed on an "AS IS" BASIS,
+13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+14   * See the License for the specific language governing permissions and
+15   * limitations under the License.
+16   */
+17  package org.apache.log4j.plugins;
+18  
+19  import java.util.ArrayList;
+20  import java.util.Collections;
+21  import java.util.HashMap;
+22  import java.util.Iterator;
+23  import java.util.List;
+24  import java.util.Map;
+25  
+26  import org.apache.log4j.spi.LoggerRepository;
+27  import org.apache.log4j.spi.LoggerRepositoryEx;
+28  import org.apache.log4j.spi.LoggerRepositoryEventListener;
+29  
+30  
+31  /***
+32   * This is a registry for Plugin instances. It provides methods to
+33   * start and stop plugin objects individually and to stop all
+34   * plugins for a repository.
+35   *
+36   * @author Mark Womack
+37   * @author Paul Smith
+38   * @since 1.3
+39   */
+40  public final class PluginRegistry {
+41      /***
+42       * The pluginMap is keyed by plugin name and contains plugins as values.
+43       * key=plugin.getName, value=plugin
+44       */
+45      private final Map pluginMap;
+46      /***
+47       * Logger repository.
+48       */
+49      private final LoggerRepositoryEx loggerRepository;
+50  
+51      /***
+52       * the listener used to listen for repository events.
+53       */
+54      private final RepositoryListener listener = new RepositoryListener();
+55      /***
+56       * List of listeners.
+57       */
+58      private final List listenerList =
+59              Collections.synchronizedList(new ArrayList());
+60  
+61      /***
+62       * Creates a new instance.
+63       * @param repository logger repository.
+64       */
+65      public PluginRegistry(final LoggerRepositoryEx repository) {
+66          super();
+67          pluginMap = new HashMap();
+68          this.loggerRepository = repository;
+69          this.loggerRepository.addLoggerRepositoryEventListener(listener);
+70      }
+71  
+72      /***
+73       * Get logger repository.
+74       * @return logger repository.
+75       */
+76      public LoggerRepositoryEx getLoggerRepository() {
+77          return loggerRepository;
+78      }
+79  
+80  
+81      /***
+82       * Returns true if the specified name is already taken by
+83       * an existing Plugin registered within the scope of the specified
+84       * LoggerRepository.
+85       *
+86       * @param name The name to check the repository for
+87       * @return true if the name is already in use, otherwise false
+88       */
+89      public boolean pluginNameExists(final String name) {
+90          synchronized (pluginMap) {
+91              return pluginMap.containsKey(name);
+92          }
+93      }
+94  
+95  
+96      /***
+97       * Adds a plugin to the plugin registry.
+98       * If a plugin with the same name exists
+99       * already, it is shutdown and removed.
+100      *
+101      * @param plugin the plugin to add.
+102      */
+103     public void addPlugin(final Plugin plugin) {
+104         // put plugin into the repository's reciever map
+105         synchronized (pluginMap) {
+106             String name = plugin.getName();
+107 
+108             // make sure the plugin has reference to repository
+109             plugin.setLoggerRepository(getLoggerRepository());
+110 
+111             Plugin existingPlugin = (Plugin) pluginMap.get(name);
+112             if (existingPlugin != null) {
+113                 existingPlugin.shutdown();
+114             }
+115 
+116             // put the new plugin into the map
+117             pluginMap.put(name, plugin);
+118             firePluginStarted(plugin);
+119         }
+120     }
+121 
+122 
+123     /***
+124      * Calls the pluginStarted method on every registered PluginListener.
+125      *
+126      * @param plugin The plugin that has been started.
+127      */
+128     private void firePluginStarted(final Plugin plugin) {
+129         PluginEvent e = null;
+130         synchronized (listenerList) {
+131             for (Iterator iter = listenerList.iterator(); iter.hasNext();) {
+132                 PluginListener l = (PluginListener) iter.next();
+133                 if (e == null) {
+134                     e = new PluginEvent(plugin);
+135                 }
+136                 l.pluginStarted(e);
+137             }
+138         }
+139     }
+140 
+141 
+142     /***
+143      * Calls the pluginStopped method for every registered PluginListner.
+144      *
+145      * @param plugin The plugin that has been stopped.
+146      */
+147     private void firePluginStopped(final Plugin plugin) {
+148         PluginEvent e = null;
+149         synchronized (listenerList) {
+150             for (Iterator iter = listenerList.iterator(); iter.hasNext();) {
+151                 PluginListener l = (PluginListener) iter.next();
+152                 if (e == null) {
+153                     e = new PluginEvent(plugin);
+154                 }
+155                 l.pluginStopped(e);
+156             }
+157         }
+158     }
+159 
+160 
+161     /***
+162      * Returns all the plugins for a given repository.
+163      *
+164      * @return List list of plugins from the repository.
+165      */
+166     public List getPlugins() {
+167         synchronized (pluginMap) {
+168             List pluginList = new ArrayList(pluginMap.size());
+169             Iterator iter = pluginMap.values().iterator();
+170 
+171             while (iter.hasNext()) {
+172                 pluginList.add(iter.next());
+173             }
+174             return pluginList;
+175         }
+176     }
+177 
+178 
+179     /***
+180      * Returns all the plugins for a given repository that are instances
+181      * of a certain class.
+182      *
+183      * @param pluginClass the class the plugin must implement to be selected.
+184      * @return List list of plugins from the repository.
+185      */
+186     public List getPlugins(final Class pluginClass) {
+187         synchronized (pluginMap) {
+188             List pluginList = new ArrayList(pluginMap.size());
+189             Iterator iter = pluginMap.values().iterator();
+190 
+191             while (iter.hasNext()) {
+192                 Object plugin = iter.next();
+193 
+194                 if (pluginClass.isInstance(plugin)) {
+195                     pluginList.add(plugin);
+196                 }
+197             }
+198             return pluginList;
+199         }
+200     }
+201 
+202 
+203     /***
+204      * Stops a plugin by plugin name and repository.
+205      *
+206      * @param pluginName the name of the plugin to stop.
+207      * @return Plugin the plugin, if stopped, or null if the
+208      *         the plugin was not found in the registry.
+209      */
+210     public Plugin stopPlugin(final String pluginName) {
+211         synchronized (pluginMap) {
+212             Plugin plugin = (Plugin) pluginMap.get(pluginName);
+213 
+214             if (plugin == null) {
+215                 return null;
+216             }
+217 
+218             // shutdown the plugin
+219             plugin.shutdown();
+220 
+221             // remove it from the plugin map
+222             pluginMap.remove(pluginName);
+223             firePluginStopped(plugin);
+224 
+225             // return it for future use
+226             return plugin;
+227         }
+228     }
+229 
+230     /***
+231      * Stops all plugins in the given logger repository.
+232      */
+233     public void stopAllPlugins() {
+234         synchronized (pluginMap) {
+235             // remove the listener for this repository
+236             loggerRepository.removeLoggerRepositoryEventListener(listener);
+237 
+238             Iterator iter = pluginMap.values().iterator();
+239 
+240             while (iter.hasNext()) {
+241                 Plugin plugin = (Plugin) iter.next();
+242                 plugin.shutdown();
+243                 firePluginStopped(plugin);
+244             }
+245         }
+246     }
+247 
+248 
+249     /***
+250      * Adds a PluginListener to this registry to be notified
+251      * of PluginEvents.
+252      *
+253      * @param l PluginListener to add to this registry
+254      */
+255     public void addPluginListener(final PluginListener l) {
+256         listenerList.add(l);
+257     }
+258 
+259 
+260     /***
+261      * Removes a particular PluginListener from this registry
+262      * such that it will no longer be notified of PluginEvents.
+263      *
+264      * @param l PluginListener to remove
+265      */
+266     public void removePluginListener(final PluginListener l) {
+267         listenerList.remove(l);
+268     }
+269 
+270     /***
+271      * Internal class used to handle listener events from repositories.
+272      */
+273     private class RepositoryListener implements LoggerRepositoryEventListener {
+274         /***
+275          * Stops all plugins associated with the repository being reset.
+276          *
+277          * @param repository the repository that was reset.
+278          */
+279         public void configurationResetEvent(final LoggerRepository repository) {
+280             PluginRegistry.this.stopAllPlugins();
+281         }
+282 
+283 
+284         /***
+285          * Called when the repository configuration is changed.
+286          *
+287          * @param repository the repository that was changed.
+288          */
+289         public void configurationChangedEvent(
+290                 final LoggerRepository repository) {
+291             // do nothing with this event
+292         }
+293 
+294 
+295         /***
+296          * Stops all plugins associated with the repository being shutdown.
+297          *
+298          * @param repository the repository being shutdown.
+299          */
+300         public void shutdownEvent(final LoggerRepository repository) {
+301             PluginRegistry.this.stopAllPlugins();
+302         }
+303     }
+304 }
+
+
+ + Propchange: logging/site/trunk/docs/log4j/companions/component/xref/org/apache/log4j/plugins/PluginRegistry.html ------------------------------------------------------------------------------ svn:mime-type = text/html Added: logging/site/trunk/docs/log4j/companions/component/xref/org/apache/log4j/plugins/PluginSkeleton.html URL: http://svn.apache.org/viewvc/logging/site/trunk/docs/log4j/companions/component/xref/org/apache/log4j/plugins/PluginSkeleton.html?view=auto&rev=558355 ============================================================================== --- logging/site/trunk/docs/log4j/companions/component/xref/org/apache/log4j/plugins/PluginSkeleton.html (added) +++ logging/site/trunk/docs/log4j/companions/component/xref/org/apache/log4j/plugins/PluginSkeleton.html Sat Jul 21 10:20:56 2007 @@ -0,0 +1,236 @@ + + + +PluginSkeleton xref + + + +
View Javadoc
+
+1   /*
+2    * Licensed to the Apache Software Foundation (ASF) under one or more
+3    * contributor license agreements.  See the NOTICE file distributed with
+4    * this work for additional information regarding copyright ownership.
+5    * The ASF licenses this file to You under the Apache License, Version 2.0
+6    * (the "License"); you may not use this file except in compliance with
+7    * the License.  You may obtain a copy of the License at
+8    *
+9    *      http://www.apache.org/licenses/LICENSE-2.0
+10   *
+11   * Unless required by applicable law or agreed to in writing, software
+12   * distributed under the License is distributed on an "AS IS" BASIS,
+13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+14   * See the License for the specific language governing permissions and
+15   * limitations under the License.
+16   */
+17  
+18  package org.apache.log4j.plugins;
+19  
+20  import org.apache.log4j.spi.ComponentBase;
+21  import org.apache.log4j.spi.LoggerRepository;
+22  
+23  import java.beans.PropertyChangeEvent;
+24  import java.beans.PropertyChangeListener;
+25  import java.beans.PropertyChangeSupport;
+26  
+27  
+28  /***
+29   * A convienent abstract class for plugin subclasses that implements
+30   * the basic methods of the Plugin interface. Subclasses are required
+31   * to implement the isActive(), activateOptions(), and shutdown()
+32   * methods.
+33   * <p/>
+34   * <p>Developers are not required to subclass PluginSkeleton to
+35   * develop their own plugins (they are only required to implement the
+36   * Plugin interface), but it provides a convenient base class to start
+37   * from.
+38   * <p/>
+39   * Contributors: Nicko Cadell
+40   *
+41   * @author Mark Womack (mwomack@apache.org)
+42   * @author Paul Smith (psmith@apache.org)
+43   * @since 1.3
+44   */
+45  public abstract class PluginSkeleton extends ComponentBase implements Plugin {
+46      /***
+47       * Name of this plugin.
+48       */
+49      protected String name = "";
+50  
+51      /***
+52       * Active state of plugin.
+53       */
+54      protected boolean active;
+55  
+56      /***
+57       * This is a delegate that does all the PropertyChangeListener
+58       * support.
+59       */
+60      private PropertyChangeSupport propertySupport =
+61              new PropertyChangeSupport(this);
+62  
+63      /***
+64       * Construct new instance.
+65       */
+66      protected PluginSkeleton() {
+67          super();
+68      }
+69  
+70      /***
+71       * Gets the name of the plugin.
+72       *
+73       * @return String the name of the plugin.
+74       */
+75      public String getName() {
+76          return name;
+77      }
+78  
+79      /***
+80       * Sets the name of the plugin and notifies
+81       * PropertyChangeListeners of the change.
+82       *
+83       * @param newName the name of the plugin to set.
+84       */
+85      public void setName(final String newName) {
+86          String oldName = this.name;
+87          this.name = newName;
+88          propertySupport.firePropertyChange("name", oldName, this.name);
+89      }
+90  
+91      /***
+92       * Gets the logger repository for this plugin.
+93       *
+94       * @return LoggerRepository the logger repository this plugin will affect.
+95       */
+96      public LoggerRepository getLoggerRepository() {
+97          return repository;
+98      }
+99  
+100     /***
+101      * Sets the logger repository used by this plugin and notifies a
+102      * relevant PropertyChangeListeners registered. This
+103      * repository will be used by the plugin functionality.
+104      *
+105      * @param repository the logger repository that this plugin should affect.
+106      */
+107     public void setLoggerRepository(final LoggerRepository repository) {
+108         Object oldValue = this.repository;
+109         this.repository = repository;
+110         firePropertyChange("loggerRepository", oldValue, this.repository);
+111     }
+112 
+113     /***
+114      * Returns whether this plugin is Active or not.
+115      *
+116      * @return true/false
+117      */
+118     public synchronized boolean isActive() {
+119         return active;
+120     }
+121 
+122     /***
+123      * Returns true if the plugin has the same name and logger repository as the
+124      * testPlugin passed in.
+125      *
+126      * @param testPlugin The plugin to test equivalency against.
+127      * @return Returns true if testPlugin is considered to be equivalent.
+128      */
+129     public boolean isEquivalent(final Plugin testPlugin) {
+130         return (repository == testPlugin.getLoggerRepository())
+131                 && ((this.name == null && testPlugin.getName() == null)
+132                 || (this.name != null
+133                            && name.equals(testPlugin.getName())))
+134                 && this.getClass().equals(testPlugin.getClass());
+135     }
+136 
+137     /***
+138      * Add property change listener.
+139      * @param listener listener.
+140      */
+141     public final void addPropertyChangeListener(
+142             final PropertyChangeListener listener) {
+143         propertySupport.addPropertyChangeListener(listener);
+144     }
+145 
+146     /***
+147      * Add property change listener for one property only.
+148      * @param propertyName property name.
+149      * @param listener listener.
+150      */
+151     public final void addPropertyChangeListener(
+152             final String propertyName,
+153             final PropertyChangeListener listener) {
+154         propertySupport.addPropertyChangeListener(propertyName, listener);
+155     }
+156 
+157     /***
+158      * Remove property change listener.
+159      * @param listener listener.
+160      */
+161     public final void removePropertyChangeListener(
+162             final PropertyChangeListener listener) {
+163         propertySupport.removePropertyChangeListener(listener);
+164     }
+165 
+166     /***
+167      * Remove property change listener on a specific property.
+168      * @param propertyName property name.
+169      * @param listener listener.
+170      */
+171     public final void removePropertyChangeListener(
+172             final String propertyName,
+173             final PropertyChangeListener listener) {
+174         propertySupport.removePropertyChangeListener(propertyName, listener);
+175     }
+176 
+177     /***
+178      * Fire a property change event to appropriate listeners.
+179      * @param evt change event.
+180      */
+181     protected final void firePropertyChange(
+182             final PropertyChangeEvent evt) {
+183         propertySupport.firePropertyChange(evt);
+184     }
+185 
+186     /***
+187      * Fire property change event to appropriate listeners.
+188      * @param propertyName property name.
+189      * @param oldValue old value.
+190      * @param newValue new value.
+191      */
+192     protected final void firePropertyChange(
+193             final String propertyName,
+194             final boolean oldValue,
+195             final boolean newValue) {
+196         propertySupport.firePropertyChange(propertyName, oldValue, newValue);
+197     }
+198 
+199     /***
+200      * Fire property change event to appropriate listeners.
+201      * @param propertyName property name.
+202      * @param oldValue old value.
+203      * @param newValue new value.
+204      */
+205     protected final void firePropertyChange(
+206             final String propertyName,
+207             final int oldValue, final int newValue) {
+208         propertySupport.firePropertyChange(propertyName, oldValue, newValue);
+209     }
+210 
+211     /***
+212      * Fire property change event to appropriate listeners.
+213      * @param propertyName property name.
+214      * @param oldValue old value.
+215      * @param newValue new value.
+216      */
+217     protected final void firePropertyChange(
+218             final String propertyName,
+219             final Object oldValue,
+220             final Object newValue) {
+221         propertySupport.firePropertyChange(propertyName, oldValue, newValue);
+222     }
+223 }
+
+
+ + Propchange: logging/site/trunk/docs/log4j/companions/component/xref/org/apache/log4j/plugins/PluginSkeleton.html ------------------------------------------------------------------------------ svn:mime-type = text/html Added: logging/site/trunk/docs/log4j/companions/component/xref/org/apache/log4j/plugins/Receiver.html URL: http://svn.apache.org/viewvc/logging/site/trunk/docs/log4j/companions/component/xref/org/apache/log4j/plugins/Receiver.html?view=auto&rev=558355 ============================================================================== --- logging/site/trunk/docs/log4j/companions/component/xref/org/apache/log4j/plugins/Receiver.html (added) +++ logging/site/trunk/docs/log4j/companions/component/xref/org/apache/log4j/plugins/Receiver.html Sat Jul 21 10:20:56 2007 @@ -0,0 +1,145 @@ + + + +Receiver xref + + + +
View Javadoc
+
+1   /*
+2    * Licensed to the Apache Software Foundation (ASF) under one or more
+3    * contributor license agreements.  See the NOTICE file distributed with
+4    * this work for additional information regarding copyright ownership.
+5    * The ASF licenses this file to You under the Apache License, Version 2.0
+6    * (the "License"); you may not use this file except in compliance with
+7    * the License.  You may obtain a copy of the License at
+8    *
+9    *      http://www.apache.org/licenses/LICENSE-2.0
+10   *
+11   * Unless required by applicable law or agreed to in writing, software
+12   * distributed under the License is distributed on an "AS IS" BASIS,
+13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+14   * See the License for the specific language governing permissions and
+15   * limitations under the License.
+16   */
+17  
+18  package org.apache.log4j.plugins;
+19  
+20  import org.apache.log4j.Level;
+21  import org.apache.log4j.Logger;
+22  import org.apache.log4j.spi.LoggingEvent;
+23  import org.apache.log4j.spi.Thresholdable;
+24  
+25  
+26  /***
+27   * Defines the base class for Receiver plugins.
+28   * <p/>
+29   * <p>Just as Appenders send logging events outside of the log4j
+30   * environment (to files, to smtp, to sockets, etc), Receivers bring
+31   * logging events inside the log4j environment.
+32   * <p/>
+33   * <p>Receivers are meant to support the receiving of
+34   * remote logging events from another process. For example,
+35   * SocketAppender "appends" a logging event to a socket, configured
+36   * for a specific host and port number.  On the receiving side of
+37   * the socket can be a SocketReceiver object.  The SocketReceiver
+38   * object receives the logging event, and then "posts" it to the
+39   * log4j environment (LoggerRepository) on the receiving machine, to
+40   * be handled by the configured appenders, etc.  The various
+41   * settings in this environment (Logger levels, Appender filters &
+42   * thresholds) are applied to the received logging event.
+43   * <p/>
+44   * <p>Receivers can also be used to "import" log messages from other
+45   * logging packages into the log4j environment.
+46   * <p/>
+47   * <p>Receivers can be configured to post events to a given
+48   * LoggerRepository.
+49   * <p/>
+50   * <p>Subclasses of Receiver must implement the isActive(),
+51   * activateOptions(), and shutdown() methods. The doPost() method
+52   * is provided to standardize the "import" of remote events into
+53   * the repository.
+54   *
+55   * @author Mark Womack
+56   * @author Ceki G&uuml;lc&uuml;
+57   * @author Paul Smith (psmith@apache.org)
+58   * @since 1.3
+59   */
+60  public abstract class Receiver extends PluginSkeleton implements Thresholdable {
+61      /***
+62       * Threshold level.
+63       */
+64      protected Level thresholdLevel;
+65  
+66      /***
+67       * Create new instance.
+68       */
+69      protected Receiver() {
+70          super();
+71      }
+72  
+73      /***
+74       * Sets the receiver theshold to the given level.
+75       *
+76       * @param level The threshold level events must equal or be greater
+77       *              than before further processing can be done.
+78       */
+79      public void setThreshold(final Level level) {
+80          Level oldValue = this.thresholdLevel;
+81          thresholdLevel = level;
+82          firePropertyChange("threshold", oldValue, this.thresholdLevel);
+83      }
+84  
+85      /***
+86       * Gets the current threshold setting of the receiver.
+87       *
+88       * @return Level The current threshold level of the receiver.
+89       */
+90      public Level getThreshold() {
+91          return thresholdLevel;
+92      }
+93  
+94      /***
+95       * Returns true if the given level is equals or greater than the current
+96       * threshold value of the receiver.
+97       *
+98       * @param level The level to test against the receiver threshold.
+99       * @return boolean True if level is equal or greater than the
+100      *         receiver threshold.
+101      */
+102     public boolean isAsSevereAsThreshold(final Level level) {
+103         return ((thresholdLevel == null)
+104                 || level.isGreaterOrEqual(thresholdLevel));
+105     }
+106 
+107     /***
+108      * Posts the logging event to a logger in the configured logger
+109      * repository.
+110      *
+111      * @param event the log event to post to the local log4j environment.
+112      */
+113     public void doPost(final LoggingEvent event) {
+114         // if event does not meet threshold, exit now
+115         if (!isAsSevereAsThreshold(event.getLevel())) {
+116             return;
+117         }
+118 
+119         // get the "local" logger for this event from the
+120         // configured repository.
+121         Logger localLogger =
+122                 getLoggerRepository().getLogger(event.getLoggerName());
+123 
+124         // if the logger level is greater or equal to the level
+125         // of the event, use the logger to append the event.
+126         if (event.getLevel()
+127                 .isGreaterOrEqual(localLogger.getEffectiveLevel())) {
+128             // call the loggers appenders to process the event
+129             localLogger.callAppenders(event);
+130         }
+131   }
+132 }
+
+
+ + Propchange: logging/site/trunk/docs/log4j/companions/component/xref/org/apache/log4j/plugins/Receiver.html ------------------------------------------------------------------------------ svn:mime-type = text/html Added: logging/site/trunk/docs/log4j/companions/component/xref/org/apache/log4j/plugins/package-frame.html URL: http://svn.apache.org/viewvc/logging/site/trunk/docs/log4j/companions/component/xref/org/apache/log4j/plugins/package-frame.html?view=auto&rev=558355 ============================================================================== --- logging/site/trunk/docs/log4j/companions/component/xref/org/apache/log4j/plugins/package-frame.html (added) +++ logging/site/trunk/docs/log4j/companions/component/xref/org/apache/log4j/plugins/package-frame.html Sat Jul 21 10:20:56 2007 @@ -0,0 +1,45 @@ + + + + + + Apache Component Companion for log4j 1.2. 1.0-SNAPSHOT Reference Package org.apache.log4j.plugins + + + + +

+ org.apache.log4j.plugins +

+ +

Classes

+ + + + + \ No newline at end of file Propchange: logging/site/trunk/docs/log4j/companions/component/xref/org/apache/log4j/plugins/package-frame.html ------------------------------------------------------------------------------ svn:mime-type = text/html Added: logging/site/trunk/docs/log4j/companions/component/xref/org/apache/log4j/plugins/package-summary.html URL: http://svn.apache.org/viewvc/logging/site/trunk/docs/log4j/companions/component/xref/org/apache/log4j/plugins/package-summary.html?view=auto&rev=558355 ============================================================================== --- logging/site/trunk/docs/log4j/companions/component/xref/org/apache/log4j/plugins/package-summary.html (added) +++ logging/site/trunk/docs/log4j/companions/component/xref/org/apache/log4j/plugins/package-summary.html Sat Jul 21 10:20:56 2007 @@ -0,0 +1,102 @@ + + + + + + Apache Component Companion for log4j 1.2. 1.0-SNAPSHOT Reference Package $name + + + +
+ +
+
+ +
+ +

Package org.apache.log4j.plugins

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Class Summary
+ Pauseable +
+ Plugin +
+ PluginConfigurator +
+ PluginEvent +
+ PluginListener +
+ PluginRegistry +
+ PluginSkeleton +
+ Receiver +
+ +
+ +
+
+ +
+
+ Copyright © null Apache Software Foundation. All Rights Reserved. + + \ No newline at end of file Propchange: logging/site/trunk/docs/log4j/companions/component/xref/org/apache/log4j/plugins/package-summary.html ------------------------------------------------------------------------------ svn:mime-type = text/html Added: logging/site/trunk/docs/log4j/companions/component/xref/org/apache/log4j/scheduler/Job.html URL: http://svn.apache.org/viewvc/logging/site/trunk/docs/log4j/companions/component/xref/org/apache/log4j/scheduler/Job.html?view=auto&rev=558355 ============================================================================== --- logging/site/trunk/docs/log4j/companions/component/xref/org/apache/log4j/scheduler/Job.html (added) +++ logging/site/trunk/docs/log4j/companions/component/xref/org/apache/log4j/scheduler/Job.html Sat Jul 21 10:20:56 2007 @@ -0,0 +1,49 @@ + + + +Job xref + + + +
View Javadoc
+
+1   /*
+2    * Licensed to the Apache Software Foundation (ASF) under one or more
+3    * contributor license agreements.  See the NOTICE file distributed with
+4    * this work for additional information regarding copyright ownership.
+5    * The ASF licenses this file to You under the Apache License, Version 2.0
+6    * (the "License"); you may not use this file except in compliance with
+7    * the License.  You may obtain a copy of the License at
+8    *
+9    *      http://www.apache.org/licenses/LICENSE-2.0
+10   *
+11   * Unless required by applicable law or agreed to in writing, software
+12   * distributed under the License is distributed on an "AS IS" BASIS,
+13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+14   * See the License for the specific language governing permissions and
+15   * limitations under the License.
+16   */
+17  
+18  package org.apache.log4j.scheduler;
+19  
+20  
+21  /***
+22   * Job is a very simple interface. It only has a single method {@link #execute}
+23   * which is called by the {@link Scheduler} when a task is ready for execution.
+24   * <p/>
+25   * It is assumed that the execution context
+26   * are contained within the implementing
+27   * {@link Job} itself.
+28   *
+29   * @author Ceki G&uuml;lc&uuml;
+30   */
+31  public interface Job {
+32      /***
+33       * Execute job.
+34       */
+35      void execute();
+36  }
+
+
+ + Propchange: logging/site/trunk/docs/log4j/companions/component/xref/org/apache/log4j/scheduler/Job.html ------------------------------------------------------------------------------ svn:mime-type = text/html