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
public abstract class TorqueAbstractPermissionManager extends AbstractPermissionManager
This implementation persists to a database via Torque.- Version:
- $Id:$
- Author:
- Thomas Vandahl
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.apache.fulcrum.security.spi.AbstractManager
manager
-
Fields inherited from interface org.apache.fulcrum.security.PermissionManager
ROLE
-
-
Constructor Summary
Constructors Constructor Description TorqueAbstractPermissionManager()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
checkExists(String permissionName)
Determines if thePermission
exists in the security system.void
configure(org.apache.avalon.framework.configuration.Configuration conf)
Avalon Service lifecycle methodprotected abstract <T extends Permission>
List<T>doSelectAllPermissions(Connection con)
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 namePermissionSet
getAllPermissions()
Retrieves all permissions defined in the system.<T extends Permission>
TgetPermissionById(Object id)
Retrieve 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.void
removePermission(Permission permission)
Removes a Permission from the system.void
renamePermission(Permission permission, String name)
Renames an existing Permission.-
Methods inherited from class org.apache.fulcrum.security.spi.AbstractPermissionManager
addPermission, checkExists, getPermissionInstance, getPermissionInstance
-
Methods inherited from class org.apache.fulcrum.security.spi.AbstractEntityManager
getClassName, setClassName
-
Methods inherited from class org.apache.fulcrum.security.spi.AbstractManager
dispose, getGroupManager, getPermissionManager, getRoleManager, getServiceManager, getUserManager, release, resolve, service
-
-
-
-
Constructor Detail
-
TorqueAbstractPermissionManager
public TorqueAbstractPermissionManager()
-
-
Method Detail
-
configure
public void configure(org.apache.avalon.framework.configuration.Configuration conf) throws org.apache.avalon.framework.configuration.ConfigurationException
Avalon Service lifecycle method- Specified by:
configure
in interfaceorg.apache.avalon.framework.configuration.Configurable
- Overrides:
configure
in 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
protected <T extends Permission> T persistNewPermission(T permission) throws DataBackendException
Creates a new permission with specified attributes.- Specified by:
persistNewPermission
in 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
public PermissionSet getAllPermissions() throws DataBackendException
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
public boolean checkExists(String permissionName) throws DataBackendException
Determines if thePermission
exists in the security system.- Parameters:
permissionName
- aPermission
value- 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:
getPermissionById
in interfacePermissionManager
- Overrides:
getPermissionById
in classAbstractPermissionManager
- Type Parameters:
T
- permission type- 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:
getPermissionByName
in interfacePermissionManager
- Overrides:
getPermissionByName
in classAbstractPermissionManager
- Type Parameters:
T
- permission type- 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.
-
-