org.osgi.framework

Class AdminPermission

public final class AdminPermission extends 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
                        StartLevel.setBundleStartLevel
   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              PackageAdmin.refreshPackages
                        PackageAdmin.resolveBundles
   resource             Bundle.getResource
                        Bundle.getResources
                        Bundle.getEntry
                        Bundle.getEntryPaths
                        Bundle.findEntries
                        Bundle resource/entry URL creation
   startlevel           StartLevel.setStartLevel
                        StartLevel.setInitialBundleStartLevel 
   context              Bundle.getBundleContext                     
                        
 

The special action "*" will represent all actions.

The name of this permission is a filter expression. The filter gives access to the following parameters:

Version: $Revision: 1.34 $

UNKNOWN:

Field Summary
static StringCLASS
The action string class (Value is "class").
static StringCONTEXT
The action string context (Value is "context").
static StringEXECUTE
The action string execute (Value is "execute").
static StringEXTENSIONLIFECYCLE
The action string extensionLifecycle (Value is "extensionLifecycle").
static StringLIFECYCLE
The action string lifecycle (Value is "lifecycle").
static StringLISTENER
The action string listener (Value is "listener").
static StringMETADATA
The action string metadata (Value is "metadata").
static StringRESOLVE
The action string resolve (Value is "resolve").
static StringRESOURCE
The action string resource (Value is "resource").
static StringSTARTLEVEL
The action string startlevel (Value is "startlevel").
Constructor Summary
AdminPermission()
Creates a new AdminPermission object that matches all bundles and has all actions.
AdminPermission(String filter, String actions)
Create a new AdminPermission.
AdminPermission(Bundle bundle, String actions)
Creates a new AdminPermission object to be used by the code that must check a Permission object.
Method Summary
booleanequals(Object obj)
Determines the equality of two AdminPermission objects.
StringgetActions()
Returns the canonical string representation of the AdminPermission actions.
inthashCode()
Returns the hash code value for this object.
booleanimplies(Permission p)
Determines if the specified permission is implied by this object.
PermissionCollectionnewPermissionCollection()
Returns a new PermissionCollection object suitable for storing AdminPermissions.

Field Detail

CLASS

public static final String CLASS
The action string class (Value is "class").

Since: 1.3

CONTEXT

public static final String CONTEXT
The action string context (Value is "context").

Since: 1.4

EXECUTE

public static final String EXECUTE
The action string execute (Value is "execute").

Since: 1.3

EXTENSIONLIFECYCLE

public static final String EXTENSIONLIFECYCLE
The action string extensionLifecycle (Value is "extensionLifecycle").

Since: 1.3

LIFECYCLE

public static final String LIFECYCLE
The action string lifecycle (Value is "lifecycle").

Since: 1.3

LISTENER

public static final String LISTENER
The action string listener (Value is "listener").

Since: 1.3

METADATA

public static final String METADATA
The action string metadata (Value is "metadata").

Since: 1.3

RESOLVE

public static final String RESOLVE
The action string resolve (Value is "resolve").

Since: 1.3

RESOURCE

public static final String RESOURCE
The action string resource (Value is "resource").

Since: 1.3

STARTLEVEL

public static final String STARTLEVEL
The action string startlevel (Value is "startlevel").

Since: 1.3

Constructor Detail

AdminPermission

public AdminPermission()
Creates a new AdminPermission object that matches all bundles and has all actions. Equivalent to AdminPermission("*","*");

AdminPermission

public AdminPermission(String filter, 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 "*" or null matches all bundle. actions class, execute, extensionLifecycle, lifecycle, listener, metadata, resolve, resource, startlevel or context. A value of "*" or null indicates all actions

AdminPermission

public AdminPermission(Bundle bundle, String actions)
Creates a new AdminPermission object to be used by the code that must check a Permission object.

Parameters: bundle A bundle actions class, execute, extensionLifecycle, lifecycle, listener, metadata, resolve, resource, startlevel, context.

Since: 1.3

Method Detail

equals

public boolean equals(Object obj)
Determines the equality of two AdminPermission objects.

Parameters: obj The object being compared for equality with this object.

Returns: true if obj is equivalent to this AdminPermission; false otherwise.

getActions

public String getActions()
Returns the canonical string representation of the AdminPermission actions.

Always returns present AdminPermission actions in the following order: class, execute, extensionLifecycle, lifecycle, listener, metadata, resolve, resource, startlevel, context.

Returns: Canonical string representation of the AdminPermission actions.

hashCode

public int hashCode()
Returns the hash code value for this object.

Returns: Hash code value for this object.

implies

public boolean implies(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

AND this object's actions include all of the specified permission's actions.

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

Parameters: p The permission to interrogate.

Returns: true if the specified permission is implied by this object; false otherwise.

Throws: RuntimeException if specified permission was not constructed with a bundle or "*"

newPermissionCollection

public PermissionCollection newPermissionCollection()
Returns a new PermissionCollection object suitable for storing AdminPermissions.

Returns: A new PermissionCollection object.