]> source.dussan.org Git - archiva.git/commitdiff
Removing method from repository layout
authorMartin Stockhammer <martin_s@apache.org>
Wed, 3 Jun 2020 14:03:29 +0000 (16:03 +0200)
committerMartin Stockhammer <martin_s@apache.org>
Wed, 3 Jun 2020 14:03:29 +0000 (16:03 +0200)
archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/BaseRepositoryContentLayout.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/mock/ManagedRepositoryContentMock.java
archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/mock/ManagedRepositoryContentMock.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/content/ManagedDefaultRepositoryContent.java
archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/dependency/tree/Maven3DependencyTreeBuilder.java

index 3cb7b153c2d28c11670e29b0c50af7adb4cbaea2..71562b127d94ee9ca7713405148609bc3e045636 100644 (file)
@@ -270,17 +270,4 @@ public interface BaseRepositoryContentLayout extends ManagedRepositoryContentLay
     /// *****************   End of new generation interface **********************
 
 
-    /**
-     * <p>
-     * Convenience method to get the repository (on disk) root directory.
-     * </p>
-     * <p>
-     * Equivalent to calling <code>.getRepository().getLocation()</code>
-     * </p>
-     *
-     * @return the repository (on disk) root directory.
-     */
-    String getRepoRoot();
-
-
 }
index a31554bb13fdaa0eaabbe9ade9948ae9609ba99e..a9eebef5910a8df7ade96368b6b9c4b8c42ff571 100644 (file)
@@ -937,23 +937,24 @@ public class MetadataTools
             path = path.substring( 0, idx );
         }
 
-        Path repoDir = Paths.get( managedRepository.getRepoRoot(), path );
+        StorageAsset repoDir = managedRepository.getGenericContent( ).getRepository( ).getAsset( "" );
 
-        if ( !Files.exists(repoDir))
+        if ( !repoDir.exists())
         {
             throw new IOException( "Unable to gather the list of snapshot versions on a non-existant directory: "
-                                       + repoDir.toAbsolutePath() );
+                                       + repoDir.toString() );
         }
 
-        if ( !Files.isDirectory( repoDir ))
+        if ( !repoDir.isContainer())
         {
             throw new IOException(
-                "Unable to gather the list of snapshot versions on a non-directory: " + repoDir.toAbsolutePath() );
+                "Unable to gather the list of snapshot versions on a non-directory: " + repoDir.toString() );
         }
 
-        try(Stream<Path> stream = Files.list(repoDir)) {
+        Path repoRoot = repoDir.getFilePath( );
+        try(Stream<Path> stream = Files.list(repoRoot)) {
             String result = stream.filter(  Files::isRegularFile ).map( path1 ->
-                PathUtil.getRelative( managedRepository.getRepoRoot(), path1 )
+                repoRoot.relativize( path1 ).toString()
             ).filter( filetypes::matchesArtifactPattern ).findFirst().orElse( null );
             if (result!=null) {
                 return managedRepository.getGenericContent().toArtifactReference( result );
index 60e8fd35fbd1d20d9daee41bf7926ecadc02deaf..69af3d37f5ead05fdc1d6460e515d58253040b8d 100644 (file)
@@ -303,12 +303,6 @@ public class ManagedRepositoryContentMock implements BaseRepositoryContentLayout
         return null;
     }
 
-    @Override
-    public String getRepoRoot( )
-    {
-        return null;
-    }
-
     @Override
     public ManagedRepository getRepository( )
     {
index ecc6430ebcbf855a8be59d5a87b370b10b2ea092..06e9680e2c0cf5a12d4b81703c570e71b6b01248 100644 (file)
@@ -305,12 +305,6 @@ public class ManagedRepositoryContentMock implements BaseRepositoryContentLayout
         return repository.getId();
     }
 
-    @Override
-    public String getRepoRoot( )
-    {
-        return getRepoRootAsset().getFilePath().toString();
-    }
-
     private StorageAsset getRepoRootAsset() {
         if (fsStorage==null) {
             try {
index 63a03727751a2f1b56eeb50b442ac627b0d53bb8..831b2c6c09fc51479382f27377aaa37d1124ce8f 100644 (file)
@@ -326,12 +326,6 @@ public class ManagedRepositoryContentMock implements BaseRepositoryContentLayout
         return repository.getId();
     }
 
-    @Override
-    public String getRepoRoot( )
-    {
-        return getRepoRootAsset().getFilePath().toString();
-    }
-
     private StorageAsset getRepoRootAsset() {
         if (fsStorage==null) {
             try {
index f63d83a764f3fe24eea695bd4a0d57bd43ef7c92..6349618dfeae0f8341e5b9bf38c72040bb8bbc3b 100644 (file)
@@ -1374,12 +1374,6 @@ public class ManagedDefaultRepositoryContent
 
     }
 
-    @Override
-    public String getRepoRoot( )
-    {
-        return convertUriToPath( repository.getLocation( ) );
-    }
-
     private String convertUriToPath( URI uri )
     {
         if ( uri.getScheme( ) == null )
index b7dbc09740d9723ea5abb1209f2d49f68a6d8533..d8d0a0c3c3720bca58c8430dc6c02144068b984c 100644 (file)
@@ -159,14 +159,7 @@ public class Maven3DependencyTreeBuilder
         // FIXME take care of relative path
         ResolveRequest resolveRequest = new ResolveRequest();
         resolveRequest.dependencyVisitor = dependencyVisitor;
-        try
-        {
-            resolveRequest.localRepoDir = repository.getContent().getLayout( BaseRepositoryContentLayout.class ).getRepoRoot();
-        }
-        catch ( LayoutException e )
-        {
-            throw new DependencyTreeBuilderException( "Could not convert to layout " + e.getMessage( ), e );
-        }
+        resolveRequest.localRepoDir = repository.getAsset( "" ).getFilePath().toAbsolutePath().toString();
         resolveRequest.groupId = groupId;
         resolveRequest.artifactId = artifactId;
         resolveRequest.version = version;