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>
@DestinationType(FILE_SYSTEM)
public class SftpFileSystem
extends SftpSession
implements 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 TypeMethodDescriptionvoidappendFile(SftpFileRef file, InputStream content) voidchangeDirectory(String folder) voidclose()Closes the client and correlating SFTP session.copyFile(SftpFileRef f, String destinationFolder, boolean createFolder) Copies the file to another folder.voidcreateFile(SftpFileRef file, InputStream content) voidcreateFolder(String folder) voidbooleanexists(SftpFileRef file) booleanfolderExists(String folder) longgetName(SftpFileRef file) Get a string representation of an identification of a file.intgetNumberOfFilesInFolder(String folder) getParentFolder(SftpFileRef file) booleanisFolder(SftpFileRef sftpFileRef) booleanisOpen()list(SftpFileRef folder, TypeFilter filter) moveFile(SftpFileRef f, String destinationFolder, boolean createFolder) Moves the file to another folder.voidopen()readFile(SftpFileRef f, String charset) voidremoveFolder(String folder, boolean removeNonEmptyFolder) renameFile(SftpFileRef source, SftpFileRef destination) Renames the file to a new name, possibly in another folder.voidsetRemoteDirectory(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
configure, getClient, isSessionStillWorking, setAuthAlias, setHost, setKnownHostsPath, setPassword, setPort, setPrefCSEncryption, setPrefSCEncryption, setPrivateKeyAuthAlias, setPrivateKeyFilePath, setPrivateKeyPassword, setProxyAuthAlias, setProxyHost, setProxyPassword, setProxyPort, setProxyTransportType, setProxyUsername, setStrictHostKeyChecking, setUsernameMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.frankframework.filesystem.IBasicFileSystem
configure, getCanonicalNameOrErrorMessage, list
-
Constructor Details
-
SftpFileSystem
public SftpFileSystem()
-
-
Method Details
-
open
- Specified by:
openin interfaceIBasicFileSystem<SftpFileRef>- Overrides:
openin classSftpSession- Throws:
FileSystemException
-
close
public void close()Description copied from class:SftpSessionCloses the client and correlating SFTP session.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceIBasicFileSystem<SftpFileRef>- Overrides:
closein classSftpSession
-
isOpen
public boolean isOpen()- Specified by:
isOpenin interfaceIBasicFileSystem<SftpFileRef>
-
toFile
Description copied from interface:IBasicFileSystemGet a file 'F' representation of an identification of a file. Must pair up with the implementation ofIBasicFileSystem.getName(Object).- Specified by:
toFilein interfaceIBasicFileSystem<SftpFileRef>- Throws:
FileSystemException
-
toFile
public SftpFileRef toFile(@Nullable String folder, @Nullable String filename) throws FileSystemException Description copied from interface:IBasicFileSystemCreates a reference to a file. If filename is not absolute, it will be created in 'defaultFolder'.- Specified by:
toFilein interfaceIBasicFileSystem<SftpFileRef>- Throws:
FileSystemException
-
getNumberOfFilesInFolder
- Specified by:
getNumberOfFilesInFolderin interfaceIBasicFileSystem<SftpFileRef>- Throws:
FileSystemException
-
list
public DirectoryStream<SftpFileRef> list(SftpFileRef folder, TypeFilter filter) throws FileSystemException - Specified by:
listin interfaceIBasicFileSystem<SftpFileRef>- Throws:
FileSystemException
-
exists
- Specified by:
existsin interfaceIBasicFileSystem<SftpFileRef>- Throws:
FileSystemException
-
isFolder
- Specified by:
isFolderin interfaceIBasicFileSystem<SftpFileRef>
-
createFile
- Specified by:
createFilein interfaceIWritableFileSystem<SftpFileRef>- Parameters:
file- FileSystem file referencecontent- to write or NULL. When NULL existing files should be overwritten, and new files should be created.- Throws:
FileSystemException
-
appendFile
- Specified by:
appendFilein interfaceIWritableFileSystem<SftpFileRef>- Throws:
FileSystemException
-
readFile
- Specified by:
readFilein interfaceIBasicFileSystem<SftpFileRef>- Throws:
FileSystemException
-
deleteFile
- Specified by:
deleteFilein interfaceIBasicFileSystem<SftpFileRef>- Throws:
FileSystemException
-
folderExists
- Specified by:
folderExistsin interfaceIBasicFileSystem<SftpFileRef>- Throws:
FileSystemException
-
changeDirectory
- Throws:
FileSystemException
-
createFolder
- Specified by:
createFolderin interfaceIBasicFileSystem<SftpFileRef>- Throws:
FileSystemException
-
removeFolder
- Specified by:
removeFolderin interfaceIBasicFileSystem<SftpFileRef>- Throws:
FileSystemException
-
renameFile
public SftpFileRef renameFile(SftpFileRef source, SftpFileRef destination) throws FileSystemException Description copied from interface:IWritableFileSystemRenames the file to a new name, possibly in another folder. Does not need to check for the existence of the source or non-existence of the destination.- Specified by:
renameFilein interfaceIWritableFileSystem<SftpFileRef>- Throws:
FileSystemException
-
moveFile
public SftpFileRef moveFile(SftpFileRef f, String destinationFolder, boolean createFolder) throws FileSystemException Description copied from interface:IBasicFileSystemMoves 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:
moveFilein interfaceIBasicFileSystem<SftpFileRef>- Throws:
FileSystemException
-
copyFile
public SftpFileRef copyFile(SftpFileRef f, String destinationFolder, boolean createFolder) throws FileSystemException Description copied from interface:IBasicFileSystemCopies 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:
copyFilein interfaceIBasicFileSystem<SftpFileRef>- Throws:
FileSystemException
-
getFileSize
- Specified by:
getFileSizein interfaceIBasicFileSystem<SftpFileRef>
-
getName
Description copied from interface:IBasicFileSystemGet 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:
getNamein interfaceIBasicFileSystem<SftpFileRef>
-
getParentFolder
- Specified by:
getParentFolderin interfaceIBasicFileSystem<SftpFileRef>
-
getCanonicalName
- Specified by:
getCanonicalNamein interfaceIBasicFileSystem<SftpFileRef>
-
getModificationTime
- Specified by:
getModificationTimein interfaceIBasicFileSystem<SftpFileRef>- Throws:
FileSystemException
-
getAdditionalFileProperties
- Specified by:
getAdditionalFilePropertiesin interfaceIBasicFileSystem<SftpFileRef>
-
getPhysicalDestinationName
- Specified by:
getPhysicalDestinationNamein interfaceHasPhysicalDestination
-
setRemoteDirectory
Path of the file or directory to start working.- Default value
- Home folder of the sftp user
-