You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2024/08/12 12:43:23 UTC

(commons-vfs) 01/02: Javadoc

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

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-vfs.git

commit c2f27144952dbbd66f8c5e64a63b93e094410eef
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Aug 12 08:03:00 2024 -0400

    Javadoc
---
 .../apache/commons/vfs2/cache/LRUFilesCache.java   |  6 +++++
 .../commons/vfs2/cache/SoftRefFilesCache.java      | 18 +++++++++++---
 .../vfs2/impl/StandardFileSystemManager.java       |  5 ++++
 .../commons/vfs2/provider/sftp/SftpFileSystem.java |  7 ++++++
 .../commons/vfs2/provider/zip/ZipFileSystem.java   | 29 +++++++++++++++++++---
 5 files changed, 58 insertions(+), 7 deletions(-)

diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/LRUFilesCache.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/LRUFilesCache.java
index 450497e5..ae9080a4 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/LRUFilesCache.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/LRUFilesCache.java
@@ -157,6 +157,12 @@ public class LRUFilesCache extends AbstractFilesCache {
         }
     }
 
+    /**
+     * Gets or creates a new Map.
+     *
+     * @param fileSystem the key
+     * @return an existing or new Map.
+     */
     protected Map<FileName, FileObject> getOrCreateFilesystemCache(final FileSystem fileSystem) {
         return fileSystemCache.computeIfAbsent(fileSystem, k -> new MyLRUMap(k, lruSize));
     }
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/SoftRefFilesCache.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/SoftRefFilesCache.java
index ac0cea64..b58c7940 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/SoftRefFilesCache.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/SoftRefFilesCache.java
@@ -114,8 +114,15 @@ public class SoftRefFilesCache extends AbstractFilesCache {
         }
     }
 
-    protected Reference<FileObject> createReference(final FileObject file, final ReferenceQueue<FileObject> refqueue) {
-        return new SoftReference<>(file, refqueue);
+    /**
+     * Creates a new Reference.
+     *
+     * @param file a file object.
+     * @param referenceQueue a ReferenceQueue.
+     * @return a new Reference on the given input.
+     */
+    protected Reference<FileObject> createReference(final FileObject file, final ReferenceQueue<FileObject> referenceQueue) {
+        return new SoftReference<>(file, referenceQueue);
     }
 
     private synchronized void endThread() {
@@ -142,11 +149,16 @@ public class SoftRefFilesCache extends AbstractFilesCache {
         return fo;
     }
 
+    /**
+     * Gets or creates a new Map.
+     *
+     * @param fileSystem the key.
+     * @return an existing or new Map.
+     */
     protected synchronized Map<FileName, Reference<FileObject>> getOrCreateFilesystemCache(final FileSystem fileSystem) {
         if (fileSystemCache.isEmpty()) {
             startThread();
         }
-
         return fileSystemCache.computeIfAbsent(fileSystem, k -> new HashMap<>());
     }
 
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/StandardFileSystemManager.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/StandardFileSystemManager.java
index 572ed619..f9fab054 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/StandardFileSystemManager.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/StandardFileSystemManager.java
@@ -231,6 +231,11 @@ public class StandardFileSystemManager extends DefaultFileSystemManager {
         }
     }
 
+    /**
+     * Gets a new DefaultFileReplicator.
+     *
+     * @return a new DefaultFileReplicator.
+     */
     protected DefaultFileReplicator createDefaultFileReplicator() {
         return new DefaultFileReplicator();
     }
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileSystem.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileSystem.java
index 5d304469..5e1cf396 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileSystem.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileSystem.java
@@ -89,6 +89,13 @@ public class SftpFileSystem extends AbstractFileSystem {
      */
     private final boolean execDisabled;
 
+    /**
+     * Constructs a new instance.
+     *
+     * @param rootName The root file name of this file system.
+     * @param session The session.
+     * @param fileSystemOptions Options to build this file system.
+     */
     protected SftpFileSystem(final GenericFileName rootName, final Session session, final FileSystemOptions fileSystemOptions) {
         super(rootName, null, fileSystemOptions);
         this.session = Objects.requireNonNull(session, "session");
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/zip/ZipFileSystem.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/zip/ZipFileSystem.java
index b8a8990c..73fe4cda 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/zip/ZipFileSystem.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/zip/ZipFileSystem.java
@@ -44,6 +44,7 @@ import org.apache.commons.vfs2.provider.UriParser;
  * A read-only file system for ZIP and JAR files.
  */
 public class ZipFileSystem extends AbstractFileSystem {
+
     private static final char[] ENC = {'!'};
 
     private static final Log LOG = LogFactory.getLog(ZipFileSystem.class);
@@ -97,6 +98,13 @@ public class ZipFileSystem extends AbstractFileSystem {
         return new ZipFileObject(name, null, this, false);
     }
 
+    /**
+     * Creates a Zip file.
+     *
+     * @param file the underlying file. 
+     * @return a Zip file.
+     * @throws FileSystemException if a file system error occurs.
+     */
     protected ZipFile createZipFile(final File file) throws FileSystemException {
         try {
             return new ZipFile(file, charset);
@@ -105,8 +113,16 @@ public class ZipFileSystem extends AbstractFileSystem {
         }
     }
 
-    protected ZipFileObject createZipFileObject(final AbstractFileName name, final ZipEntry entry) throws FileSystemException {
-        return new ZipFileObject(name, entry, this, true);
+    /**
+     * Creates a new Zip file object.
+     *
+     * @param fileName the underlying file. 
+     * @param entry the Zip entry.
+     * @return a new ZipFileObject.
+     * @throws FileSystemException if a file system error occurs.
+     */
+    protected ZipFileObject createZipFileObject(final AbstractFileName fileName, final ZipEntry entry) throws FileSystemException {
+        return new ZipFileObject(fileName, entry, this, true);
     }
 
     @Override
@@ -133,18 +149,23 @@ public class ZipFileSystem extends AbstractFileSystem {
     }
 
     /**
-     * Returns a cached file.
+     * Gets a cached file.
      */
     @Override
     protected FileObject getFileFromCache(final FileName name) {
         return cache.get(name);
     }
 
+    /**
+     * Gets the zip file.
+     *
+     * @return the zip file.
+     * @throws FileSystemException if a file system error occurs.
+     */
     protected ZipFile getZipFile() throws FileSystemException {
         if (zipFile == null && file.exists()) {
             zipFile = createZipFile(file);
         }
-
         return zipFile;
     }