net.larsan.norna
Class ContextPermission

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

public class ContextPermission
extends java.security.Permission

A context permission works much like a file permissions. Context path URLs are mapped using three actions, namely:

   "lookup,bind,unbind" (or "*")
 
This defaut implementation insist that all target paths to be specified relative to the server root. Should multiple servers be involved the given URL must be absolute. So, operating on a single server the following two permissions are not equal even if the're essentially pointing to the same object :
   norna://localhost/services/photo/images
   /services/photo/images
 
Note that a path must start with a forward slash or 'norna:' to be valid. The permission uses a hyphen to indicate sub-paths, so that:
   /services/photo/images/-
 
implies:
   /services/photo/images/football.gif
 

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

Constructor Summary
ContextPermission(java.lang.String target, java.lang.String action)
          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

ContextPermission

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

Parameters:
target - Permission target, e.g an object path
action - Parmission action, e.g. any or all of "lookup,bind,unbind"
Method Detail

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

getActions

public java.lang.String getActions()
Get the actions of this permission. Available actions are "get,execute,status". this method will nerver return null.

Specified by:
getActions in class java.security.Permission
Returns:
The actions of this 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