OSGi Service Platform
Release 4

org.osgi.framework
Class AdminPermission

java.lang.Object
  extended byjava.security.Permission
      extended byorg.osgi.framework.AdminPermission
All Implemented Interfaces:
java.security.Guard, java.io.Serializable

public final class AdminPermission
extends java.security.Permission

Indicates the caller's authority to perform specific privileged administrative operations on or to get sensitive information about a bundle.

The special action "*" will represent all actions.

Version:
$Revision: 1.13 $
See Also:
Serialized Form

Field Summary
protected  int action_mask
          The actions mask.
protected  Bundle bundle
          The bundle governed by this AdminPermission - only used if wildcard is false and filter == null
protected  java.util.Dictionary bundleProperties
          If this AdminPermission was constructed with a bundle, this dictionary holds the properties of that bundle, used to match a filter in implies.
static java.lang.String CLASS
          The action string class (Value is "class").
static java.lang.String EXECUTE
          The action string execute (Value is "execute").
static java.lang.String EXTENSIONLIFECYCLE
          The action string extensionLifecycle (Value is "extensionLifecycle").
protected  java.lang.String filter
          An x.500 distinguished name used to match a bundle's signature - only used if wildcard is false and bundle = null
protected  Filter filterImpl
          If this AdminPermission was constructed with a filter, this dictionary holds a Filter matching object used to evaluate the filter in implies.
static java.lang.String LIFECYCLE
          The action string lifecycle (Value is "lifecycle").
static java.lang.String LISTENER
          The action string listener (Value is "listener").
static java.lang.String METADATA
          The action string metadata (Value is "metadata").
static java.lang.String PERMISSION
          The action string permission (Value is "permission").
static java.lang.String RESOLVE
          The action string resolve (Value is "resolve").
static java.lang.String RESOURCE
          The action string resource (Value is "resource").
static java.lang.String STARTLEVEL
          The action string startlevel (Value is "startlevel").
protected  boolean wildcard
          Indicates that this AdminPermission refers to all bundles
 
Constructor Summary
AdminPermission()
          Creates a new AdminPermission object that matches all bundles and has all actions.
AdminPermission(Bundle bundle, java.lang.String actions)
          Creates a new AdminPermission object for use by the Policy object to instantiate new Permission objects.
AdminPermission(java.lang.String filter, java.lang.String actions)
          Creates a new AdminPermission object for use by the Policy object to instantiate new Permission objects.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Determines the equality of two AdminPermission objects.
 java.lang.String getActions()
          Returns the canonical string representation of the AdminPermission 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 new PermissionCollection object suitable for storing AdminPermissions.
 
Methods inherited from class java.security.Permission
checkGuard, getName, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

bundle

protected Bundle bundle
The bundle governed by this AdminPermission - only used if wildcard is false and filter == null


wildcard

protected boolean wildcard
Indicates that this AdminPermission refers to all bundles


filter

protected java.lang.String filter
An x.500 distinguished name used to match a bundle's signature - only used if wildcard is false and bundle = null


CLASS

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

See Also:
Constant Field Values

EXECUTE

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

See Also:
Constant Field Values

LIFECYCLE

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

See Also:
Constant Field Values

LISTENER

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

See Also:
Constant Field Values

METADATA

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

See Also:
Constant Field Values

PERMISSION

public static final java.lang.String PERMISSION
The action string permission (Value is "permission").

See Also:
Constant Field Values

RESOLVE

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

See Also:
Constant Field Values

RESOURCE

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

See Also:
Constant Field Values

STARTLEVEL

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

See Also:
Constant Field Values

EXTENSIONLIFECYCLE

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

See Also:
Constant Field Values

action_mask

protected transient int action_mask
The actions mask.


bundleProperties

protected java.util.Dictionary bundleProperties
If this AdminPermission was constructed with a bundle, this dictionary holds the properties of that bundle, used to match a filter in implies. This is not initialized until necessary, and then cached in this object.


filterImpl

protected Filter filterImpl
If this AdminPermission was constructed with a filter, this dictionary holds a Filter matching object used to evaluate the filter in implies. This is not initialized until necessary, and then cached in this object

Constructor Detail

AdminPermission

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


AdminPermission

public AdminPermission(java.lang.String filter,
                       java.lang.String actions)
Creates a new AdminPermission object for use by the Policy object to instantiate new Permission objects. Null arguments are equivalent to "*"

Parameters:
filter - an X.500 Distinguished Name suffix or "*" to match all bundles
actions - class, execute, lifecycle, listener, metadata, permission, resolve, resource, startlevel, or "*" to indicate all actions

AdminPermission

public AdminPermission(Bundle bundle,
                       java.lang.String actions)
Creates a new AdminPermission object for use by the Policy object to instantiate new Permission objects.

Parameters:
bundle - A bundle
actions - class, execute, lifecycle, listener, metadata, permission, resolve, resource, startlevel, or "*" to indicate all actions
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

AND this object's actions include all of the specified permission's actions Special case: if the specified permission was constructed with "*", 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:
java.lang.RuntimeException - if specified permission was not constructed with a bundle or "*"

getActions

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

Always returns present AdminPermission actions in the following order: CLASS, EXECUTE, LIFECYCLE, LISTENER, METADATA, PERMISSION, RESOLVE, RESOURCE, STARTLEVEL.

Returns:
Canonical string representation of the AdminPermission actions.

equals

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

Two AdminPermission objects are equal.

Parameters:
obj - The object being compared for equality with this object.
Returns:
true if obj is equivalent to this AdminPermission; false otherwise.

hashCode

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

Returns:
Hash code value for this object.

newPermissionCollection

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

Returns:
A new PermissionCollection object.

OSGi Service Platform
Release 4

Copyright (c) OSGi Alliance (2000, 2005). All Rights Reserved.