Package ej.property
Class PropertyPermission
- java.lang.Object
-
- java.security.Permission
-
- ej.property.PropertyPermission
-
- All Implemented Interfaces:
Serializable,Guard
public class PropertyPermission extends Permission
Permission to manipulate services usingPropertyLoader.getProperty(String)orPropertyLoader.getProperty(String, String)orPropertyRegistry.setProperty(String, String)orPropertyRegistry.removeProperty(String).- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static StringGET_ACTIONAction associated withPropertyLoader.getProperty(String)orPropertyLoader.getProperty(String, String).static StringREMOVE_ACTIONAction associated withPropertyRegistry.removeProperty(String).static StringSET_ACTIONAction associated withPropertyRegistry.setProperty(String, String).
-
Constructor Summary
Constructors Constructor Description PropertyPermission(String parentName, String key, String action)Creates a permission for the given property.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)Checks two Permission objects for equality.StringgetActions()Returns the actions as a String.StringgetKey()Gets the property key handled by this permission.inthashCode()Returns the hash code value for this Permission object.booleanimplies(Permission permission)Checks if the specified permission's actions are "implied by" this object's actions.-
Methods inherited from class java.security.Permission
getName, toString
-
-
-
-
Field Detail
-
GET_ACTION
public static final String GET_ACTION
Action associated withPropertyLoader.getProperty(String)orPropertyLoader.getProperty(String, String).- See Also:
- Constant Field Values
-
SET_ACTION
public static final String SET_ACTION
Action associated withPropertyRegistry.setProperty(String, String).- See Also:
- Constant Field Values
-
REMOVE_ACTION
public static final String REMOVE_ACTION
Action associated withPropertyRegistry.removeProperty(String).- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PropertyPermission
public PropertyPermission(String parentName, String key, String action)
Creates a permission for the given property.The action can be one of
,GET_ACTIONorSET_ACTION.REMOVE_ACTION- Parameters:
parentName- the name of the service loader or service registry.key- the property key.action- the action realized with the service.
-
-
Method Detail
-
getActions
public String getActions()
Description copied from class:PermissionReturns the actions as a String. This is abstract so subclasses can defer creating a String representation until one is needed. Subclasses should always return actions in what they consider to be their canonical form. For example, two FilePermission objects created via the following:perm1 = new FilePermission(p1, "read,write"); perm2 = new FilePermission(p2, "write,read");
both return "read,write" when thegetActionsmethod is invoked.- Specified by:
getActionsin classPermission- Returns:
- the actions of this Permission.
-
getKey
public String getKey()
Gets the property key handled by this permission.- Returns:
- the property key.
-
equals
public boolean equals(@Nullable Object obj)
Description copied from class:PermissionChecks two Permission objects for equality.Do not use the
equalsmethod for making access control decisions; use theimpliesmethod.- Specified by:
equalsin classPermission- Parameters:
obj- the object we are testing for equality with this object.- Returns:
- true if both Permission objects are equivalent.
- See Also:
Object.hashCode(),HashMap
-
hashCode
public int hashCode()
Description copied from class:PermissionReturns the hash code value for this Permission object.The required
hashCodebehavior for Permission Objects is the following:- Whenever it is invoked on the same Permission object more than once during an execution of a
Java application, the
hashCodemethod must consistently return the same integer. This integer need not remain consistent from one execution of an application to another execution of the same application. - If two Permission objects are equal according to the
equalsmethod, then calling thehashCodemethod on each of the two Permission objects must produce the same integer result.
- Specified by:
hashCodein classPermission- Returns:
- a hash code value for this object.
- See Also:
Object.equals(java.lang.Object),System.identityHashCode(java.lang.Object)
- Whenever it is invoked on the same Permission object more than once during an execution of a
Java application, the
-
implies
public boolean implies(@Nullable Permission permission)
Description copied from class:PermissionChecks if the specified permission's actions are "implied by" this object's actions.This must be implemented by subclasses of Permission, as they are the only ones that can impose semantics on a Permission object.
- Specified by:
impliesin classPermission- Parameters:
permission- the permission to check against.- Returns:
- true if the specified permission is implied by this object, false if not.
-
-