org.apache.jackrabbit.core.security
Class AbstractAccessControlManager

java.lang.Object
  extended by org.apache.jackrabbit.core.security.AbstractAccessControlManager
All Implemented Interfaces:
AccessControlManager, JackrabbitAccessControlManager
Direct Known Subclasses:
DefaultAccessManager, SimpleAccessManager

public abstract class AbstractAccessControlManager
extends Object
implements JackrabbitAccessControlManager

AbstractAccessControlManager...


Constructor Summary
AbstractAccessControlManager()
           
 
Method Summary
protected abstract  void checkInitialized()
          Check if this manager has been properly initialized.
protected abstract  void checkPermission(String absPath, int permission)
          Check if the specified privileges are granted at absPath.
protected abstract  void checkValidNodePath(String absPath)
          Tests if the given absPath is absolute and points to an existing node.
 JackrabbitAccessControlPolicy[] getApplicablePolicies(Principal principal)
          Returns the applicable policies for the specified principal or an empty array if no additional policies can be applied.
 AccessControlPolicyIterator getApplicablePolicies(String absPath)
          Returns an empty iterator.
 JackrabbitAccessControlPolicy[] getPolicies(Principal principal)
          Returns the AccessControlPolicy objects that have been set for the given principal or an empty array if no policy has been set.
 AccessControlPolicy[] getPolicies(String absPath)
          Returns null.
protected abstract  PrivilegeRegistry getPrivilegeRegistry()
           
 Privilege[] getSupportedPrivileges(String absPath)
          Always returns all registered Privileges.
 Privilege privilegeFromName(String privilegeName)
           
 void removePolicy(String absPath, AccessControlPolicy policy)
          Always throws AccessControlException
 void setPolicy(String absPath, AccessControlPolicy policy)
          Always throws AccessControlException
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.jackrabbit.api.security.JackrabbitAccessControlManager
getEffectivePolicies, getPrivileges, hasPrivileges
 
Methods inherited from interface javax.jcr.security.AccessControlManager
getEffectivePolicies, getPrivileges, hasPrivileges
 

Constructor Detail

AbstractAccessControlManager

public AbstractAccessControlManager()
Method Detail

getSupportedPrivileges

public Privilege[] getSupportedPrivileges(String absPath)
                                   throws PathNotFoundException,
                                          RepositoryException
Always returns all registered Privileges.

Specified by:
getSupportedPrivileges in interface AccessControlManager
Parameters:
absPath - Path to an existing node.
Returns:
Always returns all registered Privileges.
Throws:
PathNotFoundException
RepositoryException
See Also:
AccessControlManager.getSupportedPrivileges(String)

privilegeFromName

public Privilege privilegeFromName(String privilegeName)
                            throws AccessControlException,
                                   RepositoryException
Specified by:
privilegeFromName in interface AccessControlManager
Throws:
AccessControlException
RepositoryException
See Also:
AccessControlManager.privilegeFromName(String)

getPolicies

public AccessControlPolicy[] getPolicies(String absPath)
                                  throws PathNotFoundException,
                                         AccessDeniedException,
                                         RepositoryException
Returns null.

Specified by:
getPolicies in interface AccessControlManager
Parameters:
absPath - Path to an existing node.
Returns:
always returns null.
Throws:
PathNotFoundException
AccessDeniedException
RepositoryException
See Also:
AccessControlManager.getApplicablePolicies(String)

getApplicablePolicies

public AccessControlPolicyIterator getApplicablePolicies(String absPath)
                                                  throws PathNotFoundException,
                                                         AccessDeniedException,
                                                         RepositoryException
Returns an empty iterator.

Specified by:
getApplicablePolicies in interface AccessControlManager
Parameters:
absPath - Path to an existing node.
Returns:
always returns an empty iterator.
Throws:
PathNotFoundException
AccessDeniedException
RepositoryException
See Also:
AccessControlManager.getApplicablePolicies(String)

setPolicy

public void setPolicy(String absPath,
                      AccessControlPolicy policy)
               throws PathNotFoundException,
                      AccessControlException,
                      AccessDeniedException,
                      RepositoryException
Always throws AccessControlException

Specified by:
setPolicy in interface AccessControlManager
Throws:
PathNotFoundException
AccessControlException
AccessDeniedException
RepositoryException
See Also:
AccessControlManager.setPolicy(String, AccessControlPolicy)

removePolicy

public void removePolicy(String absPath,
                         AccessControlPolicy policy)
                  throws PathNotFoundException,
                         AccessControlException,
                         AccessDeniedException,
                         RepositoryException
Always throws AccessControlException

Specified by:
removePolicy in interface AccessControlManager
Throws:
PathNotFoundException
AccessControlException
AccessDeniedException
RepositoryException
See Also:
AccessControlManager.removePolicy(String, AccessControlPolicy)

getApplicablePolicies

public JackrabbitAccessControlPolicy[] getApplicablePolicies(Principal principal)
                                                      throws AccessDeniedException,
                                                             AccessControlException,
                                                             UnsupportedRepositoryOperationException,
                                                             RepositoryException
Description copied from interface: JackrabbitAccessControlManager
Returns the applicable policies for the specified principal or an empty array if no additional policies can be applied.

Specified by:
getApplicablePolicies in interface JackrabbitAccessControlManager
Parameters:
principal - A principal known to the editing session.
Returns:
array of policies for the specified principal. Note that the policy object returned must reveal the path of the node where they can be applied later on using AccessControlManager.setPolicy(String, javax.jcr.security.AccessControlPolicy).
Throws:
AccessDeniedException - if the session lacks MODIFY_ACCESS_CONTROL privilege.
AccessControlException - if the specified principal does not exist or if another access control related exception occurs.
UnsupportedRepositoryOperationException - if editing access control policies by principal is not supported.
RepositoryException - if another error occurs.
See Also:
JackrabbitAccessControlManager.getApplicablePolicies(java.security.Principal)

getPolicies

public JackrabbitAccessControlPolicy[] getPolicies(Principal principal)
                                            throws AccessDeniedException,
                                                   AccessControlException,
                                                   UnsupportedRepositoryOperationException,
                                                   RepositoryException
Description copied from interface: JackrabbitAccessControlManager
Returns the AccessControlPolicy objects that have been set for the given principal or an empty array if no policy has been set. This method reflects the binding state, including transient policy modifications.

Specified by:
getPolicies in interface JackrabbitAccessControlManager
Parameters:
principal - A valid principal.
Returns:
The policies defined for the given principal or an empty array.
Throws:
AccessDeniedException - if the session lacks READ_ACCESS_CONTROL privilege.
AccessControlException - if the specified principal does not exist or if another access control related exception occurs.
UnsupportedRepositoryOperationException - if editing access control policies by principal is not supported.
RepositoryException - If another error occurs.
See Also:
JackrabbitAccessControlManager.getPolicies(java.security.Principal)

checkInitialized

protected abstract void checkInitialized()
                                  throws IllegalStateException
Check if this manager has been properly initialized.

Throws:
IllegalStateException - If this manager has not been properly initialized.

checkPermission

protected abstract void checkPermission(String absPath,
                                        int permission)
                                 throws AccessDeniedException,
                                        PathNotFoundException,
                                        RepositoryException
Check if the specified privileges are granted at absPath.

Parameters:
absPath - Path to an existing node.
permission - Permissions to be checked.
Throws:
AccessDeniedException - if the session does not have the specified privileges.
PathNotFoundException - if no node exists at absPath of if the session does not have the permission to READ it.
RepositoryException - If another error occurs.

getPrivilegeRegistry

protected abstract PrivilegeRegistry getPrivilegeRegistry()
                                                   throws RepositoryException
Returns:
the privilege registry
Throws:
RepositoryException - If another error occurs.

checkValidNodePath

protected abstract void checkValidNodePath(String absPath)
                                    throws PathNotFoundException,
                                           RepositoryException
Tests if the given absPath is absolute and points to an existing node.

Parameters:
absPath - Path to an existing node.
Throws:
PathNotFoundException - if no node at absPath exists or the session does not have privilege to retrieve the node.
RepositoryException - If the given absPath is not absolute or if some other error occurs.


Copyright © 2004-2010 The Apache Software Foundation. All Rights Reserved.