mirror of https://github.com/apache/archiva.git
move sanitize to configuration class
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@504728 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a2bc87deb7
commit
dc1905e16a
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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(); )
|
||||
|
|
Loading…
Reference in New Issue