OSGi™ Service Platform
Compendium Specification

Release 4 Version 4.3

org.osgi.service.deploymentadmin.spi
Class DeploymentCustomizerPermission

java.lang.Object
  extended by java.security.Permission
      extended by org.osgi.service.deploymentadmin.spi.DeploymentCustomizerPermission
All Implemented Interfaces:
java.io.Serializable, java.security.Guard

public class DeploymentCustomizerPermission
extends java.security.Permission

The DeploymentCustomizerPermission permission gives the right to Resource Processors to access a bundle's (residing in a Deployment Package) private area. The bundle and the Resource Processor (customizer) have to be in the same Deployment Package.

The Resource Processor that has this permission is allowed to access the bundle's private area by calling the DeploymentSession.getDataFile(Bundle) method during the session (see DeploymentSession). After the session ends the FilePermissions are withdrawn. The Resource Processor will have FilePermission with "read", "write" and "delete" actions for the returned File that represents the the base directory of the persistent storage area and for its subdirectories.

The actions string is converted to lowercase before processing.

See Also:
Serialized Form

Field Summary
static java.lang.String PRIVATEAREA
          Constant String to the "privatearea" action.
 
Constructor Summary
DeploymentCustomizerPermission(java.lang.String name, java.lang.String actions)
          Creates a new DeploymentCustomizerPermission object for the given name and action.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Checks two DeploymentCustomizerPermission objects for equality.
 java.lang.String getActions()
          Returns the String representation of the action list.
 int hashCode()
          Returns hash code for this permission object.
 boolean implies(java.security.Permission permission)
          Checks if this DeploymentCustomizerPermission would imply the parameter permission.
 java.security.PermissionCollection newPermissionCollection()
          Returns a new PermissionCollection object for storing DeploymentCustomizerPermission objects.
 
Methods inherited from class java.security.Permission
checkGuard, getName
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PRIVATEAREA

public static final java.lang.String PRIVATEAREA
Constant String to the "privatearea" action.

See Also:
Constant Field Values
Constructor Detail

DeploymentCustomizerPermission

public DeploymentCustomizerPermission(java.lang.String name,
                                      java.lang.String actions)
Creates a new DeploymentCustomizerPermission object for the given name and action.

The name parameter is a filter string. This filter has the same syntax as an OSGi filter but only the "name" attribute is allowed. The value of the attribute is a Bundle Symbolic Name that represents a bundle. The only allowed action is the "privatearea" action. E.g.

 Permission     perm    = new DeploymentCustomizerPermission(
                                                        "(name=com.acme.bundle)", "privatearea");
 
The Resource Processor that has this permission is allowed to access the bundle's private area by calling the DeploymentSession.getDataFile(Bundle) method. The Resource Processor will have FilePermission with "read", "write" and "delete" actions for the returned File and its subdirectories during the deployment session.

Parameters:
name - Bundle Symbolic Name of the target bundle, must not be null.
actions - action string (only the "privatearea" or "*" action is valid; "*" means all the possible actions), must not be null.
Throws:
java.lang.IllegalArgumentException - if the filter is invalid, the list of actions contains unknown operations or one of the parameters is null
Method Detail

equals

public boolean equals(java.lang.Object obj)
Checks two DeploymentCustomizerPermission objects for equality. Two permission objects are equal if:

Specified by:
equals in class java.security.Permission
Parameters:
obj - the reference object with which to compare.
Returns:
true if the two objects are equal.
See Also:
Object.equals(java.lang.Object)

hashCode

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

Specified by:
hashCode in class java.security.Permission
Returns:
Hash code for this permission object.
See Also:
Object.hashCode()

getActions

public java.lang.String getActions()
Returns the String representation of the action list.

Specified by:
getActions in class java.security.Permission
Returns:
Action list of this permission instance. It is always "privatearea".
See Also:
Permission.getActions()

implies

public boolean implies(java.security.Permission permission)
Checks if this DeploymentCustomizerPermission would imply the parameter permission. This permission implies another DeploymentCustomizerPermission permission if: The value of the name attribute means Bundle Symbolic Name and not Deployment Package Symbolic Name here!

Specified by:
implies in class java.security.Permission
Parameters:
permission - Permission to check.
Returns:
true if this DeploymentCustomizerPermission object implies the specified permission.
See Also:
Permission.implies(java.security.Permission)

newPermissionCollection

public java.security.PermissionCollection newPermissionCollection()
Returns a new PermissionCollection object for storing DeploymentCustomizerPermission objects.

Overrides:
newPermissionCollection in class java.security.Permission
Returns:
The new PermissionCollection.
See Also:
Permission.newPermissionCollection()

OSGi™ Service Platform
Compendium Specification

Release 4 Version 4.3

Copyright © OSGi Alliance (2000, 2012). All Rights Reserved. Licensed under the OSGi Specification License, Version 2.0