com.cafesoft.cams.access
Interface PermissionCollection

All Superinterfaces:
Debuggable
All Known Implementing Classes:
AbstractPermissionCollection

public interface PermissionCollection
extends Debuggable

The PermissionCollection interface represents a homogeneous collection of non-overlapping Permission instances. (Grouping by Permission type enables more efficient management and access control checking).

"Overlapping" Permissions may not be added to a PermissionCollection. Given two Permission instances: A and B, they are considered to overlap if their fully-qualfied ResourcePatterns are identical and they have at least one action in common or neither has any actions. Permissions are NOT "overlapping" if their ResourcePatterns are not identical.


Method Summary
 void addPermission(Permission permission)
          Add a Permission.
 boolean containsOverlapping(Permission permission)
          Check for an overlapping Permission.
 Permission getOverlapping(Permission permission)
          Get an overlapping Permission.
 Permission getPermission(ResourceRequest resourceReq)
          Get the Permission best matching a ResourceRequest.
 PermissionIterator getPermissions()
          Get all Permissions.
 void initialize(Config config)
          Initialize the AccessControlRule.
 void removePermission(Permission permission)
          Remove a Permission.
 
Methods inherited from interface com.cafesoft.core.util.Debuggable
setDebug
 

Method Detail

initialize

public void initialize(Config config)
                throws ConfigException
Initialize the AccessControlRule.

Parameters:
config - a Config object that provides access to configuration parameters and a runtime Context.
ConfigException

addPermission

public void addPermission(Permission permission)
                   throws OverlappingPermissionsException
Add a Permission.

Parameters:
permission - the Permission to be added.
OverlappingPermissionsException

removePermission

public void removePermission(Permission permission)
Remove a Permission.

Parameters:
permission - the Permission to be removed.

getPermissions

public PermissionIterator getPermissions()
Get all Permissions.

Returns:
a PermissionIterator through which all Permissions may be accessed.

getPermission

public Permission getPermission(ResourceRequest resourceReq)
Get the Permission best matching a ResourceRequest.

Parameters:
resourceReq - the ResourceRequest
Returns:
the Permission best matching the ResourceRequest or null if no match.

containsOverlapping

public boolean containsOverlapping(Permission permission)
Check for an overlapping Permission.

Two Permission instances: A and B are considered to overlap if:

  1. they are implemented by the same Class
  2. their fully-qualfied ResourcePatterns are identical
  3. they have at least one action in common or neither has any actions at all.
If any of this conditions is false, then the two Permissions do not overlap.

Parameters:
permission - the Permission to be checked for an overlap.
Returns:
true if this PermissionCollection contains another Permission that overlaps the specified Permission.
See Also:
getOverlapping(com.cafesoft.cams.access.Permission)

getOverlapping

public Permission getOverlapping(Permission permission)
Get an overlapping Permission.

Parameters:
permission - the Permission that overlaps the one to be retrieved.
Returns:
the overlapping Permission or null if no Permission overlaps.


Generated on 10:40:31 AM September 10, 2003, © 1996-2003 Cafésoft LLC. All rights reserved.