Class VirtualFileSystemFactory

  • All Implemented Interfaces:
    FileSystemFactory

    public class VirtualFileSystemFactory
    extends java.lang.Object
    implements FileSystemFactory
    SSHd file system factory to reduce the visibility to a physical folder.
    • Field Detail

      • defaultHomeDir

        private java.nio.file.Path defaultHomeDir
      • homeDirs

        private final java.util.Map<java.lang.String,​java.nio.file.Path> homeDirs
    • Constructor Detail

      • VirtualFileSystemFactory

        public VirtualFileSystemFactory()
      • VirtualFileSystemFactory

        public VirtualFileSystemFactory​(java.nio.file.Path defaultHomeDir)
    • Method Detail

      • setDefaultHomeDir

        public void setDefaultHomeDir​(java.nio.file.Path defaultHomeDir)
      • getDefaultHomeDir

        public java.nio.file.Path getDefaultHomeDir()
      • setUserHomeDir

        public void setUserHomeDir​(java.lang.String userName,
                                   java.nio.file.Path userHomeDir)
      • getUserHomeDir

        public java.nio.file.Path getUserHomeDir​(java.lang.String userName)
      • getUserHomeDir

        public java.nio.file.Path getUserHomeDir​(SessionContext session)
                                          throws java.io.IOException
        Specified by:
        getUserHomeDir in interface FileSystemFactory
        Parameters:
        session - The session created for the user
        Returns:
        The recommended user home directory - null if none
        Throws:
        java.io.IOException - If failed to resolve user's home directory
      • createFileSystem

        public java.nio.file.FileSystem createFileSystem​(SessionContext session)
                                                  throws java.io.IOException
        Description copied from interface: FileSystemFactory
        Create user specific file system.
        Specified by:
        createFileSystem in interface FileSystemFactory
        Parameters:
        session - The session created for the user
        Returns:
        The current FileSystem for the provided session
        Throws:
        java.io.IOException - if the file system can not be created