KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > catalina > users > AbstractGroup


1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17
18
19 package org.apache.catalina.users;
20
21
22 import java.util.Iterator JavaDoc;
23
24 import org.apache.catalina.Group;
25 import org.apache.catalina.Role;
26 import org.apache.catalina.UserDatabase;
27
28
29 /**
30  * <p>Convenience base class for {@link Group} implementations.</p>
31  *
32  * @author Craig R. McClanahan
33  * @version $Revision: 467222 $ $Date: 2006-10-24 05:17:11 +0200 (mar., 24 oct. 2006) $
34  * @since 4.1
35  */

36
37 public abstract class AbstractGroup implements Group {
38
39
40     // ----------------------------------------------------- Instance Variables
41

42
43     /**
44      * The description of this group.
45      */

46     protected String JavaDoc description = null;
47
48
49     /**
50      * The group name of this group.
51      */

52     protected String JavaDoc groupname = null;
53
54
55     // ------------------------------------------------------------- Properties
56

57
58     /**
59      * Return the description of this group.
60      */

61     public String JavaDoc getDescription() {
62
63         return (this.description);
64
65     }
66
67
68     /**
69      * Set the description of this group.
70      *
71      * @param description The new description
72      */

73     public void setDescription(String JavaDoc description) {
74
75         this.description = description;
76
77     }
78
79
80     /**
81      * Return the group name of this group, which must be unique
82      * within the scope of a {@link UserDatabase}.
83      */

84     public String JavaDoc getGroupname() {
85
86         return (this.groupname);
87
88     }
89
90
91     /**
92      * Set the group name of this group, which must be unique
93      * within the scope of a {@link UserDatabase}.
94      *
95      * @param groupname The new group name
96      */

97     public void setGroupname(String JavaDoc groupname) {
98
99         this.groupname = groupname;
100
101     }
102
103
104     /**
105      * Return the set of {@link Role}s assigned specifically to this group.
106      */

107     public abstract Iterator JavaDoc getRoles();
108
109
110     /**
111      * Return the {@link UserDatabase} within which this Group is defined.
112      */

113     public abstract UserDatabase getUserDatabase();
114
115
116     /**
117      * Return an Iterator over the set of {@link org.apache.catalina.User}s that
118      * are members of this group.
119      */

120     public abstract Iterator JavaDoc getUsers();
121
122
123     // --------------------------------------------------------- Public Methods
124

125
126     /**
127      * Add a new {@link Role} to those assigned specifically to this group.
128      *
129      * @param role The new role
130      */

131     public abstract void addRole(Role role);
132
133
134     /**
135      * Is this group specifically assigned the specified {@link Role}?
136      *
137      * @param role The role to check
138      */

139     public abstract boolean isInRole(Role role);
140
141
142     /**
143      * Remove a {@link Role} from those assigned to this group.
144      *
145      * @param role The old role
146      */

147     public abstract void removeRole(Role role);
148
149
150     /**
151      * Remove all {@link Role}s from those assigned to this group.
152      */

153     public abstract void removeRoles();
154
155
156     // ------------------------------------------------------ Principal Methods
157

158
159     /**
160      * Make the principal name the same as the group name.
161      */

162     public String JavaDoc getName() {
163
164         return (getGroupname());
165
166     }
167
168
169 }
170
Popular Tags