public class DeviceMgmtPermission
extends java.security.Permission
DeviceMgmtPermission
class defines permissions for registering and unregistering devices as
well as opening devices using their registered configurations.
Device management permissions have a target name and actions.
The target name is a combination of a device name and of a device ID or range of device IDs.
It takes the following form:
{device-name-spec} [ ":"{device-id-spec} ]
{device-name-spec}
{device-name-spec}
string takes the following form:
{device-name} | "*" | ""
The {device-name}
string is a device name as may be returned by a call to DeviceDescriptor.getName
.
{device-name-spec}
specification consisting of the asterisk ("*") matches all device names.
A {device-name-spec}
specification consisting of the empty string ("") designates an undefined device name
that may only be matched by an empty string or an asterisk.
{device-id-spec}
{device-id-spec}
string takes the following form:
{device-id} | "-"{device-id} | {device-id}"-"[{device-id}] | "*"
The {device-id}
string is a device ID as may be returned by a call to DeviceDescriptor.getID
.
The characters in the string must all be decimal digits.
{device-id-spec}
specification of the form "N-" (where N is a device ID) signifies all device IDs
numbered N and above, while a specification of the form "-N" indicates all device IDs numbered N and below.
A single asterisk in the place of the {device-id-spec}
field matches all device IDs.
The target name "*:*"
matches all device names and all device IDs as is the target name "*"
.
register
and unregister
. Their
meaning is defined as follows:
open
DeviceManager.open(id, ...)
and DeviceManager.open(name, ...)
methods)register
unregister
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
OPEN
The
open action. |
static java.lang.String |
REGISTER
The
register action. |
static java.lang.String |
UNREGISTER
The
unregister action. |
Constructor and Description |
---|
DeviceMgmtPermission(java.lang.String name,
java.lang.String actions)
Constructs a new
DeviceMgmtPermission instance with the specified target name and action list. |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj)
Checks two
DeviceMgmtPermission objects for equality. |
java.lang.String |
getActions()
Returns the list of possible actions in the following order:
register ,
unregister or open . |
int |
hashCode()
Returns the hash code value for this object.
|
boolean |
implies(java.security.Permission permission)
Checks if this
DeviceMgmtPermission object "implies" the specified permission. |
java.security.PermissionCollection |
newPermissionCollection()
Returns a new
PermissionCollection for storing DeviceMgmtPermission objects. |
public static final java.lang.String REGISTER
register
action.public static final java.lang.String UNREGISTER
unregister
action.public static final java.lang.String OPEN
open
action.public DeviceMgmtPermission(java.lang.String name, java.lang.String actions)
DeviceMgmtPermission
instance with the specified target name and action list.name
- the target name (as defined above).actions
- comma-separated list of device management operations: register
unregister
or open
.java.lang.NullPointerException
- if name
is null
.java.lang.IllegalArgumentException
- if actions is null
, empty or contains an action other than the
specified possible actions.public boolean equals(java.lang.Object obj)
DeviceMgmtPermission
objects for equality.equals
in class java.security.Permission
obj
- the object to test for equality with this object.true
if obj
is a DeviceMgmtPermission
and has the same target name and
actions as this DeviceMgmtPermission
object.public java.lang.String getActions()
register
,
unregister
or open
.getActions
in class java.security.Permission
public int hashCode()
hashCode
in class java.security.Permission
public boolean implies(java.security.Permission permission)
DeviceMgmtPermission
object "implies" the specified permission.
More specifically, this method returns true
if:
permission
is an instance of DeviceMgmtPermission
, and
permission
's actions are a proper subset of this action list, and
permission
's device name, ID or range thereof
is included in this device name or ID range, whichever is defined.
implies
in class java.security.Permission
permission
- the permission to check against.true
if the specified permission is not null
and is implied by this object, false
otherwise.public java.security.PermissionCollection newPermissionCollection()
PermissionCollection
for storing DeviceMgmtPermission
objects.
DeviceMgmtPermission
objects must be stored in a manner that allows them to be inserted into the
collection in any order, but that also enables the PermissionCollection
implies method to be implemented
in an efficient (and consistent) manner.
If null
is returned, then the caller of this method is free to store permissions of this type in any
PermissionCollection they choose (one that uses a Hashtable
, one that uses a Vector
, etc).
newPermissionCollection
in class java.security.Permission
PermissionCollection
suitable for storing DeviceMgmtPermission
objects, or
null
if one is not defined.Copyright © 2012, 2014, Oracle and/or its affiliates. All rights reserved.
Legal Notices