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:
java.io.Closeable,java.lang.AutoCloseable,ClientSessionHolder,SessionContextHolder,SessionHolder<ClientSession>
- Direct Known Subclasses:
SftpFileSystemAutomatic
public class SftpFileSystem extends 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.private classSftpFileSystem.Wrapper
-
Field Summary
Fields Modifier and Type Field Description private java.util.concurrent.atomic.AtomicReference<ClientSession>clientSessionprivate SftpPathdefaultDirprivate SftpErrorDataHandlererrorDataHandlerprivate SftpClientFactoryfactoryprivate java.lang.Stringidprivate java.util.concurrent.atomic.AtomicBooleanopenstatic AttributeRepository.AttributeKey<java.lang.Boolean>OWNED_SESSIONAnAttributeRepository.AttributeKeythat can be set toBoolean.TRUEon theClientSessionto tell theSftpFileSystemthat it owns that session and should close it when theSftpFileSystemitself is closed.private SftpFileSystem.SftpClientPoolpoolprivate intreadBufferSizeprivate SftpVersionSelectorselectorprivate java.util.List<java.nio.file.FileStore>storesprivate java.util.Set<java.lang.String>supportedViewsstatic java.util.NavigableSet<java.lang.String>UNIVERSAL_SUPPORTED_VIEWSprivate intversionprivate intwriteBufferSize-
Fields inherited from class org.apache.sshd.common.file.util.BaseFileSystem
log
-
-
Constructor Summary
Constructors Modifier Constructor Description SftpFileSystem(SftpFileSystemProvider provider, java.lang.String id, ClientSession session, SftpClientFactory factory, SftpVersionSelector selector, SftpErrorDataHandler errorDataHandler)protectedSftpFileSystem(SftpFileSystemProvider provider, java.lang.String id, SftpClientFactory factory, SftpVersionSelector selector, SftpErrorDataHandler errorDataHandler)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()protected SftpPathcreate(java.lang.String root, java.util.List<java.lang.String> names)SftpClientgetClient()ClientSessiongetClientSession()SftpPathgetDefaultDir()java.util.List<java.nio.file.FileStore>getFileStores()java.lang.StringgetId()intgetReadBufferSize()ClientSessiongetSession()SftpErrorDataHandlergetSftpErrorDataHandler()SftpVersionSelectorgetSftpVersionSelector()java.nio.file.attribute.UserPrincipalLookupServicegetUserPrincipalLookupService()intgetVersion()intgetWriteBufferSize()protected voidinit()booleanisOpen()SftpFileSystemProviderprovider()protected ClientSessionsessionForSftpClient()protected voidsetClientSession(ClientSession newSession)voidsetReadBufferSize(int size)voidsetWriteBufferSize(int size)java.util.Set<java.lang.String>supportedFileAttributeViews()java.lang.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 java.util.NavigableSet<java.lang.String> UNIVERSAL_SUPPORTED_VIEWS
-
OWNED_SESSION
public static final AttributeRepository.AttributeKey<java.lang.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.
-
id
private final java.lang.String id
-
factory
private final SftpClientFactory factory
-
selector
private final SftpVersionSelector selector
-
errorDataHandler
private final SftpErrorDataHandler errorDataHandler
-
pool
private SftpFileSystem.SftpClientPool pool
-
version
private int version
-
supportedViews
private java.util.Set<java.lang.String> supportedViews
-
defaultDir
private SftpPath defaultDir
-
readBufferSize
private int readBufferSize
-
writeBufferSize
private int writeBufferSize
-
stores
private final java.util.List<java.nio.file.FileStore> stores
-
open
private final java.util.concurrent.atomic.AtomicBoolean open
-
clientSession
private java.util.concurrent.atomic.AtomicReference<ClientSession> clientSession
-
-
Constructor Detail
-
SftpFileSystem
public SftpFileSystem(SftpFileSystemProvider provider, java.lang.String id, ClientSession session, SftpClientFactory factory, SftpVersionSelector selector, SftpErrorDataHandler errorDataHandler) throws java.io.IOException
- Throws:
java.io.IOException
-
SftpFileSystem
protected SftpFileSystem(SftpFileSystemProvider provider, java.lang.String id, SftpClientFactory factory, SftpVersionSelector selector, SftpErrorDataHandler errorDataHandler)
-
-
Method Detail
-
init
protected void init() throws java.io.IOException- Throws:
java.io.IOException
-
getSftpVersionSelector
public final SftpVersionSelector getSftpVersionSelector()
-
getSftpErrorDataHandler
public SftpErrorDataHandler getSftpErrorDataHandler()
-
getId
public final java.lang.String getId()
-
getVersion
public final int getVersion()
-
provider
public SftpFileSystemProvider provider()
- Overrides:
providerin classBaseFileSystem<SftpPath>
-
getFileStores
public java.util.List<java.nio.file.FileStore> getFileStores()
- Overrides:
getFileStoresin classBaseFileSystem<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(java.lang.String root, java.util.List<java.lang.String> names)
- Specified by:
createin classBaseFileSystem<SftpPath>
-
getClientSession
public ClientSession getClientSession()
- Specified by:
getClientSessionin interfaceClientSessionHolder- Returns:
- The underlying
ClientSessionused
-
getSession
public ClientSession getSession()
- Specified by:
getSessionin interfaceSessionHolder<ClientSession>
-
setClientSession
protected void setClientSession(ClientSession newSession)
-
sessionForSftpClient
protected ClientSession sessionForSftpClient() throws java.io.IOException
- Throws:
java.io.IOException
-
getClient
public SftpClient getClient() throws java.io.IOException
- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein classjava.nio.file.FileSystem- Throws:
java.io.IOException
-
isOpen
public boolean isOpen()
- Specified by:
isOpenin classjava.nio.file.FileSystem
-
supportedFileAttributeViews
public java.util.Set<java.lang.String> supportedFileAttributeViews()
- Specified by:
supportedFileAttributeViewsin classjava.nio.file.FileSystem
-
getUserPrincipalLookupService
public java.nio.file.attribute.UserPrincipalLookupService getUserPrincipalLookupService()
- Specified by:
getUserPrincipalLookupServicein classjava.nio.file.FileSystem
-
getDefaultDir
public SftpPath getDefaultDir()
- Overrides:
getDefaultDirin classBaseFileSystem<SftpPath>
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-