Package org.apache.sshd.sftp.client.fs
Class SftpFileSystemAutomatic
- java.lang.Object
-
- java.nio.file.FileSystem
-
- org.apache.sshd.common.file.util.BaseFileSystem<SftpPath>
-
- org.apache.sshd.sftp.client.fs.SftpFileSystem
-
- org.apache.sshd.sftp.client.fs.SftpFileSystemAutomatic
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,ClientSessionHolder
,SessionContextHolder
,SessionHolder<ClientSession>
public class SftpFileSystemAutomatic extends SftpFileSystem
AnSftpFileSystem
that uses a provider function for itsClientSession
so that it can continue to function even if a session was closed. The provider is supposed to create a new session if the current one is not open.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.sshd.sftp.client.fs.SftpFileSystem
SftpFileSystem.DefaultGroupPrincipal, SftpFileSystem.DefaultUserPrincipal, SftpFileSystem.DefaultUserPrincipalLookupService, SftpFileSystem.SftpClientHandle, SftpFileSystem.SftpClientPool
-
-
Field Summary
Fields Modifier and Type Field Description private IOFunction<java.lang.Boolean,ClientSession>
sessionProvider
-
Fields inherited from class org.apache.sshd.sftp.client.fs.SftpFileSystem
OWNED_SESSION, UNIVERSAL_SUPPORTED_VIEWS
-
Fields inherited from class org.apache.sshd.common.file.util.BaseFileSystem
log
-
-
Constructor Summary
Constructors Constructor Description SftpFileSystemAutomatic(SftpFileSystemProvider provider, java.lang.String id, IOFunction<java.lang.Boolean,ClientSession> sessionProvider, SftpClientFactory factory, SftpVersionSelector selector, SftpErrorDataHandler errorDataHandler)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ClientSession
getClientSession()
protected ClientSession
sessionForSftpClient()
-
Methods inherited from class org.apache.sshd.sftp.client.fs.SftpFileSystem
close, create, getClient, getDefaultDir, getFileStores, getId, getReadBufferSize, getSession, getSftpErrorDataHandler, getSftpVersionSelector, getUserPrincipalLookupService, getVersion, getWriteBufferSize, init, isOpen, provider, setClientSession, setReadBufferSize, setWriteBufferSize, supportedFileAttributeViews, toString
-
Methods inherited from class org.apache.sshd.common.file.util.BaseFileSystem
appendDedupSep, create, create, getPath, getPathMatcher, getRootDirectories, getSeparator, globToRegex, handleWindowsSeparator, hostFsHasWindowsSeparator, isReadOnly, newWatchService
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.sshd.common.session.SessionHolder
getSessionContext
-
-
-
-
Field Detail
-
sessionProvider
private final IOFunction<java.lang.Boolean,ClientSession> sessionProvider
-
-
Constructor Detail
-
SftpFileSystemAutomatic
public SftpFileSystemAutomatic(SftpFileSystemProvider provider, java.lang.String id, IOFunction<java.lang.Boolean,ClientSession> sessionProvider, SftpClientFactory factory, SftpVersionSelector selector, SftpErrorDataHandler errorDataHandler) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
getClientSession
public ClientSession getClientSession()
- Specified by:
getClientSession
in interfaceClientSessionHolder
- Overrides:
getClientSession
in classSftpFileSystem
- Returns:
- The underlying
ClientSession
used
-
sessionForSftpClient
protected ClientSession sessionForSftpClient() throws java.io.IOException
- Overrides:
sessionForSftpClient
in classSftpFileSystem
- Throws:
java.io.IOException
-
-