KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > osgi > service > useradmin > Role


1 /*
2  * $Header: /cvshome/build/org.osgi.service.useradmin/src/org/osgi/service/useradmin/Role.java,v 1.10 2006/07/11 00:54:01 hargrave Exp $
3  *
4  * Copyright (c) OSGi Alliance (2001, 2006). All Rights Reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */

18 package org.osgi.service.useradmin;
19
20 import java.util.Dictionary JavaDoc;
21
22 /**
23  * The base interface for <code>Role</code> objects managed by the User Admin
24  * service.
25  *
26  * <p>
27  * This interface exposes the characteristics shared by all <code>Role</code>
28  * classes: a name, a type, and a set of properties.
29  * <p>
30  * Properties represent public information about the <code>Role</code> object that
31  * can be read by anyone. Specific {@link UserAdminPermission} objects are
32  * required to change a <code>Role</code> object's properties.
33  * <p>
34  * <code>Role</code> object properties are <code>Dictionary</code> objects. Changes
35  * to these objects are propagated to the User Admin service and made
36  * persistent.
37  * <p>
38  * Every User Admin service contains a set of predefined <code>Role</code> objects
39  * that are always present and cannot be removed. All predefined <code>Role</code>
40  * objects are of type <code>ROLE</code>. This version of the
41  * <code>org.osgi.service.useradmin</code> package defines a single predefined
42  * role named &quot;user.anyone&quot;, which is inherited by any other role.
43  * Other predefined roles may be added in the future. Since
44  * &quot;user.anyone&quot; is a <code>Role</code> object that has properties
45  * associated with it that can be read and modified. Access to these properties
46  * and their use is application specific and is controlled using
47  * <code>UserAdminPermission</code> in the same way that properties for other
48  * <code>Role</code> objects are.
49  *
50  * @version $Revision: 1.10 $
51  */

52 public interface Role {
53     /**
54      * The name of the predefined role, user.anyone, that all users and groups
55      * belong to.
56      * @since 1.1
57      */

58     public static final String JavaDoc USER_ANYONE = "user.anyone";
59     /**
60      * The type of a predefined role.
61      *
62      * <p>
63      * The value of <code>ROLE</code> is 0.
64      */

65     public static final int ROLE = 0;
66     /**
67      * The type of a {@link User} role.
68      *
69      * <p>
70      * The value of <code>USER</code> is 1.
71      */

72     public static final int USER = 1;
73     /**
74      * The type of a {@link Group} role.
75      *
76      * <p>
77      * The value of <code>GROUP</code> is 2.
78      */

79     public static final int GROUP = 2;
80
81     /**
82      * Returns the name of this role.
83      *
84      * @return The role's name.
85      */

86     public String JavaDoc getName();
87
88     /**
89      * Returns the type of this role.
90      *
91      * @return The role's type.
92      */

93     public int getType();
94
95     /**
96      * Returns a <code>Dictionary</code> of the (public) properties of this
97      * <code>Role</code> object. Any changes to the returned <code>Dictionary</code>
98      * will change the properties of this <code>Role</code> object. This will
99      * cause a <code>UserAdminEvent</code> object of type
100      * {@link UserAdminEvent#ROLE_CHANGED} to be broadcast to any
101      * <code>UserAdminListener</code> objects.
102      *
103      * <p>
104      * Only objects of type <code>String</code> may be used as property keys, and
105      * only objects of type <code>String</code> or <code>byte[]</code> may be used
106      * as property values. Any other types will cause an exception of type
107      * <code>IllegalArgumentException</code> to be raised.
108      *
109      * <p>
110      * In order to add, change, or remove a property in the returned
111      * <code>Dictionary</code>, a {@link UserAdminPermission} named after the
112      * property name (or a prefix of it) with action <code>changeProperty</code>
113      * is required.
114      *
115      * @return <code>Dictionary</code> containing the properties of this
116      * <code>Role</code> object.
117      */

118     public Dictionary JavaDoc getProperties();
119 }
120
Popular Tags