CoherenceTM v3.3
Copyright© 2000-2007 by Oracle Corporation

com.tangosol.net
Class ClusterPermission

java.lang.Object
  extended by java.security.Permission
      extended by com.tangosol.net.ClusterPermission
All Implemented Interfaces:
Serializable, Guard

public final class ClusterPermission
extends Permission
implements Serializable

This class represents access to a clustered resource such as a Service or NamedCache. A ClusterPermission consists of a target name and a set of actions valid for that target.

Target name is a string containing a list of one or more comma-separated target attributes. The valid target attributes are:

If a target string does not contain the "service" attribute, it is equivalent to the "service=*" attribute value. If a target string does not contain the "cache" attribute, it is equivalent to the "cache=*" attribute value or is meant to indicate a service that is not a CacheService (e.g. InvocationService). A target name string consisting of a single "*" indicates all clustered resources.

The actions to be granted are passed to the constructor in a string containing a list of one or more comma-separated keywords. The possible keywords are: "create", "destroy", "join", "manage", "all". An action string "all" indicates a combination of all valid actions.
Note: the actions string is converted to lowercase before processing.

Since:
Coherence 2.5
Author:
gg 2004.05.28

Field Summary
static int ALL
          All actions.
static int CREATE
          Create action.
static int DESTROY
          Create action.
static int JOIN
          Join action.
static int NONE
          No actions.
 
Constructor Summary
ClusterPermission(String sTarget, String sAction)
          Construct a ClusterPermission object.
 
Method Summary
 boolean equals(Object obj)
          Checks two Permission objects for equality.
static String formatAction(int nAction)
          Format the action string.
 String getActions()
          Return the actions as a String in a canonical form.
 String getServiceName()
          Return the service name for this permission object or null if the permission applies to any service.
 int hashCode()
          Return the hash code value for this ClusterPermission object.
 boolean implies(Permission permission)
          Check if the specified permission's actions are "implied by" this object's actions.
static void main(String[] asArg)
          Unit test allows to compare the specified permissions.
protected  void parseAction(String sAction)
          Parse the action string and set the action flag.
protected  void parseTarget(String sTarget)
          Parse the target string.
 
Methods inherited from class java.security.Permission
checkGuard, getName, newPermissionCollection, toString
 

Field Detail

CREATE

public static final int CREATE
Create action.

See Also:
Constant Field Values

DESTROY

public static final int DESTROY
Create action.

See Also:
Constant Field Values

JOIN

public static final int JOIN
Join action.

See Also:
Constant Field Values

ALL

public static final int ALL
All actions.

See Also:
Constant Field Values

NONE

public static final int NONE
No actions.

See Also:
Constant Field Values
Constructor Detail

ClusterPermission

public ClusterPermission(String sTarget,
                         String sAction)
Construct a ClusterPermission object.

Parameters:
sTarget - the clustered resource name; must be specified
sAction - the action(s) name; must be specified
Method Detail

getActions

public String getActions()
Return the actions as a String in a canonical form.

Specified by:
getActions in class Permission
Returns:
the actions of this Permission

implies

public boolean implies(Permission permission)
Check if the specified permission's actions are "implied by" this object's actions.

There is a slight difference in semantics of the wild card ("*") in "this" and passed-in Permission's target. The specified permission for cache-less services will not contain any "cache=" attribute in the target string, while cache services will always specify a "cache=" attribute.

Specified by:
implies in class Permission
Parameters:
permission - the permission to check against
Returns:
true if the specified permission is implied by this object, false if not

equals

public boolean equals(Object obj)
Checks two Permission objects for equality.

Specified by:
equals in class Permission
Parameters:
obj - the object we are testing for equality with this object
Returns:
true if both Permission objects are equivalent

hashCode

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

Specified by:
hashCode in class Permission
Returns:
a hash code value for this object

getServiceName

public String getServiceName()
Return the service name for this permission object or null if the permission applies to any service.

Returns:
the service name for this permission object

parseTarget

protected void parseTarget(String sTarget)
Parse the target string.

Parameters:
sTarget - the target string

parseAction

protected void parseAction(String sAction)
Parse the action string and set the action flag.

Parameters:
sAction - the action string

formatAction

public static String formatAction(int nAction)
Format the action string.

Parameters:
nAction - the action mask
Returns:
the action string

main

public static void main(String[] asArg)
Unit test allows to compare the specified permissions.
   java com.tangosol.net.ClusterPermission    
 


CoherenceTM v3.3
Copyright© 2000-2007 by Oracle Corporation