Package org.frankframework.filesystem
Class LocalFileSystem
java.lang.Object
org.frankframework.filesystem.AbstractFileSystem<Path>
org.frankframework.filesystem.LocalFileSystem
- All Implemented Interfaces:
AutoCloseable
,HasPhysicalDestination
,IBasicFileSystem<Path>
,ISupportsCustomFileAttributes<Path>
,IWritableFileSystem<Path>
public class LocalFileSystem
extends AbstractFileSystem<Path>
implements IWritableFileSystem<Path>, ISupportsCustomFileAttributes<Path>
FileSystem
representation of the local filesystem.- Author:
- Gerrit van Brakel
-
Field Summary
Fields inherited from class org.frankframework.filesystem.AbstractFileSystem
log
Fields inherited from interface org.frankframework.filesystem.ISupportsCustomFileAttributes
FILE_ATTRIBUTE_PARAM_PREFIX
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionappendFile
(Path f) void
Copies the file to another folder.createFile
(Path f) void
createFile
(Path file, InputStream contents, Map<String, String> customFileAttributes) Creates a file with the given custom file attributes.void
createFolder
(String folder) void
deleteFile
(Path f) boolean
boolean
folderExists
(String folder) long
getFileSize
(Path f) Get a string representation of an identification of a file.getRoot()
boolean
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) renameFile
(Path source, Path destination) Renames the file to a new name, possibly in a another folder.void
setCreateRootFolder
(boolean createRootFolder) Whether the LocalFileSystem tries to create the root folder if it doesn't exist yet.void
Path to the folder that serves as the root of this virtual filesystem.Get a file 'F' representation of an identification of a file.Creates a reference to a file.Methods inherited from class org.frankframework.filesystem.AbstractFileSystem
close, getMaxNumberOfMessagesToList, getNumberOfFilesInFolder, isOpen, setMaxNumberOfMessagesToList
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
close, getCanonicalNameOrErrorMessage, getNumberOfFilesInFolder, isOpen
Methods inherited from interface org.frankframework.filesystem.ISupportsCustomFileAttributes
getCustomFileAttributes, hasCustomFileAttributes
Methods inherited from interface org.frankframework.filesystem.IWritableFileSystem
appendFile, createFile
-
Constructor Details
-
LocalFileSystem
public LocalFileSystem()
-
-
Method Details
-
configure
- Specified by:
configure
in interfaceIBasicFileSystem<Path>
- Throws:
ConfigurationException
-
open
- Specified by:
open
in interfaceIBasicFileSystem<Path>
- Overrides:
open
in classAbstractFileSystem<Path>
- Throws:
FileSystemException
-
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<Path>
-
toFile
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<Path>
-
list
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<Path>
- Throws:
FileSystemException
-
exists
- Specified by:
exists
in interfaceIBasicFileSystem<Path>
-
createFile
- Specified by:
createFile
in interfaceIWritableFileSystem<Path>
- Throws:
IOException
-
createFile
public void createFile(Path file, InputStream contents, Map<String, String> customFileAttributes) throws FileSystemException, IOExceptionDescription copied from interface:ISupportsCustomFileAttributes
Creates a file with the given custom file attributes.- Specified by:
createFile
in interfaceISupportsCustomFileAttributes<Path>
- Parameters:
file
-contents
-customFileAttributes
-- Throws:
FileSystemException
IOException
-
appendFile
- Specified by:
appendFile
in interfaceIWritableFileSystem<Path>
- Throws:
IOException
-
readFile
- Specified by:
readFile
in interfaceIBasicFileSystem<Path>
- Throws:
FileSystemException
-
deleteFile
- Specified by:
deleteFile
in interfaceIBasicFileSystem<Path>
- Throws:
FileSystemException
-
isFolder
- Specified by:
isFolder
in interfaceIBasicFileSystem<Path>
-
folderExists
- Specified by:
folderExists
in interfaceIBasicFileSystem<Path>
- Throws:
FileSystemException
-
createFolder
- Specified by:
createFolder
in interfaceIBasicFileSystem<Path>
- Throws:
FileSystemException
-
removeFolder
- Specified by:
removeFolder
in interfaceIBasicFileSystem<Path>
- Throws:
FileSystemException
-
renameFile
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<Path>
- Throws:
FileSystemException
-
moveFile
public Path moveFile(Path 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<Path>
- Throws:
FileSystemException
-
copyFile
public Path copyFile(Path 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<Path>
- Throws:
FileSystemException
-
getFileSize
- Specified by:
getFileSize
in interfaceIBasicFileSystem<Path>
- Throws:
FileSystemException
-
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<Path>
-
getParentFolder
- Specified by:
getParentFolder
in interfaceIBasicFileSystem<Path>
- Throws:
FileSystemException
-
getCanonicalName
- Specified by:
getCanonicalName
in interfaceIBasicFileSystem<Path>
- Throws:
FileSystemException
-
getModificationTime
- Specified by:
getModificationTime
in interfaceIBasicFileSystem<Path>
- Throws:
FileSystemException
-
getAdditionalFileProperties
@Nullable public Map<String,Object> getAdditionalFileProperties(Path file) throws FileSystemException - Specified by:
getAdditionalFileProperties
in interfaceIBasicFileSystem<Path>
- Throws:
FileSystemException
-
getPhysicalDestinationName
- Specified by:
getPhysicalDestinationName
in interfaceHasPhysicalDestination
-
setRoot
Path to the folder that serves as the root of this virtual filesystem. All specifications of folders or files are relative to this root. When the root is left unspecified, absolute paths to files and folders can be used -
getRoot
-
setCreateRootFolder
Whether the LocalFileSystem tries to create the root folder if it doesn't exist yet.- Parameters:
createRootFolder
-
-