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 theAccessControlEntryand theJackrabbitAccessControlEntryinterfaces.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAccessControlEntryImpl(Principal principal, Privilege[] privileges, boolean isAllow, Map<String,Value> restrictions)Construct an access control entry for the given principal and privileges.protectedAccessControlEntryImpl(Principal principal, PrivilegeBits privilegesBits, boolean isAllow, Map<String,Value> restrictions)Construct an access control entry for the given principal and privileges.protectedAccessControlEntryImpl(AccessControlEntryImpl base, Privilege[] privileges, boolean isAllow)protectedAccessControlEntryImpl(AccessControlEntryImpl base, PrivilegeBits privilegeBits, boolean isAllow)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected intbuildHashCode()Build the hash code.booleanequals(Object obj)PrincipalgetPrincipal()PrivilegeBitsgetPrivilegeBits()PrivilegeCollectiongetPrivilegeCollection()protected abstract PrivilegeManagerImplgetPrivilegeManager()Privilege[]getPrivileges()protected abstract NameResolvergetResolver()ValuegetRestriction(String restrictionName)ValuegetRestriction(Name restrictionName)String[]getRestrictionNames()Map<Name,Value>getRestrictions()Returns the restrictions defined for this entry.Value[]getRestrictions(String restrictionName)protected abstract ValueFactorygetValueFactory()inthashCode()booleanhasRestrictions()Returnstrueif this ACE defines any restriction.booleanisAllow()
-
-
-
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-trueif this ACE grants the specified privileges to the specified principal;falseotherwise.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-trueif this ACE grants the specified privileges to the specified principal;falseotherwise.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:
AccessControlExceptionRepositoryException
-
AccessControlEntryImpl
protected AccessControlEntryImpl(AccessControlEntryImpl base, Privilege[] privileges, boolean isAllow) throws AccessControlException, RepositoryException
- Parameters:
base-privileges-isAllow-- Throws:
AccessControlExceptionRepositoryException
-
-
Method Detail
-
getPrivilegeBits
public PrivilegeBits getPrivilegeBits()
- Returns:
- the permission bits that correspond to the privileges defined by this entry.
-
hasRestrictions
public boolean hasRestrictions()
Returnstrueif this ACE defines any restriction.- Returns:
trueif this ACE defines any restriction;falseotherwise.
-
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:
getPrincipalin interfaceAccessControlEntry- See Also:
AccessControlEntry.getPrincipal()
-
getPrivileges
public Privilege[] getPrivileges()
- Specified by:
getPrivilegesin interfaceAccessControlEntry- See Also:
AccessControlEntry.getPrivileges()
-
isAllow
public boolean isAllow()
- Specified by:
isAllowin interfaceJackrabbitAccessControlEntry- See Also:
JackrabbitAccessControlEntry.isAllow()
-
getRestrictionNames
public String[] getRestrictionNames() throws NamespaceException
- Specified by:
getRestrictionNamesin interfaceJackrabbitAccessControlEntry- Throws:
NamespaceException- See Also:
JackrabbitAccessControlEntry.getRestrictionNames()
-
getRestriction
public Value getRestriction(String restrictionName) throws RepositoryException
- Specified by:
getRestrictionin interfaceJackrabbitAccessControlEntry- Throws:
RepositoryException- See Also:
JackrabbitAccessControlEntry.getRestriction(String)
-
getRestrictions
public Value[] getRestrictions(String restrictionName) throws RepositoryException
- Specified by:
getRestrictionsin interfaceJackrabbitAccessControlEntry- Throws:
RepositoryException- See Also:
JackrabbitAccessControlEntry.getRestrictions(String)
-
getPrivilegeCollection
public PrivilegeCollection getPrivilegeCollection()
- Specified by:
getPrivilegeCollectionin interfaceJackrabbitAccessControlEntry
-
hashCode
public int hashCode()
- Overrides:
hashCodein classObject- See Also:
Object.hashCode()
-
equals
public boolean equals(Object obj)
- Overrides:
equalsin classObject- See Also:
Object.equals(Object)
-
-