KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > security > jacc > PolicyContextHandler


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 package javax.security.jacc;
25
26 /**
27  * This interface defines the methods that must be implemented by handlers
28  * that are to be registered and activated by the <code>PolicyContext</code>
29  * class. The <code>PolicyContext</code> class provides methods for containers
30  * to register and activate container-specific <code>PolicyContext</code>
31  * handlers. <code>Policy</code> providers use the <code>PolicyContext</code>
32  * class to activate handlers to obtain (from the container) additional policy
33  * relevant context to apply in their access decisions. All handlers
34  * registered and activated via the <code>PolicyContext</code> class must
35  * implement the <code>PolicyContextHandler</code> interface.
36  *
37  * @see javax.security.jacc.PolicyContext
38  * @see javax.security.jacc.PolicyContextException
39  *
40  * @author Ron Monzillo
41  * @author Gary Ellison
42  */

43
44 public interface PolicyContextHandler {
45     
46     /** This public method returns a boolean result indicating whether or
47      * not the handler supports the context object identified by the
48      * (case-sensitive) key value.
49      * @param key a <code>String</code> value identifying a context object
50      * that could be supported by the handler. The value of this parameter
51      * must not be null.
52      * @return a boolean indicating whether or not the context object
53      * corresponding to the argument key is handled by the handler.
54      *
55      * @throws javax.security.jacc.PolicyContextException
56      * if the implementation throws a checked exception that has not been
57      * accounted for by the method signature. The exception thrown
58      * by the implementation class will be encapsulated (during construction)
59      * in the thrown PolicyContextException
60      */

61     
62     public boolean supports(String JavaDoc key)
63     throws javax.security.jacc.PolicyContextException JavaDoc;
64
65     /** This public method returns the keys identifying the context objects
66      * supported by the handler. The value of each key supported by a handler
67      * must be a non-null <code>String</code> value.
68      * @return an array containing <code>String</code> values
69      * identifing the context objects supported by the handler. The array
70      * must not contain duplicate key values. In the
71      * unlikely case that the Handler supports no keys, the handler must
72      * return a zero length array. The value null must never be returned by
73      * this method.
74      *
75      * @throws javax.security.jacc.PolicyContextException
76      * if the implementation throws a checked exception that has not been
77      * accounted for by the method signature. The exception thrown
78      * by the implementation class will be encapsulated (during construction)
79      * in the thrown PolicyContextException
80      */

81
82     public String JavaDoc[] getKeys()
83     throws javax.security.jacc.PolicyContextException JavaDoc;
84
85     /** This public method is used by the <code>PolicyContext</code> class to
86      * activate the handler and obtain from it the context object
87      * identified by the (case-sensitive) key. In addition to the key,
88      * the handler will be activated with the handler data value associated
89      * within the <code>PolicyContext</code> class
90      * with the thread on which the call to this method is made.
91      * <P>
92      * Note that the policy context identifier associated with a thread
93      * is available to the handler by calling PolicyContext.getContextID().
94      * <P>
95      * @param key a String that identifies the context object to be returned
96      * by the handler. The value of this paramter must not be null.
97      * @param data the handler data <code>Object</code> associated with the
98      * thread on which the call to this method has been made. Note that
99      * the value passed through this parameter may be <code>null</code>.
100      * @return The container and handler specific <code>Object</code>
101      * containing the desired context. A <code>null</code> value may
102      * be returned if the value of the corresponding context is null.
103      *
104      * @throws javax.security.jacc.PolicyContextException
105      * if the implementation throws a checked exception that has not been
106      * accounted for by the method signature. The exception thrown
107      * by the implementation class will be encapsulated (during construction)
108      * in the thrown PolicyContextException
109      */

110
111     public Object JavaDoc getContext(String JavaDoc key, Object JavaDoc data)
112     throws javax.security.jacc.PolicyContextException JavaDoc;
113
114 }
115
116
Popular Tags