com.metamatrix.platform.security.api
Class AuthorizationPermissionsImpl

java.lang.Object
  extended by com.metamatrix.platform.security.api.AuthorizationPermissionsImpl
All Implemented Interfaces:
AuthorizationPermissions, java.io.Serializable

public final class AuthorizationPermissionsImpl
extends java.lang.Object
implements AuthorizationPermissions

This class represents a heterogeneous set of AuthorizationPermission instances. Like the AuthorizationPermission class, this class (and all AuthorizationPermissionCollection classes) also has an implies method that can be used to determine whether a particular AuthorizationPermission is allowed by the permissions contained within an AuthorizationPermissionsImpl instance.

The different AuthorizationPermission instances contained by an AuthorizationPermissionsImpl instance are organized into homogeneous AuthorizationPermissionCollection objects contained in the AuthorizationPermissionsImpl object; an AuthorizationPermission object added to the AuthorizationPermissionsImpl object is automatically placed into the appropriate AuthorizationPermissionCollection object for that type (or realm) of permission (as prescribed by the result of the newAuthorizationPermissionCollection() method on the AuthorizationPermission subclass). If no special container is specified, a default container (which has some optimizations for the implies method, based upon the AuthorizationPermission object's hashCode() method) is used.

See Also:
Serialized Form

Constructor Summary
AuthorizationPermissionsImpl()
          Creates a new AuthorizationPermissionsImpl object containing no AuthorizationPermission objects.
AuthorizationPermissionsImpl(AuthorizationPermissions orig)
          Create a new AuthorizationPermissionsImpl object that is a copy of the original.
 
Method Summary
 boolean add(AuthorizationPermission permission)
          Adds a permission object to this object by adding it to the AuthorizationPermissionCollection for the class the AuthorizationPermission belongs to.
 boolean add(AuthorizationPermissions permissions)
          Convenience method to add AuthorizationPermissionsImpl to this object by adding each one to the AuthorizationPermissionCollection for the class that AuthorizationPermission instance belongs to.
 boolean add(java.util.Set permissions)
          Convenience method to add a Set of permission objects to this object by adding each one to the AuthorizationPermissionCollection for the class that AuthorizationPermission instance belongs to.
 void clear()
          Remove from this collection the entire set of existing permissions.
 boolean implies(AuthorizationPermission permission)
          Checks to see if the AuthorizationPermissionCollection in this object that corresponds to the specified permission's type contains permissions that imply access to the resouces in the permission object.
 boolean isReadOnly()
          Determine whether this AuthorizationPermissionCollection object is "readonly".
 java.util.Iterator iterator()
          Obtain an iterator over the AuthorizationPermission instances in this collection.
 boolean remove(AuthorizationPermission permission)
          Remove from this collection's set of existing permissions the specified permission.
 boolean removeAll(AuthorizationPermissions permissions)
          Remove from this collection's set of existing permissions all of the set of specified permissions.
 boolean removeAll(java.util.Set permissions)
          Remove from this collection's set of existing permissions all of the set of specified permissions.
 void setReadOnly()
          Marks this AuthorizationPermissionCollection object as "readonly".
 int size()
          Determine the number of AuthorizationPermission instances represented by this object.
 java.lang.String toString()
          Returns a string representation of the object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AuthorizationPermissionsImpl

public AuthorizationPermissionsImpl()
Creates a new AuthorizationPermissionsImpl object containing no AuthorizationPermission objects.


AuthorizationPermissionsImpl

public AuthorizationPermissionsImpl(AuthorizationPermissions orig)
Create a new AuthorizationPermissionsImpl object that is a copy of the original. Make a deep copy of the orig.

Parameters:
orig - The original to be copied.
Method Detail

setReadOnly

public void setReadOnly()
Marks this AuthorizationPermissionCollection object as "readonly". After a AuthorizationPermissionCollection object is marked as readonly, no new AuthorizationPermission objects can be added to it using the add.

Specified by:
setReadOnly in interface AuthorizationPermissions

isReadOnly

public boolean isReadOnly()
Determine whether this AuthorizationPermissionCollection object is "readonly". If it is readonly, no new AuthorizationPermission objects can be added to it using the add.

Specified by:
isReadOnly in interface AuthorizationPermissions

add

public boolean add(AuthorizationPermission permission)
Adds a permission object to this object by adding it to the AuthorizationPermissionCollection for the class the AuthorizationPermission belongs to. This method creates a new AuthorizationPermissionCollection object (and adds the permission to it) if an appropriate collection does not yet exist.

Specified by:
add in interface AuthorizationPermissions
Parameters:
permission - the AuthorizationPermission object to add.
Returns:
true if this collection changed as a result of the addition.
Throws:
java.lang.SecurityException - if this AuthorizationPermission object is marked as readonly.
See Also:
AuthorizationPermissions.isReadOnly(), AuthorizationPermissions.add(AuthorizationPermissions), AuthorizationPermissions.add(Set)

add

public boolean add(AuthorizationPermissions permissions)
Convenience method to add AuthorizationPermissionsImpl to this object by adding each one to the AuthorizationPermissionCollection for the class that AuthorizationPermission instance belongs to. This method creates new AuthorizationPermissionCollection object as required.

Specified by:
add in interface AuthorizationPermissions
Parameters:
permissions - the set of AuthorizationPermission objects to add.
Returns:
true if this collection changed as a result of the addition.
Throws:
java.lang.SecurityException - if this AuthorizationPermission object is marked as readonly.
See Also:
isReadOnly()

add

public boolean add(java.util.Set permissions)
Convenience method to add a Set of permission objects to this object by adding each one to the AuthorizationPermissionCollection for the class that AuthorizationPermission instance belongs to. This method creates new AuthorizationPermissionCollection object as required.

Specified by:
add in interface AuthorizationPermissions
Parameters:
permissions - the set of AuthorizationPermission objects to add.
Returns:
true if this collection changed as a result of the addition.
Throws:
java.lang.SecurityException - if this AuthorizationPermission object is marked as readonly.
See Also:
isReadOnly()

remove

public boolean remove(AuthorizationPermission permission)
Remove from this collection's set of existing permissions the specified permission. If the permission is not currently in this collection, this method simply returns without performing any operation.

Specified by:
remove in interface AuthorizationPermissions
Parameters:
permission - the permission that is to be removed from this policy.

removeAll

public boolean removeAll(java.util.Set permissions)
Remove from this collection's set of existing permissions all of the set of specified permissions. If any of the permissions are not currently in this collection, that permission is ignored.

Specified by:
removeAll in interface AuthorizationPermissions
Parameters:
permissions - the set of permissions that are to be removed from this policy.

removeAll

public boolean removeAll(AuthorizationPermissions permissions)
Remove from this collection's set of existing permissions all of the set of specified permissions. If any of the permissions are not currently in this collection, that permission is ignored.

Specified by:
removeAll in interface AuthorizationPermissions
Parameters:
permissions - The AuthorizationPermissionsImpl that are to be removed from this policy.

clear

public void clear()
Remove from this collection the entire set of existing permissions.

Specified by:
clear in interface AuthorizationPermissions

iterator

public java.util.Iterator iterator()
Obtain an iterator over the AuthorizationPermission instances in this collection.

Specified by:
iterator in interface AuthorizationPermissions
Returns:
an iterator that can be used to access each of the instances in this collection.

implies

public boolean implies(AuthorizationPermission permission)
Checks to see if the AuthorizationPermissionCollection in this object that corresponds to the specified permission's type contains permissions that imply access to the resouces in the permission object.

Specified by:
implies in interface AuthorizationPermissions
Parameters:
permission - the AuthorizationPermission object to check.
Returns:
true if permission is implied by the permissions in the AuthorizationPermissionCollection it belongs to, false if not.

size

public int size()
Determine the number of AuthorizationPermission instances represented by this object.

Specified by:
size in interface AuthorizationPermissions
Returns:
the number of permissions within this object.

toString

public java.lang.String toString()
Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of the object.


Copyright © 2009. All Rights Reserved.