aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2014-05-01 14:29:28 +1000
committerOlivier Lamy <olamy@apache.org>2014-05-01 14:29:28 +1000
commit10a0761768c8704497aefe730677bfd38a39a0a1 (patch)
tree8c755f2c62fdd857dddfcc208d4f3b4320827d76
parent7808ee5fafdb02b7d9e0b104fc4a8642bce4f8ac (diff)
downloadarchiva-10a0761768c8704497aefe730677bfd38a39a0a1.tar.gz
archiva-10a0761768c8704497aefe730677bfd38a39a0a1.zip
[MRM-1837] DefaultArchivaConfiguration holds references to classes
-rw-r--r--archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/DefaultArchivaConfiguration.java38
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/AutoRemoveConsumer.java2
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/repository/RepositoryPurgeConsumer.java2
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumer.java2
-rw-r--r--archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/archiva/converter/legacy/LegacyConverterArtifactConsumer.java6
-rw-r--r--pom.xml4
6 files changed, 30 insertions, 24 deletions
diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/DefaultArchivaConfiguration.java b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/DefaultArchivaConfiguration.java
index 9b403d1d2..c6cc9530b 100644
--- a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/DefaultArchivaConfiguration.java
+++ b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/DefaultArchivaConfiguration.java
@@ -89,7 +89,7 @@ import java.util.Set;
* before reading it from the registry.
* </p>
*/
-@Service ( "archivaConfiguration#default" )
+@Service( "archivaConfiguration#default" )
public class DefaultArchivaConfiguration
implements ArchivaConfiguration, RegistryListener
{
@@ -99,7 +99,7 @@ public class DefaultArchivaConfiguration
* Plexus registry to read the configuration from.
*/
@Inject
- @Named ( value = "commons-configuration" )
+ @Named( value = "commons-configuration" )
private Registry registry;
@Inject
@@ -183,7 +183,7 @@ public class DefaultArchivaConfiguration
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)
@@ -204,7 +204,7 @@ public class DefaultArchivaConfiguration
config.getRepositoryGroupsAsMap();
if ( !config.getRepositories().isEmpty() )
{
- for ( V1RepositoryConfiguration r : config.getRepositories() )
+ for ( V1RepositoryConfiguration r : config.getRepositories() )
{
r.setScanned( r.isIndexed() );
@@ -269,8 +269,7 @@ public class DefaultArchivaConfiguration
// 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();
@@ -440,7 +439,7 @@ public class DefaultArchivaConfiguration
return registry.getSubset( KEY );
}
- @SuppressWarnings ( "unchecked" )
+ @SuppressWarnings( "unchecked" )
@Override
public synchronized void save( Configuration configuration )
throws IndeterminateConfigurationException, RegistryException
@@ -559,7 +558,8 @@ public class DefaultArchivaConfiguration
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."
+ );
}
}
@@ -584,7 +584,7 @@ public class DefaultArchivaConfiguration
/**
* 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.
@@ -602,7 +602,7 @@ public class DefaultArchivaConfiguration
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;
@@ -651,7 +651,6 @@ public class DefaultArchivaConfiguration
}
-
@Override
public void addChangeListener( RegistryListener listener )
{
@@ -680,6 +679,18 @@ public class DefaultArchivaConfiguration
{
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
@@ -714,7 +725,7 @@ public class DefaultArchivaConfiguration
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 );
}
@@ -818,7 +829,8 @@ public class DefaultArchivaConfiguration
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() ) );
}
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/AutoRemoveConsumer.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/AutoRemoveConsumer.java
index 75654c6cb..d6e929779 100644
--- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/AutoRemoveConsumer.java
+++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/AutoRemoveConsumer.java
@@ -167,7 +167,7 @@ public class AutoRemoveConsumer
private void initIncludes()
{
- includes = new ArrayList<String>( filetypes.getFileTypePatterns( FileTypes.AUTO_REMOVE ) );
+ includes = new ArrayList<>( filetypes.getFileTypePatterns( FileTypes.AUTO_REMOVE ) );
}
@PostConstruct
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/repository/RepositoryPurgeConsumer.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/repository/RepositoryPurgeConsumer.java
index 5cc20c404..5b6be2e8a 100644
--- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/repository/RepositoryPurgeConsumer.java
+++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/repository/RepositoryPurgeConsumer.java
@@ -238,7 +238,7 @@ public class RepositoryPurgeConsumer
private void initIncludes()
{
- includes = new ArrayList<String>( filetypes.getFileTypePatterns( FileTypes.ARTIFACTS ) );
+ includes = new ArrayList<>( filetypes.getFileTypePatterns( FileTypes.ARTIFACTS ) );
}
@PostConstruct
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumer.java b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumer.java
index 487af9190..4e6df8cdb 100644
--- a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumer.java
+++ b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumer.java
@@ -266,7 +266,7 @@ public class NexusIndexerConsumer
List<String> indexable = filetypes.getFileTypePatterns( FileTypes.INDEXABLE_CONTENT );
List<String> artifacts = filetypes.getFileTypePatterns( FileTypes.ARTIFACTS );
- includes = new ArrayList<String>( indexable.size() + artifacts.size() );
+ includes = new ArrayList<>( indexable.size() + artifacts.size() );
includes.addAll( indexable );
diff --git a/archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/archiva/converter/legacy/LegacyConverterArtifactConsumer.java b/archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/archiva/converter/legacy/LegacyConverterArtifactConsumer.java
index b17a74a5b..ff15d3b1f 100644
--- a/archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/archiva/converter/legacy/LegacyConverterArtifactConsumer.java
+++ b/archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/archiva/converter/legacy/LegacyConverterArtifactConsumer.java
@@ -58,15 +58,9 @@ public class LegacyConverterArtifactConsumer
{
private Logger log = LoggerFactory.getLogger( LegacyConverterArtifactConsumer.class );
- /**
- *
- */
@Inject
private ArtifactConverter artifactConverter;
- /**
- *
- */
private ArtifactFactory artifactFactory;
private ManagedRepositoryContent managedRepository;
diff --git a/pom.xml b/pom.xml
index f758398c0..e947718d4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -67,7 +67,7 @@
<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>
@@ -614,7 +614,7 @@
<dependency>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
- <version>1.9</version>
+ <version>1.10</version>
<exclusions>
<exclusion>
<groupId>commons-beanutils</groupId>