Class TorqueAbstractPermissionManager
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
org.apache.fulcrum.security.torque.TorqueAbstractPermissionManager
- 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
- Direct Known Subclasses:
PeerPermissionManager,TorqueDynamicPermissionManagerImpl
This implementation persists to a database via Torque.
- Version:
- $Id:$
- Author:
- Thomas Vandahl
- 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 TypeMethodDescriptionbooleancheckExists(String permissionName) Determines if thePermissionexists in the security system.voidconfigure(org.apache.avalon.framework.configuration.Configuration conf) Avalon Service lifecycle methodprotected abstract <T extends Permission>
List<T> Get all specialized Permissionsprotected abstract <T extends Permission>
TdoSelectById(Integer id, Connection con) Get a specialized Permission by idprotected abstract <T extends Permission>
TdoSelectByName(String name, Connection con) Get a specialized Permission by nameRetrieves all permissions defined in the system.<T extends Permission>
TRetrieve a Permission object with specified id.<T extends Permission>
TgetPermissionByName(String name) Retrieve a Permission object with specified name.protected <T extends Permission>
TpersistNewPermission(T permission) Creates a new permission with specified attributes.voidremovePermission(Permission permission) Removes a Permission from the system.voidrenamePermission(Permission permission, String name) Renames an existing Permission.Methods inherited from class org.apache.fulcrum.security.spi.AbstractPermissionManager
addPermission, checkExists, getPermissionInstance, getPermissionInstanceMethods inherited from class org.apache.fulcrum.security.spi.AbstractEntityManager
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, setupLogger
-
Constructor Details
-
TorqueAbstractPermissionManager
public TorqueAbstractPermissionManager()
-
-
Method Details
-
configure
public void configure(org.apache.avalon.framework.configuration.Configuration conf) throws org.apache.avalon.framework.configuration.ConfigurationException Avalon Service lifecycle method- Specified by:
configurein interfaceorg.apache.avalon.framework.configuration.Configurable- Overrides:
configurein classAbstractEntityManager- Throws:
org.apache.avalon.framework.configuration.ConfigurationException
-
doSelectAllPermissions
protected abstract <T extends Permission> List<T> doSelectAllPermissions(Connection con) throws org.apache.torque.TorqueException Get all specialized Permissions- Parameters:
con- a database connection- Returns:
- a List of Permission instances
- Throws:
org.apache.torque.TorqueException- if any database error occurs
-
doSelectByName
protected abstract <T extends Permission> T doSelectByName(String name, Connection con) throws org.apache.torque.NoRowsException, org.apache.torque.TooManyRowsException, org.apache.torque.TorqueException Get a specialized Permission by name- Parameters:
name- the name of the groupcon- a database connection- Returns:
- a Permission instance
- Throws:
org.apache.torque.NoRowsException- if no such group existsorg.apache.torque.TooManyRowsException- if multiple groups with the given name existorg.apache.torque.TorqueException- if any database error occurs if any other database error occurs
-
doSelectById
protected abstract <T extends Permission> T doSelectById(Integer id, Connection con) throws org.apache.torque.NoRowsException, org.apache.torque.TooManyRowsException, org.apache.torque.TorqueException Get a specialized Permission by id- Parameters:
id- the id of the groupcon- a database connection- Returns:
- a Permission instance
- Throws:
org.apache.torque.NoRowsException- if no such group existsorg.apache.torque.TooManyRowsException- if multiple groups with the given id existorg.apache.torque.TorqueException- if any database error occurs if any other database error occurs
-
renamePermission
public void renamePermission(Permission permission, String name) throws DataBackendException, UnknownEntityException Renames an existing Permission.- Parameters:
permission- The object describing the permission to be renamed.name- the new name for the permission.- Throws:
DataBackendException- if there was an error accessing the data backend.UnknownEntityException- if the permission does not exist.
-
removePermission
public void removePermission(Permission permission) throws DataBackendException, UnknownEntityException Removes a Permission from the system.- Parameters:
permission- The object describing the permission to be removed.- Throws:
DataBackendException- if there was an error accessing the data backend.UnknownEntityException- if the permission does not exist.
-
persistNewPermission
Creates a new permission with specified attributes.- Specified by:
persistNewPermissionin classAbstractPermissionManager- 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.
-
getAllPermissions
Retrieves all permissions defined in the system.- Returns:
- the names of all roles defined in the system.
- Throws:
DataBackendException- if there was an error accessing the data backend.
-
checkExists
Determines if thePermissionexists in the security system.- Parameters:
permissionName- aPermissionvalue- Returns:
- true if the permission name exists in the system, false otherwise
- Throws:
DataBackendException- when more than one Permission with the same name exists.
-
getPermissionById
public <T extends Permission> T getPermissionById(Object id) throws DataBackendException, UnknownEntityException Retrieve a Permission object with specified id.- Specified by:
getPermissionByIdin interfacePermissionManager- Overrides:
getPermissionByIdin classAbstractPermissionManager- Parameters:
id- the id of the Permission.- Returns:
- an object representing the Permission with specified id.
- Throws:
DataBackendException- if there was an error accessing the data backend.UnknownEntityException- if the permission does not exist.
-
getPermissionByName
public <T extends Permission> T getPermissionByName(String name) throws DataBackendException, UnknownEntityException Retrieve a Permission object with specified name.- Specified by:
getPermissionByNamein interfacePermissionManager- Overrides:
getPermissionByNamein classAbstractPermissionManager- Parameters:
name- the name of the Group.- Returns:
- an object representing the Group with specified name.
- Throws:
DataBackendException- if there was an error accessing the data backend.UnknownEntityException- if the group does not exist.
-