From dc1905e16a45069d844e99a88aa65b065adcc59e Mon Sep 17 00:00:00 2001 From: Brett Porter Date: Wed, 7 Feb 2007 22:56:33 +0000 Subject: [PATCH] move sanitize to configuration class git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@504728 13f79535-47bb-0310-9956-ffa450edef68 --- .../DefaultConfigurationStore.java | 24 +------------------ .../src/main/mdo/configuration.mdo | 18 ++++++++++++++ 2 files changed, 19 insertions(+), 23 deletions(-) diff --git a/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/DefaultConfigurationStore.java b/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/DefaultConfigurationStore.java index 911f7eb87..b99e7735e 100644 --- a/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/DefaultConfigurationStore.java +++ b/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/DefaultConfigurationStore.java @@ -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 { diff --git a/archiva-configuration/src/main/mdo/configuration.mdo b/archiva-configuration/src/main/mdo/configuration.mdo index e869ce089..274f83f52 100644 --- a/archiva-configuration/src/main/mdo/configuration.mdo +++ b/archiva-configuration/src/main/mdo/configuration.mdo @@ -133,6 +133,24 @@ return valid; } + /** + * Perform any Upgrades and Adjustments needed to bring configuration up to the + * current configuration format. + */ + public void sanitize() + { + for ( java.util.Iterator i = getRepositories().iterator(); i.hasNext(); ) + { + RepositoryConfiguration repo = (RepositoryConfiguration) i.next(); + + // Ensure that the repo.urlName is set. + if ( org.codehaus.plexus.util.StringUtils.isEmpty( repo.getUrlName() ) ) + { + repo.setUrlName( repo.getId() ); + } + } + } + public RepositoryConfiguration getRepositoryByUrlName( String urlName ) { for ( java.util.Iterator i = getRepositories().iterator(); i.hasNext(); ) -- 2.39.5