net.larsan.norna
Class PackagePermission

java.lang.Object
  |
  +--java.security.Permission
        |
        +--net.larsan.norna.PackagePermission
All Implemented Interfaces:
java.security.Guard, java.io.Serializable

public class PackagePermission
extends java.security.Permission

The package permission for importing/exporting packages. The Norna framework supports the notion of 'exporting' packages to make them available to other services from different class loaders. This permission is used by the class loaders to make sure no service is able to import or export packages they do not explicitly have declared.

This permission have three different actions:

   export
   import
   load
 
All targets takes a package or a '*' for a blanket permission. It is also possible to set a target for a package including all subpackages by using a trailing '-' such as:
   net.larsan.norna.base.PackagePermission "urd.test.-", "export"
 
The permission above would allow the caller to export any class in the "urd.test" package but also any subpackages such as 'urd.test.impl'.

Normally a service will have a blanket permission for exporting and importing which covers those classes explicitly named in the service manifest for exporting or importing.

Version:
Alpha-0.2 / 2002-10-06 21:37
Author:
Lars J. Nilsson
See Also:
Serialized Form

Constructor Summary
PackagePermission(java.lang.String target, java.lang.String actions)
          Create a permission using a target and an action string.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Check equality on target name and actions.
 java.lang.String getActions()
          Get the actions of this permission.
 int hashCode()
          Get hash code based on target name and actions
 boolean implies(java.security.Permission perm)
          Check if a permission is 'implied' by this permission.
 
Methods inherited from class java.security.Permission
checkGuard, getName, newPermissionCollection, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PackagePermission

public PackagePermission(java.lang.String target,
                         java.lang.String actions)
Create a permission using a target and an action string. Neither of the two arument may be null. The action may be "*" to mark a blanket permission.

Parameters:
target - Permission target, e.g package name, or "*" for all packages
actions - Parmission action, e.g. "export,import,load", or "*" for blanket permission
Method Detail

getActions

public java.lang.String getActions()
Get the actions of this permission.

Specified by:
getActions in class java.security.Permission
Returns:
The actions of this permission

implies

public boolean implies(java.security.Permission perm)
Check if a permission is 'implied' by this permission.

Specified by:
implies in class java.security.Permission

equals

public boolean equals(java.lang.Object obj)
Check equality on target name and actions.

Specified by:
equals in class java.security.Permission

hashCode

public int hashCode()
Get hash code based on target name and actions

Specified by:
hashCode in class java.security.Permission