Removing method from repository layout

This commit is contained in:
Martin Stockhammer 2020-06-03 16:03:29 +02:00
parent d8f55d0c99
commit cb0e5f8eea
7 changed files with 9 additions and 52 deletions

View 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();
}

View 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 );

View File

@ -303,12 +303,6 @@ public class ManagedRepositoryContentMock implements BaseRepositoryContentLayout
return null;
}
@Override
public String getRepoRoot( )
{
return null;
}
@Override
public ManagedRepository getRepository( )
{

View 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 {

View 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 {

View 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 )

View 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;