source: trunk/gcc/libjava/java/security/acl/AclEntry.java

Last change on this file was 2, checked in by bird, 22 years ago

Initial revision

  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 5.3 KB
Line 
1/* AclEntry.java -- An entry in an ACL list.
2 Copyright (C) 1998 Free Software Foundation, Inc.
3
4This file is part of GNU Classpath.
5
6GNU Classpath is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2, or (at your option)
9any later version.
10
11GNU Classpath is distributed in the hope that it will be useful, but
12WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GNU Classpath; see the file COPYING. If not, write to the
18Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
1902111-1307 USA.
20
21Linking this library statically or dynamically with other modules is
22making a combined work based on this library. Thus, the terms and
23conditions of the GNU General Public License cover the whole
24combination.
25
26As a special exception, the copyright holders of this library give you
27permission to link this library with independent modules to produce an
28executable, regardless of the license terms of these independent
29modules, and to copy and distribute the resulting executable under
30terms of your choice, provided that you also meet, for each linked
31independent module, the terms and conditions of the license of that
32module. An independent module is a module which is not derived from
33or based on this library. If you modify this library, you may extend
34this exception to your version of the library, but you are not
35obligated to do so. If you do not wish to do so, delete this
36exception statement from your version. */
37
38package java.security.acl;
39
40import java.security.Principal;
41import java.util.Enumeration;
42
43/**
44 * This interface models an entry in an access control list (ACL). Java
45 * ACL's consist of a list of entries, where each consists of a
46 * <code>Principal</code> and a list of <code>Permission</code>'s which
47 * have been granted to that <code>Principal</code>. An ACL can also
48 * be <em>negative</em>, which indicates that the list of
49 * <code>Permission</code>'s is a list of permissions that are <em>not</em>
50 * granted to the <code>Principal</code>. A <code>Principal</code> can
51 * have at most one regular (or positive) ACL entry and one negative
52 * ACL entry.
53 *
54 * @version 0.0
55 *
56 * @author Aaron M. Renn (arenn@urbanophile.com)
57 */
58public interface AclEntry extends Cloneable
59{
60 /**
61 * This method returns the <code>Principal</code> associated with this
62 * ACL entry.
63 *
64 * @return The <code>Principal</code> for this ACL entry
65 */
66 public abstract Principal getPrincipal();
67
68 /**
69 * This method sets ths <code>Principal</code> associated with this
70 * ACL entry. This operation will only succeed if there is not already
71 * a <code>Principal</code> assigned.
72 *
73 * @param user The <code>Principal</code> for this ACL entry
74 *
75 * @return <code>true</code> if the <code>Principal</code> was successfully set or <code>false</code> if this entry already has a <code>Principal</code>.
76 */
77 public abstract boolean setPrincipal(Principal user);
78
79 /**
80 * This method sets this ACL entry to be a <em>negative</em> entry, indicating
81 * that it contains a list of permissions that are <em>not</em> granted
82 * to the entry's <code>Principal</code>. Note that there is no way to
83 * undo this operation.
84 */
85 public abstract void setNegativePermissions();
86
87 /**
88 * This method tests whether or not this ACL entry is a negative entry or not.
89 *
90 * @return <code>true</code> if this ACL entry is negative, <code>false</code> otherwise
91 */
92 public abstract boolean isNegative();
93
94 /**
95 * This method adds the specified permission to this ACL entry.
96 *
97 * @param perm The <code>Permission</code> to add
98 *
99 * @return <code>true</code> if the permission was added or <code>false</code> if it was already set for this entry
100 */
101 public abstract boolean addPermission(Permission permission);
102
103 /**
104 * This method deletes the specified permission to this ACL entry.
105 *
106 * @param perm The <code>Permission</code> to delete from this ACL entry.
107 *
108 * @return <code>true</code> if the permission was successfully deleted or <code>false</code> if the permission was not part of this ACL to begin with
109 */
110 public abstract boolean removePermission(Permission perm);
111
112 /**
113 * This method tests whether or not the specified permission is associated
114 * with this ACL entry.
115 *
116 * @param perm The <code>Permission</code> to test
117 *
118 * @return <code>true</code> if this permission is associated with this entry or <code>false</code> otherwise
119 */
120 public abstract boolean checkPermission(Permission permission);
121
122 /**
123 * This method returns a list of all <code>Permission</code> objects
124 * associated with this ACL entry as an <code>Enumeration</code>.
125 *
126 * @return A list of permissions for this ACL entry
127 */
128 public abstract Enumeration permissions();
129
130 /**
131 * This method returns this object as a <code>String</code>.
132 *
133 * @return A <code>String</code> representation of this object
134 */
135 public abstract String toString();
136
137 /**
138 * This method returns a clone of this ACL entry
139 *
140 * @return A clone of this ACL entry
141 */
142 public abstract Object clone();
143}
Note: See TracBrowser for help on using the repository browser.