This is an automated email from the ASF dual-hosted git repository.

martin_s pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/archiva.git

commit a34a59f9c35869909b2940894821f391b296a479
Author: Martin Stockhammer <[email protected]>
AuthorDate: Thu Feb 27 22:33:23 2020 +0100

    Adding leaf method
---
 .../org/apache/archiva/repository/storage/StorageAsset.java | 13 ++++++++++---
 .../apache/archiva/repository/storage/FilesystemAsset.java  | 10 ++++++++++
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git 
a/archiva-modules/archiva-base/archiva-storage-api/src/main/java/org/apache/archiva/repository/storage/StorageAsset.java
 
b/archiva-modules/archiva-base/archiva-storage-api/src/main/java/org/apache/archiva/repository/storage/StorageAsset.java
index 5e6b529..8209fcd 100644
--- 
a/archiva-modules/archiva-base/archiva-storage-api/src/main/java/org/apache/archiva/repository/storage/StorageAsset.java
+++ 
b/archiva-modules/archiva-base/archiva-storage-api/src/main/java/org/apache/archiva/repository/storage/StorageAsset.java
@@ -36,6 +36,7 @@ import java.util.List;
  *
  * The implementation may read the data directly from the filesystem or 
underlying storage implementation.
  *
+ * @since 3.0
  * @author Martin Stockhammer <[email protected]>
  */
 public interface StorageAsset
@@ -56,24 +57,30 @@ public interface StorageAsset
 
     /**
      * Returns the name of the asset. It may be just the filename.
-     * @return
+     * @return the asset name
      */
     String getName();
 
     /**
      * Returns the time of the last modification.
      *
-     * @return
+     * @return the time instant of the last modification
      */
     Instant getModificationTime();
 
     /**
      * Returns true, if this asset is a container type and contains further 
child assets.
-     * @return
+     * @return <code>true</code>, if this is a container type, otherwise 
<code>false</code>
      */
     boolean isContainer();
 
     /**
+     * Returns true, if this asset is a leaf node and cannot contain further 
childs
+     * @return <code>true</code>, if this is a leaf type, otherwise 
<code>false</code>
+     */
+    boolean isLeaf();
+
+    /**
      * List the child assets.
      *
      * @return The list of children. If there are no children and if the asset 
is not a container, a empty list will be returned.
diff --git 
a/archiva-modules/archiva-base/archiva-storage-fs/src/main/java/org/apache/archiva/repository/storage/FilesystemAsset.java
 
b/archiva-modules/archiva-base/archiva-storage-fs/src/main/java/org/apache/archiva/repository/storage/FilesystemAsset.java
index 271dc1e..2f501d6 100644
--- 
a/archiva-modules/archiva-base/archiva-storage-fs/src/main/java/org/apache/archiva/repository/storage/FilesystemAsset.java
+++ 
b/archiva-modules/archiva-base/archiva-storage-fs/src/main/java/org/apache/archiva/repository/storage/FilesystemAsset.java
@@ -257,6 +257,16 @@ public class FilesystemAsset implements StorageAsset, 
Comparable {
         }
     }
 
+    @Override
+    public boolean isLeaf( )
+    {
+        if (Files.exists( assetPath )) {
+            return Files.isRegularFile( assetPath );
+        } else {
+            return !directoryHint;
+        }
+    }
+
     /**
      * Returns the list of directory entries, if this asset represents a 
directory.
      * Otherwise a empty list will be returned.

Reply via email to