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

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

public abstract class AccessControlEntryImpl
extends Object
implements org.apache.jackrabbit.api.security.JackrabbitAccessControlEntry

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


Constructor Summary
protected AccessControlEntryImpl(AccessControlEntryImpl base, Privilege[] privileges, boolean isAllow)
           
protected AccessControlEntryImpl(AccessControlEntryImpl base, PrivilegeBits privilegeBits, boolean isAllow)
           
protected AccessControlEntryImpl(Principal principal, Privilege[] privileges, boolean isAllow, Map<String,Value> restrictions)
          Construct an access control entry for the given principal and privileges.
protected AccessControlEntryImpl(Principal principal, PrivilegeBits privilegesBits, 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()
           
 PrivilegeBits getPrivilegeBits()
           
protected abstract  PrivilegeManagerImpl getPrivilegeManager()
           
 Privilege[] getPrivileges()
           
protected abstract  org.apache.jackrabbit.spi.commons.conversion.NameResolver getResolver()
           
 Value getRestriction(org.apache.jackrabbit.spi.Name restrictionName)
           
 Value getRestriction(String restrictionName)
           
 String[] getRestrictionNames()
           
 Map<org.apache.jackrabbit.spi.Name,Value> getRestrictions()
          Returns the restrictions defined for this entry.
protected abstract  ValueFactory getValueFactory()
           
 int hashCode()
           
 boolean hasRestrictions()
          Returns true if this ACE defines any restriction.
 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,
                                 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(Principal principal,
                                 PrivilegeBits privilegesBits,
                                 boolean isAllow,
                                 Map<String,Value> restrictions)
                          throws RepositoryException
Construct an access control entry for the given principal and privileges.

Parameters:
principal - Principal for this access control entry.
privilegesBits - 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:
RepositoryException - if another error occurs.

AccessControlEntryImpl

protected AccessControlEntryImpl(AccessControlEntryImpl base,
                                 PrivilegeBits privilegeBits,
                                 boolean isAllow)
                          throws AccessControlException,
                                 RepositoryException
Parameters:
base -
privilegeBits -
isAllow -
Throws:
AccessControlException
RepositoryException

AccessControlEntryImpl

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

getPrivilegeBits

public PrivilegeBits getPrivilegeBits()
Returns:
the permission bits that correspond to the privileges defined by this entry.

hasRestrictions

public boolean hasRestrictions()
Returns true if this ACE defines any restriction.

Returns:
true if this ACE defines any restriction; false otherwise.

getRestrictions

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

Returns:
the restrictions defined for this entry.

getRestriction

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

getResolver

protected abstract org.apache.jackrabbit.spi.commons.conversion.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.

getPrivilegeManager

protected abstract PrivilegeManagerImpl getPrivilegeManager()
Returns:
The privilege manager in use.

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 org.apache.jackrabbit.api.security.JackrabbitAccessControlEntry
See Also:
JackrabbitAccessControlEntry.isAllow()

getRestrictionNames

public String[] getRestrictionNames()
                             throws NamespaceException
Specified by:
getRestrictionNames in interface org.apache.jackrabbit.api.security.JackrabbitAccessControlEntry
Throws:
NamespaceException
See Also:
JackrabbitAccessControlEntry.getRestrictionNames()

getRestriction

public Value getRestriction(String restrictionName)
                     throws RepositoryException
Specified by:
getRestriction in interface org.apache.jackrabbit.api.security.JackrabbitAccessControlEntry
Throws:
RepositoryException
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-2012 The Apache Software Foundation. All Rights Reserved.