Index (Frames) | Index (No Frames) | Package | Package Tree | Tree
java.security

Class BasicPermission

java.lang.Object
|
+--java.security.Permission
   |
   +--java.security.BasicPermission

All Implemented Interfaces:

Serializable, Guard, Serializable


public abstract class BasicPermission

extends Permission

implements 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:See Also:

Constructor Summary

BasicPermission(java.lang.String name)

Create a new instance with the specified permission name.
BasicPermission(java.lang.String name, java.lang.String actions)

Create a new instance with the specified permission name.

Method Summary

booleanequals(java.lang.Object obj)

This method tests to see if this object is equal to the specified Object.
java.lang.StringgetActions()

This method returns a list of the actions associated with this permission.
inthashCode()

This method returns a hash code for this permission object.
booleanimplies(java.security.Permission perm)

This method tests to see if the specified permission is implied by this permission.
java.security.PermissionCollectionnewPermissionCollection()

This method returns an instance of PermissionCollection suitable for storing BasicPermission objects.

Constructor Details

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:


Method Details

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:

Parameters:

Returns:


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:


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:

Parameters:

Returns:


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: