Class TorqueAbstractRoleManager
- 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.AbstractRoleManager
-
- org.apache.fulcrum.security.torque.TorqueAbstractRoleManager
-
- 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
,RoleManager
,LazyLoadable
- Direct Known Subclasses:
PeerRoleManager
,TorqueDynamicRoleManagerImpl
public abstract class TorqueAbstractRoleManager extends AbstractRoleManager implements LazyLoadable
This implementation persists to a database via Torque.- Version:
- $Id:$
- Author:
- Thomas Vandahl
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Boolean
lazyLoading
-
Fields inherited from class org.apache.fulcrum.security.spi.AbstractManager
manager
-
Fields inherited from interface org.apache.fulcrum.security.RoleManager
ROLE
-
-
Constructor Summary
Constructors Constructor Description TorqueAbstractRoleManager()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
checkExists(String roleName)
Determines if theRole
exists in the security system.void
configure(org.apache.avalon.framework.configuration.Configuration conf)
Avalon Service lifecycle methodprotected abstract <T extends Role>
List<T>doSelectAllRoles(Connection con)
Get all specialized Rolesprotected abstract <T extends Role>
TdoSelectById(Integer id, Connection con)
Get a specialized Role by idprotected abstract <T extends Role>
TdoSelectByName(String name, Connection con)
Get a specialized Role by nameRoleSet
getAllRoles()
Retrieves all roles defined in the system.Boolean
getLazyLoading()
<T extends Role>
TgetRoleById(Object id)
Retrieve a Role object with specified id.<T extends Role>
TgetRoleByName(String name)
Retrieve a Role object with specified name.protected <T extends Role>
TpersistNewRole(T role)
Creates a new role with specified attributes.void
removeRole(Role role)
Removes a Role from the system.void
renameRole(Role role, String name)
Renames an existing Role.void
setLazyLoading(Boolean lazyLoading)
-
Methods inherited from class org.apache.fulcrum.security.spi.AbstractRoleManager
addRole, checkExists, getRoleInstance, getRoleInstance
-
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
-
-
-
-
Field Detail
-
lazyLoading
protected Boolean lazyLoading
-
-
Constructor Detail
-
TorqueAbstractRoleManager
public TorqueAbstractRoleManager()
-
-
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
-
doSelectAllRoles
protected abstract <T extends Role> List<T> doSelectAllRoles(Connection con) throws org.apache.torque.TorqueException
Get all specialized Roles- Parameters:
con
- a database connection- Returns:
- a List of Role instances
- Throws:
org.apache.torque.TorqueException
- if any database error occurs
-
doSelectByName
protected abstract <T extends Role> T doSelectByName(String name, Connection con) throws org.apache.torque.NoRowsException, org.apache.torque.TooManyRowsException, org.apache.torque.TorqueException
Get a specialized Role by name- Parameters:
name
- the name of the groupcon
- a database connection- Returns:
- a Role 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 Role> T doSelectById(Integer id, Connection con) throws org.apache.torque.NoRowsException, org.apache.torque.TooManyRowsException, org.apache.torque.TorqueException
Get a specialized Role by id- Parameters:
id
- the id of the groupcon
- a database connection- Returns:
- a Role 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
-
renameRole
public void renameRole(Role role, String name) throws DataBackendException, UnknownEntityException
Renames an existing Role.- Specified by:
renameRole
in interfaceRoleManager
- Parameters:
role
- The object describing the role to be renamed.name
- the new name for the role.- Throws:
DataBackendException
- if there was an error accessing the data backend.UnknownEntityException
- if the role does not exist.
-
persistNewRole
protected <T extends Role> T persistNewRole(T role) throws DataBackendException
Creates a new role with specified attributes.- Specified by:
persistNewRole
in classAbstractRoleManager
- Type Parameters:
T
- role type- Parameters:
role
- the object describing the role to be created.- Returns:
- a new Role object that has id set up properly.
- Throws:
DataBackendException
- if there was an error accessing the data backend.
-
removeRole
public void removeRole(Role role) throws DataBackendException, UnknownEntityException
Removes a Role from the system.- Specified by:
removeRole
in interfaceRoleManager
- Parameters:
role
- The object describing the role to be removed.- Throws:
DataBackendException
- if there was an error accessing the data backend.UnknownEntityException
- if the role does not exist.
-
checkExists
public boolean checkExists(String roleName) throws DataBackendException
Determines if theRole
exists in the security system.- Specified by:
checkExists
in interfaceRoleManager
- Parameters:
roleName
- aRole
value- Returns:
- true if the role name exists in the system, false otherwise
- Throws:
DataBackendException
- when more than one Role with the same name exists.
-
getAllRoles
public RoleSet getAllRoles() throws DataBackendException
Retrieves all roles defined in the system.- Specified by:
getAllRoles
in interfaceRoleManager
- Returns:
- the names of all roles defined in the system.
- Throws:
DataBackendException
- if there was an error accessing the data backend.
-
getRoleById
public <T extends Role> T getRoleById(Object id) throws DataBackendException, UnknownEntityException
Retrieve a Role object with specified id.- Specified by:
getRoleById
in interfaceRoleManager
- Overrides:
getRoleById
in classAbstractRoleManager
- Type Parameters:
T
- the role type- Parameters:
id
- the id of the Role.- Returns:
- an object representing the Role with specified id.
- Throws:
DataBackendException
- if there was an error accessing the data backend.UnknownEntityException
- if the role does not exist.
-
getRoleByName
public <T extends Role> T getRoleByName(String name) throws DataBackendException, UnknownEntityException
Retrieve a Role object with specified name.- Specified by:
getRoleByName
in interfaceRoleManager
- Overrides:
getRoleByName
in classAbstractRoleManager
- Type Parameters:
T
- type of role- Parameters:
name
- the name of the Role.- Returns:
- an object representing the Role with specified name.
- Throws:
DataBackendException
- if there was an error accessing the data backend.UnknownEntityException
- if the role does not exist.- See Also:
RoleManager.getRoleByName(java.lang.String)
-
getLazyLoading
public Boolean getLazyLoading()
- Specified by:
getLazyLoading
in interfaceLazyLoadable
-
setLazyLoading
public void setLazyLoading(Boolean lazyLoading)
- Specified by:
setLazyLoading
in interfaceLazyLoadable
-
-