Class AdminPermission
- java.lang.Object
-
- java.security.Permission
-
- java.security.BasicPermission
-
- org.osgi.framework.AdminPermission
-
- All Implemented Interfaces:
java.io.Serializable
,java.security.Guard
public final class AdminPermission extends java.security.BasicPermission
A bundle's authority to perform specific privileged administrative operations on or to get sensitive information about a bundle. The actions for this permission are:Action Methods class Bundle.loadClass execute Bundle.start Bundle.stop BundleStartLevel.setStartLevel extensionLifecycle BundleContext.installBundle for extension bundles Bundle.update for extension bundles Bundle.uninstall for extension bundles lifecycle BundleContext.installBundle Bundle.update Bundle.uninstall listener BundleContext.addBundleListener for SynchronousBundleListener BundleContext.removeBundleListener for SynchronousBundleListener metadata Bundle.getHeaders Bundle.getLocation resolve FrameworkWiring.refreshBundles FrameworkWiring.resolveBundles resource Bundle.getResource Bundle.getResources Bundle.getEntry Bundle.getEntryPaths Bundle.findEntries Bundle resource/entry URL creation startlevel FrameworkStartLevel.setStartLevel FrameworkStartLevel.setInitialBundleStartLevel context Bundle.getBundleContext weave WovenClass.getBytes WovenClass.setBytes WovenClass.getDynamicImports for modification
The special action "*" will represent all actions. The
resolve
action is implied by theclass
,execute
andresource
actions.The name of this permission is a filter expression. The filter gives access to the following attributes:
- signer - A Distinguished Name chain used to sign a bundle. Wildcards in a DN are not matched according to the filter string rules, but according to the rules defined for a DN chain.
- location - The location of a bundle.
- id - The bundle ID of the designated bundle.
- name - The symbolic name of a bundle.
- Author:
- $Id: 2a803b07dcdc9af47ca0cb208d96fcd9c0bcfb0c $
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
CLASS
The action stringclass
.static java.lang.String
CONTEXT
The action stringcontext
.static java.lang.String
EXECUTE
The action stringexecute
.static java.lang.String
EXTENSIONLIFECYCLE
The action stringextensionLifecycle
.static java.lang.String
LIFECYCLE
The action stringlifecycle
.static java.lang.String
LISTENER
The action stringlistener
.static java.lang.String
METADATA
The action stringmetadata
.static java.lang.String
RESOLVE
The action stringresolve
.static java.lang.String
RESOURCE
The action stringresource
.static java.lang.String
STARTLEVEL
The action stringstartlevel
.static java.lang.String
WEAVE
The action stringweave
.
-
Constructor Summary
Constructors Constructor Description AdminPermission()
Creates a newAdminPermission
object that matches all bundles and has all actions.AdminPermission(java.lang.String filter, java.lang.String actions)
Create a new AdminPermission.AdminPermission(Bundle bundle, java.lang.String actions)
Creates a new requestedAdminPermission
object to be used by the code that must performcheckPermission
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
Determines the equality of twoAdminPermission
objects.java.lang.String
getActions()
Returns the canonical string representation of theAdminPermission
actions.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 newPermissionCollection
object suitable for storingAdminPermission
s.
-
-
-
Field Detail
-
CLASS
public static final java.lang.String CLASS
The action stringclass
. Theclass
action implies theresolve
action.- Since:
- 1.3
- See Also:
- Constant Field Values
-
EXECUTE
public static final java.lang.String EXECUTE
The action stringexecute
. Theexecute
action implies theresolve
action.- Since:
- 1.3
- See Also:
- Constant Field Values
-
EXTENSIONLIFECYCLE
public static final java.lang.String EXTENSIONLIFECYCLE
The action stringextensionLifecycle
.- Since:
- 1.3
- See Also:
- Constant Field Values
-
LIFECYCLE
public static final java.lang.String LIFECYCLE
The action stringlifecycle
.- Since:
- 1.3
- See Also:
- Constant Field Values
-
LISTENER
public static final java.lang.String LISTENER
The action stringlistener
.- Since:
- 1.3
- See Also:
- Constant Field Values
-
METADATA
public static final java.lang.String METADATA
The action stringmetadata
.- Since:
- 1.3
- See Also:
- Constant Field Values
-
RESOLVE
public static final java.lang.String RESOLVE
The action stringresolve
. Theresolve
action is implied by theclass
,execute
andresource
actions.- Since:
- 1.3
- See Also:
- Constant Field Values
-
RESOURCE
public static final java.lang.String RESOURCE
The action stringresource
. Theresource
action implies theresolve
action.- Since:
- 1.3
- See Also:
- Constant Field Values
-
STARTLEVEL
public static final java.lang.String STARTLEVEL
The action stringstartlevel
.- Since:
- 1.3
- See Also:
- Constant Field Values
-
CONTEXT
public static final java.lang.String CONTEXT
The action stringcontext
.- Since:
- 1.4
- See Also:
- Constant Field Values
-
WEAVE
public static final java.lang.String WEAVE
The action stringweave
.- Since:
- 1.6
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AdminPermission
public AdminPermission()
Creates a newAdminPermission
object that matches all bundles and has all actions. Equivalent to AdminPermission("*","*");
-
AdminPermission
public AdminPermission(java.lang.String filter, java.lang.String actions)
Create a new AdminPermission. This constructor must only be used to create a permission that is going to be checked.Examples:
(signer=\*,o=ACME,c=US) (&(signer=\*,o=ACME,c=US)(name=com.acme.*) (location=http://www.acme.com/bundles/*)) (id>=1)
When a signer key is used within the filter expression the signer value must escape the special filter chars ('*', '(', ')').
Null arguments are equivalent to "*".
- Parameters:
filter
- A filter expression that can use signer, location, id, and name keys. A value of "*" ornull
matches all bundle. Filter attribute names are processed in a case sensitive manner.actions
-class
,execute
,extensionLifecycle
,lifecycle
,listener
,metadata
,resolve
,resource
,startlevel
,context
orweave
. A value of "*" ornull
indicates all actions.- Throws:
java.lang.IllegalArgumentException
- If the filter has an invalid syntax.
-
AdminPermission
public AdminPermission(Bundle bundle, java.lang.String actions)
Creates a new requestedAdminPermission
object to be used by the code that must performcheckPermission
.AdminPermission
objects created with this constructor cannot be added to anAdminPermission
permission collection.- Parameters:
bundle
- A bundle.actions
-class
,execute
,extensionLifecycle
,lifecycle
,listener
,metadata
,resolve
,resource
,startlevel
,context
,weave
. A value of "*" ornull
indicates all actions.- Since:
- 1.3
-
-
Method Detail
-
implies
public boolean implies(java.security.Permission p)
Determines if the specified permission is implied by this object. This method throws an exception if the specified permission was not constructed with a bundle.This method returns
true
if the specified permission is an AdminPermission AND- this object's filter matches the specified permission's bundle ID, bundle symbolic name, bundle location and bundle signer distinguished name chain OR
- this object's filter is "*"
Special case: if the specified permission was constructed with "*" filter, then this method returns
true
if this object's filter is "*" and this object's actions include all of the specified permission's actions- Overrides:
implies
in classjava.security.BasicPermission
- Parameters:
p
- The requested permission.- Returns:
true
if the specified permission is implied by this object;false
otherwise.
-
getActions
public java.lang.String getActions()
Returns the canonical string representation of theAdminPermission
actions.Always returns present
AdminPermission
actions in the following order:class
,execute
,extensionLifecycle
,lifecycle
,listener
,metadata
,resolve
,resource
,startlevel
,context
,weave
.- Overrides:
getActions
in classjava.security.BasicPermission
- Returns:
- Canonical string representation of the
AdminPermission
actions.
-
newPermissionCollection
public java.security.PermissionCollection newPermissionCollection()
Returns a newPermissionCollection
object suitable for storingAdminPermission
s.- Overrides:
newPermissionCollection
in classjava.security.BasicPermission
- Returns:
- A new
PermissionCollection
object.
-
equals
public boolean equals(java.lang.Object obj)
Determines the equality of twoAdminPermission
objects.- Overrides:
equals
in classjava.security.BasicPermission
- Parameters:
obj
- The object being compared for equality with this object.- Returns:
true
ifobj
is equivalent to thisAdminPermission
;false
otherwise.
-
hashCode
public int hashCode()
Returns the hash code value for this object.- Overrides:
hashCode
in classjava.security.BasicPermission
- Returns:
- Hash code value for this object.
-
-