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(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, ValueFactory valueFactory)
          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()
           
 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.
 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
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.

AccessControlEntryImpl

protected AccessControlEntryImpl(Principal principal,
                                 Privilege[] privileges,
                                 boolean isAllow,
                                 Map<String,Value> restrictions,
                                 ValueFactory valueFactory)
                          throws AccessControlException
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).
valueFactory - the value factory.
Throws:
AccessControlException - if either principal or privileges are invalid.
Method Detail

getPrivilegeBits

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

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()
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
See Also:
JackrabbitAccessControlEntry.getRestrictionNames()

getRestriction

public Value getRestriction(String restrictionName)
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
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.