Package org.osgi.service.dal
Class DevicePermission
java.lang.Object
java.security.Permission
java.security.BasicPermission
org.osgi.service.dal.DevicePermission
- All Implemented Interfaces:
Serializable
,Guard
A bundle's authority to perform specific privileged administrative operations
on the devices. The method
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.
- See Also:
-
Field Summary
-
Constructor Summary
ConstructorDescriptionDevicePermission
(String filter, String action) Creates a newDevicePermission
with the given filter and actions.DevicePermission
(Device device, String action) Creates a newDevicePermission
with the given device and actions. -
Method Summary
Modifier and TypeMethodDescriptionboolean
TwoDevicePermission
instances are equal if: Represents the same filter and action. Represents the same device (in respect to device unique identifier) and action.Returns the canonical string representation ofREMOVE
action.int
hashCode()
Returns the hash code value for this object.boolean
Determines if the specified permission is implied by this object.Returns a newPermissionCollection
suitable for storingDevicePermission
instances.Methods inherited from class java.security.Permission
checkGuard, getName, toString
-
Field Details
-
REMOVE
A permission action to remove the device.- See Also:
-
-
Constructor Details
-
DevicePermission
Creates a newDevicePermission
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
- Parameters:
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.- Throws:
IllegalArgumentException
- If the filter syntax is not correct or invalid action is specified.NullPointerException
- If the filter or action is null.
-
DevicePermission
Creates a newDevicePermission
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 theDevicePermission
permission collections.- Parameters:
device
- The device that needs to be checked for a permission.action
-REMOVE
action.- Throws:
IllegalArgumentException
- If an invalid action is specified.NullPointerException
- If the device or action is null.
-
-
Method Details
-
equals
TwoDevicePermission
instances are equal if:- Represents the same filter and action.
- Represents the same device (in respect to device unique identifier) and action.
- Overrides:
equals
in classBasicPermission
- Parameters:
obj
- The object being compared for equality with this object.- Returns:
true
if two permissions are equal,false
otherwise.
-
hashCode
public int hashCode()Returns the hash code value for this object.- Overrides:
hashCode
in classBasicPermission
- Returns:
- Hash code value for this object.
-
getActions
Returns the canonical string representation ofREMOVE
action.- Overrides:
getActions
in classBasicPermission
- Returns:
- The canonical string representation of the actions.
-
implies
Determines if the specified permission is implied by this object. The method will returnfalse
if the specified permission was not constructed byDevicePermission(Device, String)
. Returnstrue
if the specified permission is aDevicePermission
and this permission filter matches the specified permission device properties.- Overrides:
implies
in classBasicPermission
- Parameters:
p
- The permission to be implied. It must be constructed byDevicePermission(Device, String)
.- Returns:
true
if the specified permission is implied by this permission,false
otherwise.- Throws:
IllegalArgumentException
- If the specified permission is not constructed byDevicePermission(Device, String)
.
-
newPermissionCollection
Returns a newPermissionCollection
suitable for storingDevicePermission
instances.- Overrides:
newPermissionCollection
in classBasicPermission
- Returns:
- A new
PermissionCollection
instance.
-