From: Martin Stockhammer Date: Thu, 2 Nov 2017 20:52:53 +0000 (+0100) Subject: Changing content access to repository registry X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=8070af6128fed9bd66b2766dd876df4958a201d3;p=archiva.git Changing content access to repository registry --- diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/MetadataUpdaterConsumer.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/MetadataUpdaterConsumer.java index 33da78606..a09ff247d 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/MetadataUpdaterConsumer.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/MetadataUpdaterConsumer.java @@ -30,9 +30,9 @@ import org.apache.archiva.model.VersionedReference; import org.apache.archiva.repository.ContentNotFoundException; import org.apache.archiva.repository.ManagedRepository; import org.apache.archiva.repository.ManagedRepositoryContent; -import org.apache.archiva.repository.RepositoryContentFactory; import org.apache.archiva.repository.RepositoryException; import org.apache.archiva.repository.RepositoryNotFoundException; +import org.apache.archiva.repository.RepositoryRegistry; import org.apache.archiva.repository.layout.LayoutException; import org.apache.archiva.repository.metadata.MetadataTools; import org.apache.archiva.repository.metadata.RepositoryMetadataException; @@ -72,7 +72,7 @@ public class MetadataUpdaterConsumer private String description = "Update / Create maven-metadata.xml files"; @Inject - private RepositoryContentFactory repositoryFactory; + private RepositoryRegistry repositoryRegistry; @Inject private MetadataTools metadataTools; @@ -120,7 +120,14 @@ public class MetadataUpdaterConsumer { try { - this.repository = repositoryFactory.getManagedRepositoryContent( repoConfig.getId( ) ); + ManagedRepository repo = repositoryRegistry.getManagedRepository( repoConfig.getId( ) ); + if (repo==null) { + throw new RepositoryNotFoundException( "Repository not found: "+repoConfig.getId() ); + } + this.repository = repo.getContent(); + if (this.repository==null) { + throw new RepositoryNotFoundException( "Repository content not found: "+repoConfig.getId() ); + } this.repositoryDir = Paths.get( repository.getRepoRoot( ) ); this.scanStartTimestamp = System.currentTimeMillis( ); }