Class BundlePermission
- All Implemented Interfaces:
Serializable, Guard
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.
- Since:
- 1.3
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate static final intprivate static final intprivate intThe actions mask.(package private) static final intprivate static final intprivate static final intprivate StringThe actions in canonical form.static final StringThe action stringfragment.static final StringThe action stringhost.static final StringThe action stringprovide.static final StringThe action stringrequire.private static final long -
Constructor Summary
ConstructorsConstructorDescriptionBundlePermission(String symbolicName, int mask) Package private constructor used by BundlePermissionCollection.BundlePermission(String symbolicName, String actions) Defines the authority to provide and/or require and or specify a host fragment symbolic name within the OSGi environment. -
Method Summary
Modifier and TypeMethodDescriptionbooleanDetermines the equality of twoBundlePermissionobjects.Returns the canonical string representation of theBundlePermissionactions.(package private) intReturns the current action mask.inthashCode()Returns the hash code value for this object.booleanDetermines if the specified permission is implied by this object.Returns a newPermissionCollectionobject suitable for storingBundlePermissionobjects.private static intparseActions(String actions) Parse action string into action mask.private voidreadObject is called to restore the state of the BundlePermission from a stream.private voidsetTransients(int mask) Called by constructors and when deserialized.private voidWriteObject is called to save the state of theBundlePermissionobject to a stream.Methods inherited from class Permission
checkGuard, getName, toString
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
PROVIDE
The action stringprovide. Theprovideaction implies therequireaction.- See Also:
-
REQUIRE
The action stringrequire. Therequireaction is implied by theprovideaction.- See Also:
-
HOST
-
FRAGMENT
-
ACTION_PROVIDE
private static final int ACTION_PROVIDE- See Also:
-
ACTION_REQUIRE
private static final int ACTION_REQUIRE- See Also:
-
ACTION_HOST
private static final int ACTION_HOST- See Also:
-
ACTION_FRAGMENT
private static final int ACTION_FRAGMENT- See Also:
-
ACTION_ALL
private static final int ACTION_ALL- See Also:
-
ACTION_NONE
static final int ACTION_NONE- See Also:
-
action_mask
private transient int action_maskThe actions mask. -
actions
The actions in canonical form.
-
-
Constructor Details
-
BundlePermission
Defines the authority to provide and/or require and or specify a host fragment symbolic name within the OSGi environment.Bundle Permissions are granted over all possible versions of a bundle. A bundle that needs to provide a bundle must have the appropriate
BundlePermissionfor the symbolic name; a bundle that requires a bundle must have the appropriateBundlePermssionfor that symbolic name; a bundle that specifies a fragment host must have the appropriateBundlePermissionfor that symbolic name.- Parameters:
symbolicName- The bundle symbolic name.actions-provide,require,host,fragment(canonical order).
-
BundlePermission
BundlePermission(String symbolicName, int mask) Package private constructor used by BundlePermissionCollection.- Parameters:
symbolicName- the bundle symbolic namemask- the action mask
-
-
Method Details
-
setTransients
private void setTransients(int mask) Called by constructors and when deserialized.- Parameters:
mask-
-
getActionsMask
int getActionsMask()Returns the current action mask.Used by the BundlePermissionCollection class.
- Returns:
- Current action mask.
-
parseActions
Parse action string into action mask.- Parameters:
actions- Action string.- Returns:
- action mask.
-
implies
Determines if the specified permission is implied by this object.This method checks that the symbolic name of the target is implied by the symbolic name of this object. The list of
BundlePermissionactions must either match or allow for the list of the target object to imply the targetBundlePermissionaction.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- Overrides:
impliesin classBasicPermission- Parameters:
p- The requested permission.- Returns:
trueif the specifiedBundlePermissionaction is implied by this object;falseotherwise.
-
getActions
Returns the canonical string representation of theBundlePermissionactions.Always returns present
BundlePermissionactions in the following order:provide,require,host,fragment.- Overrides:
getActionsin classBasicPermission- Returns:
- Canonical string representation of the
BundlePermissionactions.
-
newPermissionCollection
Returns a newPermissionCollectionobject suitable for storingBundlePermissionobjects.- Overrides:
newPermissionCollectionin classBasicPermission- Returns:
- A new
PermissionCollectionobject.
-
equals
Determines the equality of twoBundlePermissionobjects. This method checks that specified bundle has the same bundle symbolic name andBundlePermissionactions as thisBundlePermissionobject.- Overrides:
equalsin classBasicPermission- Parameters:
obj- The object to test for equality with thisBundlePermissionobject.- Returns:
trueifobjis aBundlePermission, and has the same bundle symbolic name and actions as thisBundlePermissionobject;falseotherwise.
-
hashCode
public int hashCode()Returns the hash code value for this object.- Overrides:
hashCodein classBasicPermission- Returns:
- A hash code value for this object.
-
writeObject
WriteObject is called to save the state of theBundlePermissionobject to a stream. The actions are serialized, and the superclass takes care of the name.- Throws:
IOException
-
readObject
readObject is called to restore the state of the BundlePermission from a stream.- Throws:
IOExceptionClassNotFoundException
-