From 4ea420ae99322713721db7a7d05302a2b56da2b5 Mon Sep 17 00:00:00 2001 From: Martin Stockhammer Date: Tue, 27 Mar 2018 07:56:12 +0200 Subject: [PATCH] Changing event api --- .../repository/maven2/MavenManagedRepository.java | 2 +- .../repository/maven2/MavenRemoteRepository.java | 4 ++-- .../index/mock/ArchivaIndexManagerMock.java | 13 +++++++++++++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/repository/maven2/MavenManagedRepository.java b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/repository/maven2/MavenManagedRepository.java index 46dec05bf..05f877142 100644 --- a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/repository/maven2/MavenManagedRepository.java +++ b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/repository/maven2/MavenManagedRepository.java @@ -76,7 +76,7 @@ public class MavenManagedRepository extends AbstractManagedRepository public MavenManagedRepository( String id, String name, Path basePath ) { super( RepositoryType.MAVEN, id, name, basePath); - this.indexCreationFeature = new IndexCreationFeature(id, this); + this.indexCreationFeature = new IndexCreationFeature(this, this); } public MavenManagedRepository( Locale primaryLocale, String id, String name, Path basePath ) diff --git a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/repository/maven2/MavenRemoteRepository.java b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/repository/maven2/MavenRemoteRepository.java index f549e46dd..55305ca09 100644 --- a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/repository/maven2/MavenRemoteRepository.java +++ b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/repository/maven2/MavenRemoteRepository.java @@ -64,14 +64,14 @@ public class MavenRemoteRepository extends AbstractRemoteRepository public MavenRemoteRepository( String id, String name, Path basePath ) { super( RepositoryType.MAVEN, id, name, basePath ); - this.indexCreationFeature = new IndexCreationFeature(id, this); + this.indexCreationFeature = new IndexCreationFeature(this, this); } public MavenRemoteRepository( Locale primaryLocale, String id, String name, Path basePath ) { super( primaryLocale, RepositoryType.MAVEN, id, name, basePath ); - this.indexCreationFeature = new IndexCreationFeature(id, this); + this.indexCreationFeature = new IndexCreationFeature(this, this); } @Override diff --git a/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/repository/index/mock/ArchivaIndexManagerMock.java b/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/repository/index/mock/ArchivaIndexManagerMock.java index 72114947d..f6f59250d 100644 --- a/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/repository/index/mock/ArchivaIndexManagerMock.java +++ b/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/repository/index/mock/ArchivaIndexManagerMock.java @@ -495,6 +495,19 @@ public class ArchivaIndexManagerMock implements ArchivaIndexManager { } } + @Override + public void updateLocalIndexPath(Repository repo) { + if (repo.supportsFeature(IndexCreationFeature.class)) { + IndexCreationFeature icf = repo.getFeature(IndexCreationFeature.class).get(); + try { + icf.setLocalIndexPath(getIndexPath(repo)); + } catch (IOException e) { + log.error("Could not set local index path for {}. New URI: {}", repo.getId(), icf.getIndexPath()); + } + } + } + + private Path getIndexPath(Repository repo) throws IOException { IndexCreationFeature icf = repo.getFeature(IndexCreationFeature.class).get(); Path repoDir = repo.getLocalPath(); -- 2.39.5