From b804db659977514037ea19b2cc473fcba9701a67 Mon Sep 17 00:00:00 2001 From: Martin Stockhammer Date: Sat, 13 Jun 2020 14:03:27 +0200 Subject: [PATCH] Adding layout method --- .../archiva/repository/ManagedRepositoryContent.java | 6 ++++++ .../repository/ManagedRepositoryContentLayout.java | 1 + .../maven/content/ManagedDefaultRepositoryContent.java | 9 +++++++++ 3 files changed, 16 insertions(+) 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 f4ad5af12..4c06dab85 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 @@ -193,4 +193,10 @@ public interface ManagedRepositoryContent extends RepositoryContent * @return true, if the layout is supported, otherwise false */ boolean supportsLayout(Class clazz); + + /** + * Returns a list of supported layout classes + * @return + */ + List> getSupportedLayouts( ); } 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 3bc4736b3..d53743d7a 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 @@ -48,4 +48,5 @@ public interface ManagedRepositoryContentLayout * @throws LayoutException if the conversion is not possible */ T adaptItem( Class clazz, ContentItem item ) throws LayoutException; + } diff --git a/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/content/ManagedDefaultRepositoryContent.java b/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/content/ManagedDefaultRepositoryContent.java index b66207dd8..72dc336a4 100644 --- a/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/content/ManagedDefaultRepositoryContent.java +++ b/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/content/ManagedDefaultRepositoryContent.java @@ -65,6 +65,7 @@ import java.net.URI; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; +import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Objects; @@ -120,6 +121,8 @@ public class ManagedDefaultRepositoryContent public static final Pattern GENERIC_SNAPSHOT_PATTERN = Pattern.compile( "^(.*)-" + SNAPSHOT ); + private static final List> LAYOUTS = Arrays.asList( BaseRepositoryContentLayout.class ); + /** * We are caching content items in a weak reference map. To avoid always recreating the * the hierarchical structure. @@ -1461,6 +1464,12 @@ public class ManagedDefaultRepositoryContent return clazz.isAssignableFrom( this.getClass( ) ); } + @Override + public List> getSupportedLayouts( ) + { + return LAYOUTS; + } + /** * Moves the file to the artifact destination */ -- 2.39.5