Author: tv
Date: Fri Sep 7 13:16:04 2012
New Revision: 1382009
URL: http://svn.apache.org/viewvc?rev=1382009&view=rev
Log:
Improve framework compatibility
Modified:
turbine/fulcrum/trunk/security/api/src/java/org/apache/fulcrum/security/GroupManager.java
turbine/fulcrum/trunk/security/api/src/java/org/apache/fulcrum/security/ModelManager.java
turbine/fulcrum/trunk/security/api/src/java/org/apache/fulcrum/security/PermissionManager.java
turbine/fulcrum/trunk/security/api/src/java/org/apache/fulcrum/security/RoleManager.java
turbine/fulcrum/trunk/security/api/src/java/org/apache/fulcrum/security/SecurityService.java
turbine/fulcrum/trunk/security/api/src/java/org/apache/fulcrum/security/UserManager.java
turbine/fulcrum/trunk/security/api/src/java/org/apache/fulcrum/security/model/ACLFactory.java
turbine/fulcrum/trunk/security/api/src/java/org/apache/fulcrum/security/model/turbine/TurbineUserManager.java
turbine/fulcrum/trunk/security/api/src/java/org/apache/fulcrum/security/spi/AbstractUserManager.java
Modified:
turbine/fulcrum/trunk/security/api/src/java/org/apache/fulcrum/security/GroupManager.java
URL:
http://svn.apache.org/viewvc/turbine/fulcrum/trunk/security/api/src/java/org/apache/fulcrum/security/GroupManager.java?rev=1382009&r1=1382008&r2=1382009&view=diff
==============================================================================
---
turbine/fulcrum/trunk/security/api/src/java/org/apache/fulcrum/security/GroupManager.java
(original)
+++
turbine/fulcrum/trunk/security/api/src/java/org/apache/fulcrum/security/GroupManager.java
Fri Sep 7 13:16:04 2012
@@ -18,7 +18,6 @@ package org.apache.fulcrum.security;
* specific language governing permissions and limitations
* under the License.
*/
-import org.apache.avalon.framework.component.Component;
import org.apache.fulcrum.security.entity.Group;
import org.apache.fulcrum.security.util.DataBackendException;
import org.apache.fulcrum.security.util.EntityExistsException;
@@ -29,16 +28,16 @@ import org.apache.fulcrum.security.util.
* An GroupManager performs {@link org.apache.fulcrum.security.entity.Group}
* objects related tasks on behalf of the
* {@link org.apache.fulcrum.security.BaseSecurityService}.
- *
+ *
* The responsibilities of this class include loading data of an group from the
* storage and putting them into the
* {@link org.apache.fulcrum.security.entity.Group} objects, saving those data
* to the permanent storage.
- *
+ *
* @author <a href="mailto:[email protected]">Eric Pugh</a>
* @version $Id$
*/
-public interface GroupManager extends Component
+public interface GroupManager
{
/** Avalon role - used to id the component within the manager */
@@ -46,34 +45,34 @@ public interface GroupManager extends Co
/**
* Construct a blank Group object.
- *
+ *
* This method calls getGroupClass, and then creates a new object using the
* default constructor.
- *
+ *
* @return an object implementing Group interface.
* @throws DataBackendException
* if the object could not be instantiated.
*/
- Group getGroupInstance() throws DataBackendException;
+ <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.
- *
+ *
* @param groupName
* The name of the Group
- *
+ *
* @return an object implementing Group interface.
* @throws DataBackendException
* if the object could not be instantiated.
*/
- Group getGroupInstance(String groupName) throws DataBackendException;
+ <T extends Group> T getGroupInstance(String groupName) throws
DataBackendException;
/**
* Retrieve a Group object with specified name.
- *
+ *
* @param name
* the name of the Group.
* @return an object representing the Group with specified name.
@@ -82,26 +81,26 @@ public interface GroupManager extends Co
* @throws UnknownEntityException
* if the group does not exist.
*/
- Group getGroupByName(String name) throws DataBackendException,
UnknownEntityException;
+ <T extends Group> T getGroupByName(String name) throws
DataBackendException, UnknownEntityException;
/**
* Retrieve a Group object with specified Id.
- *
+ *
* @param name
* the name of the Group.
- *
+ *
* @return an object representing the Group with specified name.
- *
+ *
* @exception UnknownEntityException
* if the permission does not exist in the database.
* @exception DataBackendException
* if there is a problem accessing the storage.
*/
- Group getGroupById(Object id) throws DataBackendException,
UnknownEntityException;
+ <T extends Group> T getGroupById(Object id) throws DataBackendException,
UnknownEntityException;
/**
* Renames an existing Group.
- *
+ *
* @param group
* The object describing the group to be renamed.
* @param name
@@ -115,7 +114,7 @@ public interface GroupManager extends Co
/**
* Removes a Group from the system.
- *
+ *
* @param group
* The object describing the group to be removed.
* @throws DataBackendException
@@ -127,7 +126,7 @@ public interface GroupManager extends Co
/**
* Creates a new group with specified attributes.
- *
+ *
* @param group
* the object describing the group to be created.
* @return the new Group object.
@@ -136,11 +135,11 @@ public interface GroupManager extends Co
* @throws EntityExistsException
* if the group already exists.
*/
- Group addGroup(Group group) throws DataBackendException,
EntityExistsException;
+ <T extends Group> T addGroup(T group) throws DataBackendException,
EntityExistsException;
/**
* Retrieves all groups defined in the system.
- *
+ *
* @return the names of all groups defined in the system.
* @throws DataBackendException
* if there was an error accessing the data backend.
@@ -149,7 +148,7 @@ public interface GroupManager extends Co
/**
* Determines if the <code>Group</code> exists in the security system.
- *
+ *
* @param permission
* a <code>Group</code> value
* @return true if the group exists in the system, false otherwise
@@ -158,12 +157,12 @@ public interface GroupManager extends Co
* @throws Exception
* A generic exception.
*/
- public boolean checkExists(Group group) throws DataBackendException;
+ boolean checkExists(Group group) throws DataBackendException;
/**
* Determines if a <code>Group</code> exists in the security system with
the
* specified name.
- *
+ *
* @param groupName
* the name of a <code>Group</code> to check.
* @return true if the group exists in the system, false otherwise
@@ -172,6 +171,5 @@ public interface GroupManager extends Co
* @throws Exception
* A generic exception.
*/
- public boolean checkExists(String group) throws DataBackendException;
-
+ boolean checkExists(String group) throws DataBackendException;
}
Modified:
turbine/fulcrum/trunk/security/api/src/java/org/apache/fulcrum/security/ModelManager.java
URL:
http://svn.apache.org/viewvc/turbine/fulcrum/trunk/security/api/src/java/org/apache/fulcrum/security/ModelManager.java?rev=1382009&r1=1382008&r2=1382009&view=diff
==============================================================================
---
turbine/fulcrum/trunk/security/api/src/java/org/apache/fulcrum/security/ModelManager.java
(original)
+++
turbine/fulcrum/trunk/security/api/src/java/org/apache/fulcrum/security/ModelManager.java
Fri Sep 7 13:16:04 2012
@@ -18,18 +18,16 @@ package org.apache.fulcrum.security;
* specific language governing permissions and limitations
* under the License.
*/
-import org.apache.avalon.framework.component.Component;
/**
* Right now is just a marker interface, and provides the Role name.
- *
- *
+ *
+ *
* @author <a href="mailto:[email protected]">Eric Pugh</a>
* @version $Id$
*/
-public interface ModelManager extends Component
+public interface ModelManager
{
/** Avalon role - used to id the component within the manager */
String ROLE = ModelManager.class.getName();
-
}
Modified:
turbine/fulcrum/trunk/security/api/src/java/org/apache/fulcrum/security/PermissionManager.java
URL:
http://svn.apache.org/viewvc/turbine/fulcrum/trunk/security/api/src/java/org/apache/fulcrum/security/PermissionManager.java?rev=1382009&r1=1382008&r2=1382009&view=diff
==============================================================================
---
turbine/fulcrum/trunk/security/api/src/java/org/apache/fulcrum/security/PermissionManager.java
(original)
+++
turbine/fulcrum/trunk/security/api/src/java/org/apache/fulcrum/security/PermissionManager.java
Fri Sep 7 13:16:04 2012
@@ -18,7 +18,6 @@ package org.apache.fulcrum.security;
* specific language governing permissions and limitations
* under the License.
*/
-import org.apache.avalon.framework.component.Component;
import org.apache.fulcrum.security.entity.Permission;
import org.apache.fulcrum.security.util.DataBackendException;
import org.apache.fulcrum.security.util.EntityExistsException;
@@ -29,16 +28,16 @@ import org.apache.fulcrum.security.util.
* An GroupManager performs {@link org.apache.fulcrum.security.entity.Group}
* objects related tasks on behalf of the
* {@link org.apache.fulcrum.security.BaseSecurityService}.
- *
+ *
* The responsibilities of this class include loading data of an group from the
* storage and putting them into the
* {@link org.apache.fulcrum.security.entity.Group} objects, saving those data
* to the permanent storage.
- *
+ *
* @author <a href="mailto:[email protected]">Eric Pugh</a>
* @version $Id$
*/
-public interface PermissionManager extends Component
+public interface PermissionManager
{
/** Avalon role - used to id the component within the manager */
@@ -46,34 +45,34 @@ public interface PermissionManager exten
/**
* Construct a blank Permission object.
- *
+ *
* This method calls getPermissionClass, and then creates a new object
using
* the default constructor.
- *
+ *
* @return an object implementing Permission interface.
* @throws UnknownEntityException
* if the object could not be instantiated.
*/
- Permission getPermissionInstance() throws UnknownEntityException;
+ <T extends Permission> T getPermissionInstance() throws
UnknownEntityException;
/**
* Construct a blank Permission object.
- *
+ *
* This method calls getPermissionClass, and then creates a new object
using
* the default constructor.
- *
+ *
* @param permName
* The name of the Permission
- *
+ *
* @return an object implementing Permission interface.
* @throws UnknownEntityException
* if the object could not be instantiated.
*/
- Permission getPermissionInstance(String permName) throws
UnknownEntityException;
+ <T extends Permission> T getPermissionInstance(String permName) throws
UnknownEntityException;
/**
* Retrieve a Permission object with specified name.
- *
+ *
* @param name
* the name of the Permission.
* @return an object representing the Permission with specified name.
@@ -82,26 +81,26 @@ public interface PermissionManager exten
* @throws UnknownEntityException
* if the permission does not exist.
*/
- Permission getPermissionByName(String name) throws DataBackendException,
UnknownEntityException;
+ <T extends Permission> T getPermissionByName(String name) throws
DataBackendException, UnknownEntityException;
/**
* Retrieve a Permission object with specified Id.
- *
+ *
* @param name
* the name of the Permission.
- *
+ *
* @return an object representing the Permission with specified name.
- *
+ *
* @exception UnknownEntityException
* if the permission does not exist in the database.
* @exception DataBackendException
* if there is a problem accessing the storage.
*/
- Permission getPermissionById(Object id) throws DataBackendException,
UnknownEntityException;
+ <T extends Permission> T getPermissionById(Object id) throws
DataBackendException, UnknownEntityException;
/**
* Retrieves all permissions defined in the system.
- *
+ *
* @return the names of all permissions defined in the system.
* @throws DataBackendException
* if there was an error accessing the data backend.
@@ -110,7 +109,7 @@ public interface PermissionManager exten
/**
* Creates a new permission with specified attributes.
- *
+ *
* @param permission
* The object describing the permission to be created.
* @return the new Permission object.
@@ -119,11 +118,11 @@ public interface PermissionManager exten
* @throws EntityExistsException
* if the permission already exists.
*/
- Permission addPermission(Permission permission) throws
DataBackendException, EntityExistsException;
+ <T extends Permission> T addPermission(T permission) throws
DataBackendException, EntityExistsException;
/**
* Removes a Permission from the system.
- *
+ *
* @param permission
* The object describing the permission to be removed.
* @throws DataBackendException
@@ -135,7 +134,7 @@ public interface PermissionManager exten
/**
* Renames an existing Permission.
- *
+ *
* @param permission
* The object describing the permission to be renamed.
* @param name
@@ -149,7 +148,7 @@ public interface PermissionManager exten
/**
* Determines if the <code>Permission</code> exists in the security system.
- *
+ *
* @param permission
* a <code>Permission</code> value
* @return true if the permission exists in the system, false otherwise
@@ -163,7 +162,7 @@ public interface PermissionManager exten
/**
* Determines if a <code>Permission</code> exists in the security system
* with the specified name.
- *
+ *
* @param permissionName
* the name of a <code>Permission</code> to check
* @return true if the permission exists in the system, false otherwise
Modified:
turbine/fulcrum/trunk/security/api/src/java/org/apache/fulcrum/security/RoleManager.java
URL:
http://svn.apache.org/viewvc/turbine/fulcrum/trunk/security/api/src/java/org/apache/fulcrum/security/RoleManager.java?rev=1382009&r1=1382008&r2=1382009&view=diff
==============================================================================
---
turbine/fulcrum/trunk/security/api/src/java/org/apache/fulcrum/security/RoleManager.java
(original)
+++
turbine/fulcrum/trunk/security/api/src/java/org/apache/fulcrum/security/RoleManager.java
Fri Sep 7 13:16:04 2012
@@ -18,7 +18,6 @@ package org.apache.fulcrum.security;
* specific language governing permissions and limitations
* under the License.
*/
-import org.apache.avalon.framework.component.Component;
import org.apache.fulcrum.security.entity.Role;
import org.apache.fulcrum.security.util.DataBackendException;
import org.apache.fulcrum.security.util.EntityExistsException;
@@ -29,50 +28,50 @@ import org.apache.fulcrum.security.util.
* An GroupManager performs {@link org.apache.fulcrum.security.entity.Group}
* objects related tasks on behalf of the
* {@link org.apache.fulcrum.security.BaseSecurityService}.
- *
+ *
* The responsibilities of this class include loading data of an group from the
* storage and putting them into the
* {@link org.apache.fulcrum.security.entity.Group} objects, saving those data
* to the permanent storage.
- *
+ *
* @author <a href="mailto:[email protected]">Eric Pugh</a>
* @version $Id$
*/
-public interface RoleManager extends Component
+public interface RoleManager
{
/** Avalon role - used to id the component within the manager */
String ROLE = RoleManager.class.getName();
/**
* Construct a blank Role object.
- *
+ *
* This method calls getRoleClass, and then creates a new object using the
* default constructor.
- *
+ *
* @return an object implementing Role interface.
* @throws DataBackendException
* if the object could not be instantiated.
*/
- public Role getRoleInstance() throws DataBackendException;
+ <T extends Role> T getRoleInstance() throws DataBackendException;
/**
* Construct a blank Role object.
- *
+ *
* This method calls getRoleClass, and then creates a new object using the
* default constructor.
- *
+ *
* @param roleName
* The name of the Role
- *
+ *
* @return an object implementing Role interface.
* @throws DataBackendException
* if the object could not be instantiated.
*/
- Role getRoleInstance(String roleName) throws DataBackendException;
+ <T extends Role> T getRoleInstance(String roleName) throws
DataBackendException;
/**
* Retrieve a Role object with specified name.
- *
+ *
* @param name
* the name of the Role.
* @return an object representing the Role with specified name.
@@ -81,26 +80,26 @@ public interface RoleManager extends Com
* @throws UnknownEntityException
* if the role does not exist.
*/
- Role getRoleByName(String name) throws DataBackendException,
UnknownEntityException;
+ <T extends Role> T getRoleByName(String name) throws DataBackendException,
UnknownEntityException;
/**
* Retrieve a Role object with specified Id.
- *
+ *
* @param name
* the name of the Role.
- *
+ *
* @return an object representing the Role with specified name.
- *
+ *
* @exception UnknownEntityException
* if the permission does not exist in the database.
* @exception DataBackendException
* if there is a problem accessing the storage.
*/
- Role getRoleById(Object id) throws DataBackendException,
UnknownEntityException;
+ <T extends Role> T getRoleById(Object id) throws DataBackendException,
UnknownEntityException;
/**
* Retrieves all roles defined in the system.
- *
+ *
* @return the names of all roles defined in the system.
* @throws DataBackendException
* if there was an error accessing the data backend.
@@ -109,7 +108,7 @@ public interface RoleManager extends Com
/**
* Creates a new role with specified attributes.
- *
+ *
* @param role
* The object describing the role to be created.
* @return the new Role object.
@@ -118,11 +117,11 @@ public interface RoleManager extends Com
* @throws EntityExistsException
* if the role already exists.
*/
- Role addRole(Role role) throws DataBackendException, EntityExistsException;
+ <T extends Role> T addRole(T role) throws DataBackendException,
EntityExistsException;
/**
* Removes a Role from the system.
- *
+ *
* @param role
* The object describing the role to be removed.
* @throws DataBackendException
@@ -134,7 +133,7 @@ public interface RoleManager extends Com
/**
* Renames an existing Role.
- *
+ *
* @param role
* The object describing the role to be renamed.
* @param name
@@ -148,7 +147,7 @@ public interface RoleManager extends Com
/**
* Determines if the <code>Role</code> exists in the security system.
- *
+ *
* @param role
* a <code>Role</code> value
* @return true if the role exists in the system, false otherwise
@@ -162,7 +161,7 @@ public interface RoleManager extends Com
/**
* Determines if a <code>Role</code> exists in the security system with the
* specified role name.
- *
+ *
* @param roleName
* the name of a <code>Role</code> to check.
* @return true if the role exists in the system, false otherwise
Modified:
turbine/fulcrum/trunk/security/api/src/java/org/apache/fulcrum/security/SecurityService.java
URL:
http://svn.apache.org/viewvc/turbine/fulcrum/trunk/security/api/src/java/org/apache/fulcrum/security/SecurityService.java?rev=1382009&r1=1382008&r2=1382009&view=diff
==============================================================================
---
turbine/fulcrum/trunk/security/api/src/java/org/apache/fulcrum/security/SecurityService.java
(original)
+++
turbine/fulcrum/trunk/security/api/src/java/org/apache/fulcrum/security/SecurityService.java
Fri Sep 7 13:16:04 2012
@@ -18,51 +18,50 @@ package org.apache.fulcrum.security;
* specific language governing permissions and limitations
* under the License.
*/
-import org.apache.avalon.framework.component.Component;
/**
* The Security Service manages Users, Groups Roles and Permissions in the
* system.
- *
+ *
* The task performed by the security service include providing access to the
* various types of managers.
- *
+ *
* <p>
* Because of pluggable nature of the Services, it is possible to create
* multiple implementations of SecurityService, for example employing database
* and directory server as the data backend. <br>
- *
+ *
* @author <a href="mailto:[email protected]">Eric Pugh</a>
* @version $Id$
*/
-public interface SecurityService extends Component
+public interface SecurityService
{
String ROLE = SecurityService.class.getName();
/**
* Returns the configured UserManager.
- *
+ *
* @return An UserManager object
*/
UserManager getUserManager();
/**
* Returns the configured GroupManager.
- *
+ *
* @return An UserManager object
*/
GroupManager getGroupManager();
/**
* Returns the configured RoleManager.
- *
+ *
* @return An RoleManager object
*/
RoleManager getRoleManager();
/**
* Returns the configured PermissionManager.
- *
+ *
* @return An PermissionManager object
*/
PermissionManager getPermissionManager();
@@ -70,7 +69,7 @@ public interface SecurityService extends
/**
* Returns the configured ModelManager object that can then be casted to
the
* specific model.
- *
+ *
* @return An ModelManager object
*/
ModelManager getModelManager();
Modified:
turbine/fulcrum/trunk/security/api/src/java/org/apache/fulcrum/security/UserManager.java
URL:
http://svn.apache.org/viewvc/turbine/fulcrum/trunk/security/api/src/java/org/apache/fulcrum/security/UserManager.java?rev=1382009&r1=1382008&r2=1382009&view=diff
==============================================================================
---
turbine/fulcrum/trunk/security/api/src/java/org/apache/fulcrum/security/UserManager.java
(original)
+++
turbine/fulcrum/trunk/security/api/src/java/org/apache/fulcrum/security/UserManager.java
Fri Sep 7 13:16:04 2012
@@ -18,7 +18,6 @@ package org.apache.fulcrum.security;
* specific language governing permissions and limitations
* under the License.
*/
-import org.apache.avalon.framework.component.Component;
import org.apache.fulcrum.security.acl.AccessControlList;
import org.apache.fulcrum.security.entity.User;
import org.apache.fulcrum.security.util.DataBackendException;
@@ -31,51 +30,51 @@ import org.apache.fulcrum.security.util.
* An UserManager performs {@link org.apache.fulcrum.security.entity.User}
* objects related tasks on behalf of the
* {@link org.apache.fulcrum.security.BaseSecurityService}.
- *
+ *
* The responsibilities of this class include loading data of an user from the
* storage and putting them into the
* {@link org.apache.fulcrum.security.entity.User} objects, saving those data
to
* the permanent storage, and authenticating users.
- *
+ *
* @author <a href="mailto:[email protected]">Eric Pugh</a>
* @author <a href="mailto:[email protected]">Rafal Krzewski</a>
* @version $Id$
*/
-public interface UserManager extends Component
+public interface UserManager
{
/** Avalon role - used to id the component within the manager */
String ROLE = UserManager.class.getName();
/**
* Construct a blank User object.
- *
+ *
* This method calls getUserClass, and then creates a new object using the
* default constructor.
- *
+ *
* @return an object implementing User interface.
* @throws DataBackendException
* if the object could not be instantiated.
*/
- User getUserInstance() throws DataBackendException;
+ <T extends User> T getUserInstance() throws DataBackendException;
/**
* Construct a blank User object.
- *
+ *
* This method calls getUserClass, and then creates a new object using the
* default constructor.
- *
+ *
* @param userName
* The name of the user.
- *
+ *
* @return an object implementing User interface.
* @throws DataBackendException
* if the object could not be instantiated.
*/
- User getUserInstance(String userName) throws DataBackendException;
+ <T extends User> T getUserInstance(String userName) throws
DataBackendException;
/**
* Determines if the <code>User</code> exists in the security system.
- *
+ *
* @param role
* a <code>User</code> value
* @return true if the user exists in the system, false otherwise
@@ -88,9 +87,9 @@ public interface UserManager extends Com
/**
* Check whether a specified user's account exists.
- *
+ *
* The login name is used for looking up the account.
- *
+ *
* @param userName
* The name of the user to be checked.
* @return true if the specified account exists
@@ -101,7 +100,7 @@ public interface UserManager extends Com
/**
* Retrieve a user from persistent storage using username as the key.
- *
+ *
* @param username
* the name of the user.
* @return an User object.
@@ -110,11 +109,11 @@ public interface UserManager extends Com
* @exception DataBackendException
* if there is a problem accessing the storage.
*/
- User getUser(String username) throws UnknownEntityException,
DataBackendException;
+ <T extends User> T getUser(String username) throws UnknownEntityException,
DataBackendException;
/**
* Retrieve a user from persistent storage using the id as the key.
- *
+ *
* @param id
* the id of the user.
* @return an User object.
@@ -123,13 +122,13 @@ public interface UserManager extends Com
* @exception DataBackendException
* if there is a problem accessing the storage.
*/
- User getUserById(Object id) throws UnknownEntityException,
DataBackendException;
+ <T extends User> T getUserById(Object id) throws UnknownEntityException,
DataBackendException;
/**
* Retrieve a user from persistent storage using username as the key, and
* authenticate the user. The implementation may chose to authenticate to
* the server as the user whose data is being retrieved.
- *
+ *
* @param username
* the name of the user.
* @param password
@@ -142,11 +141,11 @@ public interface UserManager extends Com
* @exception DataBackendException
* if there is a problem accessing the storage.
*/
- User getUser(String username, String password) throws
PasswordMismatchException, UnknownEntityException, DataBackendException;
+ <T extends User> T getUser(String username, String password) throws
PasswordMismatchException, UnknownEntityException, DataBackendException;
/**
* Retrieves all users defined in the system.
- *
+ *
* @return the names of all users defined in the system.
* @throws DataBackendException
* if there was an error accessing the data backend.
@@ -156,7 +155,7 @@ public interface UserManager extends Com
/**
* Saves User's data in the permanent storage. The user account is required
* to exist in the storage.
- *
+ *
* @param user
* the user object to save
* @throws UnknownEntityException
@@ -170,7 +169,7 @@ public interface UserManager extends Com
* Authenticate an User with the specified password. If authentication is
* successful the method returns nothing. If there are any problems,
* exception was thrown.
- *
+ *
* @param user
* an User object to authenticate.
* @param password
@@ -186,22 +185,22 @@ public interface UserManager extends Com
/**
* Creates new user account with specified attributes.
- *
+ *
* @param user
* the object describing account to be created.
* @param password
* The password to use for the object creation
- *
+ *
* @throws DataBackendException
* if there was an error accessing the data backend.
* @throws EntityExistsException
* if the user account already exists.
*/
- public User addUser(User user, String password) throws
EntityExistsException, DataBackendException;
+ <T extends User> T addUser(T user, String password) throws
EntityExistsException, DataBackendException;
/**
* Removes an user account from the system.
- *
+ *
* @param user
* the object describing the account to be removed.
* @throws DataBackendException
@@ -213,7 +212,7 @@ public interface UserManager extends Com
/**
* Change the password for an User.
- *
+ *
* @param user
* an User to change password for.
* @param oldPassword
@@ -232,12 +231,12 @@ public interface UserManager extends Com
/**
* Forcibly sets new password for an User.
- *
+ *
* This is supposed by the administrator to change the forgotten or
* compromised passwords. Certain implementatations of this feature would
* require administrative level access to the authenticating server /
* program.
- *
+ *
* @param user
* an User to change password for.
* @param password
@@ -252,12 +251,11 @@ public interface UserManager extends Com
/**
* Return a Class object representing the system's chosen implementation of
* of ACL interface.
- *
+ *
* @return systems's chosen implementation of ACL interface.
* @throws UnknownEntityException
* if the implementation of ACL interface could not be
* determined, or does not exist.
*/
- public AccessControlList getACL(User user) throws UnknownEntityException;
-
+ <T extends AccessControlList> T getACL(User user) throws
UnknownEntityException;
}
Modified:
turbine/fulcrum/trunk/security/api/src/java/org/apache/fulcrum/security/model/ACLFactory.java
URL:
http://svn.apache.org/viewvc/turbine/fulcrum/trunk/security/api/src/java/org/apache/fulcrum/security/model/ACLFactory.java?rev=1382009&r1=1382008&r2=1382009&view=diff
==============================================================================
---
turbine/fulcrum/trunk/security/api/src/java/org/apache/fulcrum/security/model/ACLFactory.java
(original)
+++
turbine/fulcrum/trunk/security/api/src/java/org/apache/fulcrum/security/model/ACLFactory.java
Fri Sep 7 13:16:04 2012
@@ -24,7 +24,7 @@ import org.apache.fulcrum.security.entit
/**
* This interface describes a factory for creating AccessControlList objects.
- *
+ *
* @author <a href="mailto:[email protected]">Eric Pugh</a>
* @author <a href="mailto:[email protected]">Brett McLaughlin</a>
* @author <a href="mailto:[email protected]">Greg Ritter</a>
@@ -34,10 +34,8 @@ import org.apache.fulcrum.security.entit
* @version $Id$
*/
public interface ACLFactory
-
{
- public static final String ROLE = ACLFactory.class.getName();
-
- public AccessControlList getAccessControlList(User user);
+ String ROLE = ACLFactory.class.getName();
+ <T extends AccessControlList> T getAccessControlList(User user);
}
Modified:
turbine/fulcrum/trunk/security/api/src/java/org/apache/fulcrum/security/model/turbine/TurbineUserManager.java
URL:
http://svn.apache.org/viewvc/turbine/fulcrum/trunk/security/api/src/java/org/apache/fulcrum/security/model/turbine/TurbineUserManager.java?rev=1382009&r1=1382008&r2=1382009&view=diff
==============================================================================
---
turbine/fulcrum/trunk/security/api/src/java/org/apache/fulcrum/security/model/turbine/TurbineUserManager.java
(original)
+++
turbine/fulcrum/trunk/security/api/src/java/org/apache/fulcrum/security/model/turbine/TurbineUserManager.java
Fri Sep 7 13:16:04 2012
@@ -24,7 +24,7 @@ import org.apache.fulcrum.security.util.
/**
* This interface describes the methods that glue the "turbine" model together.
- *
+ *
* @author <a href="mailto:[email protected]">Eric Pugh</a>
* @version $Id$
*/
@@ -33,23 +33,22 @@ public interface TurbineUserManager exte
/**
* Constructs an User object to represent an anonymous user of the
* application.
- *
+ *
* @return An anonymous Turbine User.
* @throws UnknownEntityException
* if the anonymous User object couldn't be constructed.
*/
- User getAnonymousUser() throws UnknownEntityException;
+ <T extends User> T getAnonymousUser() throws UnknownEntityException;
/**
* Checks whether a passed user object matches the anonymous user pattern
* according to the configured user manager
- *
+ *
* @param An
* user object
- *
+ *
* @return True if this is an anonymous user
- *
+ *
*/
boolean isAnonymousUser(User u);
-
}
Modified:
turbine/fulcrum/trunk/security/api/src/java/org/apache/fulcrum/security/spi/AbstractUserManager.java
URL:
http://svn.apache.org/viewvc/turbine/fulcrum/trunk/security/api/src/java/org/apache/fulcrum/security/spi/AbstractUserManager.java?rev=1382009&r1=1382008&r2=1382009&view=diff
==============================================================================
---
turbine/fulcrum/trunk/security/api/src/java/org/apache/fulcrum/security/spi/AbstractUserManager.java
(original)
+++
turbine/fulcrum/trunk/security/api/src/java/org/apache/fulcrum/security/spi/AbstractUserManager.java
Fri Sep 7 13:16:04 2012
@@ -32,28 +32,28 @@ import org.apache.fulcrum.security.util.
/**
* This implementation keeps all objects in memory. This is mostly meant to
help
* with testing and prototyping of ideas.
- *
+ *
* @todo Need to load up Crypto component and actually encrypt passwords!
* @author <a href="mailto:[email protected]">Eric Pugh</a>
* @version $Id$
*/
public abstract class AbstractUserManager extends AbstractEntityManager
implements UserManager
{
- protected abstract User persistNewUser(User user) throws
DataBackendException;
+ protected abstract <T extends User> T persistNewUser(T user) throws
DataBackendException;
private ACLFactory aclFactory;
private Authenticator authenticator;
- public AccessControlList getACL(User user) throws UnknownEntityException
+ public <T extends AccessControlList> T getACL(User user) throws
UnknownEntityException
{
return getACLFactory().getAccessControlList(user);
}
/**
* Check whether a specified user's account exists.
- *
+ *
* The login name is used for looking up the account.
- *
+ *
* @param user
* The user to be checked.
* @return true if the specified account exists
@@ -69,7 +69,7 @@ public abstract class AbstractUserManage
* Retrieve a user from persistent storage using username as the key, and
* authenticate the user. The implementation may chose to authenticate to
* the server as the user whose data is being retrieved.
- *
+ *
* @param userName
* the name of the user.
* @param password
@@ -82,16 +82,17 @@ public abstract class AbstractUserManage
* @exception DataBackendException
* if there is a problem accessing the storage.
*/
- public User getUser(String userName, String password) throws
PasswordMismatchException, UnknownEntityException, DataBackendException
+ public <T extends User> T getUser(String userName, String password) throws
PasswordMismatchException, UnknownEntityException, DataBackendException
{
- User user = getUser(userName);
+ T user = getUser(userName);
authenticate(user, password);
return user;
}
- public User getUser(String name) throws DataBackendException,
UnknownEntityException
+ public <T extends User> T getUser(String name) throws
DataBackendException, UnknownEntityException
{
- User user = getAllUsers().getByName(name);
+ @SuppressWarnings("unchecked")
+ T user = (T)getAllUsers().getByName(name);
if (user == null)
{
throw new UnknownEntityException("The specified user does not
exist");
@@ -101,20 +102,21 @@ public abstract class AbstractUserManage
/**
* Retrieve a User object with specified Id.
- *
+ *
* @param id
* the id of the User.
- *
+ *
* @return an object representing the User with specified id.
- *
+ *
* @throws UnknownEntityException
* if the user does not exist in the database.
* @throws DataBackendException
* if there is a problem accessing the storage.
*/
- public User getUserById(Object id) throws DataBackendException,
UnknownEntityException
+ public <T extends User> T getUserById(Object id) throws
DataBackendException, UnknownEntityException
{
- User user = getAllUsers().getById(id);
+ @SuppressWarnings("unchecked")
+ T user = (T)getAllUsers().getById(id);
if (user == null)
{
throw new UnknownEntityException("The specified user does not
exist");
@@ -126,7 +128,7 @@ public abstract class AbstractUserManage
* Authenticate an User with the specified password. If authentication is
* successful the method returns nothing. If there are any problems,
* exception was thrown.
- *
+ *
* @param user
* an User object to authenticate.
* @param password
@@ -154,7 +156,7 @@ public abstract class AbstractUserManage
/**
* Change the password for an User. The user must have supplied the old
* password to allow the change.
- *
+ *
* @param user
* an User to change password for.
* @param oldPassword
@@ -188,12 +190,12 @@ public abstract class AbstractUserManage
/**
* Forcibly sets new password for an User.
- *
+ *
* This is supposed by the administrator to change the forgotten or
* compromised passwords. Certain implementatations of this feature would
* require administrative level access to the authenticating server /
* program.
- *
+ *
* @param user
* an User to change password for.
* @param password
@@ -218,65 +220,63 @@ public abstract class AbstractUserManage
/**
* Construct a blank User object.
- *
+ *
* This method calls getUserClass, and then creates a new object using the
* default constructor.
- *
+ *
* @return an object implementing User interface.
* @throws DataBackendException
* if the object could not be instantiated.
*/
- public User getUserInstance() throws DataBackendException
+ public <T extends User> T getUserInstance() throws DataBackendException
{
- User user;
-
try
{
- user = (User) Class.forName(getClassName()).newInstance();
+ @SuppressWarnings("unchecked")
+ T user = (T)
Class.forName(getClassName()).newInstance();
+ return user;
}
catch (Exception e)
{
throw new DataBackendException("Problem creating instance of class
" + getClassName(), e);
}
-
- return user;
}
/**
* Construct a blank User object.
- *
+ *
* This method calls getUserClass, and then creates a new object using the
* default constructor.
- *
+ *
* @param userName
* The name of the user.
- *
+ *
* @return an object implementing User interface.
- *
+ *
* @throws DataBackendException
* if the object could not be instantiated.
*/
- public User getUserInstance(String userName) throws DataBackendException
+ public <T extends User> T getUserInstance(String userName) throws
DataBackendException
{
- User user = getUserInstance();
+ T user = getUserInstance();
user.setName(userName);
return user;
}
/**
* Creates new user account with specified attributes.
- *
+ *
* @param user
* the object describing account to be created.
* @param password
* The password to use for the account.
- *
+ *
* @throws DataBackendException
* if there was an error accessing the data backend.
* @throws EntityExistsException
* if the user account already exists.
*/
- public User addUser(User user, String password) throws
DataBackendException, EntityExistsException
+ public <T extends User> T addUser(T user, String password) throws
DataBackendException, EntityExistsException
{
if (StringUtils.isEmpty(user.getName()))
{