aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-base/archiva-repository-api
diff options
context:
space:
mode:
authorMartin Stockhammer <martin_s@apache.org>2020-06-01 14:03:03 +0200
committerMartin Stockhammer <martin_s@apache.org>2020-06-01 14:03:03 +0200
commit2257aae023b20646e0b34369be24f5fc1718750f (patch)
tree7118f423730ab645510567f83e6aa4bf72348ef4 /archiva-modules/archiva-base/archiva-repository-api
parent6d7a510dea283ff8c4b1e6ae54a395dbe386e4a5 (diff)
downloadarchiva-2257aae023b20646e0b34369be24f5fc1718750f.tar.gz
archiva-2257aae023b20646e0b34369be24f5fc1718750f.zip
Repository content refactoring
Diffstat (limited to 'archiva-modules/archiva-base/archiva-repository-api')
-rw-r--r--archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/BaseRepositoryContentLayout.java27
-rw-r--r--archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/ManagedRepositoryContent.java3
-rw-r--r--archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/ManagedRepositoryContentLayout.java19
3 files changed, 30 insertions, 19 deletions
diff --git a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/BaseRepositoryContentLayout.java b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/BaseRepositoryContentLayout.java
index 0d8e9029d..e08ed3cb3 100644
--- a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/BaseRepositoryContentLayout.java
+++ b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/BaseRepositoryContentLayout.java
@@ -25,6 +25,7 @@ import org.apache.archiva.model.ProjectReference;
import org.apache.archiva.model.VersionedReference;
import org.apache.archiva.repository.content.Artifact;
import org.apache.archiva.repository.content.ContentItem;
+import org.apache.archiva.repository.content.DataItem;
import org.apache.archiva.repository.content.ItemNotFoundException;
import org.apache.archiva.repository.content.ItemSelector;
import org.apache.archiva.repository.content.Namespace;
@@ -48,6 +49,7 @@ public interface BaseRepositoryContentLayout extends RepositoryContent, ManagedR
/// ***************** New generation interface **********************
+
/**
* Returns the namespace for the given selected coordinates. The selector must specify a namespace. All other
* coordinates are ignored.
@@ -248,6 +250,14 @@ public interface BaseRepositoryContentLayout extends RepositoryContent, ManagedR
*/
void addArtifact( Path sourceFile, Artifact destination ) throws IllegalArgumentException, ContentAccessException;
+ /**
+ * Returns the metadata file for the given version.
+ *
+ * @param version the version
+ * @return the metadata file
+ */
+ DataItem getMetadataItem( Version version );
+
/// ***************** End of new generation interface **********************
@@ -419,22 +429,5 @@ public interface BaseRepositoryContentLayout extends RepositoryContent, ManagedR
*/
String toMetadataPath( ProjectReference reference );
- /**
- * Given a {@link VersionedReference}, return the path to the metadata for
- * the specific version of the project.
- *
- * @param reference the reference to use.
- * @return the path to the metadata file, or null if no metadata is appropriate.
- */
- String toMetadataPath( VersionedReference reference );
-
- /**
- * Given an {@link ArchivaArtifact}, return the relative path to the artifact.
- *
- * @param reference the archiva artifact to use.
- * @return the relative path to the artifact.
- */
- String toPath( ArchivaArtifact reference );
-
}
diff --git a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/ManagedRepositoryContent.java b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/ManagedRepositoryContent.java
index 69364af1f..f4ad5af12 100644
--- a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/ManagedRepositoryContent.java
+++ b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/ManagedRepositoryContent.java
@@ -30,7 +30,7 @@ import java.util.stream.Stream;
/**
* @author Martin Stockhammer <martin_s@apache.org>
*/
-public interface ManagedRepositoryContent
+public interface ManagedRepositoryContent extends RepositoryContent
{
@@ -43,7 +43,6 @@ public interface ManagedRepositoryContent
String toPath( ContentItem item );
-
/**
* <p>
* Convenience method to get the repository id.
diff --git a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/ManagedRepositoryContentLayout.java b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/ManagedRepositoryContentLayout.java
index e64f8b2ac..3bc4736b3 100644
--- a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/ManagedRepositoryContentLayout.java
+++ b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/ManagedRepositoryContentLayout.java
@@ -18,6 +18,9 @@ package org.apache.archiva.repository;
* under the License.
*/
+import org.apache.archiva.repository.content.ContentItem;
+import org.apache.archiva.repository.content.DataItem;
+
/**
*
* Basic interface for content layouts.
@@ -28,5 +31,21 @@ package org.apache.archiva.repository;
*/
public interface ManagedRepositoryContentLayout
{
+
+ /**
+ * Returns the repository content, that this layout is attached to.
+ * @return the content instance
+ */
ManagedRepositoryContent getGenericContent();
+
+ /**
+ * Adapts a generic content item to a specific implementation class.
+ *
+ * @param clazz the target implementation
+ * @param item the content item
+ * @param <T> the target class
+ * @return the adapted instance
+ * @throws LayoutException if the conversion is not possible
+ */
+ <T extends ContentItem> T adaptItem( Class<T> clazz, ContentItem item ) throws LayoutException;
}