You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@turbine.apache.org by tv...@apache.org on 2012/09/10 11:17:25 UTC
svn commit: r1382712 - in
/turbine/fulcrum/trunk/security/memory/src/java/org/apache/fulcrum/security/memory:
./ turbine/
Author: tv
Date: Mon Sep 10 09:17:24 2012
New Revision: 1382712
URL: http://svn.apache.org/viewvc?rev=1382712&view=rev
Log:
Fix generic return types
Modified:
turbine/fulcrum/trunk/security/memory/src/java/org/apache/fulcrum/security/memory/MemoryGroupManagerImpl.java
turbine/fulcrum/trunk/security/memory/src/java/org/apache/fulcrum/security/memory/MemoryPermissionManagerImpl.java
turbine/fulcrum/trunk/security/memory/src/java/org/apache/fulcrum/security/memory/MemoryRoleManagerImpl.java
turbine/fulcrum/trunk/security/memory/src/java/org/apache/fulcrum/security/memory/MemoryUserManagerImpl.java
turbine/fulcrum/trunk/security/memory/src/java/org/apache/fulcrum/security/memory/turbine/MemoryTurbineUserManagerImpl.java
Modified: turbine/fulcrum/trunk/security/memory/src/java/org/apache/fulcrum/security/memory/MemoryGroupManagerImpl.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/security/memory/src/java/org/apache/fulcrum/security/memory/MemoryGroupManagerImpl.java?rev=1382712&r1=1382711&r2=1382712&view=diff
==============================================================================
--- turbine/fulcrum/trunk/security/memory/src/java/org/apache/fulcrum/security/memory/MemoryGroupManagerImpl.java (original)
+++ turbine/fulcrum/trunk/security/memory/src/java/org/apache/fulcrum/security/memory/MemoryGroupManagerImpl.java Mon Sep 10 09:17:24 2012
@@ -32,7 +32,7 @@ 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.
- *
+ *
* @author <a href="mailto:epugh@upstate.com">Eric Pugh</a>
* @version $Id$
*/
@@ -45,7 +45,7 @@ public class MemoryGroupManagerImpl exte
/**
* 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.
@@ -57,7 +57,7 @@ public class MemoryGroupManagerImpl exte
/**
* Removes a Group from the system.
- *
+ *
* @param group
* The object describing the group to be removed.
* @throws DataBackendException
@@ -90,7 +90,7 @@ public class MemoryGroupManagerImpl exte
/**
* Renames an existing Group.
- *
+ *
* @param group
* The object describing the group to be renamed.
* @param name
@@ -125,7 +125,7 @@ public class MemoryGroupManagerImpl exte
/**
* Determines if the <code>Group</code> exists in the security system.
- *
+ *
* @param group
* a <code>Group</code> value
* @return true if the group exists in the system, false otherwise
@@ -141,7 +141,7 @@ public class MemoryGroupManagerImpl exte
/**
* Creates a new group with specified attributes.
- *
+ *
* @param group
* the object describing the group to be created.
* @return a new Group object that has id set up properly.
@@ -151,9 +151,8 @@ public class MemoryGroupManagerImpl exte
* if the group already exists.
*/
@Override
- public synchronized Group persistNewGroup(Group group) throws DataBackendException
+ protected synchronized <T extends Group> T persistNewGroup(T group) throws DataBackendException
{
-
group.setId(MemoryHelper.getUniqueId());
groups.add(group);
// return the object with correct id
Modified: turbine/fulcrum/trunk/security/memory/src/java/org/apache/fulcrum/security/memory/MemoryPermissionManagerImpl.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/security/memory/src/java/org/apache/fulcrum/security/memory/MemoryPermissionManagerImpl.java?rev=1382712&r1=1382711&r2=1382712&view=diff
==============================================================================
--- turbine/fulcrum/trunk/security/memory/src/java/org/apache/fulcrum/security/memory/MemoryPermissionManagerImpl.java (original)
+++ turbine/fulcrum/trunk/security/memory/src/java/org/apache/fulcrum/security/memory/MemoryPermissionManagerImpl.java Mon Sep 10 09:17:24 2012
@@ -31,7 +31,7 @@ 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.
- *
+ *
* @author <a href="mailto:epugh@upstate.com">Eric Pugh</a>
* @version $Id: MemoryPermissionManagerImpl.java 1374008 2012-08-16 19:42:18Z
* tv $
@@ -45,7 +45,7 @@ public class MemoryPermissionManagerImpl
/**
* 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.
@@ -57,7 +57,7 @@ public class MemoryPermissionManagerImpl
/**
* Renames an existing Permission.
- *
+ *
* @param permission
* The object describing the permission to be renamed.
* @param name
@@ -91,7 +91,7 @@ public class MemoryPermissionManagerImpl
/**
* Determines if the <code>Permission</code> exists in the security system.
- *
+ *
* @param permission
* a <code>String</code> value
* @return true if the permission exists in the system, false otherwise
@@ -107,7 +107,7 @@ public class MemoryPermissionManagerImpl
/**
* Removes a Permission from the system.
- *
+ *
* @param permission
* The object describing the permission to be removed.
* @throws DataBackendException
@@ -137,7 +137,7 @@ public class MemoryPermissionManagerImpl
/**
* Creates a new permission with specified attributes.
- *
+ *
* @param permission
* the object describing the permission to be created.
* @return a new Permission object that has id set up properly.
@@ -147,7 +147,7 @@ public class MemoryPermissionManagerImpl
* if the permission already exists.
*/
@Override
- protected synchronized Permission persistNewPermission(Permission permission) throws DataBackendException
+ protected synchronized <T extends Permission> T persistNewPermission(T permission) throws DataBackendException
{
permission.setId(MemoryHelper.getUniqueId());
permissions.add(permission);
Modified: turbine/fulcrum/trunk/security/memory/src/java/org/apache/fulcrum/security/memory/MemoryRoleManagerImpl.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/security/memory/src/java/org/apache/fulcrum/security/memory/MemoryRoleManagerImpl.java?rev=1382712&r1=1382711&r2=1382712&view=diff
==============================================================================
--- turbine/fulcrum/trunk/security/memory/src/java/org/apache/fulcrum/security/memory/MemoryRoleManagerImpl.java (original)
+++ turbine/fulcrum/trunk/security/memory/src/java/org/apache/fulcrum/security/memory/MemoryRoleManagerImpl.java Mon Sep 10 09:17:24 2012
@@ -29,10 +29,10 @@ import org.apache.fulcrum.security.util.
import org.apache.fulcrum.security.util.UnknownEntityException;
/**
- *
+ *
* This implementation keeps all objects in memory. This is mostly meant to help
* with testing and prototyping of ideas.
- *
+ *
* @author <a href="mailto:epugh@upstate.com">Eric Pugh</a>
* @version $Id$
*/
@@ -46,7 +46,7 @@ public class MemoryRoleManagerImpl exten
/**
* Renames an existing Role.
- *
+ *
* @param role
* The object describing the role to be renamed.
* @param name
@@ -80,7 +80,7 @@ public class MemoryRoleManagerImpl exten
/**
* Determines if the <code>Role</code> exists in the security system.
- *
+ *
* @param permission
* a <code>String</code> value
* @return true if the role exists in the system, false otherwise
@@ -96,7 +96,7 @@ public class MemoryRoleManagerImpl exten
/**
* 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.
@@ -108,7 +108,7 @@ public class MemoryRoleManagerImpl exten
/**
* Creates a new role with specified attributes.
- *
+ *
* @param role
* the object describing the role to be created.
* @return a new Role object that has id set up properly.
@@ -118,7 +118,7 @@ public class MemoryRoleManagerImpl exten
* if the role already exists.
*/
@Override
- protected synchronized Role persistNewRole(Role role) throws DataBackendException
+ protected synchronized <T extends Role> T persistNewRole(T role) throws DataBackendException
{
role.setId(MemoryHelper.getUniqueId());
roles.add(role);
@@ -130,7 +130,7 @@ public class MemoryRoleManagerImpl exten
/**
* Removes a Role from the system.
- *
+ *
* @param role
* The object describing the role to be removed.
* @throws DataBackendException
Modified: turbine/fulcrum/trunk/security/memory/src/java/org/apache/fulcrum/security/memory/MemoryUserManagerImpl.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/security/memory/src/java/org/apache/fulcrum/security/memory/MemoryUserManagerImpl.java?rev=1382712&r1=1382711&r2=1382712&view=diff
==============================================================================
--- turbine/fulcrum/trunk/security/memory/src/java/org/apache/fulcrum/security/memory/MemoryUserManagerImpl.java (original)
+++ turbine/fulcrum/trunk/security/memory/src/java/org/apache/fulcrum/security/memory/MemoryUserManagerImpl.java Mon Sep 10 09:17:24 2012
@@ -31,7 +31,7 @@ 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:epugh@upstate.com">Eric Pugh</a>
* @version $Id$
@@ -45,9 +45,9 @@ public class MemoryUserManagerImpl exten
/**
* 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
@@ -62,7 +62,7 @@ public class MemoryUserManagerImpl exten
/**
* 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.
@@ -74,7 +74,7 @@ public class MemoryUserManagerImpl exten
/**
* Removes an user account from the system.
- *
+ *
* @param user
* the object describing the account to be removed.
* @throws DataBackendException
@@ -89,31 +89,29 @@ public class MemoryUserManagerImpl exten
/**
* 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.
*/
@Override
- protected User persistNewUser(User user) throws DataBackendException
+ protected <T extends User> T persistNewUser(T user) throws DataBackendException
{
-
users.remove(user);
user.setId(MemoryHelper.getUniqueId());
users.add(user);
return user;
-
}
/**
* Stores User attributes. The User is required to exist in the system.
- *
+ *
* @param role
* The User to be stored.
* @throws DataBackendException
Modified: turbine/fulcrum/trunk/security/memory/src/java/org/apache/fulcrum/security/memory/turbine/MemoryTurbineUserManagerImpl.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/security/memory/src/java/org/apache/fulcrum/security/memory/turbine/MemoryTurbineUserManagerImpl.java?rev=1382712&r1=1382711&r2=1382712&view=diff
==============================================================================
--- turbine/fulcrum/trunk/security/memory/src/java/org/apache/fulcrum/security/memory/turbine/MemoryTurbineUserManagerImpl.java (original)
+++ turbine/fulcrum/trunk/security/memory/src/java/org/apache/fulcrum/security/memory/turbine/MemoryTurbineUserManagerImpl.java Mon Sep 10 09:17:24 2012
@@ -28,7 +28,7 @@ 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:epugh@upstate.com">Eric Pugh</a>
* @version $Id: MemoryTurbineUserManagerImpl.java 535465 2007-05-05 06:58:06Z
@@ -39,23 +39,24 @@ public class MemoryTurbineUserManagerImp
/**
* Constructs an User object to represent an anonymous user of the
* application.
- *
+ *
* @return An anonymous Turbine User.
* @throws UnknownEntityException
* if the implementation of User interface could not be
* determined, or does not exist.
*/
- public User getAnonymousUser() throws UnknownEntityException
+ public <T extends User> T getAnonymousUser() throws UnknownEntityException
{
- User user;
+ T user;
try
{
user = getUserInstance();
}
catch (DataBackendException dbe)
{
- throw new UnknownEntityException("Coudl not create an anonymous user.", dbe);
+ throw new UnknownEntityException("Could not create an anonymous user.", dbe);
}
+
user.setName("");
return user;
}
@@ -63,12 +64,12 @@ public class MemoryTurbineUserManagerImp
/**
* Checks whether a passed user object matches the anonymous user pattern
* according to the configured user manager
- *
+ *
* @param user
* An user object
- *
+ *
* @return True if this is an anonymous user
- *
+ *
*/
public boolean isAnonymousUser(User user)
{