Package org.apache.fulcrum.security.spi
Class AbstractPermissionManager
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.fulcrum.security.spi.AbstractManager
org.apache.fulcrum.security.spi.AbstractEntityManager
org.apache.fulcrum.security.spi.AbstractPermissionManager
- All Implemented Interfaces:
Serializable,org.apache.avalon.framework.activity.Disposable,org.apache.avalon.framework.configuration.Configurable,org.apache.avalon.framework.logger.LogEnabled,org.apache.avalon.framework.service.Serviceable,org.apache.avalon.framework.thread.ThreadSafe,PermissionManager
public abstract class AbstractPermissionManager
extends AbstractEntityManager
implements PermissionManager
This implementation keeps all objects in memory. This is mostly meant to help
with testing and prototyping of ideas.
- Version:
- $Id: AbstractPermissionManager.java 1372918 2012-08-14 15:19:40Z tv $
- Author:
- Eric Pugh
- See Also:
-
Field Summary
Fields inherited from class org.apache.fulcrum.security.spi.AbstractManager
managerFields inherited from interface org.apache.fulcrum.security.PermissionManager
ROLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T extends Permission>
TaddPermission(T permission) Creates a new permission with specified attributes.booleancheckExists(Permission permission) Check whether a specified permission exists.<T extends Permission>
TRetrieve a Permission object with specified Id.<T extends Permission>
TgetPermissionByName(String name) Retrieve a Permission object with specified name.<T extends Permission>
TConstruct a blank Permission object.<T extends Permission>
TgetPermissionInstance(String permName) Construct a blank Permission object.protected abstract <T extends Permission>
TpersistNewPermission(T permission) Methods inherited from class org.apache.fulcrum.security.spi.AbstractEntityManager
configure, getClassName, setClassNameMethods inherited from class org.apache.fulcrum.security.spi.AbstractManager
dispose, getGroupManager, getPermissionManager, getRoleManager, getServiceManager, getUserManager, release, resolve, serviceMethods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLoggerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.fulcrum.security.PermissionManager
checkExists, getAllPermissions, removePermission, renamePermission
-
Constructor Details
-
AbstractPermissionManager
public AbstractPermissionManager()
-
-
Method Details
-
persistNewPermission
protected abstract <T extends Permission> T persistNewPermission(T permission) throws DataBackendException - Throws:
DataBackendException
-
getPermissionInstance
Construct a blank Permission object. This method calls getPermissionClass, and then creates a new object using the default constructor.- Specified by:
getPermissionInstancein interfacePermissionManager- Type Parameters:
T- permission type- Returns:
- an object implementing Permission interface.
- Throws:
DataBackendException- if the object could not be instantiated.
-
getPermissionInstance
Construct a blank Permission object. This method calls getPermissionClass, and then creates a new object using the default constructor.- Specified by:
getPermissionInstancein interfacePermissionManager- Type Parameters:
T- permission type- Parameters:
permName- The name of the permission.- Returns:
- an object implementing Permission interface.
- Throws:
DataBackendException- if the object could not be instantiated.
-
getPermissionByName
public <T extends Permission> T getPermissionByName(String name) throws DataBackendException, UnknownEntityException Retrieve a Permission object with specified name.- Specified by:
getPermissionByNamein interfacePermissionManager- Type Parameters:
T- permission type- Parameters:
name- the name of the Permission.- Returns:
- an object representing the Permission with specified name.
- Throws:
DataBackendException- if there was an error accessing the data backend.UnknownEntityException- if the permission does not exist.
-
getPermissionById
public <T extends Permission> T getPermissionById(Object id) throws DataBackendException, UnknownEntityException Retrieve a Permission object with specified Id.- Specified by:
getPermissionByIdin interfacePermissionManager- Type Parameters:
T- permission type- Parameters:
id- the ID of the Permission.- Returns:
- an object representing the Permission with specified name.
- Throws:
UnknownEntityException- if the permission does not exist in the database.DataBackendException- if there is a problem accessing the storage.
-
addPermission
public <T extends Permission> T addPermission(T permission) throws DataBackendException, EntityExistsException Creates a new permission with specified attributes.- Specified by:
addPermissionin interfacePermissionManager- Parameters:
permission- the object describing the permission to be created.- Returns:
- a new Permission object that has id set up properly.
- Throws:
DataBackendException- if there was an error accessing the data backend.EntityExistsException- if the permission already exists.
-
checkExists
Check whether a specified permission exists. The name is used for looking up the permission- Specified by:
checkExistsin interfacePermissionManager- Parameters:
permission- The permission to be checked.- Returns:
- true if the specified permission exists
- Throws:
DataBackendException- if there was an error accessing the data backend.
-