From f0b5140e1a7eb089b25aec93b62d786678847a56 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Fri, 23 Nov 2012 18:32:55 +0000 Subject: [PATCH] return real bean id and add a flag to say if users can choose this implementation or not git-svn-id: https://svn.apache.org/repos/asf/archiva/redback/redback-core/trunk@1413018 13f79535-47bb-0310-9956-ffa450edef68 --- .../redback/users/AbstractUserManager.java | 5 +++++ .../archiva/redback/users/UserManager.java | 6 ++++++ .../users/cached/CachedUserManager.java | 7 ++++++- .../configurable/ConfigurableUserManager.java | 2 +- .../redback/users/jdo/JdoUserManager.java | 7 ++++++- .../redback/users/ldap/LdapUserManager.java | 6 +++++- .../users/memory/MemoryUserManager.java | 20 +------------------ 7 files changed, 30 insertions(+), 23 deletions(-) diff --git a/redback-users/redback-users-api/src/main/java/org/apache/archiva/redback/users/AbstractUserManager.java b/redback-users/redback-users-api/src/main/java/org/apache/archiva/redback/users/AbstractUserManager.java index a093b273..7ba96af2 100644 --- a/redback-users/redback-users-api/src/main/java/org/apache/archiva/redback/users/AbstractUserManager.java +++ b/redback-users/redback-users-api/src/main/java/org/apache/archiva/redback/users/AbstractUserManager.java @@ -147,4 +147,9 @@ public abstract class AbstractUserManager // no op prevent sub classes to need implement this method // sub classes can implement their own } + + public boolean isFinalImplementation() + { + return false; + } } diff --git a/redback-users/redback-users-api/src/main/java/org/apache/archiva/redback/users/UserManager.java b/redback-users/redback-users-api/src/main/java/org/apache/archiva/redback/users/UserManager.java index e8afaf06..054a09e6 100644 --- a/redback-users/redback-users-api/src/main/java/org/apache/archiva/redback/users/UserManager.java +++ b/redback-users/redback-users-api/src/main/java/org/apache/archiva/redback/users/UserManager.java @@ -206,4 +206,10 @@ public interface UserManager * @since 2.1 */ void initialize(); + + /** + * @since 2.1 + * @return true if this implementation is a final one and not a wrapper (configurable, cached) + */ + boolean isFinalImplementation(); } diff --git a/redback-users/redback-users-providers/redback-users-cached/src/main/java/org/apache/archiva/redback/users/cached/CachedUserManager.java b/redback-users/redback-users-providers/redback-users-cached/src/main/java/org/apache/archiva/redback/users/cached/CachedUserManager.java index 7c4d4c4f..890841a6 100644 --- a/redback-users/redback-users-providers/redback-users-cached/src/main/java/org/apache/archiva/redback/users/cached/CachedUserManager.java +++ b/redback-users/redback-users-providers/redback-users-cached/src/main/java/org/apache/archiva/redback/users/cached/CachedUserManager.java @@ -204,7 +204,7 @@ public class CachedUserManager public String getId() { - return "Cached User Manager [" + this.userImpl.getId() + "]"; + return "cached"; } public List getUsers() @@ -323,4 +323,9 @@ public class CachedUserManager { // no op configurable impl do the job } + + public boolean isFinalImplementation() + { + return false; + } } diff --git a/redback-users/redback-users-providers/redback-users-configurable/src/main/java/org/apache/archiva/redback/users/configurable/ConfigurableUserManager.java b/redback-users/redback-users-providers/redback-users-configurable/src/main/java/org/apache/archiva/redback/users/configurable/ConfigurableUserManager.java index 5d1fb868..54851a89 100644 --- a/redback-users/redback-users-providers/redback-users-configurable/src/main/java/org/apache/archiva/redback/users/configurable/ConfigurableUserManager.java +++ b/redback-users/redback-users-providers/redback-users-configurable/src/main/java/org/apache/archiva/redback/users/configurable/ConfigurableUserManager.java @@ -143,7 +143,7 @@ public class ConfigurableUserManager public String getId() { - return ConfigurableUserManager.class.getName() + " wrapping " + userManagerImpl.getId(); + return "configurable"; } public List getUsers() diff --git a/redback-users/redback-users-providers/redback-users-jdo/src/main/java/org/apache/archiva/redback/users/jdo/JdoUserManager.java b/redback-users/redback-users-providers/redback-users-jdo/src/main/java/org/apache/archiva/redback/users/jdo/JdoUserManager.java index c5513921..a334b4d6 100644 --- a/redback-users/redback-users-providers/redback-users-jdo/src/main/java/org/apache/archiva/redback/users/jdo/JdoUserManager.java +++ b/redback-users/redback-users-providers/redback-users-jdo/src/main/java/org/apache/archiva/redback/users/jdo/JdoUserManager.java @@ -65,7 +65,7 @@ public class JdoUserManager public String getId() { - return "JDO UserManager - " + this.getClass().getName(); + return "jdo"; } @@ -485,4 +485,9 @@ public class JdoUserManager { return userSecurityPolicy; } + + public boolean isFinalImplementation() + { + return true; + } } diff --git a/redback-users/redback-users-providers/redback-users-ldap/src/main/java/org/apache/archiva/redback/users/ldap/LdapUserManager.java b/redback-users/redback-users-providers/redback-users-ldap/src/main/java/org/apache/archiva/redback/users/ldap/LdapUserManager.java index 8b58508c..8bbd23f5 100644 --- a/redback-users/redback-users-providers/redback-users-ldap/src/main/java/org/apache/archiva/redback/users/ldap/LdapUserManager.java +++ b/redback-users/redback-users-providers/redback-users-ldap/src/main/java/org/apache/archiva/redback/users/ldap/LdapUserManager.java @@ -358,7 +358,7 @@ public class LdapUserManager public String getId() { - return "LDAP User-Manager: " + getClass().getName(); + return "ldap"; } /** @@ -501,4 +501,8 @@ public class LdapUserManager ldapCacheService.removeLdapUserDn( username ); } + public boolean isFinalImplementation() + { + return true; + } } diff --git a/redback-users/redback-users-providers/redback-users-memory/src/main/java/org/apache/archiva/redback/users/memory/MemoryUserManager.java b/redback-users/redback-users-providers/redback-users-memory/src/main/java/org/apache/archiva/redback/users/memory/MemoryUserManager.java index ca7e4a55..3bf7d6ea 100644 --- a/redback-users/redback-users-providers/redback-users-memory/src/main/java/org/apache/archiva/redback/users/memory/MemoryUserManager.java +++ b/redback-users/redback-users-providers/redback-users-memory/src/main/java/org/apache/archiva/redback/users/memory/MemoryUserManager.java @@ -55,25 +55,7 @@ public class MemoryUserManager public String getId() { - Properties props = new Properties(); - URL url = this - .getClass() - .getResource( - "META-INF/maven/org/codehaus/plexus/redback/redback-users-memory/pom.properties" ); - - if ( url != null ) - { - try - { - props.load( url.openStream() ); - return "MemoryUserManager - " + props.getProperty( "version" ); - } - catch ( IOException e ) - { - // Fall thru - } - } - return "MemoryUserManager - (unknown version)"; + return "memory"; } public boolean isReadOnly()