diff options
5 files changed, 7 insertions, 104 deletions
diff --git a/archiva-modules/archiva-base/archiva-configuration/pom.xml b/archiva-modules/archiva-base/archiva-configuration/pom.xml index dfa2a2072..dfb6a9b05 100644 --- a/archiva-modules/archiva-base/archiva-configuration/pom.xml +++ b/archiva-modules/archiva-base/archiva-configuration/pom.xml @@ -114,10 +114,12 @@ </exclusion> </exclusions> </dependency> +<!-- <dependency> <groupId>org.apache.archiva.redback.components</groupId> <artifactId>spring-utils</artifactId> </dependency> +--> <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> 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 b8b78d3b1..af7e2ef6d 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 @@ -25,10 +25,6 @@ import org.apache.archiva.configuration.io.registry.ConfigurationRegistryWriter; import org.apache.archiva.policies.AbstractUpdatePolicy; import org.apache.archiva.policies.CachedFailuresPolicy; import org.apache.archiva.policies.ChecksumPolicy; -import org.apache.archiva.policies.DownloadErrorPolicy; -import org.apache.archiva.policies.Policy; -import org.apache.archiva.policies.PostDownloadPolicy; -import org.apache.archiva.policies.PreDownloadPolicy; import org.apache.archiva.redback.components.evaluator.DefaultExpressionEvaluator; import org.apache.archiva.redback.components.evaluator.EvaluatorException; import org.apache.archiva.redback.components.evaluator.ExpressionEvaluator; @@ -37,10 +33,8 @@ import org.apache.archiva.redback.components.registry.Registry; import org.apache.archiva.redback.components.registry.RegistryException; import org.apache.archiva.redback.components.registry.RegistryListener; import org.apache.archiva.redback.components.registry.commons.CommonsConfigurationRegistry; -import org.apache.archiva.redback.components.springutils.ComponentContainer; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.ListUtils; -import org.apache.commons.collections4.MapUtils; import org.apache.commons.configuration.BaseConfiguration; import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.StringUtils; @@ -55,18 +49,8 @@ import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Locale; -import java.util.Map; +import java.util.*; import java.util.Map.Entry; -import java.util.Set; /** * <p> @@ -108,9 +92,6 @@ public class DefaultArchivaConfiguration @Named(value = "commons-configuration") private Registry registry; - @Inject - private ComponentContainer componentContainer; - /** * The configuration that has been converted. */ @@ -118,28 +99,6 @@ public class DefaultArchivaConfiguration /** * see #initialize - * - * @todo these don't strictly belong in here - */ - private Map<String, PreDownloadPolicy> prePolicies; - - /** - * see #initialize - * - * @todo these don't strictly belong in here - */ - private Map<String, PostDownloadPolicy> postPolicies; - - /** - * see #initialize - * - * @todo these don't strictly belong in here - */ - private Map<String, DownloadErrorPolicy> downloadErrorPolicies; - - - /** - * see #initialize * default-value="${user.home}/.m2/archiva.xml" */ private String userConfigFilename = "${user.home}/.m2/archiva.xml"; @@ -340,17 +299,7 @@ public class DefaultArchivaConfiguration } // Validate existance of policy key. - if (policyExists(policyId)) { - Policy policy = findPolicy(policyId); - // Does option exist? - if (!policy.getOptions().contains(setting)) { - setting = policy.getDefaultOption().getId(); - } - connector.addPolicy(policyId, setting); - } else { - // Policy key doesn't exist. Don't add it to golden version. - log.warn("Policy [{}] does not exist.", policyId); - } + connector.addPolicy(policyId, setting); } if (connectorValid) { @@ -429,51 +378,6 @@ public class DefaultArchivaConfiguration return value; } - private Policy findPolicy(String policyId) { - if (MapUtils.isEmpty(prePolicies)) { - log.error("No PreDownloadPolicies found!"); - return null; - } - - if (MapUtils.isEmpty(postPolicies)) { - log.error("No PostDownloadPolicies found!"); - return null; - } - - Policy policy; - - policy = prePolicies.get(policyId); - if (policy != null) { - return policy; - } - - policy = postPolicies.get(policyId); - if (policy != null) { - return policy; - } - - policy = downloadErrorPolicies.get(policyId); - if (policy != null) { - return policy; - } - - return null; - } - - private boolean policyExists(String policyId) { - if (MapUtils.isEmpty(prePolicies)) { - log.error("No PreDownloadPolicies found!"); - return false; - } - - if (MapUtils.isEmpty(postPolicies)) { - log.error("No PostDownloadPolicies found!"); - return false; - } - - return (prePolicies.containsKey(policyId) || postPolicies.containsKey(policyId) - || downloadErrorPolicies.containsKey(policyId)); - } private Registry readDefaultConfiguration() { // if it contains some old configuration, remove it (Archiva 0.9) @@ -734,9 +638,6 @@ public class DefaultArchivaConfiguration @PostConstruct public void initialize() { - this.postPolicies = componentContainer.buildMapWithRole(PostDownloadPolicy.class); - this.prePolicies = componentContainer.buildMapWithRole(PreDownloadPolicy.class); - this.downloadErrorPolicies = componentContainer.buildMapWithRole(DownloadErrorPolicy.class); // Resolve expressions in the userConfigFilename and altConfigFilename try { ExpressionEvaluator expressionEvaluator = new DefaultExpressionEvaluator(); diff --git a/archiva-modules/archiva-base/archiva-plexus-bridge/pom.xml b/archiva-modules/archiva-base/archiva-plexus-bridge/pom.xml index 96f4fcef3..cd702af9e 100644 --- a/archiva-modules/archiva-base/archiva-plexus-bridge/pom.xml +++ b/archiva-modules/archiva-base/archiva-plexus-bridge/pom.xml @@ -78,11 +78,13 @@ <artifactId>maven-artifact</artifactId> <scope>test</scope> </dependency> +<!-- <dependency> <groupId>org.apache.archiva.redback.components</groupId> <artifactId>spring-utils</artifactId> <scope>test</scope> </dependency> +--> </dependencies> </project> diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/resources/repository-servlet-simple.xml b/archiva-modules/archiva-web/archiva-webdav/src/test/resources/repository-servlet-simple.xml index 10979d0f3..435ca0d00 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/test/resources/repository-servlet-simple.xml +++ b/archiva-modules/archiva-web/archiva-webdav/src/test/resources/repository-servlet-simple.xml @@ -51,8 +51,6 @@ <alias name="registry#default" alias="commons-configuration"/> - <bean name="componentContainer" class="org.apache.archiva.redback.components.springutils.ComponentContainer"/> - <alias name="userConfiguration#redback" alias="userConfiguration#default"/> <alias name="authorizer#rbac" alias="authorizer#default"/> <alias name="userManager#configurable" alias="userManager#default"/> @@ -1363,7 +1363,7 @@ <dependency> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> - <version>1.2</version> + <version>${commons.logging.version}</version> </dependency> <dependency> |