From 6c05482be364438daadd4f8b6e3024aaf2f9769d Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Wed, 16 Jan 2013 21:48:35 +0000 Subject: [PATCH] fix dynamic usage of rbac manager impl git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1434422 13f79535-47bb-0310-9956-ffa450edef68 --- .../beans/RedbackRuntimeConfiguration.java | 2 +- ...faultRedbackRuntimeConfigurationAdmin.java | 34 ++++++------------- 2 files changed, 12 insertions(+), 24 deletions(-) diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/RedbackRuntimeConfiguration.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/RedbackRuntimeConfiguration.java index fe4a45011..ecb063942 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/RedbackRuntimeConfiguration.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/RedbackRuntimeConfiguration.java @@ -42,7 +42,7 @@ public class RedbackRuntimeConfiguration /** * Field rbacManagerImpls. */ - private java.util.List rbacManagerImpls; + private java.util.List rbacManagerImpls = new ArrayList(); private LdapConfiguration ldapConfiguration; diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/runtime/DefaultRedbackRuntimeConfigurationAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/runtime/DefaultRedbackRuntimeConfigurationAdmin.java index 3b8e30a3a..36116b0dd 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/runtime/DefaultRedbackRuntimeConfigurationAdmin.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/runtime/DefaultRedbackRuntimeConfigurationAdmin.java @@ -49,7 +49,7 @@ import java.util.Set; * @author Olivier Lamy * @since 1.4-M4 */ -@Service("userConfiguration#archiva") +@Service( "userConfiguration#archiva" ) public class DefaultRedbackRuntimeConfigurationAdmin implements RedbackRuntimeConfigurationAdmin, UserConfiguration { @@ -60,11 +60,11 @@ public class DefaultRedbackRuntimeConfigurationAdmin private ArchivaConfiguration archivaConfiguration; @Inject - @Named(value = "userConfiguration#redback") + @Named( value = "userConfiguration#redback" ) UserConfiguration userConfiguration; @Inject - @Named(value = "cache#users") + @Named( value = "cache#users" ) private Cache usersCache; @PostConstruct @@ -77,22 +77,17 @@ public class DefaultRedbackRuntimeConfigurationAdmin // migrate or not data from redback if ( !redbackRuntimeConfiguration.isMigratedFromRedbackConfiguration() ) { + // not migrated so build a new fresh one + redbackRuntimeConfiguration = new RedbackRuntimeConfiguration(); // so migrate if available String userManagerImpl = userConfiguration.getConcatenatedList( UserConfigurationKeys.USER_MANAGER_IMPL, "jdo" ); if ( StringUtils.isNotEmpty( userManagerImpl ) ) { - if ( StringUtils.contains( userManagerImpl, ',' ) ) + String[] impls = StringUtils.split( userManagerImpl, ',' ); + for ( String impl : impls ) { - String[] impls = StringUtils.split( userManagerImpl, ',' ); - for ( String impl : impls ) - { - redbackRuntimeConfiguration.getUserManagerImpls().add( impl ); - } - } - else - { - redbackRuntimeConfiguration.getUserManagerImpls().add( userManagerImpl ); + redbackRuntimeConfiguration.getUserManagerImpls().add( impl ); } } @@ -101,17 +96,10 @@ public class DefaultRedbackRuntimeConfigurationAdmin if ( StringUtils.isNotEmpty( rbacManagerImpls ) ) { - if ( StringUtils.contains( rbacManagerImpls, ',' ) ) - { - String[] impls = StringUtils.split( rbacManagerImpls, ',' ); - for ( String impl : impls ) - { - redbackRuntimeConfiguration.getRbacManagerImpls().add( impl ); - } - } - else + String[] impls = StringUtils.split( rbacManagerImpls, ',' ); + for ( String impl : impls ) { - redbackRuntimeConfiguration.getRbacManagerImpls().add( userManagerImpl ); + redbackRuntimeConfiguration.getRbacManagerImpls().add( impl ); } } -- 2.39.5