public final class ServicePermission extends BasicPermission
register
action allows a bundle to register a service on
the specified names.
get
action allows a bundle to detect a service and get
it.
ServicePermission
to get the specific service.Modifier and Type | Field and Description |
---|---|
static String |
GET
The action string
get . |
static String |
REGISTER
The action string
register . |
Constructor and Description |
---|
ServicePermission(ServiceReference reference,
String actions)
Creates a new requested
ServicePermission object to be used
by code that must perform checkPermission for the
get action. |
ServicePermission(String name,
String actions)
Create a new ServicePermission.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj)
Determines the equality of two ServicePermission 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
ServicePermission object "implies" the
specified permission. |
PermissionCollection |
newPermissionCollection()
Returns a new
PermissionCollection object for storing
ServicePermission |
checkGuard, getName, toString
public static final String GET
get
.public static final String REGISTER
register
.public ServicePermission(String name, String actions)
The name of the service is specified as a fully qualified class name. Wildcards may be used.
name ::= <class name> | <class name ending in ".*"> | *Examples:
org.osgi.service.http.HttpService org.osgi.service.http.* *For the
get
action, the name can also be a filter
expression. The filter gives access to the service properties as well as
the following attributes:
There are two possible actions: get
and
register
. The get
permission allows the owner
of this permission to obtain a service with this name. The
register
permission allows the bundle to register a service
under that name.
name
- The service class nameactions
- get
,register
(canonical order)IllegalArgumentException
- If the specified name is a filter
expression and either the specified action is not
get
or the filter has an invalid syntax.public ServicePermission(ServiceReference reference, String actions)
ServicePermission
object to be used
by code that must perform checkPermission
for the
get
action. ServicePermission
objects created
with this constructor cannot be added to a ServicePermission
permission collection.reference
- The requested service.actions
- The action get
.IllegalArgumentException
- If the specified action is not
get
or reference is null
.public boolean implies(Permission p)
ServicePermission
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()
get
,
register
.getActions
in class BasicPermission
public PermissionCollection newPermissionCollection()
PermissionCollection
object for storing
ServicePermission objects.
newPermissionCollection
in class BasicPermission
PermissionCollection
object suitable for storing
ServicePermission
objects.public boolean equals(Object obj)
ServicePermission
.equals
in class BasicPermission
obj
- The object to test for equality.ServicePermission
, and has the same
class name and actions as this ServicePermission
object; false
otherwise.public int hashCode()
hashCode
in class BasicPermission
Copyright © 2018 JBoss by Red Hat. All rights reserved.