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
This commit is contained in:
Olivier Lamy 2014-01-08 01:34:57 +00:00
parent e9fce771cf
commit cdb5d9d9c5
4 changed files with 29 additions and 12 deletions

View File

@ -37,34 +37,38 @@ import javax.inject.Named;
* UserConfigurableJdoFactory
*
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
*
*/
@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;
}
}

View File

@ -25,6 +25,11 @@
default-lazy-init="true">
<bean name="jdoFactory#users" class="org.apache.archiva.redback.common.jdo.UserConfigurableJdoFactory">
<constructor-arg>
<ref bean="userConfiguration#default"/>
</constructor-arg>
<!--
<property name="config" ref="userConfiguration#default"/>
-->
</bean>
</beans>

View File

@ -29,7 +29,12 @@
<context:property-placeholder system-properties-mode="OVERRIDE"/>
<bean name="jdoFactory#users" class="org.apache.archiva.redback.common.jdo.UserConfigurableJdoFactory">
<constructor-arg>
<ref bean="userConfiguration#default"/>
</constructor-arg>
<!--
<property name="config" ref="userConfiguration#default"/>
-->
<!--
<property name="driverName" value="org.apache.derby.jdbc.EmbeddedDriver"/>
<property name="url" value="jdbc:derby:memory:users-test" />

View File

@ -27,7 +27,10 @@
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<bean name="jdoFactory#users" class="org.apache.archiva.redback.common.jdo.UserConfigurableJdoFactory">
<property name="config" ref="userConfiguration#default"/>
<constructor-arg>
<ref bean="userConfiguration#default"/>
</constructor-arg>
<!--property name="userConfiguration" ref="userConfiguration#default"/-->
<property name="driverName" value="org.hsqldb.jdbcDriver"/>
<property name="url" value="jdbc:hsqldb:mem:redback-users-tests" />
<property name="userName" value="sa"/>