]> source.dussan.org Git - archiva.git/commitdiff
Removing dependency on ComponentContainer (spring-utils)
authorMartin Stockhammer <martin_s@apache.org>
Wed, 9 Oct 2019 17:48:54 +0000 (19:48 +0200)
committerMartin Stockhammer <martin_s@apache.org>
Wed, 9 Oct 2019 17:48:54 +0000 (19:48 +0200)
archiva-modules/archiva-base/archiva-configuration/pom.xml
archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/DefaultArchivaConfiguration.java
archiva-modules/archiva-base/archiva-plexus-bridge/pom.xml
archiva-modules/archiva-web/archiva-webdav/src/test/resources/repository-servlet-simple.xml
pom.xml

index dfa2a2072c6bb5bff86e61ced2efed0680564de1..dfb6a9b05d404f19af1eeda06cb6c5e5caf69108 100644 (file)
         </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>
index b8b78d3b1da3c1b1d2abdf481a0bd8044f7b7bd4..af7e2ef6d91e46c2b1f838d31a5427ac0d437c03 100644 (file)
@@ -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,36 +92,11 @@ public class DefaultArchivaConfiguration
     @Named(value = "commons-configuration")
     private Registry registry;
 
-    @Inject
-    private ComponentContainer componentContainer;
-
     /**
      * The configuration that has been converted.
      */
     private Configuration configuration;
 
-    /**
-     * 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"
@@ -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();
index 96f4fcef35b49f5d2b57a2471f8c17da02d126c6..cd702af9ed7e4f9423fefd1496dbb74ac31128c1 100644 (file)
       <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>
index 10979d0f3126bb7cefaabafde701c148a16c3b20..435ca0d007c7694ac03a083086aa4f932ce2fc8c 100644 (file)
@@ -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"/>
diff --git a/pom.xml b/pom.xml
index 29a372946af141c31bcd3cc2887949f130874c96..b5b7210e43cfdb83d2926b0526c06aec02396400 100644 (file)
--- a/pom.xml
+++ b/pom.xml
       <dependency>
         <groupId>commons-logging</groupId>
         <artifactId>commons-logging</artifactId>
-        <version>1.2</version>
+        <version>${commons.logging.version}</version>
       </dependency>
 
       <dependency>