From 5c0d601c8fd204611485d7d2e69666157499d8ad Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Fri, 23 Nov 2012 10:10:28 +0000 Subject: [PATCH] [MRM-1714] using LDAP can be configurable with the ui. prepare redback git-svn-id: https://svn.apache.org/repos/asf/archiva/redback/redback-core/trunk@1412808 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/archiva/redback/users/AbstractUserManager.java | 8 ++++++++ .../org/apache/archiva/redback/users/UserManager.java | 8 ++++++++ .../archiva/redback/users/cached/CachedUserManager.java | 5 +++++ .../users/configurable/ConfigurableUserManager.java | 1 + .../archiva/redback/users/ldap/LdapUserManager.java | 2 ++ 5 files changed, 24 insertions(+) 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 49b6fd0a2..a093b273a 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 @@ -25,6 +25,8 @@ import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import javax.annotation.PostConstruct; + /** * AbstractUserManager * @@ -139,4 +141,10 @@ public abstract class AbstractUserManager user = addUser( user ); return user; } + + public void initialize() + { + // no op prevent sub classes to need implement this method + // sub classes can implement their own + } } 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 4c198c783..e8afaf064 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 @@ -198,4 +198,12 @@ public interface UserManager User updateUser( User user, boolean passwordChangeRequired ) throws UserNotFoundException; + + + /** + * consumer of user manager can use it to reload various configuration + * with the configurable implementation is possible to change dynamically the real implementation used. + * @since 2.1 + */ + void initialize(); } 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 b2be9a240..7c4d4c4f6 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 @@ -318,4 +318,9 @@ public class CachedUserManager { this.usersCache = usersCache; } + + public void initialize() + { + // no op configurable impl do the job + } } 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 9805d2da8..effd8d384 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 @@ -37,6 +37,7 @@ import java.util.List; @Service( "userManager#configurable" ) public class ConfigurableUserManager extends AbstractUserManager + implements UserManager { @Inject @Named( value = "userConfiguration" ) 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 7581eef67..8b58508c7 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 @@ -24,6 +24,7 @@ import org.apache.archiva.redback.common.ldap.LdapUser; import org.apache.archiva.redback.common.ldap.UserMapper; import org.apache.archiva.redback.users.AbstractUserManager; import org.apache.archiva.redback.users.User; +import org.apache.archiva.redback.users.UserManager; import org.apache.archiva.redback.users.UserNotFoundException; import org.apache.archiva.redback.common.ldap.MappingException; import org.apache.archiva.redback.common.ldap.connection.LdapConnection; @@ -49,6 +50,7 @@ import java.util.List; @Service( "userManager#ldap" ) public class LdapUserManager extends AbstractUserManager + implements UserManager { @Inject @Named( value = "ldapConnectionFactory#configurable" ) -- 2.39.5