Using the File Binding Component in a Project

File Message Element

The File message element extends the binding element to specify properties associated with reading input files or writing output files in the file system. In the NetBeans IDE, select the properties for a file:messages() element to specify the behavior for the message.

The following table describes the message properties available for reading from or writing to the file system.

Table 1 Message Properties to Read/Write to a File System

Property 

Description 

Required 

Example 

Use 

Specifies whether a message (or message part) is literal or encoded. 

If encoded is specified, then you must also specify the encoder using the encodingStyle() property.

Required 

Literal (Default) 

fileName 

Defines the file name relative to the specified directory to read from or write to. 

If fileNameIsPattern() is false, this attribute specifies an actual file name. Otherwise, this attribute specifies a pattern marker used for filtering input files from the directory, or a file name format to write to the directory.

Required 

data.xml (Default) 

fileNameIsPattern 

Indicates whether or not the fileName() attribute designates a filename pattern.

Optional 

false 

recordDelimiter 

Defines the record delimiter when multiple records are present.  

The value of this attribute is considered only if multipleRecordsPerFile() is true.

If no value is specified for this attribute but maxBytesPerRecord() is defined when reading a file, it is assumed that each record is of fixed length with the length being the value defined for maxBytesPerRecord(). Otherwise, the default record delimiter is the linefeed character.

Optional 

\r\n 

pollingInterval 

Defines the polling interval that the File Binding Component searches for input files in the specified directory.  

The polling interval is specified in milliseconds and has a default value of 1000ms. This attribute has no effect for writing. 

Required 

1000 (Default) 

fileType 

Specifies whether the file is a text file or binary file. 

Optional 

text (Default) 

encodingStyle 

Specifies the encoding type associated with the message (or message part). This also defines the encoder type responsible to process the encoded data. 

Optional 

customencoder-1.0 

part 

The abstract WSDL configuration for message can have one or more parts. The part() property references one of the parts that is named in the abstract WSDL configuration. 

Optional 

Part1 

addEOL 

Defines whether newline characters (EOL characters) should be appended to the outbound message or to each record incase of multiple records..  

This attribute has no effect for reading 

Optional 

false 

removeEOL 

Defines whether newline characters (EOL characters) should be removed before processing. or be removed for each record incase of multiple records. 

This attribute has no effect for writing 

Optional 

false 

maxBytesPerRecord 

Defines the maximum number of bytes to be read per record. If only a single record is present, this attribute defines the total number of bytes to be read.  

This attribute has no effect for writing. 

Optional 

1024 

multipleRecordsPerFile 

Specifies whether the file to read from or write to contains multiple records or should be considered a single payload. 

Optional 

false 

archive 

Specifies whether a message is archived after it is read for processing by the File Binding Component. When true, the message is moved to the directory specified by archiveDirectory.

When a file is processed, the File Binding Component renames the file to input_file_name_processed() or input_file_name_error(), depending on the success of the operation. If the archive() property is true, the file is then moved to the archiveDirectory and a UUID is appended to the file name.

Optional 

true 

archiveDirectory 

If the archive() property is set to true(), archiveDirectory() specifies the directory to which processed (read) messages will be moved.

Filenames for archived messages are tagged with a UUID to avoid file name collision in the archive directory.  

If the archiveDirIsRelative() property is true(), then the directory specified here is a relative directory. The parent directory is the directory specified in the fileDirectory() property for the file:address() element.

Optional 

true 

archiveDirIsRelative 

Indicates whether the directory specified in archiveDirectory() is an absolute directory or a relative directory.

If true(), the parent directory is the directory specified in the fileDirectory() property for the file:address() element.

Optional 

true 

protect 

Indicates if overwrite protection is required before writing messages to a file.  

When true(), existing files of the same name will be moved to the directory specified by protectDirectory before the current message is written.

When false(), the files of the same name will be overwritten.

Optional 

true 

protectDirectory 

If the protect property is set to true, protectDirectory specifies the directory to which files will be moved to prevent them from being overwritten. Filenames for protected messages are tagged with a UUID to avoid file name collision in the protect directory.

If the protectDirIsRelative() property is true(), then the directory specified here is a relative directory.

The parent directory is the directory specified in the fileDirectory() property for the file:address() element.

Optional 

false 

protectDirIsRelative 

Indicates whether the directory specified in protectDirectory() is an absolute directory or a relative directory.

If true(), then the parent directory is the directory specified in the fileDirectory() property for the file:address() element.

Optional 

true 

stage 

Indicates if staging is enabled.  

If set to true(), then messages are first written to the directory specified by stagingDirectory.

When the message is completely written to the staging directory, then it is moved to the target directory for the message.  

Filenames for staged messages are tagged with a UUID to avoid file name collision in the staging directory.  

Optional 

false 

stageDirectory 

If the stage property is set to true, stageDirectory() specifies the directory to which files will first be written before being moved to the target directory for the message.

If the stageDirIsRelative() property is true, then the directory specified here is a relative directory.

The parent directory is the directory specified in the fileDirectory() property for the file:address() element.

Optional 

false 

stageDirIsRelative 

Indicates whether the directory specified in stageDirectory is an absolute directory or a relative directory.

If true, then the parent directory is the directory specified in the fileDirectory() property for the file:address() element.

Optional 

true