public class DevicePermission extends BasicPermission
Device.remove() is protected with
REMOVE permission action.
The name of the permission is a filter based. See OSGi Core Specification, Filter Based Permissions. The filter gives an access to all device service properties. Filter attribute names are processed in a case sensitive manner.
| Modifier and Type | Field and Description |
|---|---|
static String |
REMOVE
A permission action to remove the device.
|
| Constructor and Description |
|---|
DevicePermission(Device device,
String action)
Creates a new
DevicePermission with the given device and actions. |
DevicePermission(String filter,
String action)
Creates a new
DevicePermission with the given filter and actions. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj)
Two
DevicePermission instances are equal if:
Represents the same filter and action.
Represents the same device (in respect to device unique identifier)
and action.
|
String |
getActions()
Returns the canonical string representation of
REMOVE action. |
int |
hashCode()
Returns the hash code value for this object.
|
boolean |
implies(Permission p)
Determines if the specified permission is implied by this object.
|
PermissionCollection |
newPermissionCollection()
Returns a new
PermissionCollection suitable for storing
DevicePermission instances. |
checkGuard, getName, toStringpublic static final String REMOVE
public DevicePermission(String filter, String action)
DevicePermission with the given filter and actions.
The constructor must only be used to create a permission that is going to
be checked.
A filter example: (dal.device.hardware.vendor=acme)
An action: remove
filter - A filter expression that can use any device service
property. The filter attribute names are processed in a case
insensitive manner. A special value of "*" can be used to match
all devices.action - REMOVE action.IllegalArgumentException - If the filter syntax is not correct or
invalid action is specified.NullPointerException - If the filter or action is null.public DevicePermission(Device device, String action)
DevicePermission with the given device and actions.
The permission must be used for the security checks like:
securityManager.checkPermission(new DevicePermission(this, "remove"))
. The permissions constructed by this constructor must not be added to
the DevicePermission permission collections.
device - The device that needs to be checked for a permission.action - REMOVE action.IllegalArgumentException - If an invalid action is specified.NullPointerException - If the device or action is null.public boolean equals(Object obj)
DevicePermission instances are equal if:
equals in class BasicPermissionobj - The object being compared for equality with this object.true if two permissions are equal, false
otherwise.public int hashCode()
hashCode in class BasicPermissionpublic String getActions()
REMOVE action.getActions in class BasicPermissionpublic boolean implies(Permission p)
false if the specified permission was not
constructed by DevicePermission(Device, String).
Returns true if the specified permission is a
DevicePermission and this permission filter matches the specified
permission device properties.implies in class BasicPermissionp - The permission to be implied. It must be constructed by
DevicePermission(Device, String).true if the specified permission is implied by this
permission, false otherwise.IllegalArgumentException - If the specified permission is not
constructed by DevicePermission(Device, String).public PermissionCollection newPermissionCollection()
PermissionCollection suitable for storing
DevicePermission instances.newPermissionCollection in class BasicPermissionPermissionCollection instance.Copyright © Contributors to the Eclipse Foundation Licensed under the Eclipse Foundation Specification License – v1.0