net.larsan.norna
Class ServicePermission

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

public class ServicePermission
extends java.security.Permission

The service permission is used to fine grain control over the Norna services. The permission uses a target which must equal the service ID the permission refers to or "*" for a blanket permission. The permission takes the follwing actions:

   "get,status,start,stop"
 
The 'get' permssions applies to the service registry in getting the service handle. The 'execute' may be checked by the services on any actions on the handle. The 'status' may be checked by the services on the getStatus method.

The target can be used with a trailing "-" to indicate subpaths.

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

Constructor Summary
ServicePermission(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

ServicePermission

public ServicePermission(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 may be "*" to mark a blanket permission.

Parameters:
target - Permission target, e.g a service url or "*"
action - Parmission action, e.g. any or all of "get,start,stop,status"
Method Detail

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

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