Class AccessControlEntryImpl
- java.lang.Object
-
- org.apache.jackrabbit.core.security.authorization.AccessControlEntryImpl
-
- All Implemented Interfaces:
AccessControlEntry
,JackrabbitAccessControlEntry
public abstract class AccessControlEntryImpl extends Object implements JackrabbitAccessControlEntry
Simple, immutable implementation of theAccessControlEntry
and theJackrabbitAccessControlEntry
interfaces.
-
-
Constructor Summary
Constructors Modifier Constructor Description 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.protected
AccessControlEntryImpl(AccessControlEntryImpl base, Privilege[] privileges, boolean isAllow)
protected
AccessControlEntryImpl(AccessControlEntryImpl base, PrivilegeBits privilegeBits, boolean isAllow)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected int
buildHashCode()
Build the hash code.boolean
equals(Object obj)
Principal
getPrincipal()
PrivilegeBits
getPrivilegeBits()
PrivilegeCollection
getPrivilegeCollection()
protected abstract PrivilegeManagerImpl
getPrivilegeManager()
Privilege[]
getPrivileges()
protected abstract NameResolver
getResolver()
Value
getRestriction(String restrictionName)
Value
getRestriction(Name restrictionName)
String[]
getRestrictionNames()
Map<Name,Value>
getRestrictions()
Returns the restrictions defined for this entry.Value[]
getRestrictions(String restrictionName)
protected abstract ValueFactory
getValueFactory()
int
hashCode()
boolean
hasRestrictions()
Returnstrue
if this ACE defines any restriction.boolean
isAllow()
-
-
-
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). SeeJackrabbitAccessControlList.getRestrictionNames()
andJackrabbitAccessControlList.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). SeeJackrabbitAccessControlList.getRestrictionNames()
andJackrabbitAccessControlList.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()
Returnstrue
if this ACE defines any restriction.- Returns:
true
if this ACE defines any restriction;false
otherwise.
-
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.
-
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 interfaceAccessControlEntry
- See Also:
AccessControlEntry.getPrincipal()
-
getPrivileges
public Privilege[] getPrivileges()
- Specified by:
getPrivileges
in interfaceAccessControlEntry
- See Also:
AccessControlEntry.getPrivileges()
-
isAllow
public boolean isAllow()
- Specified by:
isAllow
in interfaceJackrabbitAccessControlEntry
- See Also:
JackrabbitAccessControlEntry.isAllow()
-
getRestrictionNames
public String[] getRestrictionNames() throws NamespaceException
- Specified by:
getRestrictionNames
in interfaceJackrabbitAccessControlEntry
- Throws:
NamespaceException
- See Also:
JackrabbitAccessControlEntry.getRestrictionNames()
-
getRestriction
public Value getRestriction(String restrictionName) throws RepositoryException
- Specified by:
getRestriction
in interfaceJackrabbitAccessControlEntry
- Throws:
RepositoryException
- See Also:
JackrabbitAccessControlEntry.getRestriction(String)
-
getRestrictions
public Value[] getRestrictions(String restrictionName) throws RepositoryException
- Specified by:
getRestrictions
in interfaceJackrabbitAccessControlEntry
- Throws:
RepositoryException
- See Also:
JackrabbitAccessControlEntry.getRestrictions(String)
-
getPrivilegeCollection
public PrivilegeCollection getPrivilegeCollection()
- Specified by:
getPrivilegeCollection
in interfaceJackrabbitAccessControlEntry
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classObject
- See Also:
Object.hashCode()
-
equals
public boolean equals(Object obj)
- Overrides:
equals
in classObject
- See Also:
Object.equals(Object)
-
-