aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Stockhammer <martin_s@apache.org>2019-06-06 21:36:46 +0200
committerMartin Stockhammer <martin_s@apache.org>2019-06-06 21:36:46 +0200
commitc2bbd80b1b728fb6e7bff05d6fe2123c8b0f6122 (patch)
tree1227739dbb9f7975c825687b4763c97ccd4f1c6c
parent6c0afa8b8f2210fa32644cf17a8fa004a98719db (diff)
downloadarchiva-c2bbd80b1b728fb6e7bff05d6fe2123c8b0f6122.tar.gz
archiva-c2bbd80b1b728fb6e7bff05d6fe2123c8b0f6122.zip
Adding type for repository group config
-rw-r--r--archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/RepositoryGroupConfiguration.java17
-rw-r--r--archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/io/registry/ConfigurationRegistryReader.java1
-rw-r--r--archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/io/registry/ConfigurationRegistryWriter.java3
-rw-r--r--archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/indexer/merger/IndexMerger.java (renamed from archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/indexer/merger/IndexMerger.java)4
-rw-r--r--archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/indexer/merger/IndexMergerException.java (renamed from archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/indexer/merger/IndexMergerException.java)0
-rw-r--r--archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/indexer/merger/IndexMergerRequest.java (renamed from archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/indexer/merger/IndexMergerRequest.java)0
-rw-r--r--archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/indexer/merger/MergedRemoteIndexesScheduler.java (renamed from archiva-modules/archiva-scheduler/archiva-scheduler-api/src/main/java/org/apache/archiva/scheduler/MergedRemoteIndexesScheduler.java)5
-rw-r--r--archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/indexer/merger/TemporaryGroupIndex.java (renamed from archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/indexer/merger/TemporaryGroupIndex.java)0
-rw-r--r--archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/indexer/merger/DefaultMergedRemoteIndexesScheduler.java (renamed from archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/indexer/merger/DefaultMergedRemoteIndexesScheduler.java)19
-rw-r--r--archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/indexer/merger/MergedRemoteIndexesTask.java (renamed from archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/indexer/merger/MergedRemoteIndexesTask.java)4
-rw-r--r--archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/indexer/merger/MergedRemoteIndexesTaskRequest.java (renamed from archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/indexer/merger/MergedRemoteIndexesTaskRequest.java)0
-rw-r--r--archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/indexer/merger/MergedRemoteIndexesTaskResult.java (renamed from archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/indexer/merger/MergedRemoteIndexesTaskResult.java)10
-rw-r--r--archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/indexer/merger/TemporaryGroupIndexCleaner.java (renamed from archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/indexer/merger/TemporaryGroupIndexCleaner.java)0
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/indexer/maven/DefaultIndexMerger.java (renamed from archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/indexer/maven/merger/DefaultIndexMerger.java)6
14 files changed, 48 insertions, 21 deletions
diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/RepositoryGroupConfiguration.java b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/RepositoryGroupConfiguration.java
index d2cc9cb27..db3498be3 100644
--- a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/RepositoryGroupConfiguration.java
+++ b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/RepositoryGroupConfiguration.java
@@ -48,6 +48,15 @@ public class RepositoryGroupConfiguration
private String name;
/**
+ *
+ * The repository type. Currently only MAVEN type
+ * is known.
+ *
+ */
+ private String type = "MAVEN";
+
+
+ /**
* The path of the merged index.
*/
private String mergedIndexPath = ".indexer";
@@ -211,4 +220,12 @@ public class RepositoryGroupConfiguration
public void setName(String name) {
this.name = name;
}
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
}
diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/io/registry/ConfigurationRegistryReader.java b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/io/registry/ConfigurationRegistryReader.java
index 7c0535e8b..8c0ff5d56 100644
--- a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/io/registry/ConfigurationRegistryReader.java
+++ b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/io/registry/ConfigurationRegistryReader.java
@@ -731,6 +731,7 @@ public class ConfigurationRegistryReader {
value.setId(id);
value.setName(registry.getString(prefix + "name"));
+ value.setType(registry.getString(prefix + "type"));
//String mergedIndexPath = registry.getString( prefix + "mergedIndexPath", value.getMergedIndexPath() );
diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/io/registry/ConfigurationRegistryWriter.java b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/io/registry/ConfigurationRegistryWriter.java
index 915cd8b8e..786b027a9 100644
--- a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/io/registry/ConfigurationRegistryWriter.java
+++ b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/io/registry/ConfigurationRegistryWriter.java
@@ -422,6 +422,9 @@ public class ConfigurationRegistryWriter {
if (value.getName() != null) {
registry.setString(prefix + "name", value.getName());
}
+ if (value.getType() != null) {
+ registry.setString(prefix + "type", value.getType());
+ }
if (value.getMergedIndexPath() != null && !value.getMergedIndexPath().equals(".indexer")
) {
String mergedIndexPath = "mergedIndexPath";
diff --git a/archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/indexer/merger/IndexMerger.java b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/indexer/merger/IndexMerger.java
index 756819e4f..79c7466cc 100644
--- a/archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/indexer/merger/IndexMerger.java
+++ b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/indexer/merger/IndexMerger.java
@@ -18,7 +18,7 @@ package org.apache.archiva.indexer.merger;
* under the License.
*/
-import org.apache.maven.index.context.IndexingContext;
+import org.apache.archiva.indexer.ArchivaIndexingContext;
import java.util.Collection;
@@ -33,7 +33,7 @@ public interface IndexMerger
* @return a temporary directory with a merge index (directory marked deleteOnExit)
* @throws IndexMergerException
*/
- IndexingContext buildMergedIndex( IndexMergerRequest indexMergerRequest )
+ ArchivaIndexingContext buildMergedIndex(IndexMergerRequest indexMergerRequest )
throws IndexMergerException;
void cleanTemporaryGroupIndex( TemporaryGroupIndex temporaryGroupIndex );
diff --git a/archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/indexer/merger/IndexMergerException.java b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/indexer/merger/IndexMergerException.java
index 3930831d6..3930831d6 100644
--- a/archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/indexer/merger/IndexMergerException.java
+++ b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/indexer/merger/IndexMergerException.java
diff --git a/archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/indexer/merger/IndexMergerRequest.java b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/indexer/merger/IndexMergerRequest.java
index 0b3803f48..0b3803f48 100644
--- a/archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/indexer/merger/IndexMergerRequest.java
+++ b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/indexer/merger/IndexMergerRequest.java
diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-api/src/main/java/org/apache/archiva/scheduler/MergedRemoteIndexesScheduler.java b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/indexer/merger/MergedRemoteIndexesScheduler.java
index cd9520cba..9ba97e701 100644
--- a/archiva-modules/archiva-scheduler/archiva-scheduler-api/src/main/java/org/apache/archiva/scheduler/MergedRemoteIndexesScheduler.java
+++ b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/indexer/merger/MergedRemoteIndexesScheduler.java
@@ -19,7 +19,8 @@ package org.apache.archiva.scheduler;
* under the License.
*/
-import org.apache.archiva.admin.model.beans.RepositoryGroup;
+
+import org.apache.archiva.repository.RepositoryGroup;
import java.nio.file.Path;
@@ -35,7 +36,7 @@ public interface MergedRemoteIndexesScheduler
* remote indexes
* @param repositoryGroup
*/
- void schedule( RepositoryGroup repositoryGroup, Path directory );
+ void schedule(RepositoryGroup repositoryGroup, Path directory );
void unschedule( RepositoryGroup repositoryGroup );
diff --git a/archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/indexer/merger/TemporaryGroupIndex.java b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/indexer/merger/TemporaryGroupIndex.java
index d0b576b74..d0b576b74 100644
--- a/archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/indexer/merger/TemporaryGroupIndex.java
+++ b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/indexer/merger/TemporaryGroupIndex.java
diff --git a/archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/indexer/merger/DefaultMergedRemoteIndexesScheduler.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/indexer/merger/DefaultMergedRemoteIndexesScheduler.java
index f0fbcbd31..0e918a58c 100644
--- a/archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/indexer/merger/DefaultMergedRemoteIndexesScheduler.java
+++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/indexer/merger/DefaultMergedRemoteIndexesScheduler.java
@@ -19,7 +19,8 @@ package org.apache.archiva.indexer.merger;
* under the License.
*/
-import org.apache.archiva.admin.model.beans.RepositoryGroup;
+import org.apache.archiva.repository.ManagedRepository;
+import org.apache.archiva.repository.RepositoryGroup;
import org.apache.archiva.scheduler.MergedRemoteIndexesScheduler;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
@@ -35,6 +36,7 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ScheduledFuture;
+import java.util.stream.Collectors;
/**
* @author Olivier Lamy
@@ -57,25 +59,26 @@ public class DefaultMergedRemoteIndexesScheduler
private Map<String, ScheduledFuture> scheduledFutureMap = new ConcurrentHashMap<>();
@Override
- public void schedule( RepositoryGroup repositoryGroup, Path directory )
+ public void schedule(RepositoryGroup repositoryGroup, Path directory )
{
- if ( StringUtils.isEmpty( repositoryGroup.getCronExpression() ) )
+ if ( StringUtils.isEmpty( repositoryGroup.getSchedulingDefinition() ) )
{
return;
}
- CronTrigger cronTrigger = new CronTrigger( repositoryGroup.getCronExpression() );
+ CronTrigger cronTrigger = new CronTrigger( repositoryGroup.getSchedulingDefinition() );
- List<String> repositories = repositoryGroup.getRepositories();
+ List<ManagedRepository> repositories = repositoryGroup.getRepositories();
IndexMergerRequest indexMergerRequest =
- new IndexMergerRequest( repositories, true, repositoryGroup.getId(), repositoryGroup.getMergedIndexPath(),
- repositoryGroup.getMergedIndexTtl() ).mergedIndexDirectory( directory );
+ new IndexMergerRequest( repositories.stream().map(r -> r.getId()).collect(Collectors.toList()), true, repositoryGroup.getId(),
+ repositoryGroup.getMergedIndexPath().getFilePath().toString(),
+ repositoryGroup.getMergedIndexTTL() ).mergedIndexDirectory( directory );
MergedRemoteIndexesTaskRequest taskRequest =
new MergedRemoteIndexesTaskRequest( indexMergerRequest, indexMerger );
logger.info( "schedule merge remote index for group {} with cron {}", repositoryGroup.getId(),
- repositoryGroup.getCronExpression() );
+ repositoryGroup.getSchedulingDefinition() );
ScheduledFuture scheduledFuture =
taskScheduler.schedule( new MergedRemoteIndexesTask( taskRequest ), cronTrigger );
diff --git a/archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/indexer/merger/MergedRemoteIndexesTask.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/indexer/merger/MergedRemoteIndexesTask.java
index c67d31286..42896e1f9 100644
--- a/archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/indexer/merger/MergedRemoteIndexesTask.java
+++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/indexer/merger/MergedRemoteIndexesTask.java
@@ -19,7 +19,7 @@ package org.apache.archiva.indexer.merger;
* under the License.
*/
-import org.apache.maven.index.context.IndexingContext;
+import org.apache.archiva.indexer.ArchivaIndexingContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -58,7 +58,7 @@ public class MergedRemoteIndexesTask
{
IndexMerger indexMerger = mergedRemoteIndexesTaskRequest.getIndexMerger();
- IndexingContext indexingContext =
+ ArchivaIndexingContext indexingContext =
indexMerger.buildMergedIndex( mergedRemoteIndexesTaskRequest.getIndexMergerRequest() );
return new MergedRemoteIndexesTaskResult( indexingContext );
diff --git a/archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/indexer/merger/MergedRemoteIndexesTaskRequest.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/indexer/merger/MergedRemoteIndexesTaskRequest.java
index bc0663dbc..bc0663dbc 100644
--- a/archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/indexer/merger/MergedRemoteIndexesTaskRequest.java
+++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/indexer/merger/MergedRemoteIndexesTaskRequest.java
diff --git a/archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/indexer/merger/MergedRemoteIndexesTaskResult.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/indexer/merger/MergedRemoteIndexesTaskResult.java
index b75a29219..b7def7000 100644
--- a/archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/indexer/merger/MergedRemoteIndexesTaskResult.java
+++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/indexer/merger/MergedRemoteIndexesTaskResult.java
@@ -19,7 +19,7 @@ package org.apache.archiva.indexer.merger;
* under the License.
*/
-import org.apache.maven.index.context.IndexingContext;
+import org.apache.archiva.indexer.ArchivaIndexingContext;
/**
* @author Olivier Lamy
@@ -27,19 +27,19 @@ import org.apache.maven.index.context.IndexingContext;
*/
public class MergedRemoteIndexesTaskResult
{
- private IndexingContext indexingContext;
+ private ArchivaIndexingContext indexingContext;
- public MergedRemoteIndexesTaskResult( IndexingContext indexingContext )
+ public MergedRemoteIndexesTaskResult( ArchivaIndexingContext indexingContext )
{
this.indexingContext = indexingContext;
}
- public IndexingContext getIndexingContext()
+ public ArchivaIndexingContext getIndexingContext()
{
return indexingContext;
}
- public void setIndexingContext( IndexingContext indexingContext )
+ public void setIndexingContext( ArchivaIndexingContext indexingContext )
{
this.indexingContext = indexingContext;
}
diff --git a/archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/indexer/merger/TemporaryGroupIndexCleaner.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/indexer/merger/TemporaryGroupIndexCleaner.java
index 583ddd2c8..583ddd2c8 100644
--- a/archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/indexer/merger/TemporaryGroupIndexCleaner.java
+++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/indexer/merger/TemporaryGroupIndexCleaner.java
diff --git a/archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/indexer/maven/merger/DefaultIndexMerger.java b/archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/indexer/maven/DefaultIndexMerger.java
index 1f4648025..0843f230b 100644
--- a/archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/indexer/maven/merger/DefaultIndexMerger.java
+++ b/archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/indexer/maven/DefaultIndexMerger.java
@@ -19,7 +19,9 @@ package org.apache.archiva.indexer.maven.merger;
*/
import org.apache.archiva.common.utils.FileUtils;
+import org.apache.archiva.indexer.ArchivaIndexingContext;
import org.apache.archiva.indexer.UnsupportedBaseContextException;
+import org.apache.archiva.indexer.maven.MavenIndexContext;
import org.apache.archiva.indexer.merger.IndexMerger;
import org.apache.archiva.indexer.merger.IndexMergerException;
import org.apache.archiva.indexer.merger.IndexMergerRequest;
@@ -86,7 +88,7 @@ public class DefaultIndexMerger
}
@Override
- public IndexingContext buildMergedIndex( IndexMergerRequest indexMergerRequest )
+ public ArchivaIndexingContext buildMergedIndex(IndexMergerRequest indexMergerRequest )
throws IndexMergerException
{
String groupId = indexMergerRequest.getGroupId();
@@ -146,7 +148,7 @@ public class DefaultIndexMerger
stopWatch.stop();
log.info( "merged index for repos {} in {} s", indexMergerRequest.getRepositoriesIds(),
stopWatch.getTime() );
- return mergedCtx;
+ return new MavenIndexContext(repositoryRegistry.getRepositoryGroup(groupId), mergedCtx);
}
catch ( IOException e)
{