IBM WebSphereTM eXtreme Scale, Release 8.6
API Specification

com.ibm.websphere.objectgrid.security
Class MapPermission

java.lang.Object
  extended by java.security.Permission
      extended by com.ibm.websphere.objectgrid.security.MapPermission
All Implemented Interfaces:
Serializable, Guard

public final class MapPermission
extends Permission

This class represents permissions to the ObjectMap. It has five different actions:

Please refer to the ObjectMap class for the permissions needed for each method.

Since:
WAS XD 6.0
See Also:
Permission, ObjectMap, Serialized Form

Field Summary
static int ALL
          All permission constant
static String ALL_PERMISSION
          All permissions String
static int INSERT
          Insert permission constant
static int INVALIDATE
          Invalidate permission constant
static int NUMBER_PERMISSION
          The total number of possible Permissions
static String[] PERMISSIONS
          An array with the string representation of each permission.
static int READ
          Read permission constant
static int REMOVE
          Remove permission constant
static int WRITE
          Write permission constant
 
Constructor Summary
MapPermission(String name, int actions)
          Constructs a new MapPermission for the named map with the specified actions.
MapPermission(String name, String actions)
          Constructs a new MapPermission for the named map with the specified actions.
MapPermission(String ogName, String mapName, int actions)
          Constructs a new MapPermission for the named map with the specified actions.
MapPermission(String ogName, String mapName, String actions)
          Constructs a new MapPermission for the named map with the specified actions.
 
Method Summary
 boolean equals(Object o)
          Checks two MapPermission objects for equality.
 String getActions()
          Returns the actions as a String.
static String getActions(int m)
          Returns the actions as a String for the specified mask.
 int getActionsInInt()
          Returns an int mask value which represents the permission's actions.
 String[] getParsedNames()
          Returns an array which contains the object grid name and map name.
 int hashCode()
          Returns the hash code value for this MapPermission object.
 boolean implies(Permission permission)
          Checks if the specified permission is "implied" by this object.
 
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
 

Field Detail

NUMBER_PERMISSION

public static final int NUMBER_PERMISSION
The total number of possible Permissions

See Also:
Constant Field Values

READ

public static final int READ
Read permission constant

See Also:
Constant Field Values

WRITE

public static final int WRITE
Write permission constant

See Also:
Constant Field Values

INSERT

public static final int INSERT
Insert permission constant

See Also:
Constant Field Values

REMOVE

public static final int REMOVE
Remove permission constant

See Also:
Constant Field Values

INVALIDATE

public static final int INVALIDATE
Invalidate permission constant

See Also:
Constant Field Values

PERMISSIONS

public static final String[] PERMISSIONS
An array with the string representation of each permission.

The indexes to the String representation are the int constants for each permission (i.e. READ, WRITE, INSERT, REMOVE, INVALIDATE)


ALL_PERMISSION

public static final String ALL_PERMISSION
All permissions String

See Also:
Constant Field Values

ALL

public static final int ALL
All permission constant

See Also:
Constant Field Values
Constructor Detail

MapPermission

public MapPermission(String name,
                     String actions)
Constructs a new MapPermission for the named map with the specified actions.

The map name for this permission should be in the format of ., for example "og1.map1". A special value of "*" is used to represent all objectgrids or all maps, for example "*.map1", "og1.*", or "*.*". A "*" is used to substitue a whole ObjectGrid name or map name. A partial substitution like "og*.map" is not supported.

Parameters:
name - the full name of the map. It is also the permission name.
actions - the comma separated list of actions, such as "read", "write", "remove", "insert", and "invalidate".
Throws:
IllegalArgumentException - if name is null or malformed or if actions is null or contains an invalidate action name

MapPermission

public MapPermission(String ogName,
                     String mapName,
                     String actions)
Constructs a new MapPermission for the named map with the specified actions.

This method is used for the ObjectGrid map of which the ObjectGrid name or map name contains a ".". In this case, we pass the ObjectGrid name and map name separately as the parameters.

ObjectGrid uses <ObjectGrid name>.<map name> as the permission name. Therefore, your application still needs to make sure there is no name conflicts for the <ObjectGrid name>.<map name>. For example, you should not have an ObjectGrid with name "og" and one of its maps with name "session.data", and another ObjectGrid with name "og.session" and one of its maps with name "data".

Parameters:
ogName - the ObjectGrid name.
mapName - the map name.
actions - the comma separated list of actions, such as "read", "write", "remove", "insert", and "invalidate".
Throws:
IllegalArgumentException - if ObjectGrid name or map name is null or if actions is null or contains an invalidate action name
Since:
6.1.0.5 FIX2

MapPermission

public MapPermission(String name,
                     int actions)
Constructs a new MapPermission for the named map with the specified actions.

The map name for this permission should be in the format of ., for example "og1.map1". A special value of "*" is used to represent all objectgrids or all maps, for example "*.map1", "og1.*", or "*.*". A "*" is used to substitue a whole ObjectGrid name or map name. A pPartial substitution like "og*.map" is not supported.

Parameters:
name - the full name of the map. It is also the permission name.
actions - the actions mask. For example, MapPermission.READ|MapPermission.WRITE
Throws:
IllegalArgumentException - if name is null or malformed or if actions is less than 0 or greater than ALL

MapPermission

public MapPermission(String ogName,
                     String mapName,
                     int actions)
Constructs a new MapPermission for the named map with the specified actions.

This method is used for the ObjectGrid map of which the ObjectGrid name or map name contains a ".". In this case, we pass the ObjectGrid name and map name as the parameters.

ObjectGrid uses <ObjectGrid name>.<map name> as the permission name. Therefore, your application still needs to make sure there is no name conflicts for the <ObjectGrid name>.<map name>. For example, you should not have an ObjectGrid with name "og" and one of its maps with name "session.data", and another ObjectGrid with name "og.session" and one of its maps with name "data".

Parameters:
ogName - the ObjectGrid name.
mapName - the map name.
actions - the actions mask. For example, MapPermission.READ|MapPermission.WRITE
Throws:
IllegalArgumentException - if ObjectGrid name or map name is null or if actions is less than 0 or greater than ALL
Since:
6.1.0.5 FIX2
Method Detail

implies

public boolean implies(Permission permission)
Checks if the specified permission is "implied" by this object.

More specifically, this method returns true if:

Specified by:
implies in class Permission
Parameters:
permission - the permission to check against.
Returns:
true if the passed permission is equal to or implied by this permission, false otherwise.

equals

public boolean equals(Object o)
Checks two MapPermission objects for equality. Two MapPermission objects are equal if and only if their names and actions are equal.

Do not use the equals method for making access control decisions; use the implies method.

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

hashCode

public int hashCode()
Returns the hash code value for this MapPermission object.

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

getActions

public String getActions()
Returns the actions as a String.

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

getActions

public static String getActions(int m)
Returns the actions as a String for the specified mask.

Parameters:
m - the mask
Returns:
the action string representation for the mask

getParsedNames

public String[] getParsedNames()
Returns an array which contains the object grid name and map name.

Returns:
the parsed name array

getActionsInInt

public int getActionsInInt()
Returns an int mask value which represents the permission's actions.

For example, for a MapPermission which has read and insert permissions, the returned value will be 5 (MapPermission.READ|MapPermission.INSERT).

Returns:
an int value which represents the permission.

IBM WebSphereTM eXtreme Scale, Release 8.6
API Specification

© Copyright International Business Machines Corp 2005,2012. All rights reserved.