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,7 +37,6 @@ import javax.inject.Named;
* UserConfigurableJdoFactory * UserConfigurableJdoFactory
* *
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
*
*/ */
@Service("jdoFactory#users") @Service("jdoFactory#users")
public class UserConfigurableJdoFactory public class UserConfigurableJdoFactory
@ -46,9 +45,14 @@ public class UserConfigurableJdoFactory
private Logger log = LoggerFactory.getLogger( getClass() ); private Logger log = LoggerFactory.getLogger( getClass() );
private UserConfiguration userConfiguration;
@Inject @Inject
@Named( value = "userConfiguration#default" ) public UserConfigurableJdoFactory(
private UserConfiguration config; @Named( value = "userConfiguration#default" ) UserConfiguration userConfiguration )
{
this.userConfiguration = userConfiguration;
}
private String getConfigString( String key, String currentValue, String defaultValue ) private String getConfigString( String key, String currentValue, String defaultValue )
{ {
@ -60,11 +64,11 @@ public class UserConfigurableJdoFactory
String value = null; String value = null;
if ( StringUtils.isNotEmpty( currentValue ) ) if ( StringUtils.isNotEmpty( currentValue ) )
{ {
value = config.getString( key, currentValue ); value = userConfiguration.getString( key, currentValue );
} }
else else
{ {
value = config.getString( key, defaultValue ); value = userConfiguration.getString( key, defaultValue );
} }
// do some interpolation as we can have some ${plexus.home} etc... // do some interpolation as we can have some ${plexus.home} etc...
StringSearchInterpolator interpolator = new StringSearchInterpolator(); StringSearchInterpolator interpolator = new StringSearchInterpolator();
@ -116,13 +120,13 @@ public class UserConfigurableJdoFactory
super.initialize(); 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"> default-lazy-init="true">
<bean name="jdoFactory#users" class="org.apache.archiva.redback.common.jdo.UserConfigurableJdoFactory"> <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="config" ref="userConfiguration#default"/>
-->
</bean> </bean>
</beans> </beans>

View File

@ -29,7 +29,12 @@
<context:property-placeholder system-properties-mode="OVERRIDE"/> <context:property-placeholder system-properties-mode="OVERRIDE"/>
<bean name="jdoFactory#users" class="org.apache.archiva.redback.common.jdo.UserConfigurableJdoFactory"> <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="config" ref="userConfiguration#default"/>
-->
<!-- <!--
<property name="driverName" value="org.apache.derby.jdbc.EmbeddedDriver"/> <property name="driverName" value="org.apache.derby.jdbc.EmbeddedDriver"/>
<property name="url" value="jdbc:derby:memory:users-test" /> <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"> http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<bean name="jdoFactory#users" class="org.apache.archiva.redback.common.jdo.UserConfigurableJdoFactory"> <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="driverName" value="org.hsqldb.jdbcDriver"/>
<property name="url" value="jdbc:hsqldb:mem:redback-users-tests" /> <property name="url" value="jdbc:hsqldb:mem:redback-users-tests" />
<property name="userName" value="sa"/> <property name="userName" value="sa"/>