Package org.frankframework.filesystem
Class FileSystemActor<F,S extends IBasicFileSystem<F>>
java.lang.Object
org.frankframework.filesystem.FileSystemActor<F,S>
Worker class for
AbstractFileSystemPipe
and AbstractFileSystemSender
.- Author:
- Gerrit van Brakel
- Specific parameters
- action Overrides attribute
action
, filename Overrides attributefilename
. If not present, the input message is used., destination Destination for actionrename
andmove
. Overrides attributedestination
., contents Content for actionwrite
andappend
., inputFolder Folder for actionslist
,mkdir
andrmdir
. This is a sub folder of baseFolder. Overrides attributeinputFolder
. If not present, the input message is used., typeFilter Filter for actionlist
. SpecifyFILES_ONLY
,FOLDERS_ONLY
orFILES_AND_FOLDERS
. By default, only files are listed.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final FileSystemActor.FileSystemAction[]
static final FileSystemActor.FileSystemAction[]
static final FileSystemActor.FileSystemAction[]
protected org.apache.logging.log4j.Logger
static final String
static final String
static final String
static final String
static final String
static final String
static final String
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
actionRequiresAtLeastOneOfTwoParametersOrAttribute
(HasName owner, ParameterList parameterList, FileSystemActor.FileSystemAction configuredAction, FileSystemActor.FileSystemAction action, String parameter1, String parameter2, String attributeName, String attributeValue) protected void
addActions
(List<FileSystemActor.FileSystemAction> specificActions) void
configure
(S fileSystem, ParameterList parameterList, FrankElement owner) doAction
(Message input, ParameterValueList pvl, PipeLineSession session) void
open()
void
If parameter ["action"<F,S extends IBasicFileSystem<F>>] is set, then the attribute action value will be overridden with the value of the parameter. void
setCharset
(String charset) Charset to be used for "read"<F,S extends IBasicFileSystem<F>> and "write"<F, S extends IBasicFileSystem<F>> action void
setCreateFolder
(boolean createFolder) Iftrue
: if a non-existing folder is part of the fileName, it will be created.void
setDeleteEmptyFolder
(boolean deleteEmptyFolder) If set to true then the folder will be deleted if it is empty after processing the action.void
setDestination
(String destination) Destination for "move"<F,S extends IBasicFileSystem<F>>, "copy"<F, S extends IBasicFileSystem<F>> or "rename"<F, S extends IBasicFileSystem<F>>. void
setExcludeWildcard
(String excludeWildcard) Filter of files to be excluded when looking in inputFolder.void
setFilename
(String filename) Filename to operate on.void
setInputFolder
(String inputFolder) void
setNumberOfBackups
(int numberOfBackups) For the actions "write"<F,S extends IBasicFileSystem<F>> and "append"<F, S extends IBasicFileSystem<F>>, with rotateSize>0: the number of backup files that is kept. void
setOutputFormat
(DocumentFormat outputFormat) Sets the outputFormat.void
setOverwrite
(boolean overwrite) If settrue
, for actions "create"<F,S extends IBasicFileSystem<F>>, "write"<F, S extends IBasicFileSystem<F>>, "move"<F, S extends IBasicFileSystem<F>>, "copy"<F, S extends IBasicFileSystem<F>> or "rename"<F, S extends IBasicFileSystem<F>>, the destination file is overwritten if it already exists void
setRemoveNonEmptyFolder
(boolean removeNonEmptyFolder) If set totrue
then the folder and the content of the non empty folder will be deleted.void
setRotateDays
(int rotateDays) For action="append"<F,S extends IBasicFileSystem<F>>: If set to a positive number, the file is rotated each day, and this number of files is kept. void
setRotateSize
(int rotateSize) For action="append"<F,S extends IBasicFileSystem<F>>: If set to a positive number, the file is rotated when it has reached the specified size, and the number of files specified in numberOfBackups is kept. void
setTypeFilter
(TypeFilter typeFilter) Filter for actionlist
.void
setWildcard
(String wildcard) Filter of files to look for in inputFolder e.g. '*.inp'.void
setWriteLineSeparator
(boolean writeLineSeparator) If set totrue
then the system specific line separator will be appended to the file after executing the action.
-
Field Details
-
log
protected org.apache.logging.log4j.Logger log -
ACTION_CREATE
- See Also:
-
ACTION_LIST
- See Also:
-
ACTION_INFO
- See Also:
-
ACTION_READ1
- See Also:
-
ACTION_READ2
- See Also:
-
ACTION_READ_DELETE
- See Also:
-
ACTION_MOVE
- See Also:
-
ACTION_COPY
- See Also:
-
ACTION_DELETE
- See Also:
-
ACTION_MKDIR
- See Also:
-
ACTION_RMDIR
- See Also:
-
ACTION_WRITE1
- See Also:
-
ACTION_WRITE2
- See Also:
-
ACTION_APPEND
- See Also:
-
ACTION_RENAME
- See Also:
-
ACTION_FORWARD
- See Also:
-
ACTION_LIST_ATTACHMENTS
- See Also:
-
PARAMETER_ACTION
- See Also:
-
PARAMETER_CONTENTS1
- See Also:
-
PARAMETER_CONTENTS2
- See Also:
-
PARAMETER_FILENAME
- See Also:
-
PARAMETER_INPUTFOLDER
- See Also:
-
PARAMETER_DESTINATION
- See Also:
-
PARAMETER_TYPEFILTER
- See Also:
-
ACTIONS_BASIC
-
ACTIONS_WRITABLE_FS
-
ACTIONS_MAIL_FS
-
-
Constructor Details
-
FileSystemActor
public FileSystemActor()
-
-
Method Details
-
configure
public void configure(@Nonnull S fileSystem, @Nonnull ParameterList parameterList, @Nonnull FrankElement owner) throws ConfigurationException - Throws:
ConfigurationException
-
actionRequiresAtLeastOneOfTwoParametersOrAttribute
protected void actionRequiresAtLeastOneOfTwoParametersOrAttribute(@Nonnull HasName owner, @Nonnull ParameterList parameterList, FileSystemActor.FileSystemAction configuredAction, FileSystemActor.FileSystemAction action, String parameter1, String parameter2, String attributeName, String attributeValue) throws ConfigurationException - Throws:
ConfigurationException
-
open
- Throws:
FileSystemException
-
doAction
public Message doAction(@Nonnull Message input, ParameterValueList pvl, @Nonnull PipeLineSession session) throws FileSystemException - Throws:
FileSystemException
-
addActions
-
setAction
If parameter ["action"<F,S extends IBasicFileSystem<F>>] is set, then the attribute action value will be overridden with the value of the parameter. -
setInputFolder
Folder that is scanned for files when action="list"<F,S extends IBasicFileSystem<F>>. When not set, the root is scanned -
setCreateFolder
public void setCreateFolder(boolean createFolder) Iftrue
: if a non-existing folder is part of the fileName, it will be created.- Default value
- false
-
setOverwrite
public void setOverwrite(boolean overwrite) If settrue
, for actions "create"<F,S extends IBasicFileSystem<F>>, "write"<F, S extends IBasicFileSystem<F>>, "move"<F, S extends IBasicFileSystem<F>>, "copy"<F, S extends IBasicFileSystem<F>> or "rename"<F, S extends IBasicFileSystem<F>>, the destination file is overwritten if it already exists - Default value
- false
-
setFilename
Filename to operate on. If not set, the parameter "filename"<F,S extends IBasicFileSystem<F>> is used. If that is not set either, the input is used -
setDestination
Destination for "move"<F,S extends IBasicFileSystem<F>>, "copy"<F, S extends IBasicFileSystem<F>> or "rename"<F, S extends IBasicFileSystem<F>>. If not set, the parameter "destination"<F, S extends IBasicFileSystem<F>> is used. If that is not set either, the input is used -
setRotateDays
public void setRotateDays(int rotateDays) For action="append"<F,S extends IBasicFileSystem<F>>: If set to a positive number, the file is rotated each day, and this number of files is kept. The inputFolder must point to the directory where the file resides - Default value
- 0
-
setRotateSize
public void setRotateSize(int rotateSize) For action="append"<F,S extends IBasicFileSystem<F>>: If set to a positive number, the file is rotated when it has reached the specified size, and the number of files specified in numberOfBackups is kept. Size is specified in plain bytes, suffixes like 'K', 'M' or 'G' are not recognized. The inputFolder must point to the directory where the file resides - Default value
- 0
-
setNumberOfBackups
public void setNumberOfBackups(int numberOfBackups) For the actions "write"<F,S extends IBasicFileSystem<F>> and "append"<F, S extends IBasicFileSystem<F>>, with rotateSize>0: the number of backup files that is kept. The inputFolder must point to the directory where the file resides - Default value
- 0
-
setWildcard
Filter of files to look for in inputFolder e.g. '*.inp'. Works with actions "move"<F,S extends IBasicFileSystem<F>>, "copy"<F, S extends IBasicFileSystem<F>>, "delete"<F, S extends IBasicFileSystem<F>> and "list"<F, S extends IBasicFileSystem<F>> -
setExcludeWildcard
Filter of files to be excluded when looking in inputFolder. Works with actions "move"<F,S extends IBasicFileSystem<F>>, "copy"<F, S extends IBasicFileSystem<F>>, "delete"<F, S extends IBasicFileSystem<F>> and "list"<F, S extends IBasicFileSystem<F>> -
setRemoveNonEmptyFolder
public void setRemoveNonEmptyFolder(boolean removeNonEmptyFolder) If set totrue
then the folder and the content of the non empty folder will be deleted. -
setWriteLineSeparator
public void setWriteLineSeparator(boolean writeLineSeparator) If set totrue
then the system specific line separator will be appended to the file after executing the action. Works with actions "write"<F,S extends IBasicFileSystem<F>> and "append"<F, S extends IBasicFileSystem<F>> - Default value
- false
-
setCharset
Charset to be used for "read"<F,S extends IBasicFileSystem<F>> and "write"<F, S extends IBasicFileSystem<F>> action -
setDeleteEmptyFolder
public void setDeleteEmptyFolder(boolean deleteEmptyFolder) If set to true then the folder will be deleted if it is empty after processing the action. Works with actions "delete"<F,S extends IBasicFileSystem<F>>, "readDelete"<F, S extends IBasicFileSystem<F>> and "move"<F, S extends IBasicFileSystem<F>> -
setOutputFormat
Sets the outputFormat. This ignored when reading a file. Is applicable to actions which return information about file(s). Relevant for: 'info', 'list', 'append', 'move', 'delete' and 'copy' actions.- Default value
- XML
-
setTypeFilter
Filter for actionlist
. SpecifyFILES_ONLY
,FOLDERS_ONLY
orFILES_AND_FOLDERS
.- Default value
- FILES_ONLY
-