View Javadoc

1   /**
2    * Logback: the generic, reliable, fast and flexible logging framework.
3    * 
4    * Copyright (C) 2000-2008, QOS.ch
5    * 
6    * This library is free software, you can redistribute it and/or modify it under
7    * the terms of the GNU Lesser General Public License as published by the Free
8    * Software Foundation.
9    */
10  package ch.qos.logback.core;
11  
12  import ch.qos.logback.core.spi.PropertyContainer;
13  import ch.qos.logback.core.status.StatusManager;
14  
15  /**
16   * A context is the main anchorage point of all logback components.
17   * 
18   * @author Ceki Gulcu
19   * 
20   */
21  public interface Context extends PropertyContainer {
22  
23    /**
24     * Return the StatusManager instance in use.
25     * 
26     * @return the {@link StatusManager} instance in use.
27     */
28    public StatusManager getStatusManager();
29  
30    /**
31     * A Context can act as a store for various objects used by LOGBack
32     * components.
33     * 
34     * @return The object stored under 'key'.
35     */
36    public Object getObject(String key);
37  
38    /**
39     * Store an object under 'key'. If no object can be found, null is returned.
40     * 
41     * @param key
42     * @param value
43     */
44    public void putObject(String key, Object value);
45  
46    /**
47     * Get all the properties for this context as a Map. Note that the returned
48     * cop might be a copy not the original. Thus, modifying the returned Map will
49     * have no effect (on the original.)
50     * 
51     * @return
52     */
53    // public Map<String, String> getPropertyMap();
54    /**
55     * Get the property of this context.
56     */
57    public String getProperty(String key);
58  
59    /**
60     * Set a property of this context.
61     */
62    public void putProperty(String key, String value);
63  
64    /**
65     * Contexts are named objects.
66     * 
67     * @return the name for this context
68     */
69    public String getName();
70  
71    /**
72     * The name of the context can be set only once.
73     * 
74     * @param name
75     */
76    public void setName(String name);
77  }