]> source.dussan.org Git - archiva.git/commitdiff
move sanitize to configuration class
authorBrett Porter <brett@apache.org>
Wed, 7 Feb 2007 22:56:33 +0000 (22:56 +0000)
committerBrett Porter <brett@apache.org>
Wed, 7 Feb 2007 22:56:33 +0000 (22:56 +0000)
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@504728 13f79535-47bb-0310-9956-ffa450edef68

archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/DefaultConfigurationStore.java
archiva-configuration/src/main/mdo/configuration.mdo

index 911f7eb87ad6ccb82b4f04cf8cb5123cadb90985..b99e7735ef69a04636ec1db5a6a6f693226df434 100644 (file)
@@ -20,7 +20,6 @@ package org.apache.maven.archiva.configuration;
  */
 
 import org.apache.commons.io.IOUtils;
-import org.apache.commons.lang.StringUtils;
 import org.apache.maven.archiva.configuration.io.xpp3.ConfigurationXpp3Reader;
 import org.apache.maven.archiva.configuration.io.xpp3.ConfigurationXpp3Writer;
 import org.codehaus.plexus.logging.AbstractLogEnabled;
@@ -103,7 +102,7 @@ public class DefaultConfigurationStore
             try
             {
                 configuration = reader.read( fileReader, false );
-                sanitizeConfiguration( configuration );
+                configuration.sanitize();
             }
             catch ( IOException e )
             {
@@ -121,27 +120,6 @@ public class DefaultConfigurationStore
         return configuration;
     }
 
-    /**
-     * Perform any Upgrades and Adjustments needed to bring configuration up to the
-     * current configuration format.
-     *
-     * @param config the configuration to upgrade and adjust.
-     */
-    private void sanitizeConfiguration( Configuration config )
-    {
-        Iterator it = config.getRepositories().iterator();
-        while ( it.hasNext() )
-        {
-            RepositoryConfiguration repo = (RepositoryConfiguration) it.next();
-
-            // Ensure that the repo.urlName is set.
-            if ( StringUtils.isEmpty( repo.getUrlName() ) )
-            {
-                repo.setUrlName( repo.getId() );
-            }
-        }
-    }
-
     public void storeConfiguration( Configuration configuration )
         throws ConfigurationStoreException, InvalidConfigurationException, ConfigurationChangeException
     {
index e869ce08914fe7e932581fd5d4faf042a4f8bf94..274f83f529fcc2c3c6ec128dd733902e30bf677b 100644 (file)
         return valid;\r
     }\r
 \r
+    /**\r
+     * Perform any Upgrades and Adjustments needed to bring configuration up to the\r
+     * current configuration format.\r
+     */\r
+    public void sanitize()\r
+    {\r
+        for ( java.util.Iterator i = getRepositories().iterator(); i.hasNext(); )\r
+        {\r
+            RepositoryConfiguration repo = (RepositoryConfiguration) i.next();\r
+\r
+            // Ensure that the repo.urlName is set.\r
+            if ( org.codehaus.plexus.util.StringUtils.isEmpty( repo.getUrlName() ) )\r
+            {\r
+                repo.setUrlName( repo.getId() );\r
+            }\r
+        }\r
+    }\r
+\r
     public RepositoryConfiguration getRepositoryByUrlName( String urlName )\r
     {\r
         for ( java.util.Iterator i = getRepositories().iterator(); i.hasNext(); )\r