public abstract class PeripheralPermission
extends java.security.Permission
PeripheralPermission abstract class is the superclass of all peripheral permissions.
A PeripheralPermission permission has a target name and, optionally, a list of actions.
The target name contains hardware addressing information.
It takes the following form:
( {device-name-spec} | {device-number} | "*" | "" ) [ ":" ( {channel-spec} | "*" | "" ) ]
{device-name-spec}{device-name-spec} string is the string representation of a device name as may be returned by a call to
PeripheralConfig.HardwareAddressing.getDeviceName(). A device name is Operating System specific such as a device file name
on UNIX systems. Occurrences of the semicolon character (":") must
be escaped with a backslash ("\"). A {device-name-spec} string that ends
with an asterisk ("*") is a prefix pattern that matches all the device names starting with the same prefix.
{device-number}{device-number} string is the decimal string representation of a device number as may be returned by
a call to PeripheralConfig.HardwareAddressing.getDeviceNumber(). The characters in the string must all be decimal digits.
{channel-spec}{channel-spec} string is peripheral type specific and must be defined by subclasses.
PeripheralPermission may defined additional specific target name formats to designate
peripherals using their specific hardware addressing information.
The actions to be granted are passed to the constructor in a string
containing a list of one or more comma-separated keywords.
The supported common actions are open and powermanage. Their meaning is defined as follows:
openPeripheralManager.open(java.lang.Class<P>, com.oracle.deviceaccess.PeripheralConfig<? super P>))powermanagePowerManaged)PeripheralPermission.PeripheralManager.open,
PowerManaged,
Serialized Form| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
OPEN
The
open action. |
static java.lang.String |
POWER_MANAGE
The
powermanage action. |
| Constructor and Description |
|---|
PeripheralPermission(java.lang.String name)
Constructs a new
PeripheralPermission with the specified target name and the implicit open action. |
PeripheralPermission(java.lang.String name,
java.lang.String actions)
Constructs a new
PeripheralPermission instance with the specified target name and action list. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object obj)
Checks two
PeripheralPermission objects for equality. |
java.lang.String |
getActions()
Returns the list of possible actions in the following order:
open or powermanage (additional actions
may be defined by subclasses). |
int |
hashCode()
Returns the hash code value for this object.
|
boolean |
implies(java.security.Permission permission)
Checks if this
PeripheralPermission object "implies" the specified permission. |
java.security.PermissionCollection |
newPermissionCollection()
Returns a new
PermissionCollection for storing PeripheralPermission objects. |
public static final java.lang.String OPEN
open action.public static final java.lang.String POWER_MANAGE
powermanage action.public PeripheralPermission(java.lang.String name)
PeripheralPermission with the specified target name and the implicit open action.name - the target name (as defined above).java.lang.NullPointerException - if name is null.Permission.getName()public PeripheralPermission(java.lang.String name,
java.lang.String actions)
PeripheralPermission instance with the specified target name and action list.name - the target name (as defined above).actions - comma-separated list of peripheral operations: open or powermanage (additional actions
may be defined by subclasses).java.lang.NullPointerException - if name is null.java.lang.IllegalArgumentException - if name is empty or if actions is null, empty or contains an action other than the
specified possible actions.Permission.getName()public boolean equals(java.lang.Object obj)
PeripheralPermission objects for equality.equals in class java.security.Permissionobj - the object to test for equality with this object.true if obj is a PeripheralPermission and has the same target name and actions as
this PeripheralPermission object.public java.lang.String getActions()
open or powermanage (additional actions
may be defined by subclasses).getActions in class java.security.Permissionpublic int hashCode()
hashCode in class java.security.Permissionpublic boolean implies(java.security.Permission permission)
PeripheralPermission object "implies" the specified permission.
More specifically, this method returns true if:
permission is an instance of PeripheralPermission, and
permission's actions are a proper subset of this object's action list, and
permission's peripheral ID, name, hardware addressing information or range thereof
is included in this peripheral ID, name or hardware addressing information range, whichever is defined.
implies in class java.security.Permissionpermission - 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 PeripheralPermission objects.
PeripheralPermission 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.PermissionPermissionCollection suitable for storing PeripheralPermission objects, or null if
one is not defined.Copyright © 2012, 2013, Oracle and/or its affiliates. All rights reserved.
Legal Notices