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>
@DestinationType(FILE_SYSTEM)
public class LocalFileSystem
extends AbstractFileSystem<Path>
implements IWritableFileSystem<Path>, ISupportsCustomFileAttributes<Path>
FileSystem representation of the local filesystem.- Author:
- Gerrit van Brakel
-
Field Summary
FieldsFields inherited from interface org.frankframework.filesystem.ISupportsCustomFileAttributes
FILE_ATTRIBUTE_PARAM_PREFIX -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidappendFile(Path f, InputStream content) voidCopies the file to another folder.copyFile(Path f, String destinationFolder, boolean createFolder, Map<String, String> customFileAttributes) Copies the file to another folder, adding the given custom file attributes to the file in the destination folder.voidcreateFile(Path file, InputStream content) voidcreateFile(Path file, InputStream contents, Map<String, String> customFileAttributes) Creates a file with the given custom file attributes.voidcreateFolder(String folder) voiddeleteFile(Path f) booleanbooleanfolderExists(String folder) booleanfolderExists(Path folder) getCustomFileAttribute(Path file, String name) Gets the value of the given custom file attribute on the given file.longgetFileSize(Path f) Get a string representation of an identification of a file.booleanlist(Path folder, TypeFilter filter) Moves the file to another folder.moveFile(Path f, String destinationFolder, boolean createFolder, Map<String, String> customFileAttributes) Moves the file to another folder, adding the given custom file attributes to the file in the destination folder.voidopen()voidremoveFolder(String folder, boolean removeNonEmptyFolder) renameFile(Path source, Path destination) Renames the file to a new name, possibly in another folder.Renames the file to a new name, possibly in another folder.voidsetCreateRootFolder(boolean createRootFolder) Whether the LocalFileSystem tries to create the root folder if it doesn't exist yet.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, setMaxNumberOfMessagesToListMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.frankframework.filesystem.IBasicFileSystem
close, getCanonicalNameOrErrorMessage, getNumberOfFilesInFolder, isOpen, listMethods inherited from interface org.frankframework.filesystem.ISupportsCustomFileAttributes
getCustomFileAttributes, hasCustomFileAttributes
-
Field Details
-
ORIGINAL_LAST_MODIFIED_TIME_ATTRIBUTE
- See Also:
-
-
Constructor Details
-
LocalFileSystem
public LocalFileSystem()
-
-
Method Details
-
configure
- Specified by:
configurein interfaceIBasicFileSystem<Path>- Throws:
ConfigurationException
-
open
- Specified by:
openin interfaceIBasicFileSystem<Path>- Overrides:
openin classAbstractFileSystem<Path>- Throws:
FileSystemException
-
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<Path>- Throws:
FileSystemException
-
toFile
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<Path>- Throws:
FileSystemException
-
list
- Specified by:
listin interfaceIBasicFileSystem<Path>- Throws:
FileSystemException
-
exists
- Specified by:
existsin interfaceIBasicFileSystem<Path>
-
createFile
- Specified by:
createFilein interfaceIWritableFileSystem<Path>- Parameters:
file- FileSystem file referencecontent- to write or NULL. When NULL existing files should be overwritten, and new files should be created.- Throws:
IOException
-
createFile
public void createFile(Path file, InputStream contents, Map<String, String> customFileAttributes) throws FileSystemException, IOExceptionDescription copied from interface:ISupportsCustomFileAttributesCreates a file with the given custom file attributes.- Specified by:
createFilein interfaceISupportsCustomFileAttributes<Path>- Parameters:
file-contents-customFileAttributes-- Throws:
FileSystemExceptionIOException
-
appendFile
- Specified by:
appendFilein interfaceIWritableFileSystem<Path>- Throws:
FileSystemExceptionIOException
-
readFile
- Specified by:
readFilein interfaceIBasicFileSystem<Path>- Throws:
FileSystemException
-
deleteFile
- Specified by:
deleteFilein interfaceIBasicFileSystem<Path>- Throws:
FileSystemException
-
isFolder
- Specified by:
isFolderin interfaceIBasicFileSystem<Path>
-
folderExists
- Specified by:
folderExistsin interfaceIBasicFileSystem<Path>- Throws:
FileSystemException
-
folderExists
-
createFolder
- Specified by:
createFolderin interfaceIBasicFileSystem<Path>- Throws:
FileSystemException
-
removeFolder
- Specified by:
removeFolderin interfaceIBasicFileSystem<Path>- Throws:
FileSystemException
-
renameFile
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<Path>- Throws:
FileSystemException
-
renameFile
public Path renameFile(Path source, Path destination, Map<String, String> customFileAttributes) throws FileSystemExceptionDescription copied from interface:ISupportsCustomFileAttributesRenames 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 interfaceISupportsCustomFileAttributes<Path>- Throws:
FileSystemException
-
moveFile
public Path moveFile(Path 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<Path>- Throws:
FileSystemException
-
moveFile
public Path moveFile(Path f, String destinationFolder, boolean createFolder, Map<String, String> customFileAttributes) throws FileSystemExceptionDescription copied from interface:ISupportsCustomFileAttributesMoves the file to another folder, adding the given custom file attributes to the file in the destination 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 interfaceISupportsCustomFileAttributes<Path>- Throws:
FileSystemException
-
copyFile
public Path copyFile(Path 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<Path>- Throws:
FileSystemException
-
copyFile
public Path copyFile(Path f, String destinationFolder, boolean createFolder, Map<String, String> customFileAttributes) throws FileSystemExceptionDescription copied from interface:ISupportsCustomFileAttributesCopies the file to another folder, adding the given custom file attributes to the file in the destination 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 interfaceISupportsCustomFileAttributes<Path>- Throws:
FileSystemException
-
getFileSize
- Specified by:
getFileSizein interfaceIBasicFileSystem<Path>- Throws:
FileSystemException
-
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<Path>
-
getParentFolder
- Specified by:
getParentFolderin interfaceIBasicFileSystem<Path>- Throws:
FileSystemException
-
getCanonicalName
- Specified by:
getCanonicalNamein interfaceIBasicFileSystem<Path>- Throws:
FileSystemException
-
getModificationTime
- Specified by:
getModificationTimein interfaceIBasicFileSystem<Path>- Throws:
FileSystemException
-
getAdditionalFileProperties
@Nullable public Map<String,Object> getAdditionalFileProperties(Path file) throws FileSystemException - Specified by:
getAdditionalFilePropertiesin interfaceIBasicFileSystem<Path>- Throws:
FileSystemException
-
getCustomFileAttribute
@Nullable public String getCustomFileAttribute(@Nonnull Path file, @Nonnull String name) throws FileSystemException Description copied from interface:ISupportsCustomFileAttributesGets the value of the given custom file attribute on the given file. If the attribute does not exist,nullis returned.- Specified by:
getCustomFileAttributein interfaceISupportsCustomFileAttributes<Path>- Parameters:
file- File object for which to get the extended attribute. Must not benull.name- Name of the extended attribute to get. Must not benull.- Returns:
- Value of the extended attribute or
nullif the attribute does not exist. - Throws:
FileSystemException
-
getPhysicalDestinationName
- Specified by:
getPhysicalDestinationNamein interfaceHasPhysicalDestination
-
setCreateRootFolder
Whether the LocalFileSystem tries to create the root folder if it doesn't exist yet.- Parameters:
createRootFolder-
-