From de76d28cabf469eefba38a8c533c7d0b7f7e76dc Mon Sep 17 00:00:00 2001 From: Martin Stockhammer Date: Thu, 4 Jun 2020 20:12:32 +0200 Subject: [PATCH] Adding getroot method for repository --- .../consumers/core/MetadataUpdaterConsumer.java | 2 +- .../CleanupReleasedSnapshotsRepositoryPurge.java | 2 +- .../archiva/admin/mock/ArchivaIndexManagerMock.java | 8 ++++---- .../repository/base/AbstractRemoteRepository.java | 2 +- .../archiva/repository/base/AbstractRepository.java | 8 +++++++- .../repository/base/ArchivaRepositoryRegistry.java | 2 +- .../repository/base/BasicManagedRepository.java | 1 + .../repository/metadata/base/MetadataTools.java | 2 +- .../repository/content/base/ContentItemTest.java | 2 +- .../mock/ManagedRepositoryContentMock.java | 2 +- .../repository/scanner/DefaultRepositoryScanner.java | 2 +- .../scanner/mock/ManagedRepositoryContentMock.java | 2 +- .../repository/storage/RepositoryStorage.java | 6 ++++++ .../archiva/repository/storage/mock/MockStorage.java | 6 ++++++ .../repository/storage/fs/FilesystemStorage.java | 6 ++++++ .../archiva/indexer/maven/MavenIndexContext.java | 4 ++-- .../archiva/indexer/maven/MavenIndexManager.java | 6 +++--- .../archiva/indexer/maven/MavenIndexManagerTest.java | 8 ++++---- .../apache/archiva/proxy/HttpProxyTransferTest.java | 2 +- .../mock/ManagedRepositoryContentMock.java | 4 ++-- .../repository/maven/MavenManagedRepository.java | 4 ++-- .../repository/maven/MavenRepositoryGroup.java | 2 +- .../repository/maven/MavenRepositoryProvider.java | 4 ++-- .../content/ManagedDefaultRepositoryContent.java | 6 +++--- .../dependency/tree/Maven3DependencyTreeBuilder.java | 4 ++-- .../metadata/storage/Maven2RepositoryStorage.java | 6 +++--- .../metadata/storage/RepositoryModelResolver.java | 6 +++--- .../content/ManagedDefaultRepositoryContentTest.java | 12 ++++++------ .../maven/content/MavenContentHelperTest.java | 2 +- .../repository/maven/metadata/MetadataToolsTest.java | 6 +++--- .../maven/mock/ArchivaIndexManagerMock.java | 8 ++++---- .../repository/maven/mock/MavenIndexContextMock.java | 2 +- .../maven/ArchivaIndexingTaskExecutorTest.java | 8 ++++---- .../apache/archiva/mock/ArchivaIndexManagerMock.java | 8 ++++---- .../archiva/webdav/ArchivaDavResourceFactory.java | 10 +++++----- 35 files changed, 95 insertions(+), 70 deletions(-) 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 3cd973e6b..9c0aeb79e 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 @@ -125,7 +125,7 @@ public class MetadataUpdaterConsumer if (this.repository==null) { throw new RepositoryNotFoundException( "Repository content not found: "+repoConfig.getId() ); } - this.repositoryDir = repository.getRepository().getAsset( "" ); + this.repositoryDir = repository.getRepository().getRoot(); this.scanStartTimestamp = System.currentTimeMillis( ); } catch ( RepositoryException e ) diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurge.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurge.java index fe58824a3..f9dca9999 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurge.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurge.java @@ -92,7 +92,7 @@ public class CleanupReleasedSnapshotsRepositoryPurge { try { - StorageAsset artifactFile = repository.getRepository( ).getAsset( "" ).resolve( path ); + StorageAsset artifactFile = repository.getRepository( ).getRoot().resolve( path ); BaseRepositoryContentLayout layout = repository.getLayout( BaseRepositoryContentLayout.class ); if ( !artifactFile.exists() ) diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/mock/ArchivaIndexManagerMock.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/mock/ArchivaIndexManagerMock.java index 31b115ae5..e2255ee42 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/mock/ArchivaIndexManagerMock.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/mock/ArchivaIndexManagerMock.java @@ -522,11 +522,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 filesystemStorage = (FilesystemStorage) repo.getAsset("").getStorage(); + FilesystemStorage filesystemStorage = (FilesystemStorage) repo.getRoot().getStorage(); if ( ! StringUtils.isEmpty(indexDir.toString( ) ) ) { @@ -563,7 +563,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 ); @@ -613,7 +613,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-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/AbstractRemoteRepository.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/AbstractRemoteRepository.java index 9e14a0522..b53997eb0 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/AbstractRemoteRepository.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/AbstractRemoteRepository.java @@ -152,7 +152,7 @@ public abstract class AbstractRemoteRepository extends AbstractRepository implem */ @Override public StorageAsset getLocalPath() { - return getStorage().getAsset(""); + return getStorage().getRoot(); } @Override diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/AbstractRepository.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/AbstractRepository.java index 9778c2aa8..6fb6a2f90 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/AbstractRepository.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/AbstractRepository.java @@ -162,7 +162,13 @@ public abstract class AbstractRepository implements EditableRepository, EventHan @Override public StorageAsset getLocalPath() { - return storage.getAsset(""); + return storage.getRoot( ); + } + + @Override + public StorageAsset getRoot( ) + { + return storage.getRoot( ); } @Override diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/ArchivaRepositoryRegistry.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/ArchivaRepositoryRegistry.java index 4bd19998c..b909e24de 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/ArchivaRepositoryRegistry.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/ArchivaRepositoryRegistry.java @@ -1284,7 +1284,7 @@ public class ArchivaRepositoryRegistry implements ConfigurationListener, EventHa return (Repository)asset; } else { - return getRepositories( ).stream( ).filter( r -> r.getAsset( "" ) + return getRepositories( ).stream( ).filter( r -> r.getRoot() .getStorage( ).equals( asset.getStorage( ) ) ).findFirst( ).orElse( null ); } } diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/BasicManagedRepository.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/BasicManagedRepository.java index f3e13617a..a82fd77a9 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/BasicManagedRepository.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/BasicManagedRepository.java @@ -26,6 +26,7 @@ import org.apache.archiva.repository.RepositoryCapabilities; import org.apache.archiva.repository.RepositoryRequestInfo; import org.apache.archiva.repository.RepositoryType; import org.apache.archiva.repository.StandardCapabilities; +import org.apache.archiva.repository.storage.StorageAsset; import org.apache.archiva.repository.storage.fs.FilesystemStorage; import org.apache.archiva.repository.storage.RepositoryStorage; import org.apache.archiva.repository.features.ArtifactCleanupFeature; diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/metadata/base/MetadataTools.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/metadata/base/MetadataTools.java index a9eebef59..3a02bbe30 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/metadata/base/MetadataTools.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/metadata/base/MetadataTools.java @@ -937,7 +937,7 @@ public class MetadataTools path = path.substring( 0, idx ); } - StorageAsset repoDir = managedRepository.getGenericContent( ).getRepository( ).getAsset( "" ); + StorageAsset repoDir = managedRepository.getGenericContent( ).getRepository( ).getRoot(); if ( !repoDir.exists()) { diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/content/base/ContentItemTest.java b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/content/base/ContentItemTest.java index 8f266d292..14451fa5d 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/content/base/ContentItemTest.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/content/base/ContentItemTest.java @@ -49,7 +49,7 @@ public abstract class ContentItemTest this.storage = new FilesystemStorage( Paths.get( "target" ), new DefaultFileLockManager( ) ); - this.asset = storage.getAsset( "" ); + this.asset = storage.getRoot(); } diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/mock/ManagedRepositoryContentMock.java b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/mock/ManagedRepositoryContentMock.java index 69af3d37f..83bddf8e7 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/mock/ManagedRepositoryContentMock.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/mock/ManagedRepositoryContentMock.java @@ -274,7 +274,7 @@ public class ManagedRepositoryContentMock implements BaseRepositoryContentLayout @Override public ContentItem toItem( String path ) throws LayoutException { - StorageAsset asset = repository.getAsset( "" ).resolve( path ); + StorageAsset asset = repository.getRoot().resolve( path ); return toItem( asset ); } diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/DefaultRepositoryScanner.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/DefaultRepositoryScanner.java index 3b49e3a9b..650162bd5 100644 --- a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/DefaultRepositoryScanner.java +++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/DefaultRepositoryScanner.java @@ -92,7 +92,7 @@ public class DefaultRepositoryScanner throw new IllegalArgumentException( "Unable to operate on a null repository." ); } - StorageAsset repositoryBase = repository.getAsset(""); + StorageAsset repositoryBase = repository.getRoot(); //MRM-1342 Repository statistics report doesn't appear to be working correctly //create the repo if not existing to have an empty stats diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/mock/ManagedRepositoryContentMock.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/mock/ManagedRepositoryContentMock.java index 06e9680e2..1a9670727 100644 --- a/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/mock/ManagedRepositoryContentMock.java +++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/mock/ManagedRepositoryContentMock.java @@ -313,7 +313,7 @@ public class ManagedRepositoryContentMock implements BaseRepositoryContentLayout e.printStackTrace(); } } - return fsStorage.getAsset(""); + return fsStorage.getRoot(); } @Override diff --git a/archiva-modules/archiva-base/archiva-storage-api/src/main/java/org/apache/archiva/repository/storage/RepositoryStorage.java b/archiva-modules/archiva-base/archiva-storage-api/src/main/java/org/apache/archiva/repository/storage/RepositoryStorage.java index 189091407..ce1089c8b 100644 --- a/archiva-modules/archiva-base/archiva-storage-api/src/main/java/org/apache/archiva/repository/storage/RepositoryStorage.java +++ b/archiva-modules/archiva-base/archiva-storage-api/src/main/java/org/apache/archiva/repository/storage/RepositoryStorage.java @@ -74,6 +74,12 @@ public interface RepositoryStorage { */ StorageAsset getAsset(String path); + /** + * Returns the root asset of the storage + * @return the storage asset that represents the root + */ + StorageAsset getRoot( ); + /** * Consumes the data and sets a lock for the file during the operation. * diff --git a/archiva-modules/archiva-base/archiva-storage-api/src/test/java/org/apache/archiva/repository/storage/mock/MockStorage.java b/archiva-modules/archiva-base/archiva-storage-api/src/test/java/org/apache/archiva/repository/storage/mock/MockStorage.java index 2741c3047..e024caefb 100644 --- a/archiva-modules/archiva-base/archiva-storage-api/src/test/java/org/apache/archiva/repository/storage/mock/MockStorage.java +++ b/archiva-modules/archiva-base/archiva-storage-api/src/test/java/org/apache/archiva/repository/storage/mock/MockStorage.java @@ -105,6 +105,12 @@ public class MockStorage implements RepositoryStorage return parent; } + @Override + public StorageAsset getRoot( ) + { + return root; + } + @Override public void consumeData( StorageAsset asset, Consumer consumerFunction, boolean readLock ) throws IOException { diff --git a/archiva-modules/archiva-base/archiva-storage-fs/src/main/java/org/apache/archiva/repository/storage/fs/FilesystemStorage.java b/archiva-modules/archiva-base/archiva-storage-fs/src/main/java/org/apache/archiva/repository/storage/fs/FilesystemStorage.java index 339e65d38..fcc1dda61 100644 --- a/archiva-modules/archiva-base/archiva-storage-fs/src/main/java/org/apache/archiva/repository/storage/fs/FilesystemStorage.java +++ b/archiva-modules/archiva-base/archiva-storage-fs/src/main/java/org/apache/archiva/repository/storage/fs/FilesystemStorage.java @@ -327,6 +327,12 @@ public class FilesystemStorage implements RepositoryStorage { } } + @Override + public StorageAsset getRoot( ) + { + return new FilesystemAsset( this, "", basePath, basePath ); + } + @Override public StorageAsset addAsset( String path, boolean container ) { diff --git a/archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/indexer/maven/MavenIndexContext.java b/archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/indexer/maven/MavenIndexContext.java index 3ece4b0a0..74542b221 100644 --- a/archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/indexer/maven/MavenIndexContext.java +++ b/archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/indexer/maven/MavenIndexContext.java @@ -70,7 +70,7 @@ public class MavenIndexContext implements ArchivaIndexingContext { @Override public StorageAsset getPath() { if (dir==null) { - StorageAsset repositoryDirAsset = repository.getAsset(""); + StorageAsset repositoryDirAsset = repository.getRoot(); Path repositoryDir = repositoryDirAsset.getFilePath().toAbsolutePath(); Path indexDir = delegate.getIndexDirectoryFile().toPath(); if (indexDir.startsWith(repositoryDir)) { @@ -78,7 +78,7 @@ public class MavenIndexContext implements ArchivaIndexingContext { } else { try { FilesystemStorage storage = new FilesystemStorage(indexDir, new DefaultFileLockManager()); - dir = storage.getAsset(""); + dir = storage.getRoot(); } catch (IOException e) { log.error("Error occured while creating storage for index dir"); } diff --git a/archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/indexer/maven/MavenIndexManager.java b/archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/indexer/maven/MavenIndexManager.java index 5f190fc19..b1231844d 100644 --- a/archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/indexer/maven/MavenIndexManager.java +++ b/archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/indexer/maven/MavenIndexManager.java @@ -595,7 +595,7 @@ public class MavenIndexManager implements ArchivaIndexManager { private StorageAsset getIndexPath(URI indexDirUri, RepositoryStorage repoStorage, String defaultDir) throws IOException { - StorageAsset rootAsset = repoStorage.getAsset(""); + StorageAsset rootAsset = repoStorage.getRoot(); RepositoryStorage storage = rootAsset.getStorage(); Path indexDirectory; Path repositoryPath = rootAsset.getFilePath().toAbsolutePath(); @@ -650,7 +650,7 @@ public class MavenIndexManager implements ArchivaIndexManager { // create remote repository path - Path repoDir = remoteRepository.getAsset( "" ).getFilePath(); + Path repoDir = remoteRepository.getRoot().getFilePath(); if ( !Files.exists( repoDir ) ) { Files.createDirectories( repoDir ); @@ -709,7 +709,7 @@ public class MavenIndexManager 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-indexer/src/test/java/org/apache/archiva/indexer/maven/MavenIndexManagerTest.java b/archiva-modules/archiva-maven/archiva-maven-indexer/src/test/java/org/apache/archiva/indexer/maven/MavenIndexManagerTest.java index ed4f54581..c025180ed 100644 --- a/archiva-modules/archiva-maven/archiva-maven-indexer/src/test/java/org/apache/archiva/indexer/maven/MavenIndexManagerTest.java +++ b/archiva-modules/archiva-maven/archiva-maven-indexer/src/test/java/org/apache/archiva/indexer/maven/MavenIndexManagerTest.java @@ -93,7 +93,7 @@ public class MavenIndexManagerTest { @Test public void pack() throws Exception { createTestContext(); - Path destDir = repository.getAsset( "" ).getFilePath().resolve("org/apache/archiva/archiva-webapp/1.0"); + Path destDir = repository.getRoot().getFilePath().resolve("org/apache/archiva/archiva-webapp/1.0"); Path srcDir = Paths.get("src/test/maven-search-test-repo/org/apache/archiva/archiva-webapp/1.0"); org.apache.commons.io.FileUtils.copyDirectory(srcDir.toFile(),destDir.toFile()); mavenIndexManager.scan(ctx); @@ -110,7 +110,7 @@ public class MavenIndexManagerTest { @Test public void scan() throws Exception { createTestContext(); - Path destDir = repository.getAsset("").getFilePath().resolve("org/apache/archiva/archiva-webapp/1.0"); + Path destDir = repository.getRoot().getFilePath().resolve("org/apache/archiva/archiva-webapp/1.0"); Path srcDir = Paths.get("src/test/maven-search-test-repo/org/apache/archiva/archiva-webapp/1.0"); org.apache.commons.io.FileUtils.copyDirectory(srcDir.toFile(),destDir.toFile()); mavenIndexManager.scan(ctx); @@ -139,7 +139,7 @@ public class MavenIndexManagerTest { ArchivaIndexingContext ctx = createTestContext(); try { - Path destDir = repository.getAsset("").getFilePath().resolve("org/apache/archiva/archiva-search/1.0"); + Path destDir = repository.getRoot().getFilePath().resolve("org/apache/archiva/archiva-search/1.0"); Path srcDir = Paths.get("src/test/maven-search-test-repo/org/apache/archiva/archiva-search/1.0"); org.apache.commons.io.FileUtils.copyDirectory(srcDir.toFile(), destDir.toFile()); List uriList = new ArrayList<>(); @@ -164,7 +164,7 @@ public class MavenIndexManagerTest { @Test public void removeArtifactsFromIndex() throws Exception { ArchivaIndexingContext ctx = createTestContext(); - Path destDir = repository.getAsset( "" ).getFilePath().resolve("org/apache/archiva/archiva-search/1.0"); + Path destDir = repository.getRoot().getFilePath().resolve("org/apache/archiva/archiva-search/1.0"); Path srcDir = Paths.get("src/test/maven-search-test-repo/org/apache/archiva/archiva-search/1.0"); org.apache.commons.io.FileUtils.copyDirectory(srcDir.toFile(), destDir.toFile()); List uriList = new ArrayList<>(); diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/HttpProxyTransferTest.java b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/HttpProxyTransferTest.java index 2a028ab59..c48586fe6 100644 --- a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/HttpProxyTransferTest.java +++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/HttpProxyTransferTest.java @@ -220,7 +220,7 @@ public class HttpProxyTransferTest managedDefaultRepository = repositoryRegistry.getManagedRepository(MANAGED_ID).getContent(); BaseRepositoryContentLayout layout = managedDefaultRepository.getLayout( BaseRepositoryContentLayout.class ); - Path expectedFile = managedDefaultRepository.getRepository().getAsset( "" ).resolve( path ).getFilePath(); + Path expectedFile = managedDefaultRepository.getRepository().getRoot().resolve( path ).getFilePath(); Files.deleteIfExists( expectedFile ); ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path ); diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/repository/mock/ManagedRepositoryContentMock.java b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/repository/mock/ManagedRepositoryContentMock.java index 831b2c6c0..d00159fd1 100644 --- a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/repository/mock/ManagedRepositoryContentMock.java +++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/repository/mock/ManagedRepositoryContentMock.java @@ -297,7 +297,7 @@ public class ManagedRepositoryContentMock implements BaseRepositoryContentLayout @Override public ContentItem toItem( String path ) throws LayoutException { - StorageAsset asset = repository.getAsset( "" ).resolve( path ); + StorageAsset asset = repository.getRoot().resolve( path ); return toItem( asset ); } @@ -334,7 +334,7 @@ public class ManagedRepositoryContentMock implements BaseRepositoryContentLayout e.printStackTrace(); } } - return fsStorage.getAsset(""); + return fsStorage.getRoot(); } @Override 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 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 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 diff --git a/archiva-modules/archiva-maven/archiva-maven-scheduler/src/test/java/org/apache/archiva/scheduler/indexing/maven/ArchivaIndexingTaskExecutorTest.java b/archiva-modules/archiva-maven/archiva-maven-scheduler/src/test/java/org/apache/archiva/scheduler/indexing/maven/ArchivaIndexingTaskExecutorTest.java index 64433fe39..3f44b5f8a 100644 --- a/archiva-modules/archiva-maven/archiva-maven-scheduler/src/test/java/org/apache/archiva/scheduler/indexing/maven/ArchivaIndexingTaskExecutorTest.java +++ b/archiva-modules/archiva-maven/archiva-maven-scheduler/src/test/java/org/apache/archiva/scheduler/indexing/maven/ArchivaIndexingTaskExecutorTest.java @@ -132,7 +132,7 @@ public class ArchivaIndexingTaskExecutorTest public void testAddArtifactToIndex() throws Exception { - Path basePath = repo.getAsset("").getFilePath(); + Path basePath = repo.getLocalPath().getFilePath(); Path artifactFile = basePath.resolve( "org/apache/archiva/archiva-index-methods-jar-test/1.0/archiva-index-methods-jar-test-1.0.jar" ); @@ -174,7 +174,7 @@ public class ArchivaIndexingTaskExecutorTest public void testUpdateArtifactInIndex() throws Exception { - Path basePath = repo.getAsset("").getFilePath(); + Path basePath = repo.getLocalPath().getFilePath(); Path artifactFile = basePath.resolve( "org/apache/archiva/archiva-index-methods-jar-test/1.0/archiva-index-methods-jar-test-1.0.jar" ); @@ -211,7 +211,7 @@ public class ArchivaIndexingTaskExecutorTest public void testRemoveArtifactFromIndex() throws Exception { - Path basePath = repo.getAsset("").getFilePath(); + Path basePath = repo.getLocalPath().getFilePath(); Path artifactFile = basePath.resolve( "org/apache/archiva/archiva-index-methods-jar-test/1.0/archiva-index-methods-jar-test-1.0.jar" ); @@ -274,7 +274,7 @@ public class ArchivaIndexingTaskExecutorTest throws Exception { - Path basePath = repo.getAsset("").getFilePath(); + Path basePath = repo.getLocalPath().getFilePath(); IndexCreationFeature icf = repo.getFeature( IndexCreationFeature.class ).get(); StorageAsset packedIndexDirectory = icf.getLocalPackedIndexPath(); StorageAsset indexerDirectory = icf.getLocalIndexPath(); diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/mock/ArchivaIndexManagerMock.java b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/mock/ArchivaIndexManagerMock.java index 6182be541..76199e1e2 100644 --- a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/mock/ArchivaIndexManagerMock.java +++ b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/mock/ArchivaIndexManagerMock.java @@ -510,11 +510,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 filesystemStorage = (FilesystemStorage) repo.getAsset("").getStorage(); + FilesystemStorage filesystemStorage = (FilesystemStorage) repo.getRoot().getStorage(); if ( ! StringUtils.isEmpty(indexDir.toString( ) ) ) { @@ -551,7 +551,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 ); @@ -601,7 +601,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-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java index fcc9c844b..5978409f6 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java @@ -284,7 +284,7 @@ public class ArchivaDavResourceFactory repositoryRequestInfo = repo.getRequestInfo(); String logicalResource = getLogicalResource( archivaLocator, null, false ); resourcesInAbsolutePath.add( - managedRepositoryContent.getRepository().getAsset( "" ).getFilePath().resolve(logicalResource ).toAbsolutePath().toString() ); + managedRepositoryContent.getRepository().getLocalPath().getFilePath().resolve(logicalResource ).toAbsolutePath().toString() ); } @@ -469,7 +469,7 @@ public class ArchivaDavResourceFactory logicalResource = logicalResource.substring( 1 ); } resourcesInAbsolutePath.add( - managedRepositoryContent.getRepository().getAsset( "" ).resolve( logicalResource ).getFilePath().toAbsolutePath().toString() ); + managedRepositoryContent.getRepository().getLocalPath().resolve( logicalResource ).getFilePath().toAbsolutePath().toString() ); } catch ( DavException e ) { @@ -686,7 +686,7 @@ public class ArchivaDavResourceFactory * create the collections themselves. */ - StorageAsset rootDirectory = managedRepositoryContent.getRepository( ).getAsset( "" ); + StorageAsset rootDirectory = managedRepositoryContent.getRepository( ).getLocalPath(); StorageAsset destDir = rootDirectory.resolve( logicalResource.getPath() ).getParent(); if ( !destDir.exists() ) @@ -1090,7 +1090,7 @@ public class ArchivaDavResourceFactory } try { FilesystemStorage storage = new FilesystemStorage(tmpDirectory.getParent(), new DefaultFileLockManager()); - mergedRepositoryContents.add( storage.getAsset("") ); + mergedRepositoryContents.add( storage.getRoot() ); } catch (IOException e) { throw new DavException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Could not create storage for " + tmpDirectory); } @@ -1376,7 +1376,7 @@ public class ArchivaDavResourceFactory Path tempRepoFile = Files.createTempDirectory( "temp" ); tempRepoFile.toFile( ).deleteOnExit( ); FilesystemStorage storage = new FilesystemStorage(tempRepoFile, new DefaultFileLockManager()); - StorageAsset tmpAsset = storage.getAsset(""); + StorageAsset tmpAsset = storage.getRoot(); IndexMergerRequest indexMergerRequest = new IndexMergerRequest( authzRepos, true, id, -- 2.39.5