aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-base
diff options
context:
space:
mode:
Diffstat (limited to 'archiva-modules/archiva-base')
-rw-r--r--archiva-modules/archiva-base/archiva-configuration/pom.xml8
-rw-r--r--archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/DefaultArchivaConfiguration.java46
-rw-r--r--archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/FileTypes.java45
-rw-r--r--archiva-modules/archiva-base/archiva-configuration/src/main/resources/META-INF/spring-context.xml32
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/pom.xml4
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-metadata-consumer/pom.xml4
-rw-r--r--archiva-modules/archiva-base/archiva-policies/pom.xml35
-rw-r--r--archiva-modules/archiva-base/archiva-proxy/pom.xml4
8 files changed, 122 insertions, 56 deletions
diff --git a/archiva-modules/archiva-base/archiva-configuration/pom.xml b/archiva-modules/archiva-base/archiva-configuration/pom.xml
index 9ec933bea..d7965b3cb 100644
--- a/archiva-modules/archiva-base/archiva-configuration/pom.xml
+++ b/archiva-modules/archiva-base/archiva-configuration/pom.xml
@@ -34,12 +34,12 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.codehaus.plexus.registry</groupId>
- <artifactId>plexus-registry-api</artifactId>
+ <groupId>org.codehaus.redback.components.registry</groupId>
+ <artifactId>spring-registry-api</artifactId>
</dependency>
<dependency>
- <groupId>org.codehaus.plexus.registry</groupId>
- <artifactId>plexus-registry-commons</artifactId>
+ <groupId>org.codehaus.redback.components.registry</groupId>
+ <artifactId>spring-registry-commons</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/DefaultArchivaConfiguration.java b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/DefaultArchivaConfiguration.java
index 6821b2f95..aace6cb8b 100644
--- a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/DefaultArchivaConfiguration.java
+++ b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/DefaultArchivaConfiguration.java
@@ -36,14 +36,16 @@ import org.codehaus.plexus.evaluator.DefaultExpressionEvaluator;
import org.codehaus.plexus.evaluator.EvaluatorException;
import org.codehaus.plexus.evaluator.ExpressionEvaluator;
import org.codehaus.plexus.evaluator.sources.SystemPropertyExpressionSource;
-import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
-import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
import org.codehaus.plexus.registry.Registry;
import org.codehaus.plexus.registry.RegistryException;
import org.codehaus.plexus.registry.RegistryListener;
+import org.codehaus.redback.components.registry.commons.CommonsConfigurationRegistry;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+import javax.annotation.PostConstruct;
+import javax.inject.Inject;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
@@ -81,18 +83,21 @@ import java.util.Set;
* before reading it from the registry.
* </p>
*
- * @plexus.component role="org.apache.maven.archiva.configuration.ArchivaConfiguration"
+ * plexus.component role="org.apache.maven.archiva.configuration.ArchivaConfiguration"
*/
+@Service("archivaConfiguration")
public class DefaultArchivaConfiguration
- implements ArchivaConfiguration, RegistryListener, Initializable
+ implements ArchivaConfiguration, RegistryListener
+ //, Initializable
{
private Logger log = LoggerFactory.getLogger( DefaultArchivaConfiguration.class );
/**
* Plexus registry to read the configuration from.
*
- * @plexus.requirement role-hint="commons-configuration"
+ * plexus.requirement role-hint="commons-configuration"
*/
+ @Inject
private Registry registry;
/**
@@ -101,24 +106,26 @@ public class DefaultArchivaConfiguration
private Configuration configuration;
/**
- * @plexus.requirement role="org.apache.maven.archiva.policies.PreDownloadPolicy"
+ * plexus.requirement role="org.apache.maven.archiva.policies.PreDownloadPolicy"
* @todo these don't strictly belong in here
*/
private Map<String, PreDownloadPolicy> prePolicies;
/**
- * @plexus.requirement role="org.apache.maven.archiva.policies.PostDownloadPolicy"
+ * plexus.requirement role="org.apache.maven.archiva.policies.PostDownloadPolicy"
* @todo these don't strictly belong in here
*/
private Map<String, PostDownloadPolicy> postPolicies;
/**
- * @plexus.configuration default-value="${user.home}/.m2/archiva.xml"
+ * TODO take about default value with spring
+ * plexus.configuration default-value="${user.home}/.m2/archiva.xml"
*/
private String userConfigFilename;
/**
- * @plexus.configuration default-value="${appserver.base}/conf/archiva.xml"
+ * * TODO take about default value with spring
+ * plexus.configuration default-value="${appserver.base}/conf/archiva.xml"
*/
private String altConfigFilename;
@@ -401,7 +408,7 @@ public class DefaultArchivaConfiguration
@SuppressWarnings("unchecked")
public synchronized void save( Configuration configuration )
- throws RegistryException, IndeterminateConfigurationException
+ throws IndeterminateConfigurationException, RegistryException
{
Registry section = registry.getSection( KEY + ".user" );
Registry baseSection = registry.getSection( KEY + ".base" );
@@ -531,20 +538,15 @@ public class DefaultArchivaConfiguration
}
}
- try
- {
- ( (Initializable) registry ).initialize();
- for ( RegistryListener regListener : registryListeners )
- {
- addRegistryChangeListener( regListener );
- }
- }
- catch ( InitializationException e )
+ ( (CommonsConfigurationRegistry) registry ).initialize();
+
+ for ( RegistryListener regListener : registryListeners )
{
- throw new RegistryException( "Unable to reinitialize configuration: " + e.getMessage(), e );
+ addRegistryChangeListener( regListener );
}
+
triggerEvent( ConfigurationEvent.SAVED );
return registry.getSection( KEY + ".user" );
@@ -638,8 +640,8 @@ public class DefaultArchivaConfiguration
}
}
+ @PostConstruct
public void initialize()
- throws InitializationException
{
// Resolve expressions in the userConfigFilename and altConfigFilename
try
@@ -652,7 +654,7 @@ public class DefaultArchivaConfiguration
}
catch ( EvaluatorException e )
{
- throw new InitializationException( "Unable to evaluate expressions found in "
+ throw new RuntimeException( "Unable to evaluate expressions found in "
+ "userConfigFilename or altConfigFilename." );
}
registry.addChangeListener( this );
diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/FileTypes.java b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/FileTypes.java
index f4de14ecc..e5e1a7e6d 100644
--- a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/FileTypes.java
+++ b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/FileTypes.java
@@ -19,37 +19,38 @@ package org.apache.maven.archiva.configuration;
* under the License.
*/
-import java.lang.reflect.Field;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.Predicate;
import org.apache.commons.configuration.CombinedConfiguration;
-import org.apache.maven.archiva.common.utils.Slf4JPlexusLogger;
import org.apache.maven.archiva.configuration.functors.FiletypeSelectionPredicate;
import org.apache.maven.archiva.configuration.io.registry.ConfigurationRegistryReader;
-import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
-import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
import org.codehaus.plexus.registry.Registry;
import org.codehaus.plexus.registry.RegistryException;
import org.codehaus.plexus.registry.RegistryListener;
-import org.codehaus.plexus.registry.commons.CommonsConfigurationRegistry;
import org.codehaus.plexus.util.SelectorUtils;
+import org.codehaus.redback.components.registry.commons.CommonsConfigurationRegistry;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.PostConstruct;
+import javax.inject.Inject;
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
/**
* FileTypes
*
* @version $Id$
*
- * @plexus.component role="org.apache.maven.archiva.configuration.FileTypes"
+ * plexus.component role="org.apache.maven.archiva.configuration.FileTypes"
*/
+@Service("fileTypes")
public class FileTypes
- implements Initializable, RegistryListener
+ implements RegistryListener
{
public static final String ARTIFACTS = "artifacts";
@@ -60,8 +61,9 @@ public class FileTypes
public static final String IGNORED = "ignored";
/**
- * @plexus.requirement
+ * plexus.requirement
*/
+ @Inject
private ArchivaConfiguration archivaConfiguration;
/**
@@ -165,8 +167,8 @@ public class FileTypes
return false;
}
+ @PostConstruct
public void initialize()
- throws InitializationException
{
// TODO: why is this done by hand?
@@ -182,7 +184,6 @@ public class FileTypes
Field fld = commonsRegistry.getClass().getDeclaredField( "configuration" );
fld.setAccessible( true );
fld.set( commonsRegistry, new CombinedConfiguration() );
- commonsRegistry.enableLogging( new Slf4JPlexusLogger( FileTypes.class ) );
commonsRegistry.addConfigurationFromResource( "org/apache/maven/archiva/configuration/default-archiva.xml" );
// Read configuration as it was intended.
@@ -193,23 +194,23 @@ public class FileTypes
}
catch ( RegistryException e )
{
- throw new InitializationException( errMsg + e.getMessage(), e );
+ throw new RuntimeException( errMsg + e.getMessage(), e );
}
catch ( SecurityException e )
{
- throw new InitializationException( errMsg + e.getMessage(), e );
+ throw new RuntimeException( errMsg + e.getMessage(), e );
}
catch ( NoSuchFieldException e )
{
- throw new InitializationException( errMsg + e.getMessage(), e );
+ throw new RuntimeException( errMsg + e.getMessage(), e );
}
catch ( IllegalArgumentException e )
{
- throw new InitializationException( errMsg + e.getMessage(), e );
+ throw new RuntimeException( errMsg + e.getMessage(), e );
}
catch ( IllegalAccessException e )
{
- throw new InitializationException( errMsg + e.getMessage(), e );
+ throw new RuntimeException( errMsg + e.getMessage(), e );
}
this.archivaConfiguration.addChangeListener( this );
diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/resources/META-INF/spring-context.xml b/archiva-modules/archiva-base/archiva-configuration/src/main/resources/META-INF/spring-context.xml
new file mode 100644
index 000000000..2831605f3
--- /dev/null
+++ b/archiva-modules/archiva-base/archiva-configuration/src/main/resources/META-INF/spring-context.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+ http://www.springframework.org/schema/context
+ http://www.springframework.org/schema/context/spring-context-3.0.xsd"
+ default-lazy-init="true">
+
+ <context:annotation-config/>
+ <context:component-scan base-package="org.apache.maven.archiva.configuration"/>
+</beans> \ No newline at end of file
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/pom.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/pom.xml
index d978c192b..34301174c 100644
--- a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/pom.xml
+++ b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/pom.xml
@@ -55,8 +55,8 @@
<artifactId>plexus-component-api</artifactId>
</dependency>
<dependency>
- <groupId>org.codehaus.plexus.registry</groupId>
- <artifactId>plexus-registry-api</artifactId>
+ <groupId>org.codehaus.redback.components.registry</groupId>
+ <artifactId>spring-registry-api</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-metadata-consumer/pom.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-metadata-consumer/pom.xml
index c71f87b0e..35599fd92 100644
--- a/archiva-modules/archiva-base/archiva-consumers/archiva-metadata-consumer/pom.xml
+++ b/archiva-modules/archiva-base/archiva-consumers/archiva-metadata-consumer/pom.xml
@@ -58,8 +58,8 @@
<artifactId>plexus-component-api</artifactId>
</dependency>
<dependency>
- <groupId>org.codehaus.plexus.registry</groupId>
- <artifactId>plexus-registry-api</artifactId>
+ <groupId>org.codehaus.redback.components.registry</groupId>
+ <artifactId>spring-registry-api</artifactId>
</dependency>
</dependencies>
</project>
diff --git a/archiva-modules/archiva-base/archiva-policies/pom.xml b/archiva-modules/archiva-base/archiva-policies/pom.xml
index e8049835e..d3247ea98 100644
--- a/archiva-modules/archiva-base/archiva-policies/pom.xml
+++ b/archiva-modules/archiva-base/archiva-policies/pom.xml
@@ -47,8 +47,39 @@
<artifactId>commons-lang</artifactId>
</dependency>
<dependency>
- <groupId>org.codehaus.plexus.cache</groupId>
- <artifactId>plexus-cache-ehcache</artifactId>
+ <groupId>org.codehaus.redback.components.cache</groupId>
+ <artifactId>spring-cache-api</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-asm</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.redback.components.cache</groupId>
+ <artifactId>spring-cache-ehcache</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>net.sf.ehcache</groupId>
+ <artifactId>ehcache-core</artifactId>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
diff --git a/archiva-modules/archiva-base/archiva-proxy/pom.xml b/archiva-modules/archiva-base/archiva-proxy/pom.xml
index d33978444..b3063dbe7 100644
--- a/archiva-modules/archiva-base/archiva-proxy/pom.xml
+++ b/archiva-modules/archiva-base/archiva-proxy/pom.xml
@@ -71,8 +71,8 @@
<artifactId>plexus-component-api</artifactId>
</dependency>
<dependency>
- <groupId>org.codehaus.plexus.registry</groupId>
- <artifactId>plexus-registry-commons</artifactId>
+ <groupId>org.codehaus.redback.components.registry</groupId>
+ <artifactId>spring-registry-commons</artifactId>
<scope>test</scope>
</dependency>
<dependency>