diff options
author | Martin Stockhammer <martin_s@apache.org> | 2020-06-02 22:53:18 +0200 |
---|---|---|
committer | Martin Stockhammer <martin_s@apache.org> | 2020-06-02 22:53:18 +0200 |
commit | 873753536bbc1cd1639016ae845625f631f3cff1 (patch) | |
tree | 0345e0a67b08ceae743a8a8fb8e7db5772a9dceb /archiva-modules/archiva-base | |
parent | 22a8cbfd22c8cfb33a8d4e3e82cf22a7c03df68b (diff) | |
download | archiva-873753536bbc1cd1639016ae845625f631f3cff1.tar.gz archiva-873753536bbc1cd1639016ae845625f631f3cff1.zip |
Switching to new repository layout
Diffstat (limited to 'archiva-modules/archiva-base')
2 files changed, 25 insertions, 1 deletions
diff --git a/archiva-modules/archiva-base/archiva-model/src/main/java/org/apache/archiva/model/ArtifactReference.java b/archiva-modules/archiva-base/archiva-model/src/main/java/org/apache/archiva/model/ArtifactReference.java index 93173773f..ebed7c494 100644 --- a/archiva-modules/archiva-base/archiva-model/src/main/java/org/apache/archiva/model/ArtifactReference.java +++ b/archiva-modules/archiva-base/archiva-model/src/main/java/org/apache/archiva/model/ArtifactReference.java @@ -69,6 +69,19 @@ public class ArtifactReference private String type; + public String getProjectVersion( ) + { + return projectVersion; + } + + public void setProjectVersion( String projectVersion ) + { + this.projectVersion = projectVersion; + } + + private String projectVersion; + + //-----------/ //- Methods -/ //-----------/ diff --git a/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/DefaultRepositoryProxyHandler.java b/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/DefaultRepositoryProxyHandler.java index e5c0b4b0d..d01058116 100644 --- a/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/DefaultRepositoryProxyHandler.java +++ b/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/DefaultRepositoryProxyHandler.java @@ -49,6 +49,9 @@ import org.apache.archiva.repository.ManagedRepository; import org.apache.archiva.repository.RemoteRepository; import org.apache.archiva.repository.RemoteRepositoryContent; import org.apache.archiva.repository.RepositoryType; +import org.apache.archiva.repository.content.Artifact; +import org.apache.archiva.repository.content.ItemSelector; +import org.apache.archiva.repository.content.base.ArchivaItemSelector; import org.apache.archiva.repository.metadata.base.MetadataTools; import org.apache.archiva.repository.metadata.RepositoryMetadataException; import org.apache.archiva.repository.storage.fs.FilesystemStorage; @@ -418,7 +421,15 @@ public abstract class DefaultRepositoryProxyHandler implements RepositoryProxyHa private StorageAsset toLocalFile(ManagedRepository repository, ArtifactReference artifact ) throws LayoutException { - return repository.getContent().getLayout( BaseRepositoryContentLayout.class ).toFile( artifact ); + ItemSelector selector = ArchivaItemSelector.builder( ) + .withNamespace( artifact.getGroupId( ) ) + .withProjectId( artifact.getArtifactId( ) ) + .withArtifactId( artifact.getArtifactId( ) ) + .withArtifactVersion( artifact.getVersion() ) + .withVersion( artifact.getProjectVersion( ) ) + .withType( artifact.getType( ) ).build(); + Artifact repoArtifact = repository.getContent( ).getLayout( BaseRepositoryContentLayout.class ).getArtifact( selector ); + return repoArtifact.getAsset( ); } /** |