KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > security > acl > Group


1 /*
2  * @(#)Group.java 1.19 04/05/05
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package java.security.acl;
9
10 import java.util.Enumeration JavaDoc;
11 import java.security.Principal JavaDoc;
12
13 /**
14  * This interface is used to represent a group of principals. (A principal
15  * represents an entity such as an individual user or a company). <p>
16  *
17  * Note that Group extends Principal. Thus, either a Principal or a Group can
18  * be passed as an argument to methods containing a Principal parameter. For
19  * example, you can add either a Principal or a Group to a Group object by
20  * calling the object's <code>addMember</code> method, passing it the
21  * Principal or Group.
22  *
23  * @author Satish Dharmaraj
24  */

25 public interface Group extends Principal JavaDoc {
26
27     /**
28      * Adds the specified member to the group.
29      *
30      * @param user the principal to add to this group.
31      *
32      * @return true if the member was successfully added,
33      * false if the principal was already a member.
34      */

35     public boolean addMember(Principal JavaDoc user);
36
37     /**
38      * Removes the specified member from the group.
39      *
40      * @param user the principal to remove from this group.
41      *
42      * @return true if the principal was removed, or
43      * false if the principal was not a member.
44      */

45     public boolean removeMember(Principal JavaDoc user);
46
47     /**
48      * Returns true if the passed principal is a member of the group.
49      * This method does a recursive search, so if a principal belongs to a
50      * group which is a member of this group, true is returned.
51      *
52      * @param member the principal whose membership is to be checked.
53      *
54      * @return true if the principal is a member of this group,
55      * false otherwise.
56      */

57     public boolean isMember(Principal JavaDoc member);
58
59
60     /**
61      * Returns an enumeration of the members in the group.
62      * The returned objects can be instances of either Principal
63      * or Group (which is a subclass of Principal).
64      *
65      * @return an enumeration of the group members.
66      */

67     public Enumeration JavaDoc<? extends Principal JavaDoc> members();
68
69 }
70
Popular Tags