Changing event api

This commit is contained in:
Martin Stockhammer 2018-03-27 07:56:12 +02:00
parent d1fcc2dd2e
commit 4ea420ae99
3 changed files with 16 additions and 3 deletions

View File

@ -76,7 +76,7 @@ public class MavenManagedRepository extends AbstractManagedRepository
public MavenManagedRepository( String id, String name, Path basePath ) public MavenManagedRepository( String id, String name, Path basePath )
{ {
super( RepositoryType.MAVEN, id, name, 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 ) public MavenManagedRepository( Locale primaryLocale, String id, String name, Path basePath )

View File

@ -64,14 +64,14 @@ public class MavenRemoteRepository extends AbstractRemoteRepository
public MavenRemoteRepository( String id, String name, Path basePath ) public MavenRemoteRepository( String id, String name, Path basePath )
{ {
super( RepositoryType.MAVEN, id, name, 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 ) public MavenRemoteRepository( Locale primaryLocale, String id, String name, Path basePath )
{ {
super( primaryLocale, RepositoryType.MAVEN, id, name, basePath ); super( primaryLocale, RepositoryType.MAVEN, id, name, basePath );
this.indexCreationFeature = new IndexCreationFeature(id, this); this.indexCreationFeature = new IndexCreationFeature(this, this);
} }
@Override @Override

View File

@ -495,6 +495,19 @@ public ArchivaIndexingContext move(ArchivaIndexingContext context, Repository re
} }
} }
@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 { private Path getIndexPath(Repository repo) throws IOException {
IndexCreationFeature icf = repo.getFeature(IndexCreationFeature.class).get(); IndexCreationFeature icf = repo.getFeature(IndexCreationFeature.class).get();
Path repoDir = repo.getLocalPath(); Path repoDir = repo.getLocalPath();