java.security
Class BasicPermission
java.lang.Object
|
+--java.security.Permission
|
+--java.security.BasicPermission
All Implemented Interfaces:
Serializable, Guard, Serializable
This class implements a simple model for named permissions without an
associated action list. That is, either the named permission is granted
or it is not.
It also supports trailing wildcards to allow the easy granting of
permissions in a hierarchical fashion. (For example, the name "org.gnu.*"
might grant all permissions under the "org.gnu" permissions hierarchy).
The only valid wildcard character is a '*' which matches anything. It
must be the rightmost element in the permission name and must follow a
'.' or else the Permission name must consist of only a '*'. Any other
occurrence of a '*' is not valid.
This class ignores the action list. Subclasses can choose to implement
actions on top of this class if desired.
Since:Authors:- Aaron M. Renn <arenn@urbanophile.com>
- Eric Blake <ebb9@email.byu.edu>
See Also:
BasicPermission
public BasicPermission(java.lang.String name)
Create a new instance with the specified permission name. If the name
is empty, or contains an illegal wildcard character, an exception is
thrown.
Parameters:
Throws:
BasicPermission
public BasicPermission(java.lang.String name, java.lang.String actions)
Create a new instance with the specified permission name. If the name
is empty, or contains an illegal wildcard character, an exception is
thrown. The actions parameter is ignored.
Parameters:
Throws:
equals
public boolean equals(java.lang.Object obj)
This method tests to see if this object is equal to the specified
Object
. This will be true if and only if the specified
object meets the following conditions:
- It is an instance of the same class as this.
- It has the same name as this permission.
Parameters:
Returns:
- true if obj is semantically equal to this
getActions
public String getActions()
This method returns a list of the actions associated with this
permission. This method always returns the empty string ("") since
this class ignores actions.
Returns:
hashCode
public int hashCode()
This method returns a hash code for this permission object. The hash
code returned is the value returned by calling the hashCode
method on the String
that is the name of this permission.
Returns:
- a hash value for this object
implies
public boolean implies(java.security.Permission perm)
This method tests to see if the specified permission is implied by this
permission. This will be true if the following conditions are met:
- The specified object is an instance of the same class as this
object.
- The name of the specified permission is implied by this permission's
name based on wildcard matching. For example, "a.*" implies "a.b".
Parameters:
Returns:
- true if the specified permission is implied
newPermissionCollection
public PermissionCollection newPermissionCollection()
This method returns an instance of PermissionCollection
suitable for storing BasicPermission
objects. The
collection returned can only store objects of the same type as this.
Subclasses which use actions must override this method; but a class with
no actions will work fine with this.
Returns:
- a new empty
PermissionCollection
object
It also supports trailing wildcards to allow the easy granting of permissions in a hierarchical fashion. (For example, the name "org.gnu.*" might grant all permissions under the "org.gnu" permissions hierarchy). The only valid wildcard character is a '*' which matches anything. It must be the rightmost element in the permission name and must follow a '.' or else the Permission name must consist of only a '*'. Any other occurrence of a '*' is not valid.
This class ignores the action list. Subclasses can choose to implement actions on top of this class if desired.