33beb43a1e279460a11fb982efb9351b90955725
[utils] / security / src / main / java / org / wamblee / usermgt / GroupSet.java
1 /*
2  * Copyright 2005 the original author or authors.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package org.wamblee.usermgt;
17
18 import java.util.Set;
19
20
21 /**
22  * Represents a set of groups. A typical implemnetation would be, a readonly implementation 
23  * defined in a configuration file or a list of groups defined in a database. 
24  *
25  * @author Erik Brakkee
26  */
27 public interface GroupSet {
28     /**
29      * Must be called when the group has been modified to notify the
30      * group set.
31      *
32      * @param aGroup Group that was modified.
33      */
34     void groupModified(Group aGroup);
35
36     /**
37      * Finds the group by name.
38      *
39      * @param aName Group name.
40      *
41      * @return Group or null if not found.
42      */
43     Group find(String aName);
44
45     /**
46      * Determines if the group exists.
47      *
48      * @param aGroup Group.
49      *
50      * @return True iff the group exists.
51      */
52     boolean contains(Group aGroup);
53
54     /**
55      * Adds a group. If the group already exists, the existing group
56      * set is left unchanged.
57      *
58      * @param aGroup Group.
59      *
60      * @return DOCUMENT ME!
61      */
62     boolean add(Group aGroup);
63
64     /**
65      * Removes a group. If the group does not exist, this method is a
66      * no-op.
67      *
68      * @param aGroup Group to remove.
69      *
70      * @return True if the group was removed, false otherwise.
71      */
72     boolean remove(Group aGroup);
73
74     /**
75      * DOCUMENT ME!
76      *
77      * @return DOCUMENT ME!
78      */
79 /**
80      * DOCUMENT ME!
81      *
82      * @return DOCUMENT ME!
83      */
84 /**
85      * Returns the current groups. 
86      * @return Groups. 
87      */
88     Set<Group> list();
89
90     /**
91      * DOCUMENT ME!
92      *
93      * @return The number of groups.
94      */
95     int size();
96 }