Package org.apache.sshd.sftp.client.fs
Class SftpFileSystem
- java.lang.Object
-
- java.nio.file.FileSystem
-
- org.apache.sshd.common.file.util.BaseFileSystem<SftpPath>
-
- org.apache.sshd.sftp.client.fs.SftpFileSystem
-
- All Implemented Interfaces:
Closeable,AutoCloseable,ClientSessionHolder,SessionContextHolder,SessionHolder<ClientSession>
- Direct Known Subclasses:
SftpFileSystemAutomatic
public class SftpFileSystem extends org.apache.sshd.common.file.util.BaseFileSystem<SftpPath> implements SessionHolder<ClientSession>, ClientSessionHolder
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSftpFileSystem.DefaultGroupPrincipalstatic classSftpFileSystem.DefaultUserPrincipalstatic classSftpFileSystem.DefaultUserPrincipalLookupServiceprotected static classSftpFileSystem.SftpClientHandleTheSftpFileSystem.SftpClientPoolstoresSftpClients not directly but via handles in its channel pool.protected classSftpFileSystem.SftpClientPoolA pool ofSftpClients.
-
Field Summary
Fields Modifier and Type Field Description static AttributeRepository.AttributeKey<Boolean>OWNED_SESSIONAnAttributeRepository.AttributeKeythat can be set toBoolean.TRUEon theClientSessionto tell theSftpFileSystemthat it owns that session and should close it when theSftpFileSystemitself is closed.static NavigableSet<String>UNIVERSAL_SUPPORTED_VIEWS
-
Constructor Summary
Constructors Modifier Constructor Description SftpFileSystem(SftpFileSystemProvider provider, String id, ClientSession session, SftpClientFactory factory, SftpVersionSelector selector, SftpErrorDataHandler errorDataHandler)protectedSftpFileSystem(SftpFileSystemProvider provider, String id, SftpClientFactory factory, SftpVersionSelector selector, SftpErrorDataHandler errorDataHandler)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()protected SftpPathcreate(String root, List<String> names)SftpClientgetClient()ClientSessiongetClientSession()SftpPathgetDefaultDir()List<FileStore>getFileStores()StringgetId()intgetReadBufferSize()ClientSessiongetSession()SftpErrorDataHandlergetSftpErrorDataHandler()SftpVersionSelectorgetSftpVersionSelector()UserPrincipalLookupServicegetUserPrincipalLookupService()intgetVersion()intgetWriteBufferSize()protected voidinit()booleanisOpen()SftpFileSystemProviderprovider()protected ClientSessionsessionForSftpClient()protected voidsetClientSession(ClientSession newSession)voidsetReadBufferSize(int size)voidsetWriteBufferSize(int size)Set<String>supportedFileAttributeViews()StringtoString()-
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
-
UNIVERSAL_SUPPORTED_VIEWS
public static final NavigableSet<String> UNIVERSAL_SUPPORTED_VIEWS
-
OWNED_SESSION
public static final AttributeRepository.AttributeKey<Boolean> OWNED_SESSION
AnAttributeRepository.AttributeKeythat can be set toBoolean.TRUEon theClientSessionto tell theSftpFileSystemthat it owns that session and should close it when theSftpFileSystemitself is closed.
-
-
Constructor Detail
-
SftpFileSystem
public SftpFileSystem(SftpFileSystemProvider provider, String id, ClientSession session, SftpClientFactory factory, SftpVersionSelector selector, SftpErrorDataHandler errorDataHandler) throws IOException
- Throws:
IOException
-
SftpFileSystem
protected SftpFileSystem(SftpFileSystemProvider provider, String id, SftpClientFactory factory, SftpVersionSelector selector, SftpErrorDataHandler errorDataHandler)
-
-
Method Detail
-
init
protected void init() throws IOException- Throws:
IOException
-
getSftpVersionSelector
public final SftpVersionSelector getSftpVersionSelector()
-
getSftpErrorDataHandler
public SftpErrorDataHandler getSftpErrorDataHandler()
-
getId
public final String getId()
-
getVersion
public final int getVersion()
-
provider
public SftpFileSystemProvider provider()
- Overrides:
providerin classorg.apache.sshd.common.file.util.BaseFileSystem<SftpPath>
-
getFileStores
public List<FileStore> getFileStores()
- Overrides:
getFileStoresin classorg.apache.sshd.common.file.util.BaseFileSystem<SftpPath>
-
getReadBufferSize
public int getReadBufferSize()
-
setReadBufferSize
public void setReadBufferSize(int size)
-
getWriteBufferSize
public int getWriteBufferSize()
-
setWriteBufferSize
public void setWriteBufferSize(int size)
-
create
protected SftpPath create(String root, List<String> names)
- Specified by:
createin classorg.apache.sshd.common.file.util.BaseFileSystem<SftpPath>
-
getClientSession
public ClientSession getClientSession()
- Specified by:
getClientSessionin interfaceClientSessionHolder
-
getSession
public ClientSession getSession()
- Specified by:
getSessionin interfaceSessionHolder<ClientSession>
-
setClientSession
protected void setClientSession(ClientSession newSession)
-
sessionForSftpClient
protected ClientSession sessionForSftpClient() throws IOException
- Throws:
IOException
-
getClient
public SftpClient getClient() throws IOException
- Throws:
IOException
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein classFileSystem- Throws:
IOException
-
isOpen
public boolean isOpen()
- Specified by:
isOpenin classFileSystem
-
supportedFileAttributeViews
public Set<String> supportedFileAttributeViews()
- Specified by:
supportedFileAttributeViewsin classFileSystem
-
getUserPrincipalLookupService
public UserPrincipalLookupService getUserPrincipalLookupService()
- Specified by:
getUserPrincipalLookupServicein classFileSystem
-
getDefaultDir
public SftpPath getDefaultDir()
- Overrides:
getDefaultDirin classorg.apache.sshd.common.file.util.BaseFileSystem<SftpPath>
-
-