diff options
6 files changed, 40 insertions, 2 deletions
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 9473f9b6e..4da4d8390 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 @@ -538,6 +538,15 @@ </description> <defaultValue>300</defaultValue> </field> + <field> + <name>downloadRemoteIndexOnStartup</name> + <version>1.4.0+</version> + <type>boolean</type> + <description> + Schedule download of remote index when archiva start + </description> + <defaultValue>false</defaultValue> + </field> </fields> <codeSegments> <codeSegment> 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 5e9575811..8c0febeaf 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 @@ -59,6 +59,11 @@ public class RemoteRepository private int remoteDownloadTimeout = 300; + /** + * @since 1.4-M2 + */ + private boolean downloadRemoteIndexOnStartup = false; + public RemoteRepository() { @@ -171,11 +176,20 @@ public class RemoteRepository this.remoteDownloadTimeout = remoteDownloadTimeout; } + public boolean isDownloadRemoteIndexOnStartup() + { + return downloadRemoteIndexOnStartup; + } + + public void setDownloadRemoteIndexOnStartup( boolean downloadRemoteIndexOnStartup ) + { + this.downloadRemoteIndexOnStartup = downloadRemoteIndexOnStartup; + } + @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( '\'' ); @@ -186,6 +200,7 @@ public class RemoteRepository sb.append( ", remoteDownloadNetworkProxyId='" ).append( remoteDownloadNetworkProxyId ).append( '\'' ); sb.append( ", cronExpression='" ).append( cronExpression ).append( '\'' ); sb.append( ", remoteDownloadTimeout=" ).append( remoteDownloadTimeout ); + sb.append( ", downloadRemoteIndexOnStartup=" ).append( downloadRemoteIndexOnStartup ); sb.append( '}' ); 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/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 17871f098..e1bf5d46f 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 @@ -129,6 +129,8 @@ public class DefaultRemoteRepositoryAdmin remoteRepository.setRemoteDownloadNetworkProxyId( repositoryConfiguration.getRemoteDownloadNetworkProxyId() ); remoteRepository.setRemoteDownloadTimeout( repositoryConfiguration.getRemoteDownloadTimeout() ); + remoteRepository.setDownloadRemoteIndexOnStartup( + repositoryConfiguration.isDownloadRemoteIndexOnStartup() ); remoteRepositories.add( remoteRepository ); } return remoteRepositories; @@ -327,6 +329,8 @@ public class DefaultRemoteRepositoryAdmin remoteRepositoryConfiguration.setRemoteDownloadNetworkProxyId( remoteRepository.getRemoteDownloadNetworkProxyId() ); remoteRepositoryConfiguration.setRemoteDownloadTimeout( remoteRepository.getRemoteDownloadTimeout() ); + remoteRepositoryConfiguration.setDownloadRemoteIndexOnStartup( + remoteRepository.isDownloadRemoteIndexOnStartup() ); return remoteRepositoryConfiguration; } diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/DefaultDownloadRemoteIndexScheduler.java b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/DefaultDownloadRemoteIndexScheduler.java index b00332171..9714dcfbe 100644 --- a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/DefaultDownloadRemoteIndexScheduler.java +++ b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/DefaultDownloadRemoteIndexScheduler.java @@ -193,6 +193,15 @@ public class DefaultDownloadRemoteIndexScheduler taskScheduler.schedule( new DownloadRemoteIndexTask( downloadRemoteIndexTaskRequest, this.runningRemoteDownloadIds ), new CronTrigger( remoteRepository.getCronExpression() ) ); + + if ( remoteRepository.isDownloadRemoteIndexOnStartup() ) + { + log.info( + "remote repository {} configured with downloadRemoteIndexOnStartup schedule now a download" ); + taskScheduler.schedule( + new DownloadRemoteIndexTask( downloadRemoteIndexTaskRequest, this.runningRemoteDownloadIds ), + new Date() ); + } } } diff --git a/archiva-modules/archiva-web/archiva-webapp/pom.xml b/archiva-modules/archiva-web/archiva-webapp/pom.xml index 8acd10b12..1bcac2698 100644 --- a/archiva-modules/archiva-web/archiva-webapp/pom.xml +++ b/archiva-modules/archiva-web/archiva-webapp/pom.xml @@ -1104,7 +1104,7 @@ <type>war</type> <overWrite>false</overWrite> <outputDirectory>${basedir}/src/main/webapp</outputDirectory> - <excludes>**/web.xml,**/struts*.jar,**/sitemesh*.jar,**/struts-security.xml</excludes> + <excludes>**/web.xml,**/**.jar,**/struts-security.xml</excludes> </artifactItem> </artifactItems> </configuration> diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/include/remoteRepositoryForm.jspf b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/include/remoteRepositoryForm.jspf index f5943f2c9..000578650 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/include/remoteRepositoryForm.jspf +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/include/remoteRepositoryForm.jspf @@ -35,5 +35,6 @@ <s:textfield name="repository.remoteDownloadTimeout" label="Download Remote Index Timeout in seconds" size="10" required="false"/> <s:select list="networkProxies" name="repository.remoteDownloadNetworkProxyId" emptyOption="true" required="false" listKey="id" listValue="id" label="Network Proxy to Use for download Remote Index"/> +<s:checkbox name="repository.downloadRemoteIndexOnStartup" label="Download remote index on Archiva startup" /> |