View Javadoc

1   /**
2    * LOGBack: the generic, reliable, fast and flexible logging framework.
3    *
4    * Copyright (C) 1999-2006, QOS.ch
5    *
6    * This library is free software, you can redistribute it and/or
7    * modify it under the terms of the GNU Lesser General Public License as
8    * published by the Free Software Foundation.
9    */
10  package ch.qos.logback.core.spi;
11  
12  import java.util.Iterator;
13  
14  import ch.qos.logback.core.Appender;
15  
16  /**
17   * Interface for attaching appenders to objects.
18   * 
19   * @author Ceki Gülcü
20   */
21  public interface AppenderAttachable<E> {
22    /**
23     * Add an appender.
24     */
25    public void addAppender(Appender<E> newAppender);
26  
27    /**
28     * Get an iterator for appenders contained in the parent object.
29     */
30    public Iterator<Appender<E>> iteratorForAppenders();
31  
32    /**
33     * Get an appender by name.
34     */
35    public Appender<E> getAppender(String name);
36  
37    /**
38     * Returns <code>true</code> if the specified appender is in list of
39     * attached attached, <code>false</code> otherwise.
40     */
41    public boolean isAttached(Appender<E> appender);
42  
43    /**
44     * Detach and stop all previously added appenders.
45     */
46    void detachAndStopAllAppenders(); 
47  
48    /**
49     * Detach the appender passed as parameter from the list of appenders.
50     */
51    boolean detachAppender(Appender<E> appender);
52  
53    /**
54     * Detach the appender with the name passed as parameter from the list of
55     * appenders.
56     */
57    boolean detachAppender(String name);
58  }