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.Permission
A permission object for operations onContextManager
instances.This type of permission requires a
name
and anaction
. Thename
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:
- 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 boolean
equals(java.lang.Object obj)
Determine if this permission is equal to the given object.boolean
equals(ContextPermission permission)
Determine if this permission is equal to the given permission.java.lang.String
getActions()
Get the actions string.int
hashCode()
Get the hash code of this permission.boolean
implies(java.security.Permission permission)
Determine if the given permission is implied by this permission.boolean
implies(ContextPermission permission)
Determine if the given permission is implied by this permission.java.security.PermissionCollection
newPermissionCollection()
Get a new permission collection instance which can hold this type of permissions.ContextPermission
withActions(java.lang.String actions)
Create a copy of this permission with the additional given actions.ContextPermission
withoutActions(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:
implies
in classjava.security.Permission
- Parameters:
permission
- the other permission- Returns:
true
if the other permission is notnull
and is a context permission which is implied by this permission instance;false
otherwise
-
implies
public boolean implies(ContextPermission permission)
Determine if the given permission is implied by this permission.- Parameters:
permission
- the other permission- Returns:
true
if the other permission is notnull
and is a context permission which is implied by this permission instance;false
otherwise
-
equals
public boolean equals(java.lang.Object obj)
Determine if this permission is equal to the given object.- Specified by:
equals
in classjava.security.Permission
- Parameters:
obj
- the other object- Returns:
true
if the object is a context permission that is exactly equal to this one;false
otherwise
-
equals
public boolean equals(ContextPermission permission)
Determine if this permission is equal to the given permission.- Parameters:
permission
- the other permission- Returns:
true
if the permission is a context permission that is exactly equal to this one;false
otherwise
-
hashCode
public int hashCode()
Get the hash code of this permission.- Specified by:
hashCode
in 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:
getActions
in 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:
newPermissionCollection
in classjava.security.Permission
- Returns:
- a new permission collection instance (not
null
)
-
-