public final class BundlePermission
extends java.security.BasicPermission
A bundle symbolic name defines a unique fully qualified name. Wildcards may be used.
name ::= <symbolic name> | <symbolic name ending in ".*"> | *Examples:
org.osgi.example.bundle org.osgi.example.* *
BundlePermission has four actions: provide, require,
host, and fragment. The provide action implies the
require action.
| Modifier and Type | Field and Description |
|---|---|
private static int |
ACTION_ALL |
private static int |
ACTION_FRAGMENT |
private static int |
ACTION_HOST |
private int |
action_mask
The actions mask.
|
(package private) static int |
ACTION_NONE |
private static int |
ACTION_PROVIDE |
private static int |
ACTION_REQUIRE |
private java.lang.String |
actions
The actions in canonical form.
|
static java.lang.String |
FRAGMENT
The action string
fragment. |
static java.lang.String |
HOST
The action string
host. |
static java.lang.String |
PROVIDE
The action string
provide. |
static java.lang.String |
REQUIRE
The action string
require. |
private static long |
serialVersionUID |
| Constructor and Description |
|---|
BundlePermission(java.lang.String symbolicName,
int mask)
Package private constructor used by BundlePermissionCollection.
|
BundlePermission(java.lang.String symbolicName,
java.lang.String actions)
Defines the authority to provide and/or require and or specify a host
fragment symbolic name within the OSGi environment.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object obj)
Determines the equality of two
BundlePermission objects. |
java.lang.String |
getActions()
Returns the canonical string representation of the
BundlePermission actions. |
(package private) int |
getActionsMask()
Returns the current action mask.
|
int |
hashCode()
Returns the hash code value for this object.
|
boolean |
implies(java.security.Permission p)
Determines if the specified permission is implied by this object.
|
java.security.PermissionCollection |
newPermissionCollection()
Returns a new
PermissionCollection object suitable for storing
BundlePermission objects. |
private static int |
parseActions(java.lang.String actions)
Parse action string into action mask.
|
private void |
readObject(java.io.ObjectInputStream s)
readObject is called to restore the state of the BundlePermission from a
stream.
|
private void |
setTransients(int mask)
Called by constructors and when deserialized.
|
private void |
writeObject(java.io.ObjectOutputStream s)
WriteObject is called to save the state of the
BundlePermission
object to a stream. |
private static final long serialVersionUID
public static final java.lang.String PROVIDE
provide. The provide action implies the
require action.public static final java.lang.String REQUIRE
require. The require action is implied
by the provide action.public static final java.lang.String HOST
host.public static final java.lang.String FRAGMENT
fragment.private static final int ACTION_PROVIDE
private static final int ACTION_REQUIRE
private static final int ACTION_HOST
private static final int ACTION_FRAGMENT
private static final int ACTION_ALL
static final int ACTION_NONE
private transient int action_mask
private volatile java.lang.String actions
public BundlePermission(java.lang.String symbolicName,
java.lang.String actions)
Bundle Permissions are granted over all possible versions of a bundle.
A bundle that needs to provide a bundle must have the appropriate
BundlePermission for the symbolic name; a bundle that requires a
bundle must have the appropriate BundlePermssion for that
symbolic name; a bundle that specifies a fragment host must have the
appropriate BundlePermission for that symbolic name.
symbolicName - The bundle symbolic name.actions - provide,require, host,
fragment (canonical order).BundlePermission(java.lang.String symbolicName,
int mask)
symbolicName - the bundle symbolic namemask - the action maskprivate void setTransients(int mask)
mask - int getActionsMask()
Used by the BundlePermissionCollection class.
private static int parseActions(java.lang.String actions)
actions - Action string.public boolean implies(java.security.Permission p)
This method checks that the symbolic name of the target is implied by the
symbolic name of this object. The list of BundlePermission
actions must either match or allow for the list of the target object to
imply the target BundlePermission action.
The permission to provide a bundle implies the permission to require the named symbolic name.
x.y.*,"provide" -> x.y.z,"provide" is true
*,"require" -> x.y, "require" is true
*,"provide" -> x.y, "require" is true
x.y,"provide" -> x.y.z, "provide" is false
implies in class java.security.BasicPermissionp - The requested permission.true if the specified BundlePermission action is
implied by this object; false otherwise.public java.lang.String getActions()
BundlePermission actions.
Always returns present BundlePermission actions in the following
order: provide, require, host, fragment.
getActions in class java.security.BasicPermissionBundlePermission
actions.public java.security.PermissionCollection newPermissionCollection()
PermissionCollection object suitable for storing
BundlePermission objects.newPermissionCollection in class java.security.BasicPermissionPermissionCollection object.public boolean equals(java.lang.Object obj)
BundlePermission objects.
This method checks that specified bundle has the same bundle symbolic
name and BundlePermission actions as this
BundlePermission object.equals in class java.security.BasicPermissionobj - The object to test for equality with this
BundlePermission object.true if obj is a BundlePermission, and
has the same bundle symbolic name and actions as this
BundlePermission object; false otherwise.public int hashCode()
hashCode in class java.security.BasicPermissionprivate void writeObject(java.io.ObjectOutputStream s)
throws java.io.IOException
BundlePermission
object to a stream. The actions are serialized, and the superclass takes
care of the name.java.io.IOExceptionprivate void readObject(java.io.ObjectInputStream s)
throws java.io.IOException,
java.lang.ClassNotFoundException
java.io.IOExceptionjava.lang.ClassNotFoundException