Webmasters, gagnez de l'argent en affichant des bannières contextuelles Oxado
SourceForge.net Logo
Support This Project
   LeCouteauSuisse Project
Welcome ! [ Home ]  ·  [ Downloads ]  ·  [ Forums ]  ·  [ News ]  ·  [ Documentations ]  
[ Home ]

[ Documentations ]

FileToEventGenerator


This generator read a file, split the file into items and launch an event on each item. This generator use a splitter class, this class knwon how to split and interpret the format of the file. By default three splitters are available :

  • DelimitedFileToEventSplitter: to read delimited file (like CSV : Comma Separated Value), it's a file containing an event on each line and properties of event separated by sequence of characters (like tabulation, comma, ...). It use a RecordEvent class.
  • FixedFileToEventSplitter : to read fixed or structured file, it's a file containing an event on one or more lines. Each line have properties based on characters position and each kind of line can be identified by sequence of first characters. It use a RecordEvent class.
  • XMLFileToEventSplitter : to read XML files. It use a XMLEvent class.

See Service Configuration for detailled information to configure your service. You must declare this generator with the <generator> section inside the <generators> section. It will looks like :

<generator name="MyGeneratorName" type="LeCouteauSuisse.Components.FileToEventGenerator, 
		LeCouteauSuisseComponents, Version=1.0.0.2, Culture=neutral, PublicKeyToken=8d1037c5df6d5bd0">
This component have some parameters inside the section <settings>. Each parameter is written with a <setting> section.

Key nameMandatoryDefault valueDescription
typeYes The splitter class, assembly file name, version, culture, public key token.
pathYes The directory to monitor, in standard or Universal Naming Convention (UNC) notation.
fileFilterNo*.*The type of files to watch. For example, "*.txt" watches for changes to all text files.
includeSubdirectoriesNofalseSets a value (true or false) indicating whether subdirectories within the specified path should be monitored.
internalBufferSizeNo8192Sets the size of the internal buffer.
Specific settings for DelimitedFileToEventSplitter
headerLinesNo0Number of header lines to ignore.
headerLineWithColumnsNameNo0The line number having the column name.
footerLinesNo0Number of footer lines to ignore.
ignoreEmptyLineNotrueTrue to ignore empty lines.
ignorePrefixLineNo Ignore lines starting with this value. Compare strings using culture-sensitive ignoring the case of the strings being compared.
encodingNoThe value of Encoding.Default of the FrameworkThe encoding of the file to read. See System.Text.Encoding, name of encoding like ASCII, utf-32, ...
lineSeparatorNoThe value of Environment.NewLine of the FrameworkCharacters to identify a new line.
columnSeparatorNoTabulation value '\t'Characters to identify a new column.
columnEnclosureNo Characters at the begining and the end of the column to ignore column separator characters inside the value of the column.
escapeNo Characters preceding a column enclosure characters to consider column enclosure characters has part of the value.
dataNo Private data you want to add to each event generated.
Specific settings for FixedFileToEventSplitter
headerLinesNo0Number of header lines to ignore.
footerLinesNo0Number of footer lines to ignore.
ignoreEmptyLineNotrueTrue to ignore empty lines.
lineSeparatorNoThe value of Environment.NewLine of the FrameworkCharacters to identify a new line.
masterRecordYes List of key setting name of each master record separated by a comma.
allRecordYes List of key setting name of each record separated by a comma.
a record nameYes The description of a record (see bellow).
dataNo Private data you want to add to each event generated.
Specific settings for XMLFileToEventSplitter
xpathYes The XPath to select all event in the document
dataNo Private data you want to add to each event generated.

Description of a record

The FixedFileToEventSplitter is used to split a line of a file into fields based by characters position inside the line. It can handle different kind of lines inside the same file (example you can have lines describing a client, and lines describing a supplier, the format of these lines are different). A group of consecutive lines must be grouped to have sense, the first line of this group is named a master record. When a master record is detected all consecutive lines until the next master record are grouped inside the same event (example : you have a line describing an invoice followed by lines describing items of the invoice. Invoice line is a master record and item must be grouped with this invoice).

To describe a record you must add a setting, the key of this setting must be add to the allRecord setting, and if this record is the first of a group of lines it must be added to the masterRecord setting. A description of a record is composed of several informations. All informations are separated by comma :

{decription of the record},{prefix of record},{length of field}[,{length of field}]
The first information is a description of the record, the second describe the prefix of record, all other are length of each fields. Two method are used to detect the kind of a line, the first method test the first characters of the line, the second method test the length of the line. To have a prefixed record you must set the 'P' (ASCII code 80) character followed by the prefix of the line inside the prefix information, leave the prefix information empty if you want to test the line by length.


LeCouteauSuisse