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

java.lang.Object
  extended by org.apache.jackrabbit.core.security.authorization.AccessControlEntryImpl
All Implemented Interfaces:
AccessControlEntry, JackrabbitAccessControlEntry

public abstract class AccessControlEntryImpl
extends Object
implements JackrabbitAccessControlEntry

Simple, immutable implementation of the AccessControlEntry and the JackrabbitAccessControlEntry interfaces.


Constructor Summary
protected AccessControlEntryImpl(AccessControlEntryImpl base, Privilege[] privileges, boolean isAllow)
           
protected AccessControlEntryImpl(Principal principal, Privilege[] privileges)
          Construct an access control entry for the given principal and privileges.
protected AccessControlEntryImpl(Principal principal, Privilege[] privileges, boolean isAllow, Map<String,Value> restrictions)
          Construct an access control entry for the given principal and privileges.
 
Method Summary
protected  int buildHashCode()
          Build the hash code.
 boolean equals(Object obj)
           
 Principal getPrincipal()
           
 int getPrivilegeBits()
           
 Privilege[] getPrivileges()
           
protected abstract  NameResolver getResolver()
           
 Value getRestriction(Name restrictionName)
           
 Value getRestriction(String restrictionName)
          Return the value of the restriction with the specified name or null if no such restriction exists.
 String[] getRestrictionNames()
          Return the names of the restrictions present with this access control entry.
 Map<Name,Value> getRestrictions()
          Returns the restrictions defined for this entry.
protected abstract  ValueFactory getValueFactory()
           
 int hashCode()
           
 boolean isAllow()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AccessControlEntryImpl

protected AccessControlEntryImpl(Principal principal,
                                 Privilege[] privileges)
                          throws AccessControlException,
                                 RepositoryException
Construct an access control entry for the given principal and privileges.

Parameters:
principal - Principal for this access control entry.
privileges - Privileges for this access control entry.
Throws:
AccessControlException - if either principal or privileges are invalid.
RepositoryException - if another error occurs.

AccessControlEntryImpl

protected AccessControlEntryImpl(Principal principal,
                                 Privilege[] privileges,
                                 boolean isAllow,
                                 Map<String,Value> restrictions)
                          throws AccessControlException,
                                 RepositoryException
Construct an access control entry for the given principal and privileges.

Parameters:
principal - Principal for this access control entry.
privileges - Privileges for this access control entry.
isAllow - true if this ACE grants the specified privileges to the specified principal; false otherwise.
restrictions - A map of restriction name (String) to restriction (Value). See JackrabbitAccessControlList.getRestrictionNames() and JackrabbitAccessControlList.getRestrictionType(String).
Throws:
AccessControlException - if either principal or privileges are invalid.
RepositoryException - if another error occurs.

AccessControlEntryImpl

protected AccessControlEntryImpl(AccessControlEntryImpl base,
                                 Privilege[] privileges,
                                 boolean isAllow)
                          throws AccessControlException
Parameters:
base -
privileges -
isAllow -
Throws:
AccessControlException
Method Detail

getPrivilegeBits

public int getPrivilegeBits()
Returns:
the int representation of the privileges defined for this entry.

getRestrictions

public Map<Name,Value> getRestrictions()
Returns the restrictions defined for this entry.

Returns:
the restrictions defined for this entry.

getRestriction

public Value getRestriction(Name restrictionName)
Parameters:
restrictionName -
Returns:
The restriction with the specified name or null.

getResolver

protected abstract NameResolver getResolver()
Returns:
Returns the name resolver used to convert JCR names to Name and vice versa.

getValueFactory

protected abstract ValueFactory getValueFactory()
Returns:
The value factory to be used.

buildHashCode

protected int buildHashCode()
Build the hash code.

Returns:
the hash code.

getPrincipal

public Principal getPrincipal()
Specified by:
getPrincipal in interface AccessControlEntry
See Also:
AccessControlEntry.getPrincipal()

getPrivileges

public Privilege[] getPrivileges()
Specified by:
getPrivileges in interface AccessControlEntry
See Also:
AccessControlEntry.getPrivileges()

isAllow

public boolean isAllow()
Specified by:
isAllow in interface JackrabbitAccessControlEntry
Returns:
true if this entry adds Privileges for the principal; false otherwise.
See Also:
JackrabbitAccessControlEntry.isAllow()

getRestrictionNames

public String[] getRestrictionNames()
                             throws NamespaceException
Description copied from interface: JackrabbitAccessControlEntry
Return the names of the restrictions present with this access control entry.

Specified by:
getRestrictionNames in interface JackrabbitAccessControlEntry
Returns:
the names of the restrictions
Throws:
NamespaceException
See Also:
JackrabbitAccessControlEntry.getRestrictionNames()

getRestriction

public Value getRestriction(String restrictionName)
                     throws RepositoryException
Description copied from interface: JackrabbitAccessControlEntry
Return the value of the restriction with the specified name or null if no such restriction exists.

Specified by:
getRestriction in interface JackrabbitAccessControlEntry
Parameters:
restrictionName - The of the restriction as obtained through JackrabbitAccessControlEntry.getRestrictionNames().
Returns:
value of the restriction with the specified name or null if no such restriction exists
Throws:
RepositoryException - if an error occurs.
See Also:
JackrabbitAccessControlEntry.getRestriction(String)

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.