diff options
Diffstat (limited to 'archiva-modules/archiva-base')
44 files changed, 189 insertions, 74 deletions
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/pom.xml b/archiva-modules/archiva-base/archiva-artifact-converter/pom.xml index b1ce59a85..9268570f0 100644 --- a/archiva-modules/archiva-base/archiva-artifact-converter/pom.xml +++ b/archiva-modules/archiva-base/archiva-artifact-converter/pom.xml @@ -23,7 +23,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-base</artifactId> - <version>1.4-M4-SNAPSHOT</version> + <version>1.4-M5-SNAPSHOT</version> </parent> <artifactId>archiva-artifact-converter</artifactId> <packaging>bundle</packaging> diff --git a/archiva-modules/archiva-base/archiva-checksum/pom.xml b/archiva-modules/archiva-base/archiva-checksum/pom.xml index 2d481976a..a85ccb0a2 100644 --- a/archiva-modules/archiva-base/archiva-checksum/pom.xml +++ b/archiva-modules/archiva-base/archiva-checksum/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-base</artifactId> - <version>1.4-M4-SNAPSHOT</version> + <version>1.4-M5-SNAPSHOT</version> </parent> <artifactId>archiva-checksum</artifactId> <packaging>bundle</packaging> diff --git a/archiva-modules/archiva-base/archiva-common/pom.xml b/archiva-modules/archiva-base/archiva-common/pom.xml index b9d57c263..ddfb44350 100644 --- a/archiva-modules/archiva-base/archiva-common/pom.xml +++ b/archiva-modules/archiva-base/archiva-common/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-base</artifactId> - <version>1.4-M4-SNAPSHOT</version> + <version>1.4-M5-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>archiva-common</artifactId> diff --git a/archiva-modules/archiva-base/archiva-configuration/pom.xml b/archiva-modules/archiva-base/archiva-configuration/pom.xml index 3068537d9..d253c77e4 100644 --- a/archiva-modules/archiva-base/archiva-configuration/pom.xml +++ b/archiva-modules/archiva-base/archiva-configuration/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-base</artifactId> - <version>1.4-M4-SNAPSHOT</version> + <version>1.4-M5-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>archiva-configuration</artifactId> 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 43b383819..209e62b58 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 @@ -849,6 +849,14 @@ <description>The path of the merged index.</description> </field> <field> + <name>mergedIndexTtl</name> + <version>1.4.0+</version> + <type>int</type> + <required>false</required> + <defaultValue>30</defaultValue> + <description>The time to live of the merged index of the repository group.</description> + </field> + <field> <name>repositories</name> <version>1.2.0+</version> <association> diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-api/pom.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-api/pom.xml index bdceddfa2..92f8d12d9 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-api/pom.xml +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-api/pom.xml @@ -23,7 +23,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-consumers</artifactId> - <version>1.4-M4-SNAPSHOT</version> + <version>1.4-M5-SNAPSHOT</version> </parent> <artifactId>archiva-consumer-api</artifactId> <packaging>bundle</packaging> diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-archetype/pom.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-archetype/pom.xml index dd8cbd0e6..0e86f8263 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-archetype/pom.xml +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-archetype/pom.xml @@ -23,7 +23,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-consumers</artifactId> - <version>1.4-M4-SNAPSHOT</version> + <version>1.4-M5-SNAPSHOT</version> </parent> <artifactId>archiva-consumer-archetype</artifactId> <packaging>maven-archetype</packaging> diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/pom.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/pom.xml index 5f3c2f63f..03e675077 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/pom.xml +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/pom.xml @@ -23,7 +23,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-consumers</artifactId> - <version>1.4-M4-SNAPSHOT</version> + <version>1.4-M5-SNAPSHOT</version> </parent> <artifactId>archiva-core-consumers</artifactId> <packaging>bundle</packaging> diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java index 00cd4d241..1426cab8f 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java @@ -173,7 +173,7 @@ public class TestMetadataRepository return false; } - public Object obtainAccess( Class<?> aClass ) + public <T>T obtainAccess( Class<T> aClass ) { return null; } diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/pom.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/pom.xml index c07595bf9..c66af5f2d 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/pom.xml +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/pom.xml @@ -23,7 +23,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-consumers</artifactId> - <version>1.4-M4-SNAPSHOT</version> + <version>1.4-M5-SNAPSHOT</version> </parent> <artifactId>archiva-lucene-consumers</artifactId> <packaging>bundle</packaging> diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-metadata-consumer/pom.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-metadata-consumer/pom.xml index 9b7d1bc02..6a2fab9f1 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-metadata-consumer/pom.xml +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-metadata-consumer/pom.xml @@ -23,7 +23,7 @@ <parent> <artifactId>archiva-consumers</artifactId> <groupId>org.apache.archiva</groupId> - <version>1.4-M4-SNAPSHOT</version> + <version>1.4-M5-SNAPSHOT</version> </parent> <artifactId>archiva-metadata-consumer</artifactId> <packaging>bundle</packaging> diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-signature-consumers/pom.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-signature-consumers/pom.xml index b11a0e0a6..97d2da298 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-signature-consumers/pom.xml +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-signature-consumers/pom.xml @@ -20,7 +20,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-consumers</artifactId> - <version>1.4-M4-SNAPSHOT</version> + <version>1.4-M5-SNAPSHOT</version> </parent> <artifactId>archiva-signature-consumers</artifactId> diff --git a/archiva-modules/archiva-base/archiva-consumers/pom.xml b/archiva-modules/archiva-base/archiva-consumers/pom.xml index 2de964ed6..de25d15e6 100644 --- a/archiva-modules/archiva-base/archiva-consumers/pom.xml +++ b/archiva-modules/archiva-base/archiva-consumers/pom.xml @@ -23,7 +23,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-base</artifactId> - <version>1.4-M4-SNAPSHOT</version> + <version>1.4-M5-SNAPSHOT</version> </parent> <artifactId>archiva-consumers</artifactId> diff --git a/archiva-modules/archiva-base/archiva-converter/pom.xml b/archiva-modules/archiva-base/archiva-converter/pom.xml index 180955a9e..098a46f9f 100644 --- a/archiva-modules/archiva-base/archiva-converter/pom.xml +++ b/archiva-modules/archiva-base/archiva-converter/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-base</artifactId> - <version>1.4-M4-SNAPSHOT</version> + <version>1.4-M5-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>archiva-converter</artifactId> diff --git a/archiva-modules/archiva-base/archiva-indexer/pom.xml b/archiva-modules/archiva-base/archiva-indexer/pom.xml index 4070eb73c..f5e34fe98 100644 --- a/archiva-modules/archiva-base/archiva-indexer/pom.xml +++ b/archiva-modules/archiva-base/archiva-indexer/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-base</artifactId> - <version>1.4-M4-SNAPSHOT</version> + <version>1.4-M5-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>archiva-indexer</artifactId> 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..4a53182f8 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 @@ -19,6 +19,7 @@ package org.apache.archiva.indexer.merger; */ import com.google.common.io.Files; + import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin; import org.apache.archiva.common.plexusbridge.MavenIndexerUtils; import org.apache.archiva.common.plexusbridge.PlexusSisuBridge; @@ -35,7 +36,6 @@ import org.slf4j.LoggerFactory; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; -import javax.annotation.PostConstruct; import javax.inject.Inject; import java.io.File; import java.io.IOException; @@ -70,8 +70,6 @@ public class DefaultIndexMerger private List<TemporaryGroupIndex> temporaryGroupIndexes = new CopyOnWriteArrayList<TemporaryGroupIndex>(); - private int groupMergedIndexTtl; - @Inject public DefaultIndexMerger( PlexusSisuBridge plexusSisuBridge, MavenIndexerUtils mavenIndexerUtils ) throws PlexusSisuBridgeException @@ -81,12 +79,6 @@ public class DefaultIndexMerger indexPacker = plexusSisuBridge.lookup( IndexPacker.class, "default" ); } - @PostConstruct - public void intialize() - { - this.groupMergedIndexTtl = Integer.getInteger( IndexMerger.TMP_GROUP_INDEX_SYS_KEY, DEFAULT_GROUP_INDEX_TTL ); - } - public IndexingContext buildMergedIndex( IndexMergerRequest indexMergerRequest ) throws IndexMergerException { @@ -122,7 +114,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() ); @@ -170,9 +162,4 @@ public class DefaultIndexMerger { return this.temporaryGroupIndexes; } - - public int getGroupMergedIndexTtl() - { - return this.groupMergedIndexTtl; - } } diff --git a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/IndexMerger.java b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/IndexMerger.java index 462c3e4a1..756819e4f 100644 --- a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/IndexMerger.java +++ b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/IndexMerger.java @@ -28,12 +28,6 @@ import java.util.Collection; */ public interface IndexMerger { - - /** - * system property which contains the value in s for ttl of temporary index groups - */ - String TMP_GROUP_INDEX_SYS_KEY = "archiva.tmp.group.index.ttl"; - /** * @param indexMergerRequest * @return a temporary directory with a merge index (directory marked deleteOnExit) @@ -45,10 +39,4 @@ public interface IndexMerger void cleanTemporaryGroupIndex( TemporaryGroupIndex temporaryGroupIndex ); Collection<TemporaryGroupIndex> getTemporaryGroupIndexes(); - - /** - * @return ttl of temporay group index - */ - int getGroupMergedIndexTtl(); - } 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-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/mock/MockRepositorySessionFactory.java b/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/mock/MockRepositorySessionFactory.java index 66838594b..2acbcb57c 100644 --- a/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/mock/MockRepositorySessionFactory.java +++ b/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/mock/MockRepositorySessionFactory.java @@ -256,7 +256,7 @@ public class MockRepositorySessionFactory return false; //To change body of implemented methods use File | Settings | File Templates. } - public Object obtainAccess( Class<?> aClass ) + public <T>T obtainAccess( Class<T> aClass ) { return null; //To change body of implemented methods use File | Settings | File Templates. } diff --git a/archiva-modules/archiva-base/archiva-maven2-metadata/pom.xml b/archiva-modules/archiva-base/archiva-maven2-metadata/pom.xml index 5584d802d..bc322bc03 100644 --- a/archiva-modules/archiva-base/archiva-maven2-metadata/pom.xml +++ b/archiva-modules/archiva-base/archiva-maven2-metadata/pom.xml @@ -22,11 +22,10 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-base</artifactId> - <version>1.4-M4-SNAPSHOT</version> + <version>1.4-M5-SNAPSHOT</version> </parent> <artifactId>archiva-maven2-metadata</artifactId> - <version>1.4-M4-SNAPSHOT</version> <packaging>bundle</packaging> <name>Archiva Base :: Maven 2 Metadata</name> diff --git a/archiva-modules/archiva-base/archiva-maven2-model/pom.xml b/archiva-modules/archiva-base/archiva-maven2-model/pom.xml index 6c5e17662..f97271731 100644 --- a/archiva-modules/archiva-base/archiva-maven2-model/pom.xml +++ b/archiva-modules/archiva-base/archiva-maven2-model/pom.xml @@ -22,11 +22,10 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-base</artifactId> - <version>1.4-M4-SNAPSHOT</version> + <version>1.4-M5-SNAPSHOT</version> </parent> <artifactId>archiva-maven2-model</artifactId> - <version>1.4-M4-SNAPSHOT</version> <packaging>bundle</packaging> <name>Archiva Base :: Maven 2 Model</name> diff --git a/archiva-modules/archiva-base/archiva-model/pom.xml b/archiva-modules/archiva-base/archiva-model/pom.xml index a13aec642..dad15c4b8 100755 --- a/archiva-modules/archiva-base/archiva-model/pom.xml +++ b/archiva-modules/archiva-base/archiva-model/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-base</artifactId> - <version>1.4-M4-SNAPSHOT</version> + <version>1.4-M5-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>archiva-model</artifactId> diff --git a/archiva-modules/archiva-base/archiva-plexus-bridge/pom.xml b/archiva-modules/archiva-base/archiva-plexus-bridge/pom.xml index 339c95c70..8acffe4cc 100644 --- a/archiva-modules/archiva-base/archiva-plexus-bridge/pom.xml +++ b/archiva-modules/archiva-base/archiva-plexus-bridge/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-base</artifactId> - <version>1.4-M4-SNAPSHOT</version> + <version>1.4-M5-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>archiva-plexus-bridge</artifactId> diff --git a/archiva-modules/archiva-base/archiva-policies/pom.xml b/archiva-modules/archiva-base/archiva-policies/pom.xml index 4716fb244..919b140ac 100644 --- a/archiva-modules/archiva-base/archiva-policies/pom.xml +++ b/archiva-modules/archiva-base/archiva-policies/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-base</artifactId> - <version>1.4-M4-SNAPSHOT</version> + <version>1.4-M5-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>archiva-policies</artifactId> diff --git a/archiva-modules/archiva-base/archiva-proxy-api/pom.xml b/archiva-modules/archiva-base/archiva-proxy-api/pom.xml index f729a3946..52ee68c2e 100644 --- a/archiva-modules/archiva-base/archiva-proxy-api/pom.xml +++ b/archiva-modules/archiva-base/archiva-proxy-api/pom.xml @@ -22,7 +22,7 @@ <parent> <artifactId>archiva-base</artifactId> <groupId>org.apache.archiva</groupId> - <version>1.4-M4-SNAPSHOT</version> + <version>1.4-M5-SNAPSHOT</version> </parent> <artifactId>archiva-proxy-api</artifactId> <packaging>bundle</packaging> diff --git a/archiva-modules/archiva-base/archiva-proxy-common/pom.xml b/archiva-modules/archiva-base/archiva-proxy-common/pom.xml index cc3285a0e..62c957399 100644 --- a/archiva-modules/archiva-base/archiva-proxy-common/pom.xml +++ b/archiva-modules/archiva-base/archiva-proxy-common/pom.xml @@ -22,7 +22,7 @@ <parent> <artifactId>archiva-base</artifactId> <groupId>org.apache.archiva</groupId> - <version>1.4-M4-SNAPSHOT</version> + <version>1.4-M5-SNAPSHOT</version> </parent> <artifactId>archiva-proxy-common</artifactId> <packaging>bundle</packaging> diff --git a/archiva-modules/archiva-base/archiva-proxy/pom.xml b/archiva-modules/archiva-base/archiva-proxy/pom.xml index 2c0b46998..fd661ac1c 100644 --- a/archiva-modules/archiva-base/archiva-proxy/pom.xml +++ b/archiva-modules/archiva-base/archiva-proxy/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-base</artifactId> - <version>1.4-M4-SNAPSHOT</version> + <version>1.4-M5-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>archiva-proxy</artifactId> diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java index d7c52cea3..533951968 100644 --- a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java +++ b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java @@ -178,7 +178,7 @@ public class TestMetadataRepository return false; } - public Object obtainAccess( Class<?> aClass ) + public <T>T obtainAccess( Class<T> aClass ) { return null; //To change body of implemented methods use File | Settings | File Templates. } diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/pom.xml b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/pom.xml index 8ecfc6ffd..66a0b7fda 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/pom.xml +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/pom.xml @@ -23,7 +23,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-repository-admin</artifactId> - <version>1.4-M4-SNAPSHOT</version> + <version>1.4-M5-SNAPSHOT</version> </parent> <artifactId>archiva-repository-admin-api</artifactId> <packaging>bundle</packaging> 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 371e7d488..047724dbe 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 @@ -46,6 +46,11 @@ public class RepositoryGroup */ private String mergedIndexPath = "/.indexer"; + /** + * The TTL (time to live) of the repo group's merged index. + */ + private int mergedIndexTtl = 30; + public RepositoryGroup() { // no op @@ -132,12 +137,29 @@ public class RepositoryGroup this.mergedIndexPath = mergedIndexPath; } - public RepositoryGroup mergedIndexPath( String mergedIndexPath ) - { + public int getMergedIndexTtl() { + return mergedIndexTtl; + } + + /** + * Set the TTL of the repo group's merged index. + * + * @param mergedIndexTtl + */ + public void setMergedIndexTtl(int mergedIndexTtl) { + this.mergedIndexTtl = mergedIndexTtl; + } + + public RepositoryGroup mergedIndexPath( String mergedIndexPath ) { this.mergedIndexPath = mergedIndexPath; return this; } + public RepositoryGroup mergedIndexTtl( int mergedIndexTtl ) { + this.mergedIndexTtl = mergedIndexTtl; + return this; + } + public boolean equals( Object other ) { if ( this == other ) diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml index 168b02209..ee4b42c67 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml @@ -23,7 +23,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-repository-admin</artifactId> - <version>1.4-M4-SNAPSHOT</version> + <version>1.4-M5-SNAPSHOT</version> </parent> <artifactId>archiva-repository-admin-default</artifactId> <packaging>bundle</packaging> 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 047b8494b..ef43c1042 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 @@ -68,7 +68,7 @@ public class DefaultRepositoryGroupAdmin { repositoriesGroups.add( new RepositoryGroup( repositoryGroupConfiguration.getId(), new ArrayList<String>( repositoryGroupConfiguration.getRepositories() ) ).mergedIndexPath( - repositoryGroupConfiguration.getMergedIndexPath() ) ); + repositoryGroupConfiguration.getMergedIndexPath() ).mergedIndexTtl( repositoryGroupConfiguration.getMergedIndexTtl() ) ); } return repositoriesGroups; @@ -93,10 +93,12 @@ public class DefaultRepositoryGroupAdmin { validateRepositoryGroup( repositoryGroup, false ); validateManagedRepositoriesExists( repositoryGroup.getRepositories() ); + RepositoryGroupConfiguration repositoryGroupConfiguration = new RepositoryGroupConfiguration(); repositoryGroupConfiguration.setId( repositoryGroup.getId() ); repositoryGroupConfiguration.setRepositories( repositoryGroup.getRepositories() ); repositoryGroupConfiguration.setMergedIndexPath( repositoryGroup.getMergedIndexPath() ); + repositoryGroupConfiguration.setMergedIndexTtl( repositoryGroup.getMergedIndexTtl() ); Configuration configuration = getArchivaConfiguration().getConfiguration(); configuration.addRepositoryGroup( repositoryGroupConfiguration ); saveConfiguration( configuration ); @@ -141,6 +143,7 @@ public class DefaultRepositoryGroupAdmin repositoryGroupConfiguration.setRepositories( repositoryGroup.getRepositories() ); repositoryGroupConfiguration.setMergedIndexPath( repositoryGroup.getMergedIndexPath() ); + repositoryGroupConfiguration.setMergedIndexTtl( repositoryGroup.getMergedIndexTtl() ); configuration.addRepositoryGroup( repositoryGroupConfiguration ); saveConfiguration( configuration ); @@ -282,6 +285,11 @@ public class DefaultRepositoryGroupAdmin "Invalid character(s) found in identifier. Only the following characters are allowed: alphanumeric, '.', '-' and '_'" ); } + if ( repositoryGroup.getMergedIndexTtl() <= 0) + { + throw new RepositoryAdminException( "Merged Index TTL must be greater than 0." ); + } + Configuration configuration = getArchivaConfiguration().getConfiguration(); if ( configuration.getRepositoryGroupsAsMap().containsKey( repoGroupId ) ) diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/mock/MockRepositorySessionFactory.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/mock/MockRepositorySessionFactory.java index c594a9e75..7be9d6cb7 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/mock/MockRepositorySessionFactory.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/mock/MockRepositorySessionFactory.java @@ -256,7 +256,7 @@ public class MockRepositorySessionFactory return false; //To change body of implemented methods use File | Settings | File Templates. } - public Object obtainAccess( Class<?> aClass ) + public <T>T obtainAccess( Class<T> aClass ) { return null; //To change body of implemented methods use File | Settings | File Templates. } diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/group/RepositoryGroupAdminTest.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/group/RepositoryGroupAdminTest.java index 84135d4d8..a79d724d0 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/group/RepositoryGroupAdminTest.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/group/RepositoryGroupAdminTest.java @@ -18,6 +18,7 @@ package org.apache.archiva.admin.repository.group; * under the License. */ +import org.apache.archiva.admin.model.RepositoryAdminException; import org.apache.archiva.admin.model.beans.ManagedRepository; import org.apache.archiva.admin.model.beans.RepositoryGroup; import org.apache.archiva.admin.model.group.RepositoryGroupAdmin; @@ -67,6 +68,10 @@ public class RepositoryGroupAdminTest assertEquals( Arrays.asList( "test-new-one", "test-new-two" ), repositoryGroupAdmin.getRepositoriesGroups().get( 0 ).getRepositories() ); + // verify if default values were saved + assertEquals(30, repositoryGroupAdmin.getRepositoriesGroups().get( 0 ).getMergedIndexTtl() ); + assertEquals("/.indexer", repositoryGroupAdmin.getRepositoriesGroups().get( 0 ).getMergedIndexPath() ); + repositoryGroupAdmin.deleteRepositoryGroup( "repo-group-one", getFakeAuditInformation() ); assertEquals( 0, repositoryGroupAdmin.getRepositoriesGroups().size() ); @@ -100,7 +105,8 @@ public class RepositoryGroupAdminTest managedRepositoryAdmin.addManagedRepository( managedRepositoryTwo, false, getFakeAuditInformation() ); - RepositoryGroup repositoryGroup = new RepositoryGroup( "repo-group-one", Arrays.asList( "test-new-one" ) ); + RepositoryGroup repositoryGroup = new RepositoryGroup( "repo-group-one", Arrays.asList( "test-new-one" ) ) + .mergedIndexTtl( 20 ).mergedIndexPath( "/.nonDefaultPath" ); mockAuditListener.clearEvents(); @@ -111,6 +117,8 @@ public class RepositoryGroupAdminTest assertEquals( 1, repositoryGroupAdmin.getRepositoriesGroups().get( 0 ).getRepositories().size() ); assertEquals( Arrays.asList( "test-new-one" ), repositoryGroupAdmin.getRepositoriesGroups().get( 0 ).getRepositories() ); + assertEquals( 20, repositoryGroupAdmin.getRepositoriesGroups().get( 0 ).getMergedIndexTtl() ); + assertEquals( "/.nonDefaultPath", repositoryGroupAdmin.getRepositoriesGroups().get( 0 ).getMergedIndexPath() ); repositoryGroup = repositoryGroupAdmin.getRepositoryGroup( "repo-group-one" ); assertNotNull( repositoryGroup ); @@ -143,9 +151,8 @@ public class RepositoryGroupAdminTest } } - @Test - public void addAndDeleteGroupWithRemowingManagedRepo() + public void addAndDeleteGroupWithRemovedManagedRepo() throws Exception { try @@ -199,4 +206,78 @@ public class RepositoryGroupAdminTest managedRepositoryAdmin.deleteManagedRepository( "test-new-two", getFakeAuditInformation(), true ); } } + + @Test( expected = RepositoryAdminException.class ) + public void testAddGroupWithInvalidMergedIndexTtl() throws Exception { + try { + ManagedRepository managedRepositoryOne = + getTestManagedRepository( "test-new-one", APPSERVER_BASE_PATH + File.separator + "test-new-one" ); + + ManagedRepository managedRepositoryTwo = + getTestManagedRepository( "test-new-two", APPSERVER_BASE_PATH + File.separator + "test-new-two" ); + + managedRepositoryAdmin.addManagedRepository( managedRepositoryOne, false, getFakeAuditInformation() ); + + managedRepositoryAdmin.addManagedRepository( managedRepositoryTwo, false, getFakeAuditInformation() ); + + RepositoryGroup repositoryGroup = + new RepositoryGroup( "repo-group-one", Arrays.asList( "test-new-one", "test-new-two" ) ) + .mergedIndexTtl( -1 ); + + mockAuditListener.clearEvents(); + + repositoryGroupAdmin.addRepositoryGroup( repositoryGroup, getFakeAuditInformation() ); + } + finally + { + mockAuditListener.clearEvents(); + managedRepositoryAdmin.deleteManagedRepository( "test-new-one", getFakeAuditInformation(), true ); + managedRepositoryAdmin.deleteManagedRepository( "test-new-two", getFakeAuditInformation(), true ); + } + } + + @Test( expected = RepositoryAdminException.class ) + public void testAddAndUpdateGroupWithInvalidMergedIndexTtl() throws Exception { + try { + ManagedRepository managedRepositoryOne = + getTestManagedRepository( "test-new-one", APPSERVER_BASE_PATH + File.separator + "test-new-one" ); + + ManagedRepository managedRepositoryTwo = + getTestManagedRepository( "test-new-two", APPSERVER_BASE_PATH + File.separator + "test-new-two" ); + + managedRepositoryAdmin.addManagedRepository( managedRepositoryOne, false, getFakeAuditInformation() ); + + managedRepositoryAdmin.addManagedRepository( managedRepositoryTwo, false, getFakeAuditInformation() ); + + RepositoryGroup repositoryGroup = + new RepositoryGroup( "repo-group-one", Arrays.asList( "test-new-one", "test-new-two" ) ); + + mockAuditListener.clearEvents(); + + repositoryGroupAdmin.addRepositoryGroup( repositoryGroup, getFakeAuditInformation() ); + + assertEquals( 1, repositoryGroupAdmin.getRepositoriesGroups().size() ); + assertEquals( "repo-group-one", repositoryGroupAdmin.getRepositoriesGroups().get( 0 ).getId() ); + assertEquals( 2, repositoryGroupAdmin.getRepositoriesGroups().get( 0 ).getRepositories().size() ); + assertEquals( Arrays.asList( "test-new-one", "test-new-two" ), + repositoryGroupAdmin.getRepositoriesGroups().get( 0 ).getRepositories() ); + + // verify if default values were saved + assertEquals(30, repositoryGroupAdmin.getRepositoriesGroups().get( 0 ).getMergedIndexTtl() ); + assertEquals("/.indexer", repositoryGroupAdmin.getRepositoriesGroups().get( 0 ).getMergedIndexPath() ); + + repositoryGroup = repositoryGroupAdmin.getRepositoryGroup( "repo-group-one" ); + assertNotNull( repositoryGroup ); + + repositoryGroup.mergedIndexTtl( -1 ); + + repositoryGroupAdmin.updateRepositoryGroup( repositoryGroup, getFakeAuditInformation() ); + } + finally + { + mockAuditListener.clearEvents(); + managedRepositoryAdmin.deleteManagedRepository( "test-new-one", getFakeAuditInformation(), true ); + managedRepositoryAdmin.deleteManagedRepository( "test-new-two", getFakeAuditInformation(), true ); + } + } } diff --git a/archiva-modules/archiva-base/archiva-repository-admin/pom.xml b/archiva-modules/archiva-base/archiva-repository-admin/pom.xml index c92cae4e6..c531fd05b 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/pom.xml +++ b/archiva-modules/archiva-base/archiva-repository-admin/pom.xml @@ -23,7 +23,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-base</artifactId> - <version>1.4-M4-SNAPSHOT</version> + <version>1.4-M5-SNAPSHOT</version> </parent> <artifactId>archiva-repository-admin</artifactId> <name>Archiva Base :: Repository Admin</name> diff --git a/archiva-modules/archiva-base/archiva-repository-layer/pom.xml b/archiva-modules/archiva-base/archiva-repository-layer/pom.xml index 7571ad42c..46c6dc6c7 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/pom.xml +++ b/archiva-modules/archiva-base/archiva-repository-layer/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-base</artifactId> - <version>1.4-M4-SNAPSHOT</version> + <version>1.4-M5-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>archiva-repository-layer</artifactId> diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/pom.xml b/archiva-modules/archiva-base/archiva-repository-scanner/pom.xml index 48c45607c..a33e050ca 100644 --- a/archiva-modules/archiva-base/archiva-repository-scanner/pom.xml +++ b/archiva-modules/archiva-base/archiva-repository-scanner/pom.xml @@ -23,7 +23,7 @@ <parent> <artifactId>archiva-base</artifactId> <groupId>org.apache.archiva</groupId> - <version>1.4-M4-SNAPSHOT</version> + <version>1.4-M5-SNAPSHOT</version> </parent> <artifactId>archiva-repository-scanner</artifactId> <packaging>bundle</packaging> diff --git a/archiva-modules/archiva-base/archiva-security-common/pom.xml b/archiva-modules/archiva-base/archiva-security-common/pom.xml index 5381565c3..b5428aaf1 100644 --- a/archiva-modules/archiva-base/archiva-security-common/pom.xml +++ b/archiva-modules/archiva-base/archiva-security-common/pom.xml @@ -22,7 +22,7 @@ <parent> <artifactId>archiva-base</artifactId> <groupId>org.apache.archiva</groupId> - <version>1.4-M4-SNAPSHOT</version> + <version>1.4-M5-SNAPSHOT</version> </parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-security-common</artifactId> diff --git a/archiva-modules/archiva-base/archiva-test-utils/pom.xml b/archiva-modules/archiva-base/archiva-test-utils/pom.xml index 5f8b149b2..78f221ee4 100644 --- a/archiva-modules/archiva-base/archiva-test-utils/pom.xml +++ b/archiva-modules/archiva-base/archiva-test-utils/pom.xml @@ -22,7 +22,7 @@ <parent> <artifactId>archiva-base</artifactId> <groupId>org.apache.archiva</groupId> - <version>1.4-M4-SNAPSHOT</version> + <version>1.4-M5-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>archiva-test-utils</artifactId> diff --git a/archiva-modules/archiva-base/archiva-transaction/pom.xml b/archiva-modules/archiva-base/archiva-transaction/pom.xml index 832b7610b..6b40cb60d 100644 --- a/archiva-modules/archiva-base/archiva-transaction/pom.xml +++ b/archiva-modules/archiva-base/archiva-transaction/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-base</artifactId> - <version>1.4-M4-SNAPSHOT</version> + <version>1.4-M5-SNAPSHOT</version> </parent> <artifactId>archiva-transaction</artifactId> <packaging>bundle</packaging> diff --git a/archiva-modules/archiva-base/archiva-xml-tools/pom.xml b/archiva-modules/archiva-base/archiva-xml-tools/pom.xml index 1b726e4e6..67ffd959c 100644 --- a/archiva-modules/archiva-base/archiva-xml-tools/pom.xml +++ b/archiva-modules/archiva-base/archiva-xml-tools/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-base</artifactId> - <version>1.4-M4-SNAPSHOT</version> + <version>1.4-M5-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>archiva-xml-tools</artifactId> diff --git a/archiva-modules/archiva-base/pom.xml b/archiva-modules/archiva-base/pom.xml index 10b001b7c..a9ce3f587 100644 --- a/archiva-modules/archiva-base/pom.xml +++ b/archiva-modules/archiva-base/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-modules</artifactId> - <version>1.4-M4-SNAPSHOT</version> + <version>1.4-M5-SNAPSHOT</version> </parent> <artifactId>archiva-base</artifactId> |