public final class CapabilityPermission extends BasicPermission
provide
action allows a bundle to provide a capability
matching the specified filter.require
action allows a bundle to require a capability
matching the specified filter.Modifier and Type | Field and Description |
---|---|
static String |
PROVIDE
The action string
provide . |
static String |
REQUIRE
The action string
require . |
Constructor and Description |
---|
CapabilityPermission(String namespace,
Map<String,?> attributes,
Bundle providingBundle,
String actions)
Creates a new requested
CapabilityPermission object to be used by
code that must perform checkPermission for the require
action. |
CapabilityPermission(String name,
String actions)
Create a new CapabilityPermission.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj)
Determines the equality of two CapabilityPermission objects.
|
String |
getActions()
Returns the canonical string representation of the actions.
|
int |
hashCode()
Returns the hash code value for this object.
|
boolean |
implies(Permission p)
Determines if a
CapabilityPermission object "implies" the
specified permission. |
PermissionCollection |
newPermissionCollection()
Returns a new
PermissionCollection object for storing
CapabilityPermission objects. |
checkGuard, getName, toString
public static final String REQUIRE
require
.public static final String PROVIDE
provide
.public CapabilityPermission(String name, String actions)
The name is specified as a dot-separated string. Wildcards may be used.
name ::= <namespace> | <namespace ending in ".*"> | *Examples:
com.acme.capability.* org.foo.capability *For the
require
action, the name can also be a filter expression.
The filter gives access to the capability attributes as well as the
following attributes:
There are two possible actions: require
and provide
. The
require
permission allows the owner of this permission to require
a capability matching the attributes. The provide
permission
allows the bundle to provide a capability in the specified capability
namespace.
name
- The capability namespace or a filter over the attributes.actions
- require
,provide
(canonical order)IllegalArgumentException
- If the specified name is a filter
expression and either the specified action is not require
or the filter has an invalid syntax.public CapabilityPermission(String namespace, Map<String,?> attributes, Bundle providingBundle, String actions)
CapabilityPermission
object to be used by
code that must perform checkPermission
for the require
action. CapabilityPermission
objects created with this
constructor cannot be added to a CapabilityPermission
permission
collection.namespace
- The requested capability namespace.attributes
- The requested capability attributes.providingBundle
- The bundle providing the requested capability.actions
- The action require
.IllegalArgumentException
- If the specified action is not
require
or attributes or providingBundle are null
.public boolean implies(Permission p)
CapabilityPermission
object "implies" the
specified permission.implies
in class BasicPermission
p
- The target permission to check.true
if the specified permission is implied by this
object; false
otherwise.public String getActions()
require
,
provide
.getActions
in class BasicPermission
public PermissionCollection newPermissionCollection()
PermissionCollection
object for storing
CapabilityPermission
objects.newPermissionCollection
in class BasicPermission
PermissionCollection
object suitable for storing
CapabilityPermission
objects.public boolean equals(Object obj)
CapabilityPermission
.equals
in class BasicPermission
obj
- The object to test for equality.CapabilityPermission
, and has the same
name and actions as this CapabilityPermission
object;
false
otherwise.public int hashCode()
hashCode
in class BasicPermission
Copyright © 2006–2016 The Apache Software Foundation. All rights reserved.