diff options
author | Olivier Lamy <olamy@apache.org> | 2013-12-17 07:29:51 +0000 |
---|---|---|
committer | Olivier Lamy <olamy@apache.org> | 2013-12-17 07:29:51 +0000 |
commit | 009686ad2d546baf389f7b79ab45e817c00bcc39 (patch) | |
tree | a1615eef9914eb7d9a048bb0d177aa554659ab93 /archiva-modules/archiva-base | |
parent | d5830c882e5d5c89aacf52522d3e496645a6583a (diff) | |
download | archiva-009686ad2d546baf389f7b79ab45e817c00bcc39.tar.gz archiva-009686ad2d546baf389f7b79ab45e817c00bcc39.zip |
add a nex flag to indicate the merged index is temporary
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1551477 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/archiva-base')
2 files changed, 30 insertions, 6 deletions
diff --git a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/DefaultIndexMerger.java b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/DefaultIndexMerger.java index 68ab59791..bc39b8da4 100644 --- a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/DefaultIndexMerger.java +++ b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/DefaultIndexMerger.java @@ -20,11 +20,15 @@ package org.apache.archiva.indexer.merger; import com.google.common.io.Files; +import org.apache.archiva.admin.model.RepositoryAdminException; +import org.apache.archiva.admin.model.beans.RepositoryGroup; +import org.apache.archiva.admin.model.group.RepositoryGroupAdmin; import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin; import org.apache.archiva.common.plexusbridge.MavenIndexerUtils; import org.apache.archiva.common.plexusbridge.PlexusSisuBridge; import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException; import org.apache.commons.io.FileUtils; +import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.time.StopWatch; import org.apache.maven.index.NexusIndexer; import org.apache.maven.index.context.IndexingContext; @@ -54,9 +58,6 @@ public class DefaultIndexMerger private Logger log = LoggerFactory.getLogger( getClass() ); - @Inject - private ManagedRepositoryAdmin managedRepositoryAdmin; - private MavenIndexerUtils mavenIndexerUtils; private NexusIndexer indexer; @@ -120,8 +121,12 @@ public class DefaultIndexMerger IndexPackingRequest request = new IndexPackingRequest( indexingContext, indexLocation ); indexPacker.packIndex( request ); } - temporaryGroupIndexes.add( new TemporaryGroupIndex( mergedIndexDirectory, tempRepoId, groupId, - indexMergerRequest.getMergedIndexTtl() ) ); + + if ( indexMergerRequest.isTemporary() ) + { + temporaryGroupIndexes.add( new TemporaryGroupIndex( mergedIndexDirectory, tempRepoId, groupId, + indexMergerRequest.getMergedIndexTtl() ) ); + } stopWatch.stop(); log.info( "merged index for repos {} in {} s", indexMergerRequest.getRepositoriesIds(), stopWatch.getTime() ); diff --git a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/IndexMergerRequest.java b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/IndexMergerRequest.java index 65ceb17d0..1209410b7 100644 --- a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/IndexMergerRequest.java +++ b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/IndexMergerRequest.java @@ -47,6 +47,8 @@ public class IndexMergerRequest private File mergedIndexDirectory; + private boolean temporary; + public IndexMergerRequest( Collection<String> repositoriesIds, boolean packIndex, String groupId ) { this.repositoriesIds = repositoriesIds; @@ -133,6 +135,22 @@ public class IndexMergerRequest return this; } + public boolean isTemporary() + { + return temporary; + } + + public void setTemporary( boolean temporary ) + { + this.temporary = temporary; + } + + + public IndexMergerRequest temporary( boolean temporary ) + { + this.temporary = temporary; + return this; + } @Override public String toString() @@ -143,7 +161,8 @@ public class IndexMergerRequest sb.append( ", groupId='" ).append( groupId ).append( '\'' ); sb.append( ", mergedIndexPath='" ).append( mergedIndexPath ).append( '\'' ); sb.append( ", mergedIndexTtl=" ).append( mergedIndexTtl ); - sb.append( ", mergedIndexDirectory='" ).append( mergedIndexDirectory ).append( '\'' ); + sb.append( ", mergedIndexDirectory=" ).append( mergedIndexDirectory ); + sb.append( ", temporary=" ).append( temporary ); sb.append( '}' ); return sb.toString(); } |