Package org.wildfly.common.context
Class ContextPermission
java.lang.Object
java.security.Permission
org.wildfly.common.context.ContextPermission
- All Implemented Interfaces:
Serializable,Guard
A permission object for operations on
ContextManager instances.
This type of permission requires a name and an action. The name may be the name
of a context manager, or the special * name which means the permission applies to all context managers.
The action may be one or more of the following (each action name being separated by a comma):
get- allow getting the current contextgetPrivilegedSupplier- allow access to theContextManager.getPrivilegedSupplier()methodgetGlobalDefault- allow access to the global default contextsetGlobalDefault- allow setting the global default instancesetGlobalDefaultSupplier- allow setting the global default instance suppliergetThreadDefault- allow access to the per-thread default contextsetThreadDefault- allow setting the per-thread default instancesetThreadDefaultSupplier- allow setting the per-thread default instance supplier
* action name is allowed which implies all of the above actions.
The newPermissionCollection() method returns an optimized container for context permissions.
- Author:
- David M. Lloyd
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionContextPermission(String name, String actions) Constructs a permission with the specified name. -
Method Summary
Modifier and TypeMethodDescriptionbooleanDetermine if this permission is equal to the given object.booleanequals(ContextPermission permission) Determine if this permission is equal to the given permission.Get the actions string.inthashCode()Get the hash code of this permission.booleanimplies(Permission permission) Determine if the given permission is implied by this permission.booleanimplies(ContextPermission permission) Determine if the given permission is implied by this permission.Get a new permission collection instance which can hold this type of permissions.withActions(String actions) Create a copy of this permission with the additional given actions.withoutActions(String actions) Create a copy of this permission without any of the given actions.Methods inherited from class java.security.Permission
checkGuard, getName, toString
-
Constructor Details
-
ContextPermission
Constructs a permission with the specified name.- Parameters:
name- name of the Permission object being created (must not benull)actions- the actions string (must not benull)
-
-
Method Details
-
implies
Determine if the given permission is implied by this permission.- Specified by:
impliesin classPermission- Parameters:
permission- the other permission- Returns:
trueif the other permission is notnulland is a context permission which is implied by this permission instance;falseotherwise
-
implies
Determine if the given permission is implied by this permission.- Parameters:
permission- the other permission- Returns:
trueif the other permission is notnulland is a context permission which is implied by this permission instance;falseotherwise
-
equals
Determine if this permission is equal to the given object.- Specified by:
equalsin classPermission- Parameters:
obj- the other object- Returns:
trueif the object is a context permission that is exactly equal to this one;falseotherwise
-
equals
Determine if this permission is equal to the given permission.- Parameters:
permission- the other permission- Returns:
trueif the permission is a context permission that is exactly equal to this one;falseotherwise
-
hashCode
public int hashCode()Get the hash code of this permission.- Specified by:
hashCodein classPermission- Returns:
- the hash code of this permission
-
getActions
Get the actions string. This string will be returned in a canonical format.- Specified by:
getActionsin classPermission- Returns:
- the actions string
-
withActions
Create a copy of this permission with the additional given actions.- Parameters:
actions- the additional actions (must not benull)- Returns:
- the new permission (not
null)
-
withoutActions
Create a copy of this permission without any of the given actions.- Parameters:
actions- the actions to subtract (must not benull)- Returns:
- the new permission (not
null)
-
newPermissionCollection
Get a new permission collection instance which can hold this type of permissions.- Overrides:
newPermissionCollectionin classPermission- Returns:
- a new permission collection instance (not
null)
-