mirror of
https://github.com/apache/archiva.git
synced 2025-02-21 01:15:08 +00:00
Removing usage of Repository.getLocalPath
This commit is contained in:
parent
830ea54e0c
commit
d599b89e3d
@ -526,7 +526,7 @@ public ArchivaIndexingContext mergeContexts(Repository destinationRepo, List<Arc
|
||||
|
||||
private StorageAsset getIndexPath( Repository repo) throws IOException {
|
||||
IndexCreationFeature icf = repo.getFeature(IndexCreationFeature.class).get();
|
||||
Path repoDir = repo.getLocalPath();
|
||||
Path repoDir = repo.getAsset("").getFilePath();
|
||||
URI indexDir = icf.getIndexPath();
|
||||
String indexPath = indexDir.getPath();
|
||||
Path indexDirectory = null;
|
||||
@ -565,7 +565,7 @@ private IndexingContext createRemoteContext(RemoteRepository remoteRepository )
|
||||
|
||||
|
||||
// create remote repository path
|
||||
Path repoDir = remoteRepository.getLocalPath();
|
||||
Path repoDir = remoteRepository.getAsset("").getFilePath();
|
||||
if ( !Files.exists( repoDir ) )
|
||||
{
|
||||
Files.createDirectories( repoDir );
|
||||
@ -615,7 +615,7 @@ private IndexingContext createManagedContext( ManagedRepository repository ) thr
|
||||
|
||||
IndexingContext context;
|
||||
// take care first about repository location as can be relative
|
||||
Path repositoryDirectory = repository.getLocalPath();
|
||||
Path repositoryDirectory = repository.getAsset("").getFilePath();
|
||||
|
||||
if ( !Files.exists( repositoryDirectory ) )
|
||||
{
|
||||
|
@ -626,12 +626,12 @@ private StorageAsset getIndexPath(URI indexDir, Path repoDir, String defaultDir)
|
||||
|
||||
private StorageAsset getIndexPath( Repository repo) throws IOException {
|
||||
IndexCreationFeature icf = repo.getFeature(IndexCreationFeature.class).get();
|
||||
return getIndexPath( icf.getIndexPath(), repo.getLocalPath(), DEFAULT_INDEX_PATH);
|
||||
return getIndexPath( icf.getIndexPath(), repo.getAsset( "" ).getFilePath(), DEFAULT_INDEX_PATH);
|
||||
}
|
||||
|
||||
private StorageAsset getPackedIndexPath(Repository repo) throws IOException {
|
||||
IndexCreationFeature icf = repo.getFeature(IndexCreationFeature.class).get();
|
||||
return getIndexPath(icf.getPackedIndexPath(), repo.getLocalPath(), DEFAULT_PACKED_INDEX_PATH);
|
||||
return getIndexPath(icf.getPackedIndexPath(), repo.getAsset( "" ).getFilePath(), DEFAULT_PACKED_INDEX_PATH);
|
||||
}
|
||||
|
||||
private IndexingContext createRemoteContext(RemoteRepository remoteRepository ) throws IOException
|
||||
@ -642,7 +642,7 @@ private IndexingContext createRemoteContext(RemoteRepository remoteRepository )
|
||||
|
||||
|
||||
// create remote repository path
|
||||
Path repoDir = remoteRepository.getLocalPath();
|
||||
Path repoDir = remoteRepository.getAsset( "" ).getFilePath();
|
||||
if ( !Files.exists( repoDir ) )
|
||||
{
|
||||
Files.createDirectories( repoDir );
|
||||
@ -701,7 +701,7 @@ private IndexingContext createManagedContext( ManagedRepository repository ) thr
|
||||
|
||||
IndexingContext context;
|
||||
// take care first about repository location as can be relative
|
||||
Path repositoryDirectory = repository.getLocalPath();
|
||||
Path repositoryDirectory = repository.getAsset( "" ).getFilePath();
|
||||
|
||||
if ( !Files.exists( repositoryDirectory ) )
|
||||
{
|
||||
|
@ -93,7 +93,7 @@ public void tearDown() {
|
||||
@Test
|
||||
public void pack() throws Exception {
|
||||
createTestContext();
|
||||
Path destDir = repository.getLocalPath().resolve("org/apache/archiva/archiva-webapp/1.0");
|
||||
Path destDir = repository.getAsset( "" ).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 void pack() throws Exception {
|
||||
@Test
|
||||
public void scan() throws Exception {
|
||||
createTestContext();
|
||||
Path destDir = repository.getLocalPath().resolve("org/apache/archiva/archiva-webapp/1.0");
|
||||
Path destDir = repository.getAsset("").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);
|
||||
@ -138,7 +138,7 @@ public void update() throws Exception {
|
||||
public void addArtifactsToIndex() throws Exception {
|
||||
|
||||
ArchivaIndexingContext ctx = createTestContext();
|
||||
Path destDir = repository.getLocalPath().resolve("org/apache/archiva/archiva-search/1.0");
|
||||
Path destDir = repository.getAsset( "" ).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<>();
|
||||
@ -156,7 +156,7 @@ public void addArtifactsToIndex() throws Exception {
|
||||
@Test
|
||||
public void removeArtifactsFromIndex() throws Exception {
|
||||
ArchivaIndexingContext ctx = createTestContext();
|
||||
Path destDir = repository.getLocalPath().resolve("org/apache/archiva/archiva-search/1.0");
|
||||
Path destDir = repository.getAsset( "" ).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<>();
|
||||
|
@ -233,7 +233,7 @@ private ManagedRepository findArtifactInRepositories( List<String> repositoryIds
|
||||
for ( String repoId : repositoryIds )
|
||||
{
|
||||
ManagedRepository managedRepo = repositoryRegistry.getManagedRepository(repoId);
|
||||
Path repoDir = managedRepo.getLocalPath();
|
||||
Path repoDir = managedRepo.getAsset("").getFilePath();
|
||||
|
||||
Path file = pathTranslator.toFile( repoDir, projectArtifact.getGroupId(), projectArtifact.getArtifactId(),
|
||||
projectArtifact.getBaseVersion(),
|
||||
|
@ -123,7 +123,7 @@ public RepositoryModelResolver(ManagedRepository managedRepository, RepositoryPa
|
||||
|
||||
this.targetRepository = targetRepository;
|
||||
|
||||
this.session = MavenSystemManager.newRepositorySystemSession( managedRepository.getLocalPath().toString() );
|
||||
this.session = MavenSystemManager.newRepositorySystemSession( managedRepository.getAsset("").getFilePath().toString() );
|
||||
|
||||
this.versionRangeResolver = mavenSystemManager.getLocator().getService(VersionRangeResolver.class);
|
||||
|
||||
@ -300,7 +300,7 @@ private boolean getModelFromProxy( RemoteRepository remoteRepository, String gro
|
||||
Path tmpSha1 = null;
|
||||
Path tmpResource = null;
|
||||
String artifactPath = pathTranslator.toPath( groupId, artifactId, version, filename );
|
||||
Path resource = targetRepository.getLocalPath().resolve( artifactPath );
|
||||
Path resource = targetRepository.getAsset("").getFilePath().resolve( artifactPath );
|
||||
|
||||
Path workingDirectory = createWorkingDirectory( targetRepository.getLocation().toString() );
|
||||
try
|
||||
|
@ -168,14 +168,14 @@ public void updateManagedInstance(EditableManagedRepository repo, ManagedReposit
|
||||
throw new RepositoryException("The location entry is not a valid uri: " + cfg.getLocation());
|
||||
}
|
||||
setBaseConfig(repo, cfg);
|
||||
Path repoDir = repo.getLocalPath();
|
||||
Path repoDir = repo.getAsset("").getFilePath();
|
||||
if (!Files.exists(repoDir)) {
|
||||
log.debug("Creating repo directory {}", repoDir);
|
||||
try {
|
||||
Files.createDirectories(repoDir);
|
||||
} catch (IOException e) {
|
||||
log.error("Could not create directory {} for repository {}", repo.getLocalPath(), repo.getId(), e);
|
||||
throw new RepositoryException("Could not create directory for repository " + repo.getLocalPath());
|
||||
log.error("Could not create directory {} for repository {}", repoDir, repo.getId(), e);
|
||||
throw new RepositoryException("Could not create directory for repository " + repoDir);
|
||||
}
|
||||
}
|
||||
repo.setSchedulingDefinition(cfg.getRefreshCronExpression());
|
||||
|
@ -529,7 +529,7 @@ public ArchivaIndexingContext mergeContexts(Repository destinationRepo, List<Arc
|
||||
|
||||
private StorageAsset getIndexPath( Repository repo) throws IOException {
|
||||
IndexCreationFeature icf = repo.getFeature(IndexCreationFeature.class).get();
|
||||
Path repoDir = repo.getLocalPath();
|
||||
Path repoDir = repo.getAsset( "" ).getFilePath();
|
||||
URI indexDir = icf.getIndexPath();
|
||||
String indexPath = indexDir.getPath();
|
||||
Path indexDirectory = null;
|
||||
@ -568,7 +568,7 @@ private IndexingContext createRemoteContext(RemoteRepository remoteRepository )
|
||||
|
||||
|
||||
// create remote repository path
|
||||
Path repoDir = remoteRepository.getLocalPath();
|
||||
Path repoDir = remoteRepository.getAsset("").getFilePath();
|
||||
if ( !Files.exists( repoDir ) )
|
||||
{
|
||||
Files.createDirectories( repoDir );
|
||||
@ -618,7 +618,7 @@ private IndexingContext createManagedContext( ManagedRepository repository ) thr
|
||||
|
||||
IndexingContext context;
|
||||
// take care first about repository location as can be relative
|
||||
Path repositoryDirectory = repository.getLocalPath();
|
||||
Path repositoryDirectory = repository.getAsset("").getFilePath();
|
||||
|
||||
if ( !Files.exists( repositoryDirectory ) )
|
||||
{
|
||||
|
@ -132,7 +132,7 @@ protected IndexingContext getIndexingContext() throws UnsupportedBaseContextExce
|
||||
public void testAddArtifactToIndex()
|
||||
throws Exception
|
||||
{
|
||||
Path basePath = repo.getLocalPath();
|
||||
Path basePath = repo.getAsset("").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 void testAddArtifactToIndex()
|
||||
public void testUpdateArtifactInIndex()
|
||||
throws Exception
|
||||
{
|
||||
Path basePath = repo.getLocalPath();
|
||||
Path basePath = repo.getAsset("").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 void testUpdateArtifactInIndex()
|
||||
public void testRemoveArtifactFromIndex()
|
||||
throws Exception
|
||||
{
|
||||
Path basePath = repo.getLocalPath();
|
||||
Path basePath = repo.getAsset("").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 void testPackagedIndex()
|
||||
throws Exception
|
||||
{
|
||||
|
||||
Path basePath = repo.getLocalPath();
|
||||
Path basePath = repo.getAsset("").getFilePath();
|
||||
IndexCreationFeature icf = repo.getFeature( IndexCreationFeature.class ).get();
|
||||
StorageAsset packedIndexDirectory = icf.getLocalPackedIndexPath();
|
||||
StorageAsset indexerDirectory = icf.getLocalIndexPath();
|
||||
|
@ -513,7 +513,7 @@ public ArchivaIndexingContext mergeContexts(Repository destinationRepo, List<Arc
|
||||
|
||||
private StorageAsset getIndexPath( Repository repo) throws IOException {
|
||||
IndexCreationFeature icf = repo.getFeature(IndexCreationFeature.class).get();
|
||||
Path repoDir = repo.getLocalPath();
|
||||
Path repoDir = repo.getAsset("").getFilePath();
|
||||
URI indexDir = icf.getIndexPath();
|
||||
String indexPath = indexDir.getPath();
|
||||
Path indexDirectory = null;
|
||||
@ -552,7 +552,7 @@ private IndexingContext createRemoteContext(RemoteRepository remoteRepository )
|
||||
|
||||
|
||||
// create remote repository path
|
||||
Path repoDir = remoteRepository.getLocalPath();
|
||||
Path repoDir = remoteRepository.getAsset("").getFilePath();
|
||||
if ( !Files.exists( repoDir ) )
|
||||
{
|
||||
Files.createDirectories( repoDir );
|
||||
@ -602,7 +602,7 @@ private IndexingContext createManagedContext( ManagedRepository repository ) thr
|
||||
|
||||
IndexingContext context;
|
||||
// take care first about repository location as can be relative
|
||||
Path repositoryDirectory = repository.getLocalPath();
|
||||
Path repositoryDirectory = repository.getAsset("").getFilePath();
|
||||
|
||||
if ( !Files.exists( repositoryDirectory ) )
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user