01: /*
02: * Copyright (c) 2004-2007 QOS.ch
03: * All rights reserved.
04: *
05: * Permission is hereby granted, free of charge, to any person obtaining
06: * a copy of this software and associated documentation files (the
07: * "Software"), to deal in the Software without restriction, including
08: * without limitation the rights to use, copy, modify, merge, publish,
09: * distribute, sublicense, and/or sell copies of the Software, and to
10: * permit persons to whom the Software is furnished to do so, subject to
11: * the following conditions:
12: *
13: * The above copyright notice and this permission notice shall be
14: * included in all copies or substantial portions of the Software.
15: *
16: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17: * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18: * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19: * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20: * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21: * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22: * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23: */
24:
25: package org.slf4j.spi;
26:
27: /**
28: * This interface abstracts the service offered by various MDC
29: * implementations.
30: *
31: * @author Ceki Gülcü
32: * @since 1.4.1
33: */
34: public interface MDCAdapter {
35:
36: /**
37: * Put a context value (the <code>val</code> parameter) as identified with
38: * the <code>key</code> parameter into the current thread's context map.
39: * The <code>key</code> parameter cannot be null. The code>val</code> parameter
40: * can be null only if the underlying implementation supports it.
41: *
42: * <p>If the current thread does not have a context map it is created as a side
43: * effect of this call.
44: */
45: public void put(String key, String val);
46:
47: /**
48: * Get the context identified by the <code>key</code> parameter.
49: * The <code>key</code> parameter cannot be null.
50: *
51: * @return the string value identified by the <code>key</code> parameter.
52: */
53: public String get(String key);
54:
55: /**
56: * Remove the the context identified by the <code>key</code> parameter.
57: * The <code>key</code> parameter cannot be null.
58: *
59: * <p>
60: * This method does nothing if there is no previous value
61: * associated with <code>key</code>.
62: */
63: public void remove(String key);
64:
65: /**
66: * Clear all entries in the MDC.
67: */
68: public void clear();
69:
70: }
|