Package org.frankframework.filesystem
Interface IBasicFileSystem<F>
- Type Parameters:
F
- Representation of file and folder.
- All Superinterfaces:
AutoCloseable
,HasPhysicalDestination
- All Known Subinterfaces:
IMailFileSystem<M,
,A> IWritableFileSystem<F>
- All Known Implementing Classes:
AbstractConnectedFileSystem
,AbstractFileSystem
,AbstractMailFileSystem
,AmazonS3FileSystem
,ExchangeFileSystem
,FtpFileSystem
,ImapFileSystem
,LocalFileSystem
,Samba1FileSystem
,Samba2FileSystem
,SftpFileSystem
Interface to represent a basic filesystem, in which files can be
listed, read, deleted or moved to a folder.
For Basic filesystems, filenames could be more or less globally unique IDs. In such a case: - moving or copying a file to a folder might change its name - moving or copying a file to a folder will never 'overwrite' a file already present in the folder and therefore for basic filesystems: - toFile(folder, filename) may return always the same result as toFile(filename) - rollover and overwrite protection is not supported
- Author:
- Gerrit van Brakel
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
void
Copies the file to another folder.void
createFolder
(String folder) void
deleteFile
(F f) boolean
boolean
folderExists
(String folder) default String
Safe method to get a string representing the canonical name of a file, or an error message if the canonical name could not be established.long
getFileSize
(F f) Get a string representation of an identification of a file.int
getNumberOfFilesInFolder
(String folder) getParentFolder
(F f) boolean
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).Moves the file to another folder.void
open()
void
removeFolder
(String folder, boolean removeNonEmptyFolder) Get a file 'F' representation of an identification of a file.Creates a reference to a file.Methods inherited from interface org.frankframework.core.HasPhysicalDestination
getDomain, getPhysicalDestinationName
-
Method Details
-
configure
- Throws:
ConfigurationException
-
open
- Throws:
FileSystemException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Throws:
FileSystemException
-
isOpen
boolean isOpen() -
list
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.- Throws:
FileSystemException
-
getNumberOfFilesInFolder
- Throws:
FileSystemException
-
getName
Get a string representation of an identification of a file. Must pair up with the implementation oftoFile(String)
. Can reflect name a file has in its folder, is not expected to be unique over folders. -
getParentFolder
- Throws:
FileSystemException
-
toFile
Get a file 'F' representation of an identification of a file. Must pair up with the implementation ofgetName(Object)
.- Throws:
FileSystemException
-
toFile
Creates a reference to a file. If filename is not absolute, it will be created in 'defaultFolder'.- Throws:
FileSystemException
-
exists
- Throws:
FileSystemException
-
isFolder
- Throws:
FileSystemException
-
folderExists
- Throws:
FileSystemException
-
readFile
- Throws:
FileSystemException
IOException
-
deleteFile
- Throws:
FileSystemException
-
moveFile
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.- Throws:
FileSystemException
-
copyFile
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.- Throws:
FileSystemException
-
createFolder
- Throws:
FileSystemException
-
removeFolder
- Throws:
FileSystemException
-
getFileSize
- Throws:
FileSystemException
-
getCanonicalName
- Throws:
FileSystemException
-
getModificationTime
- Throws:
FileSystemException
-
getAdditionalFileProperties
- Throws:
FileSystemException
-
getCanonicalNameOrErrorMessage
Safe method to get a string representing the canonical name of a file, or an error message if the canonical name could not be established. Because this method is not guaranteed to return the actual canonical name, it should be used only for error messages and logging.- Parameters:
f
- File for which to try to get canonical name- Returns:
- Either the canonical name of the file, or an error.
-