From cdb5d9d9c54d618f08dde0a24a6f72f91e9dc24c Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Wed, 8 Jan 2014 01:34:57 +0000 Subject: [PATCH] use a better name for this field git-svn-id: https://svn.apache.org/repos/asf/archiva/redback/redback-core/trunk@1556422 13f79535-47bb-0310-9956-ffa450edef68 --- .../jdo/UserConfigurableJdoFactory.java | 26 +++++++++++-------- .../resources/META-INF/spring-context.xml | 5 ++++ .../src/test/resources/spring-context.xml | 5 ++++ .../src/test/resources/spring-context.xml | 5 +++- 4 files changed, 29 insertions(+), 12 deletions(-) diff --git a/redback-common/redback-common-jdo/src/main/java/org/apache/archiva/redback/common/jdo/UserConfigurableJdoFactory.java b/redback-common/redback-common-jdo/src/main/java/org/apache/archiva/redback/common/jdo/UserConfigurableJdoFactory.java index 31555955..e5114923 100644 --- a/redback-common/redback-common-jdo/src/main/java/org/apache/archiva/redback/common/jdo/UserConfigurableJdoFactory.java +++ b/redback-common/redback-common-jdo/src/main/java/org/apache/archiva/redback/common/jdo/UserConfigurableJdoFactory.java @@ -37,34 +37,38 @@ import javax.inject.Named; * UserConfigurableJdoFactory * * @author Joakim Erdfelt - * */ -@Service( "jdoFactory#users" ) +@Service("jdoFactory#users") public class UserConfigurableJdoFactory extends DefaultConfigurableJdoFactory { private Logger log = LoggerFactory.getLogger( getClass() ); + private UserConfiguration userConfiguration; + @Inject - @Named( value = "userConfiguration#default" ) - private UserConfiguration config; + public UserConfigurableJdoFactory( + @Named( value = "userConfiguration#default" ) UserConfiguration userConfiguration ) + { + this.userConfiguration = userConfiguration; + } private String getConfigString( String key, String currentValue, String defaultValue ) { String valueFromSysProps = System.getProperty( "redback." + key ); - if (StringUtils.isNotEmpty( valueFromSysProps )) + if ( StringUtils.isNotEmpty( valueFromSysProps ) ) { return valueFromSysProps; } String value = null; if ( StringUtils.isNotEmpty( currentValue ) ) { - value = config.getString( key, currentValue ); + value = userConfiguration.getString( key, currentValue ); } else { - value = config.getString( key, defaultValue ); + value = userConfiguration.getString( key, defaultValue ); } // do some interpolation as we can have some ${plexus.home} etc... StringSearchInterpolator interpolator = new StringSearchInterpolator(); @@ -116,13 +120,13 @@ public class UserConfigurableJdoFactory super.initialize(); } - public UserConfiguration getConfig() + public UserConfiguration getUserConfiguration() { - return config; + return userConfiguration; } - public void setConfig( UserConfiguration config ) + public void setUserConfiguration( UserConfiguration userConfiguration ) { - this.config = config; + this.userConfiguration = userConfiguration; } } diff --git a/redback-common/redback-common-jdo/src/main/resources/META-INF/spring-context.xml b/redback-common/redback-common-jdo/src/main/resources/META-INF/spring-context.xml index 6c510910..86a9fe94 100644 --- a/redback-common/redback-common-jdo/src/main/resources/META-INF/spring-context.xml +++ b/redback-common/redback-common-jdo/src/main/resources/META-INF/spring-context.xml @@ -25,6 +25,11 @@ default-lazy-init="true"> + + + + \ No newline at end of file diff --git a/redback-data-management/src/test/resources/spring-context.xml b/redback-data-management/src/test/resources/spring-context.xml index 4a602279..b6fb123d 100644 --- a/redback-data-management/src/test/resources/spring-context.xml +++ b/redback-data-management/src/test/resources/spring-context.xml @@ -29,7 +29,12 @@ + + + +