Class SftpFileSystem
java.lang.Object
org.frankframework.filesystem.sftp.SftpSession
org.frankframework.filesystem.sftp.SftpFileSystem
- All Implemented Interfaces:
AutoCloseable
,HasPhysicalDestination
,IConfigurable
,IBasicFileSystem<SftpFileRef>
,IWritableFileSystem<SftpFileRef>
Implementation of SFTP FileSystem
- Author:
- Niels Meijer
-
Nested Class Summary
Nested classes/interfaces inherited from class org.frankframework.filesystem.sftp.SftpSession
SftpSession.TransportType
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
changeDirectory
(String folder) void
close()
copyFile
(SftpFileRef f, String destinationFolder, boolean createFolder) Copies the file to another folder.void
createFolder
(String folder) void
boolean
exists
(SftpFileRef file) boolean
folderExists
(String folder) long
getName
(SftpFileRef file) Get a string representation of an identification of a file.int
getNumberOfFilesInFolder
(String folder) getParentFolder
(SftpFileRef file) boolean
isFolder
(SftpFileRef sftpFileRef) boolean
isOpen()
list
(String folder, TypeFilter filter) Lists files, directories or both, from a 'folder' or in the 'root' of the filesystem (when folder is null).moveFile
(SftpFileRef f, String destinationFolder, boolean createFolder) Moves the file to another folder.void
open()
readFile
(SftpFileRef f, String charset) void
removeFolder
(String folder, boolean removeNonEmptyFolder) renameFile
(SftpFileRef source, SftpFileRef destination) Renames the file to a new name, possibly in a another folder.void
setRemoteDirectory
(String remoteDirectory) Path of the file or directory to start working.Get a file 'F' representation of an identification of a file.Creates a reference to a file.Methods inherited from class org.frankframework.filesystem.sftp.SftpSession
close, configure, isSessionStillWorking, openClient, setAuthAlias, setHost, setKnownHostsPath, setPassword, setPort, setPrefCSEncryption, setPrefSCEncryption, setPrivateKeyAuthAlias, setPrivateKeyFilePath, setPrivateKeyPassword, setProxyAuthAlias, setProxyHost, setProxyPassword, setProxyPort, setProxyTransportType, setProxyUsername, setStrictHostKeyChecking, setUsername
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.frankframework.core.HasPhysicalDestination
getDomain
Methods inherited from interface org.frankframework.filesystem.IBasicFileSystem
configure, getCanonicalNameOrErrorMessage
Methods inherited from interface org.frankframework.filesystem.IWritableFileSystem
appendFile, createFile
-
Constructor Details
-
SftpFileSystem
public SftpFileSystem()
-
-
Method Details
-
open
- Specified by:
open
in interfaceIBasicFileSystem<SftpFileRef>
- Throws:
FileSystemException
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceIBasicFileSystem<SftpFileRef>
- Overrides:
close
in classSftpSession
-
isOpen
public boolean isOpen()- Specified by:
isOpen
in interfaceIBasicFileSystem<SftpFileRef>
-
toFile
Description copied from interface:IBasicFileSystem
Get a file 'F' representation of an identification of a file. Must pair up with the implementation ofIBasicFileSystem.getName(Object)
.- Specified by:
toFile
in interfaceIBasicFileSystem<SftpFileRef>
- Throws:
FileSystemException
-
toFile
public SftpFileRef toFile(@Nullable String folder, @Nullable String filename) throws FileSystemException Description copied from interface:IBasicFileSystem
Creates a reference to a file. If filename is not absolute, it will be created in 'defaultFolder'.- Specified by:
toFile
in interfaceIBasicFileSystem<SftpFileRef>
- Throws:
FileSystemException
-
getNumberOfFilesInFolder
- Specified by:
getNumberOfFilesInFolder
in interfaceIBasicFileSystem<SftpFileRef>
- Throws:
FileSystemException
-
list
public DirectoryStream<SftpFileRef> list(String folder, TypeFilter filter) throws FileSystemException Description copied from interface:IBasicFileSystem
Lists files, directories or both, from a 'folder' or in the 'root' of the filesystem (when folder is null). Only lists the objects as defined by the type filter.- Specified by:
list
in interfaceIBasicFileSystem<SftpFileRef>
- Throws:
FileSystemException
-
exists
- Specified by:
exists
in interfaceIBasicFileSystem<SftpFileRef>
- Throws:
FileSystemException
-
isFolder
- Specified by:
isFolder
in interfaceIBasicFileSystem<SftpFileRef>
-
createFile
- Specified by:
createFile
in interfaceIWritableFileSystem<SftpFileRef>
- Throws:
FileSystemException
IOException
-
appendFile
- Specified by:
appendFile
in interfaceIWritableFileSystem<SftpFileRef>
- Throws:
FileSystemException
-
readFile
- Specified by:
readFile
in interfaceIBasicFileSystem<SftpFileRef>
- Throws:
FileSystemException
-
deleteFile
- Specified by:
deleteFile
in interfaceIBasicFileSystem<SftpFileRef>
- Throws:
FileSystemException
-
folderExists
- Specified by:
folderExists
in interfaceIBasicFileSystem<SftpFileRef>
- Throws:
FileSystemException
-
changeDirectory
- Throws:
FileSystemException
-
createFolder
- Specified by:
createFolder
in interfaceIBasicFileSystem<SftpFileRef>
- Throws:
FileSystemException
-
removeFolder
- Specified by:
removeFolder
in interfaceIBasicFileSystem<SftpFileRef>
- Throws:
FileSystemException
-
renameFile
public SftpFileRef renameFile(SftpFileRef source, SftpFileRef destination) throws FileSystemException Description copied from interface:IWritableFileSystem
Renames the file to a new name, possibly in a another folder. Does not need to check for existence of the source or non-existence of the destination.- Specified by:
renameFile
in interfaceIWritableFileSystem<SftpFileRef>
- Throws:
FileSystemException
-
moveFile
public SftpFileRef moveFile(SftpFileRef f, String destinationFolder, boolean createFolder) throws FileSystemException Description copied from interface:IBasicFileSystem
Moves the file to another folder. Does not need to check for existence of the source or non-existence of the destination. Returns the moved file, or null if no file was moved or there is no reference to the moved file.- Specified by:
moveFile
in interfaceIBasicFileSystem<SftpFileRef>
- Throws:
FileSystemException
-
copyFile
public SftpFileRef copyFile(SftpFileRef f, String destinationFolder, boolean createFolder) throws FileSystemException Description copied from interface:IBasicFileSystem
Copies the file to another folder. Does not need to check for existence of the source or non-existence of the destination. Returns the copied file, or null if no file was copied or there is no reference to the copied file.- Specified by:
copyFile
in interfaceIBasicFileSystem<SftpFileRef>
- Throws:
FileSystemException
-
getFileSize
- Specified by:
getFileSize
in interfaceIBasicFileSystem<SftpFileRef>
-
getName
Description copied from interface:IBasicFileSystem
Get a string representation of an identification of a file. Must pair up with the implementation ofIBasicFileSystem.toFile(String)
. Can reflect name a file has in its folder, is not expected to be unique over folders.- Specified by:
getName
in interfaceIBasicFileSystem<SftpFileRef>
-
getParentFolder
- Specified by:
getParentFolder
in interfaceIBasicFileSystem<SftpFileRef>
-
getCanonicalName
- Specified by:
getCanonicalName
in interfaceIBasicFileSystem<SftpFileRef>
-
getModificationTime
- Specified by:
getModificationTime
in interfaceIBasicFileSystem<SftpFileRef>
- Throws:
FileSystemException
-
getAdditionalFileProperties
- Specified by:
getAdditionalFileProperties
in interfaceIBasicFileSystem<SftpFileRef>
-
getPhysicalDestinationName
- Specified by:
getPhysicalDestinationName
in interfaceHasPhysicalDestination
-
setRemoteDirectory
Path of the file or directory to start working.- Default value
- Home folder of the sftp user
-