01: /*
02: * @(#)Group.java 1.21 06/10/10
03: *
04: * Copyright 1990-2006 Sun Microsystems, Inc. All Rights Reserved.
05: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
06: *
07: * This program is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU General Public License version
09: * 2 only, as published by the Free Software Foundation.
10: *
11: * This program is distributed in the hope that it will be useful, but
12: * WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * General Public License version 2 for more details (a copy is
15: * included at /legal/license.txt).
16: *
17: * You should have received a copy of the GNU General Public License
18: * version 2 along with this work; if not, write to the Free Software
19: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20: * 02110-1301 USA
21: *
22: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
23: * Clara, CA 95054 or visit www.sun.com if you need additional
24: * information or have any questions.
25: *
26: */
27:
28: package java.security.acl;
29:
30: import java.util.Enumeration;
31: import java.security.Principal;
32:
33: /**
34: * This interface is used to represent a group of principals. (A principal
35: * represents an entity such as an individual user or a company). <p>
36: *
37: * Note that Group extends Principal. Thus, either a Principal or a Group can
38: * be passed as an argument to methods containing a Principal parameter. For
39: * example, you can add either a Principal or a Group to a Group object by
40: * calling the object's <code>addMember</code> method, passing it the
41: * Principal or Group.
42: *
43: * @author Satish Dharmaraj
44: */
45: public interface Group extends Principal {
46:
47: /**
48: * Adds the specified member to the group.
49: *
50: * @param user the principal to add to this group.
51: *
52: * @return true if the member was successfully added,
53: * false if the principal was already a member.
54: */
55: public boolean addMember(Principal user);
56:
57: /**
58: * Removes the specified member from the group.
59: *
60: * @param user the principal to remove from this group.
61: *
62: * @return true if the principal was removed, or
63: * false if the principal was not a member.
64: */
65: public boolean removeMember(Principal user);
66:
67: /**
68: * Returns true if the passed principal is a member of the group.
69: * This method does a recursive search, so if a principal belongs to a
70: * group which is a member of this group, true is returned.
71: *
72: * @param member the principal whose membership is to be checked.
73: *
74: * @return true if the principal is a member of this group,
75: * false otherwise.
76: */
77: public boolean isMember(Principal member);
78:
79: /**
80: * Returns an enumeration of the members in the group.
81: * The returned objects can be instances of either Principal
82: * or Group (which is a subclass of Principal).
83: *
84: * @return an enumeration of the group members.
85: */
86: public Enumeration members();
87:
88: }
|