diff options
author | Martin Stockhammer <martin_s@apache.org> | 2020-06-04 20:12:32 +0200 |
---|---|---|
committer | Martin Stockhammer <martin_s@apache.org> | 2020-06-04 20:12:32 +0200 |
commit | de76d28cabf469eefba38a8c533c7d0b7f7e76dc (patch) | |
tree | 8df9eee03e98fa5400b9d75e41001dd89b123394 /archiva-modules/archiva-maven/archiva-maven-repository/src | |
parent | cb0e5f8eeab97320617eeb026be5e47d0ab50af8 (diff) | |
download | archiva-de76d28cabf469eefba38a8c533c7d0b7f7e76dc.tar.gz archiva-de76d28cabf469eefba38a8c533c7d0b7f7e76dc.zip |
Adding getroot method for repository
Diffstat (limited to 'archiva-modules/archiva-maven/archiva-maven-repository/src')
12 files changed, 31 insertions, 31 deletions
diff --git a/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/MavenManagedRepository.java b/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/MavenManagedRepository.java index 6106f5698..a24c7daee 100644 --- a/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/MavenManagedRepository.java +++ b/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/MavenManagedRepository.java @@ -71,13 +71,13 @@ public class MavenManagedRepository extends AbstractManagedRepository super( RepositoryType.MAVEN, id, name, storage); this.indexCreationFeature = new IndexCreationFeature(this, this); - setLocation(storage.getAsset("").getFilePath().toUri()); + setLocation(storage.getRoot().getFilePath().toUri()); } public MavenManagedRepository( Locale primaryLocale, String id, String name, FilesystemStorage storage ) { super( primaryLocale, RepositoryType.MAVEN, id, name, storage ); - setLocation(storage.getAsset("").getFilePath().toUri()); + setLocation(storage.getRoot().getFilePath().toUri()); } @Override diff --git a/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/MavenRepositoryGroup.java b/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/MavenRepositoryGroup.java index 06a22ac73..952713d88 100644 --- a/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/MavenRepositoryGroup.java +++ b/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/MavenRepositoryGroup.java @@ -62,7 +62,7 @@ public class MavenRepositoryGroup extends AbstractRepositoryGroup implements Edi } private Path getRepositoryPath() { - return getStorage().getAsset("").getFilePath(); + return getStorage().getRoot().getFilePath(); } private void init() { diff --git a/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/MavenRepositoryProvider.java b/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/MavenRepositoryProvider.java index 801cd8730..77b910312 100644 --- a/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/MavenRepositoryProvider.java +++ b/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/MavenRepositoryProvider.java @@ -173,7 +173,7 @@ public class MavenRepositoryProvider implements RepositoryProvider { throw new RepositoryException("The location entry is not a valid uri: " + cfg.getLocation()); } setBaseConfig(repo, cfg); - Path repoDir = repo.getAsset("").getFilePath(); + Path repoDir = repo.getRoot().getFilePath(); if (!Files.exists(repoDir)) { log.debug("Creating repo directory {}", repoDir); try { @@ -307,7 +307,7 @@ public class MavenRepositoryProvider implements RepositoryProvider { IndexCreationFeature indexCreationFeature = repositoryGroup.getFeature( IndexCreationFeature.class ).get(); indexCreationFeature.setIndexPath( getURIFromString(configuration.getMergedIndexPath()) ); Path localPath = Paths.get(configuration.getMergedIndexPath()); - Path repoGroupPath = repositoryGroup.getAsset("").getFilePath().toAbsolutePath(); + Path repoGroupPath = repositoryGroup.getRoot().getFilePath().toAbsolutePath(); if (localPath.isAbsolute() && !localPath.startsWith(repoGroupPath)) { try { FilesystemStorage storage = new FilesystemStorage(localPath.getParent(), fileLockManager); diff --git a/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/content/ManagedDefaultRepositoryContent.java b/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/content/ManagedDefaultRepositoryContent.java index 6349618df..662a3c8a9 100644 --- a/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/content/ManagedDefaultRepositoryContent.java +++ b/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/content/ManagedDefaultRepositoryContent.java @@ -1147,7 +1147,7 @@ public class ManagedDefaultRepositoryContent final Predicate<StorageAsset> filter = getItemFileFilterFromSelector( selector ); StorageAsset startDir; if (selector.getNamespace().contains("*")) { - startDir = getAsset( "" ); + startDir = getAsset(""); } else if ( selector.hasProjectId( ) && selector.getProjectId().contains("*") ) { startDir = getAsset( selector.getNamespace( ) ); @@ -1411,12 +1411,12 @@ public class ManagedDefaultRepositoryContent private Path getRepoDir( ) { - return repository.getAsset( "" ).getFilePath( ); + return repository.getRoot().getFilePath( ); } private RepositoryStorage getStorage( ) { - return repository.getAsset( "" ).getStorage( ); + return repository.getRoot().getStorage( ); } /** diff --git a/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/dependency/tree/Maven3DependencyTreeBuilder.java b/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/dependency/tree/Maven3DependencyTreeBuilder.java index d8d0a0c3c..58b1939ef 100644 --- a/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/dependency/tree/Maven3DependencyTreeBuilder.java +++ b/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/dependency/tree/Maven3DependencyTreeBuilder.java @@ -159,7 +159,7 @@ public class Maven3DependencyTreeBuilder // FIXME take care of relative path ResolveRequest resolveRequest = new ResolveRequest(); resolveRequest.dependencyVisitor = dependencyVisitor; - resolveRequest.localRepoDir = repository.getAsset( "" ).getFilePath().toAbsolutePath().toString(); + resolveRequest.localRepoDir = repository.getRoot().getFilePath().toAbsolutePath().toString(); resolveRequest.groupId = groupId; resolveRequest.artifactId = artifactId; resolveRequest.version = version; @@ -238,7 +238,7 @@ public class Maven3DependencyTreeBuilder for ( String repoId : repositoryIds ) { ManagedRepository managedRepo = repositoryRegistry.getManagedRepository(repoId); - StorageAsset repoDir = managedRepo.getAsset(""); + StorageAsset repoDir = managedRepo.getRoot(); StorageAsset file = pathTranslator.toFile( repoDir, projectArtifact.getGroupId(), projectArtifact.getArtifactId(), projectArtifact.getBaseVersion(), diff --git a/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/metadata/storage/Maven2RepositoryStorage.java b/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/metadata/storage/Maven2RepositoryStorage.java index bcda250eb..51dec603f 100644 --- a/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/metadata/storage/Maven2RepositoryStorage.java +++ b/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/metadata/storage/Maven2RepositoryStorage.java @@ -166,7 +166,7 @@ public class Maven2RepositoryStorage } } } - StorageAsset basedir = managedRepository.getAsset(""); + StorageAsset basedir = managedRepository.getRoot(); if (VersionUtil.isSnapshot(artifactVersion)) { StorageAsset metadataFile = pathTranslator.toFile(basedir, readMetadataRequest.getNamespace(), readMetadataRequest.getProjectId(), artifactVersion, @@ -456,9 +456,9 @@ public class Maven2RepositoryStorage private StorageAsset getRepositoryBasedir(String repoId) throws RepositoryStorageRuntimeException { - ManagedRepository repositoryConfiguration = repositoryRegistry.getManagedRepository(repoId); + ManagedRepository repository = repositoryRegistry.getManagedRepository(repoId); - return repositoryConfiguration.getAsset(""); + return repository.getRoot(); } @Override diff --git a/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/metadata/storage/RepositoryModelResolver.java b/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/metadata/storage/RepositoryModelResolver.java index c8f0ebef1..6b72cc158 100644 --- a/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/metadata/storage/RepositoryModelResolver.java +++ b/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/metadata/storage/RepositoryModelResolver.java @@ -112,7 +112,7 @@ public class RepositoryModelResolver Map<String, NetworkProxy> networkProxiesMap, ManagedRepository targetRepository, MavenSystemManager mavenSystemManager, MavenMetadataReader metadataReader) { - this( managedRepository.getAsset(""), pathTranslator ); + this( managedRepository.getRoot(), pathTranslator ); this.managedRepository = managedRepository; @@ -125,7 +125,7 @@ public class RepositoryModelResolver this.targetRepository = targetRepository; - this.session = MavenSystemManager.newRepositorySystemSession( managedRepository.getAsset("").getFilePath().toString() ); + this.session = MavenSystemManager.newRepositorySystemSession( managedRepository.getRoot().getFilePath().toString() ); this.versionRangeResolver = mavenSystemManager.getLocator().getService(VersionRangeResolver.class); @@ -303,7 +303,7 @@ public class RepositoryModelResolver Path tmpSha1 = null; Path tmpResource = null; String artifactPath = pathTranslator.toPath( groupId, artifactId, version, filename ); - Path resource = targetRepository.getAsset("").getFilePath().resolve( artifactPath ); + Path resource = targetRepository.getRoot().getFilePath().resolve( artifactPath ); Path workingDirectory = createWorkingDirectory( targetRepository.getLocation().toString() ); try diff --git a/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/maven/content/ManagedDefaultRepositoryContentTest.java b/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/maven/content/ManagedDefaultRepositoryContentTest.java index 5b13edf88..39be5fad4 100644 --- a/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/maven/content/ManagedDefaultRepositoryContentTest.java +++ b/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/maven/content/ManagedDefaultRepositoryContentTest.java @@ -1182,7 +1182,7 @@ public class ManagedDefaultRepositoryContentTest { ManagedRepository repo = createManagedRepoWithContent( "delete-repository" ); ManagedRepositoryContent myRepoContent = repo.getContent( ); - Path repoRoot = repo.getAsset( "" ).getFilePath( ); + Path repoRoot = repo.getRoot().getFilePath( ); assertTrue( Files.exists(repoRoot.resolve( "org/apache/maven" )) ); ArchivaItemSelector selector = ArchivaItemSelector.builder( ) .withNamespace( "org.apache.maven" ).build(); @@ -1209,7 +1209,7 @@ public class ManagedDefaultRepositoryContentTest { ManagedRepository repo = createManagedRepoWithContent( "delete-repository" ); ManagedRepositoryContent myRepoContent = repo.getContent( ); - Path repoRoot = repo.getAsset( "" ).getFilePath( ); + Path repoRoot = repo.getRoot().getFilePath( ); assertTrue( Files.exists(repoRoot.resolve( "org/apache/maven/A" )) ); ArchivaItemSelector selector = ArchivaItemSelector.builder( ) .withNamespace( "org.apache.maven" ) @@ -1239,7 +1239,7 @@ public class ManagedDefaultRepositoryContentTest { ManagedRepository repo = createManagedRepoWithContent( "delete-repository" ); ManagedRepositoryContent myRepoContent = repo.getContent( ); - Path repoRoot = repo.getAsset( "" ).getFilePath( ); + Path repoRoot = repo.getRoot().getFilePath( ); assertTrue( Files.exists(repoRoot.resolve( "org/apache/maven/A/1.0" )) ); ArchivaItemSelector selector = ArchivaItemSelector.builder( ) .withNamespace( "org.apache.maven" ) @@ -1273,7 +1273,7 @@ public class ManagedDefaultRepositoryContentTest { ManagedRepository repo = createManagedRepoWithContent( "delete-repository" ); ManagedRepositoryContent myRepoContent = repo.getContent( ); - Path repoRoot = repo.getAsset( "" ).getFilePath( ); + Path repoRoot = repo.getRoot().getFilePath( ); assertTrue( Files.exists(repoRoot.resolve( "org/apache/maven/A/1.0/A-1.0.pom" )) ); assertTrue( Files.exists(repoRoot.resolve( "org/apache/maven/A/1.0/A-1.0.war" )) ); ArchivaItemSelector selector = ArchivaItemSelector.builder( ) @@ -1369,7 +1369,7 @@ public class ManagedDefaultRepositoryContentTest { ManagedRepository repo = createManagedRepoWithContent( "delete-repository" ); ManagedRepositoryContent myRepoContent = repo.getContent( ); - Path repoRoot = repo.getAsset( "" ).getFilePath( ); + Path repoRoot = repo.getRoot().getFilePath( ); ArchivaItemSelector selector = ArchivaItemSelector.builder( ) .withNamespace( "org.apache.test2" ) @@ -1437,7 +1437,7 @@ public class ManagedDefaultRepositoryContentTest ManagedRepository repo = createManagedRepoWithContent( "delete-repository" ); ManagedRepositoryContent myRepoContent = repo.getContent( ); BaseRepositoryContentLayout layout = myRepoContent.getLayout( BaseRepositoryContentLayout.class ); - Path repoRoot = repo.getAsset( "" ).getFilePath( ); + Path repoRoot = repo.getRoot().getFilePath( ); Path tmpFile = Files.createTempFile( "archiva-mvn-repotest", "jar" ); try( OutputStream outputStream = Files.newOutputStream( tmpFile )) diff --git a/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/maven/content/MavenContentHelperTest.java b/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/maven/content/MavenContentHelperTest.java index 5466bac31..1fc0fc570 100644 --- a/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/maven/content/MavenContentHelperTest.java +++ b/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/maven/content/MavenContentHelperTest.java @@ -73,7 +73,7 @@ class MavenContentHelperTest assertNotNull( ns ); assertEquals( "org.apache.archiva", ns ); - asset = storage.getAsset( "" ); + asset = storage.getRoot(); ns = MavenContentHelper.getNamespaceFromNamespacePath( asset ); assertNotNull( ns ); assertEquals( "", ns ); diff --git a/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/maven/metadata/MetadataToolsTest.java b/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/maven/metadata/MetadataToolsTest.java index fa66d29bf..1d437eb47 100644 --- a/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/maven/metadata/MetadataToolsTest.java +++ b/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/maven/metadata/MetadataToolsTest.java @@ -407,7 +407,7 @@ public class MetadataToolsTest ProjectReference reference ) throws LayoutException, IOException, SAXException, ParserConfigurationException { - Path metadataFile = repository.getRepository().getAsset( "" ).getFilePath().resolve(tools.toPath( reference ) ); + Path metadataFile = repository.getRepository().getRoot().getFilePath().resolve(tools.toPath( reference ) ); String actualMetadata = org.apache.archiva.common.utils.FileUtils.readFileToString( metadataFile, Charset.defaultCharset() ); Diff detailedDiff = DiffBuilder.compare( expectedMetadata ).withTest( actualMetadata ).checkForSimilar().build(); @@ -425,7 +425,7 @@ public class MetadataToolsTest VersionedReference reference ) throws LayoutException, IOException, SAXException, ParserConfigurationException { - Path metadataFile = repository.getRepository().getAsset("").getFilePath().resolve( tools.toPath( reference ) ); + Path metadataFile = repository.getRepository().getRoot().getFilePath().resolve( tools.toPath( reference ) ); String actualMetadata = org.apache.archiva.common.utils.FileUtils.readFileToString( metadataFile, Charset.defaultCharset() ); Diff detailedDiff = DiffBuilder.compare( expectedMetadata ).withTest( actualMetadata ).checkForSimilar().build(); @@ -656,7 +656,7 @@ public class MetadataToolsTest Path srcRepoDir = getRepositoryPath( "metadata-repository" ); Path srcDir = srcRepoDir.resolve( path ); - Path destDir = repo.getRepository().getAsset( "" ).getFilePath().resolve( path ); + Path destDir = repo.getRepository().getRoot().getFilePath().resolve( path ); assertTrue( "Source Dir exists: " + srcDir, Files.exists(srcDir) ); Files.createDirectories(destDir); diff --git a/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/maven/mock/ArchivaIndexManagerMock.java b/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/maven/mock/ArchivaIndexManagerMock.java index 2224e159a..ae00fdb7a 100644 --- a/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/maven/mock/ArchivaIndexManagerMock.java +++ b/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/maven/mock/ArchivaIndexManagerMock.java @@ -535,11 +535,11 @@ public class ArchivaIndexManagerMock implements ArchivaIndexManager { private StorageAsset getIndexPath( Repository repo) throws IOException { IndexCreationFeature icf = repo.getFeature(IndexCreationFeature.class).get(); - Path repoDir = repo.getAsset( "" ).getFilePath(); + Path repoDir = repo.getRoot().getFilePath(); URI indexDir = icf.getIndexPath(); String indexPath = indexDir.getPath(); Path indexDirectory = null; - FilesystemStorage fsStorage = (FilesystemStorage) repo.getAsset("").getStorage(); + FilesystemStorage fsStorage = (FilesystemStorage) repo.getRoot().getStorage(); if ( ! StringUtils.isEmpty(indexDir.toString( ) ) ) { @@ -576,7 +576,7 @@ public class ArchivaIndexManagerMock implements ArchivaIndexManager { // create remote repository path - Path repoDir = remoteRepository.getAsset("").getFilePath(); + Path repoDir = remoteRepository.getRoot().getFilePath(); if ( !Files.exists( repoDir ) ) { Files.createDirectories( repoDir ); @@ -626,7 +626,7 @@ public class ArchivaIndexManagerMock implements ArchivaIndexManager { IndexingContext context; // take care first about repository location as can be relative - Path repositoryDirectory = repository.getAsset("").getFilePath(); + Path repositoryDirectory = repository.getRoot().getFilePath(); if ( !Files.exists( repositoryDirectory ) ) { diff --git a/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/maven/mock/MavenIndexContextMock.java b/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/maven/mock/MavenIndexContextMock.java index 9d4ad08ae..70c8d5641 100644 --- a/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/maven/mock/MavenIndexContextMock.java +++ b/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/maven/mock/MavenIndexContextMock.java @@ -61,7 +61,7 @@ public class MavenIndexContextMock implements ArchivaIndexingContext { @Override public StorageAsset getPath() { - return indexStorage.getAsset(""); + return indexStorage.getRoot(); } @Override |