]> source.dussan.org Git - archiva.git/commitdiff
Adding getroot method for repository
authorMartin Stockhammer <martin_s@apache.org>
Thu, 4 Jun 2020 18:12:32 +0000 (20:12 +0200)
committerMartin Stockhammer <martin_s@apache.org>
Thu, 4 Jun 2020 18:12:32 +0000 (20:12 +0200)
35 files changed:
archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/MetadataUpdaterConsumer.java
archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurge.java
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/mock/ArchivaIndexManagerMock.java
archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/AbstractRemoteRepository.java
archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/AbstractRepository.java
archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/ArchivaRepositoryRegistry.java
archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/BasicManagedRepository.java
archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/metadata/base/MetadataTools.java
archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/content/base/ContentItemTest.java
archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/mock/ManagedRepositoryContentMock.java
archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/DefaultRepositoryScanner.java
archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/mock/ManagedRepositoryContentMock.java
archiva-modules/archiva-base/archiva-storage-api/src/main/java/org/apache/archiva/repository/storage/RepositoryStorage.java
archiva-modules/archiva-base/archiva-storage-api/src/test/java/org/apache/archiva/repository/storage/mock/MockStorage.java
archiva-modules/archiva-base/archiva-storage-fs/src/main/java/org/apache/archiva/repository/storage/fs/FilesystemStorage.java
archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/indexer/maven/MavenIndexContext.java
archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/indexer/maven/MavenIndexManager.java
archiva-modules/archiva-maven/archiva-maven-indexer/src/test/java/org/apache/archiva/indexer/maven/MavenIndexManagerTest.java
archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/HttpProxyTransferTest.java
archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/repository/mock/ManagedRepositoryContentMock.java
archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/MavenManagedRepository.java
archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/MavenRepositoryGroup.java
archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/MavenRepositoryProvider.java
archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/content/ManagedDefaultRepositoryContent.java
archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/dependency/tree/Maven3DependencyTreeBuilder.java
archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/metadata/storage/Maven2RepositoryStorage.java
archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/metadata/storage/RepositoryModelResolver.java
archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/maven/content/ManagedDefaultRepositoryContentTest.java
archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/maven/content/MavenContentHelperTest.java
archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/maven/metadata/MetadataToolsTest.java
archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/maven/mock/ArchivaIndexManagerMock.java
archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/maven/mock/MavenIndexContextMock.java
archiva-modules/archiva-maven/archiva-maven-scheduler/src/test/java/org/apache/archiva/scheduler/indexing/maven/ArchivaIndexingTaskExecutorTest.java
archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/mock/ArchivaIndexManagerMock.java
archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java

index 3cd973e6b7cc452fd608b7b79b356c65970a93a9..9c0aeb79e8d5eb6a801310563d6ef13cd911c014 100644 (file)
@@ -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 )
index fe58824a3f46bfcfcdd796f5fc24f0e427fe4eac..f9dca9999ef6ad91795f6ec35b65699b71da26c8 100644 (file)
@@ -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() )
index 31b115ae57a6df8150504275a6af9d0625badd94..e2255ee4212114762c8d7b26bc7d0bac762cd75c 100644 (file)
@@ -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 ) )
         {
index 9e14a05220d14830091b5194357d097d9b22997b..b53997eb022bec7744070b6ae0d5c4ee819ddbba 100644 (file)
@@ -152,7 +152,7 @@ public abstract class AbstractRemoteRepository extends AbstractRepository implem
      */
     @Override
     public StorageAsset getLocalPath() {
-        return getStorage().getAsset("");
+        return getStorage().getRoot();
     }
 
     @Override
index 9778c2aa81cd6f5e23f56ec258bfda979a3b570a..6fb6a2f90e90aaef1f3937ac2e70c64e23948e19 100644 (file)
@@ -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
index 4bd19998c11cd91bdbe578e71ded7cf0186550b1..b909e24de0b15e18277d268dc5588cc6083f8e15 100644 (file)
@@ -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 );
         }
     }
index f3e13617a2bee2e1204f555e45b2d3878ea6553a..a82fd77a9cd7ccae7170b4892f0803aefb2d9e7c 100644 (file)
@@ -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;
index a9eebef5910a8df7ade96368b6b9c4b8c42ff571..3a02bbe306b1816460799c36be1c12838c19e536 100644 (file)
@@ -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())
         {
index 8f266d2923d159fa0d21499f5091241ef3b99fac..14451fa5d8d98f083a1f1d25089b581f97dbe0ae 100644 (file)
@@ -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();
 
     }
 
index 69af3d37f5ead05fdc1d6460e515d58253040b8d..83bddf8e7a5c4bd85db2b887ca3c8a39e736f343 100644 (file)
@@ -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 );
     }
 
index 3b49e3a9b991b7e615992eee6d9d7eec132c9177..650162bd5ebe07abb02507c5016c9cb073a49fc7 100644 (file)
@@ -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
index 06e9680e2c0cf5a12d4b81703c570e71b6b01248..1a967072703270809f50a172b926df901b3610dc 100644 (file)
@@ -313,7 +313,7 @@ public class ManagedRepositoryContentMock implements BaseRepositoryContentLayout
                 e.printStackTrace();
             }
         }
-        return fsStorage.getAsset("");
+        return fsStorage.getRoot();
     }
 
     @Override
index 1890914079b744f610c33a034a8e67a1ee443327..ce1089c8ba317948b638f75d4f737d6be263859d 100644 (file)
@@ -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.
      *
index 2741c30473ea1baa3ace2590e2e15e3f35d4552b..e024caefb0282ad4aec08510e9c87417188a6a3c 100644 (file)
@@ -105,6 +105,12 @@ public class MockStorage implements RepositoryStorage
         return parent;
     }
 
+    @Override
+    public StorageAsset getRoot( )
+    {
+        return root;
+    }
+
     @Override
     public void consumeData( StorageAsset asset, Consumer<InputStream> consumerFunction, boolean readLock ) throws IOException
     {
index 339e65d384e11030c11fb55280c155643c4ddeb3..fcc1dda61ca248d577f8fdd36333e13fff92690f 100644 (file)
@@ -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 )
     {
index 3ece4b0a0347b61208b5a60a187bf3775e4ba4a9..74542b221b822682b9a4535d7f88e08db832d60f 100644 (file)
@@ -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");
                 }
index 5f190fc191b8136304ac83255114fa4e6c7c7245..b1231844d6fabe839746e6816144367ccacb346d 100644 (file)
@@ -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 ) )
         {
index ed4f5458192b2b767957788ea3bb0d9c8ced3790..c025180edb1b4215df9348f80c24a131e2540c6e 100644 (file)
@@ -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<URI> 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<URI> uriList = new ArrayList<>();
index 2a028ab59a26fe5b21ff09958ee64aef73d5cdb0..c48586fe6aec76ad7724d14569d0546fcb8edd7f 100644 (file)
@@ -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 );
 
index 831b2c6c09fc51479382f27377aaa37d1124ce8f..d00159fd1cd398fe8e6a2e0d77d4e6da60a1939c 100644 (file)
@@ -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
index 6106f569846039fcde5cb9edee1153139216248c..a24c7daee7b28be0d9e699b7709426a1f90272ff 100644 (file)
@@ -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
index 06a22ac730f941fa602f72ff005f17d68fe028c6..952713d88eac27ff5e39d05e1c7defb593e5a6a1 100644 (file)
@@ -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() {
index 801cd8730a7f84729af04564fa6d0d2279cc7f58..77b9103129fa5f300f8695aa49ec96b7a80fc3e6 100644 (file)
@@ -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);
index 6349618dfeae0f8341e5b9bf38c72040bb8bbc3b..662a3c8a9e113fb209c8bdbbb205588bb4122a21 100644 (file)
@@ -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( );
     }
 
     /**
index d8d0a0c3c3720bca58c8430dc6c02144068b984c..58b1939ef4a1492780482be8cddb897c271284cd 100644 (file)
@@ -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(),
index bcda250eb1336ed8d2f4db502a4fefdbca369a19..51dec603ffe8afa2e498d3504ae9eed50a675449 100644 (file)
@@ -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
index c8f0ebef19914afe65f830b9bddf4179fd1fbc38..6b72cc1583e7fede3fcc063cad82abea4461785b 100644 (file)
@@ -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
index 5b13edf88fdcf5b33173cd973dcedb030ac15040..39be5fad4e0e0478c63112f8a8aa8f53386a5035 100644 (file)
@@ -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 ))
index 5466bac31169859b6f38a3ce306c64d9e461e6eb..1fc0fc5706ebf76d58eb1f89675aee2a2fdd2970 100644 (file)
@@ -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 );
index fa66d29bf068f563318635ed2bbffec89988415a..1d437eb4742812f6d9f6c973cd0c5656061fcf39 100644 (file)
@@ -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);
index 2224e159ae024d05cf161775ed56e70469282011..ae00fdb7aa049d94d1bbf4a02519136471a8df52 100644 (file)
@@ -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 ) )
         {
index 9d4ad08ae307dd29e9639d8630bfcfe3fb1add27..70c8d56411e0a0cb1cfac95229229f08a19b1e06 100644 (file)
@@ -61,7 +61,7 @@ public class MavenIndexContextMock implements ArchivaIndexingContext {
 
     @Override
     public StorageAsset getPath() {
-        return indexStorage.getAsset("");
+        return indexStorage.getRoot();
     }
 
     @Override
index 64433fe39ff7763a9c672dc2c6fc550ea602298f..3f44b5f8a0cf85c71edc9a3e1c6f4217e953f94c 100644 (file)
@@ -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();
index 6182be541742b5f7c88a8b3c3d25fdd785fea250..76199e1e2b80813c241d24c68c329dadd2a7977b 100644 (file)
@@ -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 ) )
         {
index fcc9c844b6d7e33438c403c8bba9ab62f9562140..5978409f6d6983a96864bbd0d688b0b6c8971802 100644 (file)
@@ -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,