org.apache.jackrabbit.core.security.authorization
Class UnmodifiableAccessControlList

java.lang.Object
  extended by org.apache.jackrabbit.core.security.authorization.UnmodifiableAccessControlList
All Implemented Interfaces:
AccessControlList, AccessControlPolicy, JackrabbitAccessControlList, JackrabbitAccessControlPolicy

public class UnmodifiableAccessControlList
extends Object
implements JackrabbitAccessControlList

An implementation of the AccessControlList interface that only allows for reading. The write methods (addAccessControlEntry and removeAccessControlEntry) throw an AccessControlException.


Constructor Summary
UnmodifiableAccessControlList(AccessControlList acl)
          Construct a new UnmodifiableAccessControlList
UnmodifiableAccessControlList(List<? extends AccessControlEntry> accessControlEntries)
          Construct a new UnmodifiableAccessControlList
UnmodifiableAccessControlList(List<? extends AccessControlEntry> accessControlEntries, String path, Map<String,Integer> restrictions)
          Construct a new UnmodifiableAccessControlList
 
Method Summary
 boolean addAccessControlEntry(Principal principal, Privilege[] privileges)
           
 boolean addEntry(Principal principal, Privilege[] privileges, boolean isAllow)
          Same as JackrabbitAccessControlList.addEntry(Principal, Privilege[], boolean, Map) using some implementation specific restrictions.
 boolean addEntry(Principal principal, Privilege[] privileges, boolean isAllow, Map<String,Value> restrictions)
          Adds an access control entry to this policy consisting of the specified principal, the specified privileges, the isAllow flag and an optional map containing additional restrictions.
 boolean equals(Object obj)
           
 AccessControlEntry[] getAccessControlEntries()
           
 String getPath()
          Returns the path of the node this policy has been created for.
 String[] getRestrictionNames()
          Returns the names of the supported restrictions or an empty array if no restrictions are respected.
 int getRestrictionType(String restrictionName)
          Return the expected property type of the restriction with the specified restrictionName.
 int hashCode()
           
 boolean isEmpty()
          Returns true if this policy does not yet define any entries.
 void orderBefore(AccessControlEntry srcEntry, AccessControlEntry destEntry)
          If the AccessControlList implementation supports reordering of entries the specified srcEntry is inserted at the position of the specified destEntry.
 void removeAccessControlEntry(AccessControlEntry ace)
           
 int size()
          Returns the number of entries or 0 if the policy is empty.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UnmodifiableAccessControlList

public UnmodifiableAccessControlList(AccessControlList acl)
                              throws RepositoryException
Construct a new UnmodifiableAccessControlList

Parameters:
acl - The AccessControlList to be wrapped in order to prevent it's modification.
Throws:
RepositoryException - The the entries cannot be retrieved from the specified AccessControlList.

UnmodifiableAccessControlList

public UnmodifiableAccessControlList(List<? extends AccessControlEntry> accessControlEntries)
Construct a new UnmodifiableAccessControlList

Parameters:
accessControlEntries - A list of access control entries.

UnmodifiableAccessControlList

public UnmodifiableAccessControlList(List<? extends AccessControlEntry> accessControlEntries,
                                     String path,
                                     Map<String,Integer> restrictions)
Construct a new UnmodifiableAccessControlList

Parameters:
accessControlEntries -
path -
restrictions -
Method Detail

getAccessControlEntries

public AccessControlEntry[] getAccessControlEntries()
                                             throws RepositoryException
Specified by:
getAccessControlEntries in interface AccessControlList
Throws:
RepositoryException
See Also:
AccessControlList.getAccessControlEntries()

addAccessControlEntry

public boolean addAccessControlEntry(Principal principal,
                                     Privilege[] privileges)
                              throws AccessControlException,
                                     RepositoryException
Specified by:
addAccessControlEntry in interface AccessControlList
Throws:
AccessControlException
RepositoryException
See Also:
AccessControlList.addAccessControlEntry(Principal, Privilege[])

removeAccessControlEntry

public void removeAccessControlEntry(AccessControlEntry ace)
                              throws AccessControlException,
                                     RepositoryException
Specified by:
removeAccessControlEntry in interface AccessControlList
Throws:
AccessControlException
RepositoryException
See Also:
AccessControlList.removeAccessControlEntry(AccessControlEntry)

getRestrictionNames

public String[] getRestrictionNames()
Description copied from interface: JackrabbitAccessControlList
Returns the names of the supported restrictions or an empty array if no restrictions are respected.

Specified by:
getRestrictionNames in interface JackrabbitAccessControlList
Returns:
the names of the supported restrictions or an empty array.
See Also:
JackrabbitAccessControlList.getRestrictionNames()

getRestrictionType

public int getRestrictionType(String restrictionName)
Description copied from interface: JackrabbitAccessControlList
Return the expected property type of the restriction with the specified restrictionName.

Specified by:
getRestrictionType in interface JackrabbitAccessControlList
Parameters:
restrictionName - Any of the restriction names retrieved from JackrabbitAccessControlList.getRestrictionNames().
Returns:
expected property type.
See Also:
JackrabbitAccessControlList.getRestrictionType(String)

isEmpty

public boolean isEmpty()
Description copied from interface: JackrabbitAccessControlList
Returns true if this policy does not yet define any entries.

Specified by:
isEmpty in interface JackrabbitAccessControlList
Returns:
If no entries are present.
See Also:
JackrabbitAccessControlList.isEmpty()

size

public int size()
Description copied from interface: JackrabbitAccessControlList
Returns the number of entries or 0 if the policy is empty.

Specified by:
size in interface JackrabbitAccessControlList
Returns:
The number of entries present or 0 if the policy is empty.
See Also:
JackrabbitAccessControlList.size()

addEntry

public boolean addEntry(Principal principal,
                        Privilege[] privileges,
                        boolean isAllow)
                 throws AccessControlException
Description copied from interface: JackrabbitAccessControlList
Same as JackrabbitAccessControlList.addEntry(Principal, Privilege[], boolean, Map) using some implementation specific restrictions.

Specified by:
addEntry in interface JackrabbitAccessControlList
Parameters:
principal - the principal to add the entry for
privileges - the privileges to add
isAllow - if true if this is a positive (allow) entry
Returns:
true if this policy has changed by incorporating the given entry; false otherwise.
Throws:
AccessControlException - If any of the given parameter is invalid or cannot be handled by the implementation.
See Also:
JackrabbitAccessControlList.addEntry(Principal, Privilege[], boolean)

addEntry

public boolean addEntry(Principal principal,
                        Privilege[] privileges,
                        boolean isAllow,
                        Map<String,Value> restrictions)
                 throws AccessControlException
Description copied from interface: JackrabbitAccessControlList
Adds an access control entry to this policy consisting of the specified principal, the specified privileges, the isAllow flag and an optional map containing additional restrictions.

This method returns true if this policy was modified, false otherwise.

An AccessControlException is thrown if any of the specified parameters is invalid or if some other access control related exception occurs.

Specified by:
addEntry in interface JackrabbitAccessControlList
Parameters:
principal - the principal to add the entry for
privileges - the privileges to add
isAllow - if true if this is a positive (allow) entry
restrictions - A map of additional restrictions used to narrow the effect of the entry to be created. The map must map JCR names to a single Value object.
Returns:
true if this policy has changed by incorporating the given entry; false otherwise.
Throws:
AccessControlException - If any of the given parameter is invalid or cannot be handled by the implementation.
See Also:
JackrabbitAccessControlList.addEntry(Principal, Privilege[], boolean, Map)

orderBefore

public void orderBefore(AccessControlEntry srcEntry,
                        AccessControlEntry destEntry)
                 throws AccessControlException
Description copied from interface: JackrabbitAccessControlList
If the AccessControlList implementation supports reordering of entries the specified srcEntry is inserted at the position of the specified destEntry.

If destEntry is null the entry is moved to the end of the list.

If srcEntry and destEntry are the same no changes are made.

Specified by:
orderBefore in interface JackrabbitAccessControlList
Parameters:
srcEntry - The access control entry to be moved within the list.
destEntry - The entry before which the srcEntry will be moved.
Throws:
AccessControlException - If any of the given entries is invalid or cannot be handled by the implementation.
See Also:
JackrabbitAccessControlList.orderBefore(AccessControlEntry, AccessControlEntry)

getPath

public String getPath()
Description copied from interface: JackrabbitAccessControlPolicy
Returns the path of the node this policy has been created for.

Specified by:
getPath in interface JackrabbitAccessControlPolicy
Returns:
the path of the node this policy has been created for.
See Also:
JackrabbitAccessControlPolicy.getPath()

hashCode

public int hashCode()
Overrides:
hashCode in class Object
See Also:
Object.hashCode()

equals

public boolean equals(Object obj)
Overrides:
equals in class Object
See Also:
Object.equals(Object)


Copyright © 2004-2010 The Apache Software Foundation. All Rights Reserved.