aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-base
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2011-09-26 16:07:16 +0000
committerOlivier Lamy <olamy@apache.org>2011-09-26 16:07:16 +0000
commitd1a54e99e844c136f3d91b99351fe4f290d6fdcf (patch)
treecb0fa715d988775e795c4386244390fbb42ec4b2 /archiva-modules/archiva-base
parentb42ae3b9977a86cffa4e7d7b2852d93094d26a27 (diff)
downloadarchiva-d1a54e99e844c136f3d91b99351fe4f290d6fdcf.tar.gz
archiva-d1a54e99e844c136f3d91b99351fe4f290d6fdcf.zip
[MRM-1524] downloading (optionnaly) remote index to display remote artifacts in search results
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1175928 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/archiva-base')
-rw-r--r--archiva-modules/archiva-base/archiva-configuration/pom.xml2
-rw-r--r--archiva-modules/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo55
-rw-r--r--archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/AbstractRepository.java (renamed from archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/AbstractRepository.java)30
-rw-r--r--archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/ManagedRepository.java32
-rw-r--r--archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/RemoteRepository.java38
-rw-r--r--archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/RepositoryCommonValidator.java2
-rw-r--r--archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/remote/DefaultRemoteRepositoryAdmin.java15
-rw-r--r--archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/utils/RepositoryComparator.java2
-rw-r--r--archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/ArchivaAdministrationStub.java13
9 files changed, 131 insertions, 58 deletions
diff --git a/archiva-modules/archiva-base/archiva-configuration/pom.xml b/archiva-modules/archiva-base/archiva-configuration/pom.xml
index 28c722a03..3cc60f806 100644
--- a/archiva-modules/archiva-base/archiva-configuration/pom.xml
+++ b/archiva-modules/archiva-base/archiva-configuration/pom.xml
@@ -138,7 +138,7 @@
</execution>
</executions>
<configuration>
- <version>1.3.0</version>
+ <version>1.4.0</version>
<models>
<model>src/main/mdo/configuration.mdo</model>
</models>
diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo b/archiva-modules/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo
index 97c295f1c..a56c14920 100644
--- a/archiva-modules/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo
+++ b/archiva-modules/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo
@@ -403,6 +403,24 @@
<!-- TODO: should be able to detect this from the repository (perhaps by metadata at the root) -->
<defaultValue>default</defaultValue>
</field>
+ <field>
+ <name>refreshCronExpression</name>
+ <version>1.0.0+</version>
+ <type>String</type>
+ <description>
+ When to run the refresh task.
+ Default is every hour
+ </description>
+ <defaultValue>0 0 * * * ?</defaultValue>
+ </field>
+ <field>
+ <name>indexDir</name>
+ <version>1.0.0+</version>
+ <type>String</type>
+ <description>
+ The directory for the indexes of this repository.
+ </description>
+ </field>
</fields>
<codeSegments>
<codeSegment>
@@ -474,7 +492,24 @@
Timeout in seconds for connections to this repository
</description>
<defaultValue>60</defaultValue>
- </field>
+ </field>
+ <field>
+ <name>downloadRemoteIndex</name>
+ <version>1.4.0+</version>
+ <type>boolean</type>
+ <description>
+ Activate download of remote index if remoteIndexUrl is set too.
+ </description>
+ <defaultValue>false</defaultValue>
+ </field>
+ <field>
+ <name>remoteIndexUrl</name>
+ <version>1.4.0+</version>
+ <type>String</type>
+ <description>
+ Remote Index Url : if not starting with http will be relative to the remote repository url.
+ </description>
+ </field>
</fields>
</class>
<class>
@@ -520,24 +555,6 @@
<defaultValue>true</defaultValue>
</field>
<field>
- <name>indexDir</name>
- <version>1.0.0+</version>
- <type>String</type>
- <description>
- The directory for the indexes of this repository.
- </description>
- </field>
- <field>
- <name>refreshCronExpression</name>
- <version>1.0.0+</version>
- <type>String</type>
- <description>
- When to run the refresh task.
- Default is every hour
- </description>
- <defaultValue>0 0 * * * ?</defaultValue>
- </field>
- <field>
<name>retentionCount</name>
<version>1.0.0+</version>
<type>int</type>
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/AbstractRepository.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/AbstractRepository.java
index 053068454..4f7ab3656 100644
--- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/AbstractRepository.java
+++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/AbstractRepository.java
@@ -1,4 +1,4 @@
-package org.apache.archiva.admin.model;
+package org.apache.archiva.admin.model.beans;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -34,6 +34,13 @@ public class AbstractRepository
private String layout = "default";
+ /**
+ * default model value
+ */
+ private String cronExpression = "0 0 * * * ?";
+
+ private String indexDirectory;
+
public AbstractRepository()
{
// no op
@@ -76,6 +83,25 @@ public class AbstractRepository
this.layout = layout;
}
+ public String getCronExpression()
+ {
+ return cronExpression;
+ }
+
+ public void setCronExpression( String cronExpression )
+ {
+ this.cronExpression = cronExpression;
+ }
+
+ public String getIndexDirectory()
+ {
+ return indexDirectory;
+ }
+
+ public void setIndexDirectory( String indexDirectory )
+ {
+ this.indexDirectory = indexDirectory;
+ }
public int hashCode()
{
@@ -110,6 +136,8 @@ public class AbstractRepository
sb.append( "{id='" ).append( id ).append( '\'' );
sb.append( ", name='" ).append( name ).append( '\'' );
sb.append( ", layout='" ).append( layout ).append( '\'' );
+ sb.append( ", cronExpression='" ).append( cronExpression ).append( '\'' );
+ sb.append( ", indexDirectory='" ).append( indexDirectory ).append( '\'' );
sb.append( '}' );
return sb.toString();
}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/ManagedRepository.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/ManagedRepository.java
index 8e4dbcb75..a399660c4 100644
--- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/ManagedRepository.java
+++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/ManagedRepository.java
@@ -19,8 +19,6 @@ package org.apache.archiva.admin.model.beans;
* under the License.
*/
-import org.apache.archiva.admin.model.AbstractRepository;
-
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
@@ -42,11 +40,6 @@ public class ManagedRepository
private boolean blockRedeployments = false;
- /**
- * default model value
- */
- private String cronExpression = "0 0 * * * ?";
-
/**
* not need when creating the repo : only available when reading
@@ -55,7 +48,6 @@ public class ManagedRepository
private boolean scanned = false;
- private String indexDirectory;
/**
* default model value
@@ -89,8 +81,8 @@ public class ManagedRepository
this.snapshots = snapshots;
this.releases = releases;
this.blockRedeployments = blockRedeployments;
- this.cronExpression = cronExpression;
- this.indexDirectory = indexDir;
+ this.setCronExpression( cronExpression );
+ this.setIndexDirectory( indexDir );
this.scanned = scanned;
this.daysOlder = daysOlder;
this.retentionCount = retentionCount;
@@ -144,15 +136,6 @@ public class ManagedRepository
this.blockRedeployments = blockRedeployments;
}
- public String getCronExpression()
- {
- return cronExpression;
- }
-
- public void setCronExpression( String cronExpression )
- {
- this.cronExpression = cronExpression;
- }
public ManagedRepository getStagingRepository()
{
@@ -175,15 +158,7 @@ public class ManagedRepository
this.scanned = scanned;
}
- public String getIndexDirectory()
- {
- return indexDirectory;
- }
- public void setIndexDirectory( String indexDirectory )
- {
- this.indexDirectory = indexDirectory;
- }
public int getDaysOlder()
{
@@ -239,15 +214,14 @@ public class ManagedRepository
public String toString()
{
final StringBuilder sb = new StringBuilder();
+ sb.append( super.toString() );
sb.append( "ManagedRepository" );
sb.append( "{location='" ).append( location ).append( '\'' );
sb.append( ", snapshots=" ).append( snapshots );
sb.append( ", releases=" ).append( releases );
sb.append( ", blockRedeployments=" ).append( blockRedeployments );
- sb.append( ", cronExpression='" ).append( cronExpression ).append( '\'' );
sb.append( ", stagingRepository=" ).append( stagingRepository );
sb.append( ", scanned=" ).append( scanned );
- sb.append( ", indexDirectory='" ).append( indexDirectory ).append( '\'' );
sb.append( ", daysOlder=" ).append( daysOlder );
sb.append( ", retentionCount=" ).append( retentionCount );
sb.append( ", deleteReleasedSnapshots=" ).append( deleteReleasedSnapshots );
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/RemoteRepository.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/RemoteRepository.java
index 916ddd1d9..b8a789692 100644
--- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/RemoteRepository.java
+++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/RemoteRepository.java
@@ -19,8 +19,6 @@ package org.apache.archiva.admin.model.beans;
* under the License.
*/
-import org.apache.archiva.admin.model.AbstractRepository;
-
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
@@ -42,6 +40,17 @@ public class RemoteRepository
private int timeout = 60;
+ /**
+ * Activate download of remote index if remoteIndexUrl is set too.
+ */
+ private boolean downloadRemoteIndex = false;
+
+ /**
+ * Remote Index Url : if not starting with http will be relative to the remote repository url.
+ */
+ private String remoteIndexUrl = ".index";
+
+
public RemoteRepository()
{
// no op
@@ -103,17 +112,40 @@ public class RemoteRepository
this.timeout = timeout;
}
+ public boolean isDownloadRemoteIndex()
+ {
+ return downloadRemoteIndex;
+ }
+
+ public void setDownloadRemoteIndex( boolean downloadRemoteIndex )
+ {
+ this.downloadRemoteIndex = downloadRemoteIndex;
+ }
+
+ public String getRemoteIndexUrl()
+ {
+ return remoteIndexUrl;
+ }
+
+ public void setRemoteIndexUrl( String remoteIndexUrl )
+ {
+ this.remoteIndexUrl = remoteIndexUrl;
+ }
+
+
@Override
public String toString()
{
final StringBuilder sb = new StringBuilder();
+ sb.append( super.toString() );
sb.append( "RemoteRepository" );
sb.append( "{url='" ).append( url ).append( '\'' );
sb.append( ", userName='" ).append( userName ).append( '\'' );
sb.append( ", password='" ).append( password ).append( '\'' );
sb.append( ", timeout=" ).append( timeout );
+ sb.append( ", downloadRemoteIndex=" ).append( downloadRemoteIndex );
+ sb.append( ", remoteIndexUrl='" ).append( remoteIndexUrl ).append( '\'' );
sb.append( '}' );
- sb.append( super.toString() );
return sb.toString();
}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/RepositoryCommonValidator.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/RepositoryCommonValidator.java
index 23e9cb3b0..ee5668e03 100644
--- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/RepositoryCommonValidator.java
+++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/RepositoryCommonValidator.java
@@ -18,7 +18,7 @@ package org.apache.archiva.admin.repository;
* under the License.
*/
-import org.apache.archiva.admin.model.AbstractRepository;
+import org.apache.archiva.admin.model.beans.AbstractRepository;
import org.apache.archiva.admin.model.RepositoryAdminException;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.validator.GenericValidator;
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/remote/DefaultRemoteRepositoryAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/remote/DefaultRemoteRepositoryAdmin.java
index 1912cade0..294e3cb90 100644
--- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/remote/DefaultRemoteRepositoryAdmin.java
+++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/remote/DefaultRemoteRepositoryAdmin.java
@@ -24,10 +24,10 @@ import org.apache.archiva.admin.model.beans.RemoteRepository;
import org.apache.archiva.admin.model.remote.RemoteRepositoryAdmin;
import org.apache.archiva.admin.repository.AbstractRepositoryAdmin;
import org.apache.archiva.audit.AuditEvent;
-import org.apache.commons.lang.StringUtils;
import org.apache.archiva.configuration.Configuration;
import org.apache.archiva.configuration.ProxyConnectorConfiguration;
import org.apache.archiva.configuration.RemoteRepositoryConfiguration;
+import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
@@ -52,11 +52,16 @@ public class DefaultRemoteRepositoryAdmin
List<RemoteRepository> remoteRepositories = new ArrayList<RemoteRepository>();
for ( RemoteRepositoryConfiguration repositoryConfiguration : getArchivaConfiguration().getConfiguration().getRemoteRepositories() )
{
- remoteRepositories.add(
+ RemoteRepository remoteRepository =
new RemoteRepository( repositoryConfiguration.getId(), repositoryConfiguration.getName(),
repositoryConfiguration.getUrl(), repositoryConfiguration.getLayout(),
repositoryConfiguration.getUsername(), repositoryConfiguration.getPassword(),
- repositoryConfiguration.getTimeout() ) );
+ repositoryConfiguration.getTimeout() );
+ remoteRepository.setDownloadRemoteIndex( repositoryConfiguration.isDownloadRemoteIndex() );
+ remoteRepository.setRemoteIndexUrl( repositoryConfiguration.getRemoteIndexUrl() );
+ remoteRepository.setCronExpression( repositoryConfiguration.getRefreshCronExpression() );
+ remoteRepository.setIndexDirectory( repositoryConfiguration.getIndexDir() );
+ remoteRepositories.add( remoteRepository );
}
return remoteRepositories;
}
@@ -186,6 +191,10 @@ public class DefaultRemoteRepositoryAdmin
remoteRepositoryConfiguration.setUsername( remoteRepository.getUserName() );
remoteRepositoryConfiguration.setLayout( remoteRepository.getLayout() );
remoteRepositoryConfiguration.setName( remoteRepository.getName() );
+ remoteRepositoryConfiguration.setDownloadRemoteIndex( remoteRepository.isDownloadRemoteIndex() );
+ remoteRepositoryConfiguration.setRemoteIndexUrl( remoteRepository.getRemoteIndexUrl() );
+ remoteRepositoryConfiguration.setRefreshCronExpression( remoteRepository.getCronExpression() );
+ remoteRepositoryConfiguration.setIndexDir( remoteRepository.getIndexDirectory() );
return remoteRepositoryConfiguration;
}
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/utils/RepositoryComparator.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/utils/RepositoryComparator.java
index c65c2308d..975f4520f 100644
--- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/utils/RepositoryComparator.java
+++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/utils/RepositoryComparator.java
@@ -18,7 +18,7 @@ package org.apache.archiva.admin.repository.utils;
* under the License.
*/
-import org.apache.archiva.admin.model.AbstractRepository;
+import org.apache.archiva.admin.model.beans.AbstractRepository;
import java.util.Comparator;
diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/ArchivaAdministrationStub.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/ArchivaAdministrationStub.java
index a778d2452..671a48598 100644
--- a/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/ArchivaAdministrationStub.java
+++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/ArchivaAdministrationStub.java
@@ -24,6 +24,7 @@ import org.apache.archiva.admin.model.admin.ArchivaAdministration;
import org.apache.archiva.admin.model.beans.FileType;
import org.apache.archiva.admin.model.beans.LegacyArtifactPath;
import org.apache.archiva.admin.model.beans.OrganisationInformation;
+import org.apache.archiva.admin.model.beans.UiConfiguration;
import org.apache.archiva.configuration.ArchivaConfiguration;
import org.springframework.stereotype.Service;
@@ -163,4 +164,16 @@ public class ArchivaAdministrationStub
{
}
+
+ public UiConfiguration getUiConfiguration()
+ throws RepositoryAdminException
+ {
+ return null;
+ }
+
+ public void updateUiConfiguration( UiConfiguration uiConfiguration )
+ throws RepositoryAdminException
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
}