OSGi Service Platform
Release 4

org.osgi.service.cm
Class ConfigurationPermission

java.lang.Object
  extended byjava.security.Permission
      extended byorg.osgi.service.cm.ConfigurationPermission
All Implemented Interfaces:
java.security.Guard, java.io.Serializable

public final class ConfigurationPermission
extends java.security.Permission

Indicates a bundle's authority to set or get a Configuration. This permission verifies if the caller has the authority to get the configuration of a specific PID and to get set it. The target of this permission is a filter expression. The filter gives access to the following parameters:

The target bundle is not always known ahead of time. In that case, signer, name and location will not be set. The target bundle can be found by the fact that it has already registered a target service with the given PID, or the setter has set the bundle location, which identifies the target bundle. The filter can also check what PID (for singletons) or factory PID (for factories) is used.
The actions for this permission are: Every bundle must implicitly given the permission to set its own configuration.

Since:
1.2
Version:
$Revision: 1.5 $
See Also:
Serialized Form

Field Summary
static int ACTION_ALL
           
static int ACTION_ERROR
           
static int ACTION_GET
           
static java.lang.String[] ACTION_NAMES
           
static int ACTION_NONE
           
static int ACTION_READ
           
static int ACTION_REBIND
           
static int ACTION_SET
           
static int[] ACTIONS
           
static java.lang.String GET
          The action string get.
static java.lang.String READ
          The action string read.
static java.lang.String REBIND
          The action string rebind.
static java.lang.String SET
          The action string set.
 
Constructor Summary
ConfigurationPermission(Bundle bundle, java.lang.String pid, java.lang.String factoryPid, int action)
          Create a new Configuration Permission.
ConfigurationPermission(java.lang.String name, java.lang.String actions)
          Create a new ConfigurationPermission.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 java.lang.String getActions()
           
 int hashCode()
          Returns the hash code value for this object.
 boolean implies(java.security.Permission p)
          Determines if a ConfigurationPermission object "implies" the specified permission.
 java.security.PermissionCollection newPermissionCollection()
           
 
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

ACTION_GET

public static final int ACTION_GET
See Also:
Constant Field Values

ACTION_SET

public static int ACTION_SET

ACTION_READ

public static int ACTION_READ

ACTION_REBIND

public static int ACTION_REBIND

ACTION_ALL

public static int ACTION_ALL

ACTION_NONE

public static int ACTION_NONE

ACTION_ERROR

public static int ACTION_ERROR

GET

public static final java.lang.String GET
The action string get.

See Also:
Constant Field Values

SET

public static final java.lang.String SET
The action string set. This implies

See Also:
Constant Field Values

READ

public static final java.lang.String READ
The action string read.

See Also:
Constant Field Values

REBIND

public static final java.lang.String REBIND
The action string rebind.

See Also:
Constant Field Values

ACTIONS

public static final int[] ACTIONS

ACTION_NAMES

public static final java.lang.String[] ACTION_NAMES
Constructor Detail

ConfigurationPermission

public ConfigurationPermission(java.lang.String name,
                               java.lang.String actions)
Create a new ConfigurationPermission. This constructor must only be used to create a permission that is going to be checked. Configuration Admin service must use the alternate constructor.

Examples:

 
  
   
    
       (signer=*,o=ACME,c=US)   
       (pid=com.acme.*)
       (factoryPid=com.acme.*)
       (&(signer=*,o=ACME,c=US)(pid=com.acme.*))   
     
    
   
  
 

There are the following actions: get,set, and read. The set/tt> action allows a bundle to create, list, get, update and delete configurations for the target. The get action allows a bundle to receive a configuration object. The target bundle is itself in that case. The read action permits listing the configurations. The set action implies read.

Parameters:
actions - get, set, read (canonical order)

ConfigurationPermission

public ConfigurationPermission(Bundle bundle,
                               java.lang.String pid,
                               java.lang.String factoryPid,
                               int action)
Create a new Configuration Permission. This constructor is the check version. It must be used by the Configuration Admin service to check the permission.

Parameters:
bundle - The target bundle. This must be the bundle that will receive the configuration.
pid - The PID in question (for factories, the PID is generated and not checkeable).
factoryPid - The PID of the factory if this is a factory configuration
action - The action (GET, SET, or READ [no combinations allowed])
Method Detail

implies

public boolean implies(java.security.Permission p)
Determines if a ConfigurationPermission object "implies" the specified permission.

Parameters:
p - The target permission to check.
Returns:
true if the specified permission is implied by this object; false otherwise.

getActions

public java.lang.String getActions()

newPermissionCollection

public java.security.PermissionCollection newPermissionCollection()

equals

public boolean equals(java.lang.Object obj)

hashCode

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

Returns:
Hash code value for this object.

OSGi Service Platform
Release 4

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