equal
deleted
inserted
replaced
60 private static final long serialVersionUID = -2916474571451318075L; |
60 private static final long serialVersionUID = -2916474571451318075L; |
61 |
61 |
62 /** |
62 /** |
63 * Creates a new AllPermission object. |
63 * Creates a new AllPermission object. |
64 */ |
64 */ |
65 |
65 public AllPermission() { |
66 public AllPermission() |
|
67 { |
|
68 super("<all permissions>"); |
66 super("<all permissions>"); |
69 } |
67 } |
70 |
68 |
71 |
69 |
72 /** |
70 /** |
75 * to instantiate new Permission objects. |
73 * to instantiate new Permission objects. |
76 * |
74 * |
77 * @param name ignored |
75 * @param name ignored |
78 * @param actions ignored. |
76 * @param actions ignored. |
79 */ |
77 */ |
80 public AllPermission(String name, String actions) |
78 public AllPermission(String name, String actions) { |
81 { |
|
82 this(); |
79 this(); |
83 } |
80 } |
84 |
81 |
85 /** |
82 /** |
86 * Checks if the specified permission is "implied" by |
83 * Checks if the specified permission is "implied" by |
118 /** |
115 /** |
119 * Returns the canonical string representation of the actions. |
116 * Returns the canonical string representation of the actions. |
120 * |
117 * |
121 * @return the actions. |
118 * @return the actions. |
122 */ |
119 */ |
123 public String getActions() |
120 public String getActions() { |
124 { |
|
125 return "<all actions>"; |
121 return "<all actions>"; |
126 } |
122 } |
127 |
123 |
128 /** |
124 /** |
129 * Returns a new PermissionCollection object for storing AllPermission |
125 * Returns a new PermissionCollection object for storing AllPermission |
131 * <p> |
127 * <p> |
132 * |
128 * |
133 * @return a new PermissionCollection object suitable for |
129 * @return a new PermissionCollection object suitable for |
134 * storing AllPermissions. |
130 * storing AllPermissions. |
135 */ |
131 */ |
136 |
|
137 public PermissionCollection newPermissionCollection() { |
132 public PermissionCollection newPermissionCollection() { |
138 return new AllPermissionCollection(); |
133 return new AllPermissionCollection(); |
139 } |
134 } |
140 |
135 |
141 } |
136 } |
155 * |
150 * |
156 * @serial include |
151 * @serial include |
157 */ |
152 */ |
158 |
153 |
159 final class AllPermissionCollection |
154 final class AllPermissionCollection |
160 extends PermissionCollection |
155 extends PermissionCollection |
161 implements java.io.Serializable |
156 implements java.io.Serializable |
162 { |
157 { |
163 |
158 |
164 // use serialVersionUID from JDK 1.2.2 for interoperability |
159 // use serialVersionUID from JDK 1.2.2 for interoperability |
165 private static final long serialVersionUID = -4023755556366636806L; |
160 private static final long serialVersionUID = -4023755556366636806L; |
166 |
161 |
186 * |
181 * |
187 * @exception SecurityException - if this AllPermissionCollection object |
182 * @exception SecurityException - if this AllPermissionCollection object |
188 * has been marked readonly |
183 * has been marked readonly |
189 */ |
184 */ |
190 |
185 |
191 public void add(Permission permission) |
186 public void add(Permission permission) { |
192 { |
|
193 if (! (permission instanceof AllPermission)) |
187 if (! (permission instanceof AllPermission)) |
194 throw new IllegalArgumentException("invalid permission: "+ |
188 throw new IllegalArgumentException("invalid permission: "+ |
195 permission); |
189 permission); |
196 if (isReadOnly()) |
190 if (isReadOnly()) |
197 throw new SecurityException("attempt to add a Permission to a readonly PermissionCollection"); |
191 throw new SecurityException("attempt to add a Permission to a readonly PermissionCollection"); |
201 |
195 |
202 /** |
196 /** |
203 * Check and see if this set of permissions implies the permissions |
197 * Check and see if this set of permissions implies the permissions |
204 * expressed in "permission". |
198 * expressed in "permission". |
205 * |
199 * |
206 * @param p the Permission object to compare |
200 * @param permission the Permission object to compare |
207 * |
201 * |
208 * @return always returns true. |
202 * @return always returns true. |
209 */ |
203 */ |
210 |
204 |
211 public boolean implies(Permission permission) |
205 public boolean implies(Permission permission) { |
212 { |
|
213 return all_allowed; // No sync; staleness OK |
206 return all_allowed; // No sync; staleness OK |
214 } |
207 } |
215 |
208 |
216 /** |
209 /** |
217 * Returns an enumeration of all the AllPermission objects in the |
210 * Returns an enumeration of all the AllPermission objects in the |
218 * container. |
211 * container. |
219 * |
212 * |
220 * @return an enumeration of all the AllPermission objects. |
213 * @return an enumeration of all the AllPermission objects. |
221 */ |
214 */ |
222 public Enumeration<Permission> elements() |
215 public Enumeration<Permission> elements() { |
223 { |
|
224 return new Enumeration<Permission>() { |
216 return new Enumeration<Permission>() { |
225 private boolean hasMore = all_allowed; |
217 private boolean hasMore = all_allowed; |
226 |
218 |
227 public boolean hasMoreElements() { |
219 public boolean hasMoreElements() { |
228 return hasMore; |
220 return hasMore; |