1 /**
2 * Logback: the reliable, generic, fast and flexible logging framework.
3 * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
4 *
5 * This program and the accompanying materials are dual-licensed under
6 * either the terms of the Eclipse Public License v1.0 as published by
7 * the Eclipse Foundation
8 *
9 * or (per the licensee's choosing)
10 *
11 * under the terms of the GNU Lesser General Public License version 2.1
12 * as published by the Free Software Foundation.
13 */
14 package ch.qos.logback.core;
15
16 import java.util.Map;
17 import java.util.concurrent.ExecutorService;
18
19 import ch.qos.logback.core.spi.PropertyContainer;
20 import ch.qos.logback.core.status.StatusManager;
21
22 /**
23 * A context is the main anchorage point of all logback components.
24 *
25 * @author Ceki Gulcu
26 *
27 */
28 public interface Context extends PropertyContainer {
29
30 /**
31 * Return the StatusManager instance in use.
32 *
33 * @return the {@link StatusManager} instance in use.
34 */
35 public StatusManager getStatusManager();
36
37 /**
38 * A Context can act as a store for various objects used by LOGBack
39 * components.
40 *
41 * @return The object stored under 'key'.
42 */
43 public Object getObject(String key);
44
45 /**
46 * Store an object under 'key'. If no object can be found, null is returned.
47 *
48 * @param key
49 * @param value
50 */
51 public void putObject(String key, Object value);
52
53 /**
54 * Get all the properties for this context as a Map. Note that the returned
55 * cop might be a copy not the original. Thus, modifying the returned Map will
56 * have no effect (on the original.)
57 *
58 * @return
59 */
60 // public Map<String, String> getPropertyMap();
61 /**
62 * Get the property of this context.
63 */
64 public String getProperty(String key);
65
66 /**
67 * Set a property of this context.
68 */
69 public void putProperty(String key, String value);
70
71
72 /**
73 * Get a copy of the property map
74 * @return
75 * @since 0.9.20
76 */
77 public Map<String, String> getCopyOfPropertyMap();
78
79 /**
80 * Contexts are named objects.
81 *
82 * @return the name for this context
83 */
84 public String getName();
85
86 /**
87 * The name of the context can be set only once.
88 *
89 * @param name
90 */
91 public void setName(String name);
92
93 /**
94 * The time at which this context was created, expressed in
95 * millisecond elapsed since the epoch (1.1.1970).
96 *
97 * @return The time as measured when this class was created.
98 */
99 public long getBirthTime();
100
101 /**
102 * Object used for synchronization purposes.
103 * INTENDED FOR INTERNAL USAGE.
104 */
105 public Object getConfigurationLock();
106
107
108 /**
109 * Every context has an ExecutorService which be invoked to execute certain
110 * tasks in a separate thread.
111 *
112 * @return the executor for this context.
113 * @since 1.0.0
114 */
115 public ExecutorService getExecutorService();
116 }