aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaria Odea B. Ching <oching@apache.org>2013-05-20 06:24:33 +0000
committerMaria Odea B. Ching <oching@apache.org>2013-05-20 06:24:33 +0000
commit04bb7a29d3b23042655238575fd23875039f13d3 (patch)
treee578d9e885427921bcaec25803cb86384e5063a2
parentcfaf9559dd58f0b52ddd3bb906ff5f428c7e6486 (diff)
downloadarchiva-04bb7a29d3b23042655238575fd23875039f13d3.tar.gz
archiva-04bb7a29d3b23042655238575fd23875039f13d3.zip
[MRM-1751] include mergedIndexTtl in temporary group index & indexmergerrequest so the repo config for ttl will be used upon clean up instead of the default config
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1484377 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/DefaultIndexMerger.java2
-rw-r--r--archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/IndexMergerRequest.java16
-rw-r--r--archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/TemporaryGroupIndex.java13
-rw-r--r--archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/TemporaryGroupIndexCleaner.java2
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java6
5 files changed, 31 insertions, 8 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 77618be8b..e97de6ff8 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
@@ -122,7 +122,7 @@ public class DefaultIndexMerger
indexPacker.packIndex( request );
}
temporaryGroupIndexes.add(
- new TemporaryGroupIndex( tempRepoFile, tempRepoId, indexMergerRequest.getGroupId() ) );
+ new TemporaryGroupIndex( tempRepoFile, tempRepoId, indexMergerRequest.getGroupId(), 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 76d238fd2..a7a3b656f 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
@@ -42,6 +42,8 @@ public class IndexMergerRequest
private String mergedIndexPath = "/.indexer";
+ private int mergedIndexTtl;
+
public IndexMergerRequest( Collection<String> repositoriesIds, boolean packIndex, String groupId )
{
this.repositoriesIds = repositoriesIds;
@@ -52,13 +54,14 @@ public class IndexMergerRequest
/**
* @since 1.4-M4
*/
- public IndexMergerRequest( Collection<String> repositoriesIds, boolean packIndex, String groupId,
- String mergedIndexPath )
+ public IndexMergerRequest(Collection<String> repositoriesIds, boolean packIndex, String groupId,
+ String mergedIndexPath, int mergedIndexTtl)
{
this.repositoriesIds = repositoriesIds;
this.packIndex = packIndex;
this.groupId = groupId;
this.mergedIndexPath = mergedIndexPath;
+ this.mergedIndexTtl = mergedIndexTtl;
}
public Collection<String> getRepositoriesIds()
@@ -101,6 +104,14 @@ public class IndexMergerRequest
this.mergedIndexPath = mergedIndexPath;
}
+ public int getMergedIndexTtl() {
+ return mergedIndexTtl;
+ }
+
+ public void setMergedIndexTtl(int mergedIndexTtl) {
+ this.mergedIndexTtl = mergedIndexTtl;
+ }
+
@Override
public String toString()
{
@@ -109,6 +120,7 @@ public class IndexMergerRequest
sb.append( ", packIndex=" ).append( packIndex );
sb.append( ", groupId='" ).append( groupId ).append( '\'' );
sb.append( ", mergedIndexPath='" ).append( mergedIndexPath ).append( '\'' );
+ sb.append( ", mergedIndexTtl='" ).append( mergedIndexTtl ).append( '\'' );
sb.append( '}' );
return sb.toString();
}
diff --git a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/TemporaryGroupIndex.java b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/TemporaryGroupIndex.java
index 9152160b0..9ab06d647 100644
--- a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/TemporaryGroupIndex.java
+++ b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/TemporaryGroupIndex.java
@@ -36,11 +36,14 @@ public class TemporaryGroupIndex
private String groupId;
- public TemporaryGroupIndex( File directory, String indexId, String groupId )
+ private int mergedIndexTtl;
+
+ public TemporaryGroupIndex(File directory, String indexId, String groupId, int mergedIndexTtl)
{
this.directory = directory;
this.indexId = indexId;
this.groupId = groupId;
+ this.mergedIndexTtl = mergedIndexTtl;
}
public long getCreationTime()
@@ -86,6 +89,14 @@ public class TemporaryGroupIndex
this.groupId = groupId;
}
+ public int getMergedIndexTtl() {
+ return mergedIndexTtl;
+ }
+
+ public void setMergedIndexTtl(int mergedIndexTtl) {
+ this.mergedIndexTtl = mergedIndexTtl;
+ }
+
@Override
public int hashCode()
{
diff --git a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/TemporaryGroupIndexCleaner.java b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/TemporaryGroupIndexCleaner.java
index e34b24991..322d82e06 100644
--- a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/TemporaryGroupIndexCleaner.java
+++ b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/TemporaryGroupIndexCleaner.java
@@ -58,7 +58,7 @@ public class TemporaryGroupIndexCleaner
for ( TemporaryGroupIndex temporaryGroupIndex : indexMerger.getTemporaryGroupIndexes() )
{
// cleanup files older than the ttl
- if ( new Date().getTime() - temporaryGroupIndex.getCreationTime() > indexMerger.getGroupMergedIndexTtl() )
+ if ( new Date().getTime() - temporaryGroupIndex.getCreationTime() > temporaryGroupIndex.getMergedIndexTtl() )
{
log.info( "cleanTemporaryIndex for groupId {}", temporaryGroupIndex.getGroupId() );
indexMerger.cleanTemporaryGroupIndex( temporaryGroupIndex );
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java
index 67f0c1786..d9d1754e8 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java
@@ -1240,11 +1240,11 @@ public class ArchivaDavResourceFactory
repositoryGroupConfiguration.getId(), authzRepos );
IndexingContext indexingContext = indexMerger.buildMergedIndex(
new IndexMergerRequest( authzRepos, true, repositoryGroupConfiguration.getId(),
- repositoryGroupConfiguration.getMergedIndexPath() ) );
+ repositoryGroupConfiguration.getMergedIndexPath(), repositoryGroupConfiguration.getMergedIndexTtl() ) );
File mergedRepoDir = indexingContext.getIndexDirectoryFile();
TemporaryGroupIndex temporaryGroupIndex = new TemporaryGroupIndex( mergedRepoDir, indexingContext.getId(),
- repositoryGroupConfiguration.getId() ).setCreationTime(
- new Date().getTime() );
+ repositoryGroupConfiguration.getId(),repositoryGroupConfiguration.getMergedIndexTtl() )
+ .setCreationTime(new Date().getTime() );
temporaryGroupIndexMap.put( repositoryGroupConfiguration.getId(), temporaryGroupIndex );
session.setAttribute( TemporaryGroupIndexSessionCleaner.TEMPORARY_INDEX_SESSION_KEY,
temporaryGroupIndexMap );