KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > avalon > excalibur > lang > ThreadContextPolicy


1 /*
2  * Copyright (C) The Apache Software Foundation. All rights reserved.
3  *
4  * This software is published under the terms of the Apache Software License
5  * version 1.1, a copy of which has been included with this distribution in
6  * the LICENSE.txt file.
7  */

8 package org.apache.avalon.excalibur.lang;
9
10 import java.util.HashMap JavaDoc;
11 import java.util.Map JavaDoc;
12 import java.util.Iterator JavaDoc;
13
14 /**
15  * The <code>ThreadContextPolicy</code> determines the policy with
16  * which items can be added to context. It determines what to do with
17  * values when <code>ThreadContext</code> is activated and deactivated.
18  * It also determines if a variable can be set.
19  *
20  * <p>This interface is expected to be used as a Flyweight object.</p>
21  *
22  * @author <a HREF="mailto:peter@apache.org">Peter Donald</a>
23  */

24 public interface ThreadContextPolicy
25 {
26     /**
27      * Key used to store <code>ContextClassLoader</code> in ThreadContextAccessor.
28      */

29     String JavaDoc CLASSLOADER = "ContextClassLoader";
30     
31     /**
32      * The activate method is called when the ThreadContext
33      * is associated with a thread.
34      *
35      * @param accessor the accessor to retrieve values from ThreadContext
36      */

37     void activate( ThreadContextAccessor accessor );
38
39     /**
40      * The deactivate method is called when the ThreadContext is
41      * dis-associated with a thread.
42      *
43      * @param accessor the accessor to retrieve values from ThreadContext
44      */

45     void deactivate( ThreadContextAccessor accessor );
46
47     /**
48      * Verify that the key/value pair is valid.
49      *
50      * @param key The key
51      * @param value the value
52      * @exception IllegalArgumentException if pair is not valid
53      */

54     void verifyKeyValue( String JavaDoc key, Object JavaDoc value )
55         throws IllegalArgumentException JavaDoc;
56 }
57
Popular Tags