summaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-base
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2013-12-17 07:29:31 +0000
committerOlivier Lamy <olamy@apache.org>2013-12-17 07:29:31 +0000
commit1e1f7cdacd0118a5fb9a707871c7b7100b7f09d2 (patch)
tree1f1750f62f31b10b5cd1cb0b9ed96eeed848c823 /archiva-modules/archiva-base
parent3ac4f6e6624968f11d6293ac17244e1275ab1305 (diff)
downloadarchiva-1e1f7cdacd0118a5fb9a707871c7b7100b7f09d2.tar.gz
archiva-1e1f7cdacd0118a5fb9a707871c7b7100b7f09d2.zip
[MRM-1746] build merged index for groups with a cron schedule
fix issues git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1551475 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/archiva-base')
-rw-r--r--archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/DefaultMergedRemoteIndexesScheduler.java13
-rw-r--r--archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/RepositoryGroup.java2
-rw-r--r--archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/group/DefaultRepositoryGroupAdmin.java9
3 files changed, 12 insertions, 12 deletions
diff --git a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/DefaultMergedRemoteIndexesScheduler.java b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/DefaultMergedRemoteIndexesScheduler.java
index 480529b44..776253d99 100644
--- a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/DefaultMergedRemoteIndexesScheduler.java
+++ b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/DefaultMergedRemoteIndexesScheduler.java
@@ -22,6 +22,7 @@ package org.apache.archiva.indexer.merger;
import org.apache.archiva.admin.model.beans.RepositoryGroup;
import org.apache.archiva.admin.model.group.RepositoryGroupAdmin;
import org.apache.archiva.scheduler.MergedRemoteIndexesScheduler;
+import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.TaskScheduler;
@@ -52,24 +53,19 @@ public class DefaultMergedRemoteIndexesScheduler
private TaskScheduler taskScheduler;
@Inject
- private RepositoryGroupAdmin repositoryGroupAdmin;
-
- @Inject
private IndexMerger indexMerger;
private Map<String, ScheduledFuture> scheduledFutureMap = new ConcurrentHashMap<String, ScheduledFuture>();
@Override
- public void schedule( RepositoryGroup repositoryGroup )
+ public void schedule( RepositoryGroup repositoryGroup, File directory )
{
- if ( repositoryGroup.getCronExpression() == null )
+ if ( StringUtils.isEmpty( repositoryGroup.getCronExpression() ) )
{
return;
}
CronTrigger cronTrigger = new CronTrigger( repositoryGroup.getCronExpression() );
- File directory = repositoryGroupAdmin.getMergedIndexDirectory( repositoryGroup.getId() );
-
List<String> repositories = repositoryGroup.getRepositories();
IndexMergerRequest indexMergerRequest =
@@ -79,6 +75,9 @@ public class DefaultMergedRemoteIndexesScheduler
MergedRemoteIndexesTaskRequest taskRequest =
new MergedRemoteIndexesTaskRequest( indexMergerRequest, indexMerger );
+ logger.info( "schedule merge remote index for group {} with cron {}", repositoryGroup.getId(),
+ repositoryGroup.getCronExpression() );
+
ScheduledFuture scheduledFuture =
taskScheduler.schedule( new MergedRemoteIndexesTask( taskRequest ), cronTrigger );
scheduledFutureMap.put( repositoryGroup.getId(), scheduledFuture );
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/RepositoryGroup.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/RepositoryGroup.java
index 2064cc026..8a116e158 100644
--- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/RepositoryGroup.java
+++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/RepositoryGroup.java
@@ -176,7 +176,7 @@ public class RepositoryGroup
this.cronExpression = cronExpression;
}
- public RepositoryGroup mergedIndexCronExpression( String mergedIndexCronExpression )
+ public RepositoryGroup cronExpression( String mergedIndexCronExpression )
{
this.cronExpression = mergedIndexCronExpression;
return this;
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/group/DefaultRepositoryGroupAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/group/DefaultRepositoryGroupAdmin.java
index e35c74c06..abc3caae5 100644
--- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/group/DefaultRepositoryGroupAdmin.java
+++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/group/DefaultRepositoryGroupAdmin.java
@@ -84,7 +84,7 @@ public class DefaultRepositoryGroupAdmin
{
for ( RepositoryGroup repositoryGroup : getRepositoriesGroups() )
{
- mergedRemoteIndexesScheduler.schedule( repositoryGroup );
+ mergedRemoteIndexesScheduler.schedule( repositoryGroup, getMergedIndexDirectory( repositoryGroup.getId() ) );
}
}
catch ( RepositoryAdminException e )
@@ -112,7 +112,8 @@ public class DefaultRepositoryGroupAdmin
repositoriesGroups.add( new RepositoryGroup( repositoryGroupConfiguration.getId(), new ArrayList<String>(
repositoryGroupConfiguration.getRepositories() ) ).mergedIndexPath(
repositoryGroupConfiguration.getMergedIndexPath() ).mergedIndexTtl(
- repositoryGroupConfiguration.getMergedIndexTtl() ) );
+ repositoryGroupConfiguration.getMergedIndexTtl() ).cronExpression(
+ repositoryGroupConfiguration.getCronExpression() ) );
}
return repositoriesGroups;
@@ -148,7 +149,7 @@ public class DefaultRepositoryGroupAdmin
configuration.addRepositoryGroup( repositoryGroupConfiguration );
saveConfiguration( configuration );
triggerAuditEvent( repositoryGroup.getId(), null, AuditEvent.ADD_REPO_GROUP, auditInformation );
- mergedRemoteIndexesScheduler.schedule( repositoryGroup );
+ mergedRemoteIndexesScheduler.schedule( repositoryGroup, getMergedIndexDirectory( repositoryGroup.getId() ) );
return Boolean.TRUE;
}
@@ -202,7 +203,7 @@ public class DefaultRepositoryGroupAdmin
triggerAuditEvent( repositoryGroup.getId(), null, AuditEvent.MODIFY_REPO_GROUP, auditInformation );
}
mergedRemoteIndexesScheduler.unschedule( repositoryGroup );
- mergedRemoteIndexesScheduler.schedule( repositoryGroup );
+ mergedRemoteIndexesScheduler.schedule( repositoryGroup, getMergedIndexDirectory( repositoryGroup.getId() ) );
return Boolean.TRUE;
}