Package org.wildfly.common.context
Class ContextPermission
- java.lang.Object
-
- java.security.Permission
-
- org.wildfly.common.context.ContextPermission
-
- All Implemented Interfaces:
java.io.Serializable,java.security.Guard
public final class ContextPermission extends java.security.PermissionA permission object for operations onContextManagerinstances.This type of permission requires a
nameand anaction. Thenamemay be the name of a context manager, or the special*name which means the permission applies to all context managers.The
actionmay 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:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ContextPermission(java.lang.String name, java.lang.String actions)Constructs a permission with the specified name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)Determine if this permission is equal to the given object.booleanequals(ContextPermission permission)Determine if this permission is equal to the given permission.java.lang.StringgetActions()Get the actions string.inthashCode()Get the hash code of this permission.booleanimplies(java.security.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.java.security.PermissionCollectionnewPermissionCollection()Get a new permission collection instance which can hold this type of permissions.ContextPermissionwithActions(java.lang.String actions)Create a copy of this permission with the additional given actions.ContextPermissionwithoutActions(java.lang.String actions)Create a copy of this permission without any of the given actions.
-
-
-
Method Detail
-
implies
public boolean implies(java.security.Permission permission)
Determine if the given permission is implied by this permission.- Specified by:
impliesin classjava.security.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
-
implies
public boolean implies(ContextPermission permission)
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
public boolean equals(java.lang.Object obj)
Determine if this permission is equal to the given object.- Specified by:
equalsin classjava.security.Permission- Parameters:
obj- the other object- Returns:
trueif the object is a context permission that is exactly equal to this one;falseotherwise
-
equals
public boolean equals(ContextPermission permission)
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 classjava.security.Permission- Returns:
- the hash code of this permission
-
getActions
public java.lang.String getActions()
Get the actions string. This string will be returned in a canonical format.- Specified by:
getActionsin classjava.security.Permission- Returns:
- the actions string
-
withActions
@NotNull public ContextPermission withActions(java.lang.String actions)
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
@NotNull public ContextPermission withoutActions(java.lang.String actions)
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
public java.security.PermissionCollection newPermissionCollection()
Get a new permission collection instance which can hold this type of permissions.- Overrides:
newPermissionCollectionin classjava.security.Permission- Returns:
- a new permission collection instance (not
null)
-
-