aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-configuration/src/main
diff options
context:
space:
mode:
authorJoakim Erdfelt <joakime@apache.org>2006-10-26 22:04:46 +0000
committerJoakim Erdfelt <joakime@apache.org>2006-10-26 22:04:46 +0000
commit188548089d47c4d3cad9025a46046f79b7023443 (patch)
treec0353bb6affb45d8a8cc1ff3ac9be4a29e908634 /archiva-configuration/src/main
parent90da8e7205a0eb4f4f570473a68926107a7d192c (diff)
downloadarchiva-188548089d47c4d3cad9025a46046f79b7023443.tar.gz
archiva-188548089d47c4d3cad9025a46046f79b7023443.zip
* Adding distinction between repo.id and repo.urlName.
* Adding copy-paste block for repositories. * Adding copy-paste block for dependency. * Adding webdav url link in repository config. git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@468167 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-configuration/src/main')
-rw-r--r--archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/DefaultConfigurationStore.java23
-rw-r--r--archiva-configuration/src/main/mdo/configuration.mdo23
2 files changed, 46 insertions, 0 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 7a31d64d8..759e635e8 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,6 +20,7 @@ import org.apache.maven.archiva.configuration.io.xpp3.ConfigurationXpp3Reader;
import org.apache.maven.archiva.configuration.io.xpp3.ConfigurationXpp3Writer;
import org.codehaus.plexus.logging.AbstractLogEnabled;
import org.codehaus.plexus.util.IOUtil;
+import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
import java.io.File;
@@ -99,6 +100,7 @@ public class DefaultConfigurationStore
try
{
configuration = reader.read( fileReader, false );
+ sanitizeConfiguration( configuration );
}
catch ( IOException e )
{
@@ -116,6 +118,27 @@ 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 9fd042427..2b501d6c3 100644
--- a/archiva-configuration/src/main/mdo/configuration.mdo
+++ b/archiva-configuration/src/main/mdo/configuration.mdo
@@ -114,6 +114,19 @@
return valid;
}
+ public RepositoryConfiguration getRepositoryByUrlName( String urlName )
+ {
+ for ( java.util.Iterator i = getRepositories().iterator(); i.hasNext(); )
+ {
+ RepositoryConfiguration repository = (RepositoryConfiguration) i.next();
+ if ( repository.getUrlName().equals( urlName ) )
+ {
+ return repository;
+ }
+ }
+ return null;
+ }
+
public RepositoryConfiguration getRepositoryById( String id )
{
for ( java.util.Iterator i = getRepositories().iterator(); i.hasNext(); )
@@ -257,6 +270,16 @@
<version>1.0.0</version>
<fields>
<field>
+ <name>urlName</name>
+ <version>1.0.0</version>
+ <type>String</type>
+ <required>true</required>
+ <description>
+ The URL name for this repository.
+ Used to create the WebDAV URL for the repository such like - http://hostname.com/repository/${urlName}/
+ </description>
+ </field>
+ <field>
<name>directory</name>
<version>1.0.0</version>
<type>String</type>