* before reading it from the registry.
* </p>
*/
-@Service ( "archivaConfiguration#default" )
+@Service( "archivaConfiguration#default" )
public class DefaultArchivaConfiguration
implements ArchivaConfiguration, RegistryListener
{
* Plexus registry to read the configuration from.
*/
@Inject
- @Named ( value = "commons-configuration" )
+ @Named( value = "commons-configuration" )
private Registry registry;
@Inject
return configuration;
}
- @SuppressWarnings ( "unchecked" )
+ @SuppressWarnings( "unchecked" )
private Configuration load()
{
// TODO: should this be the same as section? make sure unnamed sections still work (eg, sys properties)
config.getRepositoryGroupsAsMap();
if ( !config.getRepositories().isEmpty() )
{
- for ( V1RepositoryConfiguration r : config.getRepositories() )
+ for ( V1RepositoryConfiguration r : config.getRepositories() )
{
r.setScanned( r.isIndexed() );
// Fix Proxy Connector Settings.
// Create a copy of the list to read from (to prevent concurrent modification exceptions)
- List<ProxyConnectorConfiguration> proxyConnectorList =
- new ArrayList<>( config.getProxyConnectors() );
+ List<ProxyConnectorConfiguration> proxyConnectorList = new ArrayList<>( config.getProxyConnectors() );
// Remove the old connector list.
config.getProxyConnectors().clear();
return registry.getSubset( KEY );
}
- @SuppressWarnings ( "unchecked" )
+ @SuppressWarnings( "unchecked" )
@Override
public synchronized void save( Configuration configuration )
throws IndeterminateConfigurationException, RegistryException
throw new RegistryException(
"Unable to create configuration file in either user [" + userConfigFilename + "] or alternative ["
+ altConfigFilename
- + "] locations on disk, usually happens when not allowed to write to those locations." );
+ + "] locations on disk, usually happens when not allowed to write to those locations."
+ );
}
}
/**
* Attempts to write the contents to a file, if an IOException occurs, return false.
- * <p>
+ * <p/>
* The file will be created if the directory to the file exists, otherwise this will return false.
*
* @param filetype the filetype (freeform text) to use in logging messages when failure to write.
if ( file.getParentFile() != null )
{
// Check that directory exists
- if ( ! file.getParentFile().isDirectory() )
+ if ( !file.getParentFile().isDirectory() )
{
// Directory to file must exist for file to be created
return false;
}
-
@Override
public void addChangeListener( RegistryListener listener )
{
{
boolean removed = registryListeners.remove( listener );
log.debug( "RegistryListener: '{}' removed {}", listener, removed );
+
+ Registry section = registry.getSection( KEY + ".user" );
+ if ( section != null )
+ {
+ section.removeChangeListener( listener );
+ }
+ section = registry.getSection( KEY + ".base" );
+ if ( section != null )
+ {
+ section.removeChangeListener( listener );
+ }
+
}
@PostConstruct
catch ( EvaluatorException e )
{
throw new RuntimeException(
- "Unable to evaluate expressions found in " + "userConfigFilename or altConfigFilename.", e);
+ "Unable to evaluate expressions found in " + "userConfigFilename or altConfigFilename.", e );
}
registry.addChangeListener( this );
}
private Configuration unescapeExpressions( Configuration config )
{
// TODO: for commons-configuration 1.3 only
- for ( ManagedRepositoryConfiguration c : config.getManagedRepositories() ) {
+ for ( ManagedRepositoryConfiguration c : config.getManagedRepositories() )
+ {
c.setLocation( removeExpressions( c.getLocation() ) );
c.setRefreshCronExpression( unescapeCronExpression( c.getRefreshCronExpression() ) );
}
<redback.version>2.2</redback.version>
<redback.cache.version>2.2</redback.cache.version>
<redback.quartz.version>2.1</redback.quartz.version>
- <redback.registry.version>2.2</redback.registry.version>
+ <redback.registry.version>2.3-SNAPSHOT</redback.registry.version>
<redback.spring-utils.version>2.1</redback.spring-utils.version>
<redback.taskqueue.version>2.1</redback.taskqueue.version>
<slf4j.version>1.7.7</slf4j.version>
<dependency>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
- <version>1.9</version>
+ <version>1.10</version>
<exclusions>
<exclusion>
<groupId>commons-beanutils</groupId>