Package org.apache.fulcrum.security.spi
Class AbstractGroupManager
- 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.AbstractGroupManager
-
- 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,GroupManager
public abstract class AbstractGroupManager extends AbstractEntityManager implements GroupManager
This implementation keeps all objects in memory. This is mostly meant to help with testing and prototyping of ideas.- Version:
- $Id$
- Author:
- Eric Pugh
- 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.GroupManager
ROLE
-
-
Constructor Summary
Constructors Constructor Description AbstractGroupManager()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description <T extends Group>
TaddGroup(T group)Creates a new group with specified attributes.booleancheckExists(Group group)Check whether a specified group exists.<T extends Group>
TgetGroupById(Object id)Retrieve a Group object with specified Id.<T extends Group>
TgetGroupByName(String name)Retrieve a Group object with specified name.<T extends Group>
TgetGroupInstance()Construct a blank Group object.<T extends Group>
TgetGroupInstance(String groupName)Construct a blank Group object.protected abstract <T extends Group>
TpersistNewGroup(T group)-
Methods inherited from class org.apache.fulcrum.security.spi.AbstractEntityManager
configure, getClassName, setClassName
-
Methods inherited from class org.apache.fulcrum.security.spi.AbstractManager
dispose, getGroupManager, getPermissionManager, getRoleManager, getServiceManager, getUserManager, release, resolve, service
-
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.fulcrum.security.GroupManager
checkExists, getAllGroups, removeGroup, renameGroup
-
-
-
-
Method Detail
-
persistNewGroup
protected abstract <T extends Group> T persistNewGroup(T group) throws DataBackendException
- Throws:
DataBackendException
-
getGroupInstance
public <T extends Group> T getGroupInstance() throws DataBackendException
Construct a blank Group object. This method calls getGroupClass, and then creates a new object using the default constructor.- Specified by:
getGroupInstancein interfaceGroupManager- Type Parameters:
T- The group extendingGroup- Returns:
- an object implementing Group interface.
- Throws:
DataBackendException- if the object could not be instantiated.
-
getGroupInstance
public <T extends Group> T getGroupInstance(String groupName) throws DataBackendException
Construct a blank Group object. This method calls getGroupClass, and then creates a new object using the default constructor.- Specified by:
getGroupInstancein interfaceGroupManager- Type Parameters:
T- The group of typeGroup- Parameters:
groupName- The name of the Group- Returns:
- an object implementing Group interface.
- Throws:
DataBackendException- if the object could not be instantiated.
-
getGroupByName
public <T extends Group> T getGroupByName(String name) throws DataBackendException, UnknownEntityException
Retrieve a Group object with specified name.- Specified by:
getGroupByNamein interfaceGroupManager- Type Parameters:
T- The group of typeGroup- 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.
-
getGroupById
public <T extends Group> T getGroupById(Object id) throws DataBackendException, UnknownEntityException
Retrieve a Group object with specified Id.- Specified by:
getGroupByIdin interfaceGroupManager- Type Parameters:
T- Group type- Parameters:
id- the ID of the Group.- Returns:
- an object representing the Group with specified name.
- Throws:
UnknownEntityException- if the permission does not exist in the database.DataBackendException- if there is a problem accessing the storage.
-
addGroup
public <T extends Group> T addGroup(T group) throws DataBackendException, EntityExistsException
Creates a new group with specified attributes.- Specified by:
addGroupin interfaceGroupManager- Parameters:
group- the object describing the group to be created.- Returns:
- a new Group object that has id set up properly.
- Throws:
DataBackendException- if there was an error accessing the data backend.EntityExistsException- if the group already exists.
-
checkExists
public boolean checkExists(Group group) throws DataBackendException
Check whether a specified group exists. The name is used for looking up the group- Specified by:
checkExistsin interfaceGroupManager- Parameters:
group- The group to be checked.- Returns:
- true if the specified group exists
- Throws:
DataBackendException- if there was an error accessing the data backend.
-
-