uCosminexus Service Platform, Overview
This subsection describes the functionality and file formats supported in the file conversion operation.
The file conversion operation reads the conversion source input file from the work folder or common folder, and writes the post conversion output file to the work folder or common folder.
The following figure shows an overview of the processing of the file conversion operation:
Figure 8-26 Processing of the file conversion operation
The following table describes the formats of the input and output files that are supported in the file conversion operation:
Table 8-12 File formats supported in the file conversion operation
No. | Processing method | Input file format | Output file format | Support | |
---|---|---|---|---|---|
1 | Batch processing method | Binary format | Binary format | Y | |
2 | XML format | Y | |||
3 | XML format | Binary format | Y | ||
4 | XML format | Y | |||
5 | Partition processing method | Binary format | Fixed length format | Binary format | Y |
6 | XML format | Y | |||
7 | Length tag format | Binary format | N | ||
8 | XML format | N | |||
9 | linefeed separator format | Binary format | Y | ||
10 | XML format | Y | |||
11 | Other than above | Binary format | N | ||
12 | XML format | N | |||
13 | XML format | Binary format | Y | ||
14 | XML format | Y |
The differences between the fixed length, length tag, and linefeed separator formats are as follows:
You can convert the layout when you convert the file. Also, if the I/O format is the binary format, you can also assign or delete a linefeed code and convert the character code.
In the batch processing method, the input files are read and converted in a batch. After conversion, the data is written to the output file in a batch.
The target data format, and the contents to be converted in the batch processing method are as follows:
The reading of the input file, conversion, writing to the output file is processed for each record of the input file. Repetitive processing is executed until the end of the input file.
For examples of definition when a file is converted from the binary format to XML format, and from the XML format to binary format with the partition processing method, see "Appendix E Example for defining file operations adapter " in "Service Platform Reception and Adapter Definition Guide".
The judgment method for each record varies depending on the input file format.
The data formats of the input file subject to the partition processing method are the binary format definition and XML schema. The target data structure must be a structure in which the header record part, data record part, and trailer record part occur in this sequence.
The data record part is a data having a structure wherein the decided element sequence is continuously repeated. This structure is the same as the database table structure, the decided element sequence (lines in the binary format, and data beneath specific elements in the XML format) is called a record, and this is an image that is repeated n times. There are no restrictions on the number of elements in a record and the number of records.
The header record part and trailer record part are complex content elements containing any element, and the records are not repeated. Furthermore, you can omit these parts.
The following figures show the images of the data file structure and data record part:
Figure 8-27 Data file structure
Figure 8-28 Image of the data record part
The data format corresponds to the binary format (fixed length format and linefeed separator format), and XML format. The input and output formats must have the structure of the above formats.
The following figures show the examples of data in the binary format:
Figure 8-29 Example of data in the fixed length format
Figure 8-30 Example of data in the linefeed separator format
The binary format definition, XML schema, and data transformation definition that must be defined in the partition processing method are as follows:
Table 8-13 Record types depending on the record presence specification (Fixed length method)
Record presence specification | Presence of header record part | Present | Present | Absent | Absent |
---|---|---|---|---|---|
Presence of trailer record part | Present | Absent | Present | Absent | |
Position and length of the record part | Header record part | Top of file to Header record length |
Top of file to Header record length |
-- | -- |
Data record part | Header record part End position to Data record length * Number of data records |
Header record part End position to Data record length * Number of data records |
Top of file to Data record length * Number of data records |
Top of file to Data record length * Number of data records |
|
Trailer record part | Data record part End position to Trailer record length |
-- | Data record part End position to Trailer record length |
-- |
Data record part size = Data file size - (Header record length + Trailer record length) Number of records = Size of data record part / Data record length (rounded off after the decimal point) |
Table 8-14 Record types depending on the record presence specification (Linefeed separator method)
Record presence specification | Presence of header record part | Present | Present | Absent | Absent |
---|---|---|---|---|---|
Presence of trailer record part | Present | Absent | Present | Absent | |
Position and length of the record part | Header record part | First line | First line | -- | -- |
Data record part | First line onwards to Just before last line |
First line onwards to Last line |
First line to Just before last line |
First line to Last line |
|
Trailer record part | Last line | -- | Last line | -- |
Table 8-15 Error determining pattern
Header record part | Trailer record part | Number of lines to be converted in the file |
---|---|---|
Yes | Yes | 1 line or less |
Yes | No | 0 lines or less |
No | Yes | 0 lines or less |
To specify the record demarcation of the header record, data record, and trailer record for the input XML file, set up the path of the elements to be read in the file operations adapter definition file.
The following table describes the items and contents set up in the file operations adapter definition file:
Table 8-16 Settings in the file operations adapter definition file (Partition input in the input XML file)
Set items | Set contents |
---|---|
csc.adapter.fileOperation.transform.header.inElement | Specify the path of the elements corresponding to the header record in the input XML file. If a header record is not used, this item need not be specified (ignored even if specified). |
csc.adapter.fileOperation.transform.data.inElement | Specify the path of the elements corresponding to the data record in the input XML file. |
csc.adapter.fileOperation.transform.trailer.inElement | Specify the path of the elements corresponding to the trailer record in the input XML file. If a trailer record is not used, this item need not be specified (ignored even if specified). |
The following figure shows the example settings of the input XML file and file operations adapter definition file:
Figure 8-31 Example settings of the input XML file and file operations adapter definition file
In the partition processing method, a output template XML file is used for the input file in order to merge the conversion results of each record into one XML file.
The contents of the output template XML file must be formatted according to the output XML schema created in "(b) Target data formats". If the file is not an integral-form XML document, an error occurs during conversion.
The following table describes the specifications for the output template XML file:
Table 8-17 Specifications for the output template XML file
Item | Specifications |
---|---|
File name | File name specified in the csc.adapter.fileOperation.transform.outputTemplateXmlFile property of the file operations adapter definition file |
Character encoding | UTF-8 |
Specific elements in the output template XML file are replaced in the records (output data), to create the output XML file.
Specify the elements replaced in the records in the file operations adapter definition file. The following table describes the items and contents set up in the file operations adapter definition file:
Table 8-18 Settings in the file operations adapter definition file (Merging the output XML file)
Set items | Set contents |
---|---|
csc.adapter.fileOperation.transform.header.outElement | Specify the path of the elements corresponding to the header record in the output XML file. If a header record is not used, this item need not be specified (ignored even if specified). |
csc.adapter.fileOperation.transform.data.outElement | Specify the path of the elements corresponding to the data record in the output XML file. |
csc.adapter.fileOperation.transform.trailer.outElement | Specify the path of the elements corresponding to the trailer record in the output XML file. If a trailer record is not used, this item need not be specified (ignored even if specified). |
The following figure shows the example settings of the output template XML file, and file operations adapter definition file:
Figure 8-32 Example settings of the output template XML file and file operations adapter definition file
The following figure shows an example of converting the output template XML file into the output XML file. Note that the linefeed and spaces of the output XML file are displayed in this example, but in the actual output XML file, the linefeed and spaces between the elements are deleted.
Figure 8-33 Example of XML file output
The output XML file that uses the output template XML file is output in the format described in the following table:
Table 8-19 Format of the output XML file
Item | Specifications |
---|---|
Character encoding | UTF-8 |
Spaces between the elements | Deleted. |
Linefeeds between the elements | Deleted. |
Namespace declaration |
|
File contents | XML data is output according to the output XML schema. The compliance with the output XML schema is not validated. |
If the partition processing method is selected in the file conversion operation, you can collectively convert multiple data records as one element. You can perform the conversion whether the input file is in the binary format or XML format.
The following figures show examples where the input file is in the binary format, the total number of data records is 6, and two data records are converted as one element:
Figure 8-34 Example of converting two data records as one element (in the fixed length format)
Figure 8-35 Example of converting two data records as one element (in the linefeed separator format)
Specify the settings for one element (number of records converted simultaneously) in the following parameter of the file operations adapter definition file:
For the contents of the parameter, see "File operations adapter definition file" in "Service Platform Reference Guide".
If the total number of data records is indivisible by the value specified in the parameter, convert the remaining records at one time.
The following figure shows an example of conversion where the total number of data records is 6, and four data records are converted as one element:
Figure 8-36 Example of conversion when the records are indivisible by the value specified for the element
When all the following conditions are fulfilled, you can collectively convert multiple header records as one element:
You can specify the number of header records to be converted in the csc.adapter.fileOperation.transform.header.batchSize property of the file operations adapter definition file.
In the following conditions, an error might occur during conversion:
Specify the format of the files to be read or written in the file conversion operation by first creating a binary format definition file on the binary format definition screen, and then specifying the file format as a self-defined file of the file operations adapter.
For details on the binary format definition screen, see "1.2.1 Binary Format Definition Window" in "Service Platform Reference Guide".
For details on creating the binary format definition file, see "4.4 Creating Message Formats (Binary Format Definition File)" in "Service Platform Basic Development Guide".
For details on specifying the self-defined file of the file operations adapter, see "File operations adapter definition file" in "Service Platform Reference Guide".
Specify the data transformation definition file (xsl file) to be converted from the pre-created input file to the output file, as the self-defined file of the file operations adapter.
To create a mapping definition file with the mapping definition editor for the development environment, use the data transformation definition to create the xsl file. For details on specifying the self-defined file of the file operations adapter, see "File operations adapter definition file" in "Service Platform Reference Guide".
In the file conversion operation, you can use the character code conversion UOC to convert files.
When you use the character code conversion UOC, you must set up the following files for the self-defined file on the Service Adapter Settings window (details):
If you specify the file described in 1 at the same time as the file described in 2, the file described in 1 is given priority and the file described in 2 is ignored.
For details on how to specify the settings in the Service Adapter Settings window (details), see the locations describing the file conversion operation in "3.3.11 Defining file operations adapters" in "Service Platform Reception and Adapter Definition Guide".
For an overview of the character code conversion UOC and the implementation method, see "Appendix I Character code conversion using character code conversion UOC" in "Service Platform Basic Development Guide".
The following table describes the self-defined files required for converting the partition processing method in the file conversion operation, and the list of properties of the file operations adapter definition file that must be specified. For details on the file operations adapter definition file, see "File operations adapter definition file" in "Service Platform Reference Guide".
Table 8-20 Self-defined files and properties of file operations adapter definition file that must be specified in the partition processing method
Files specified as self-defined file | Input file | Output file | |||
---|---|---|---|---|---|
Binary | XML | Binary | XML | ||
XSLT file for header layout conversion | Y#1 | Y#1 | Y#1 | Y#1 | |
XSLT file for data layout conversion | Y | Y | Y | Y | |
XSLT file for trailer layout conversion | Y#2 | Y#2 | Y#2 | Y#2 | |
FDX file for input header | Y#1 | -- | -- | -- | |
FDX file for input data | Y | -- | -- | -- | |
FDX file for input trailer | Y#2 | -- | -- | -- | |
XML schema file for input header | -- | -- | -- | -- | |
XML schema file for input data | -- | -- | -- | -- | |
XML schema file for input trailer | -- | -- | -- | -- | |
Properties specified in the file operations adapter definition file | csc.adapter.fileOperation.transform.input (input file type) |
Y | Y | -- | -- |
csc.adapter.fileOperation.transform.output (output file type) |
-- | -- | Y | Y | |
csc.adapter.fileOperation.transform.headerRecord (use of header records) |
Y#1 | Y#1 | Y#1 | Y#1 | |
csc.adapter.fileOperation.transform.trailerRecord (use of trailer records) |
Y#2 | Y#2 | Y#2 | Y#2 | |
csc.adapter.fileOperation.transform.header.inElement (name of input header element) |
-- | Y#1 | -- | -- | |
csc.adapter.fileOperation.transform.data.inElement (name of input data element) |
-- | Y | -- | -- | |
csc.adapter.fileOperation.transform.trailer.inElement (name of input trailer element) |
-- | Y#2 | -- | -- | |
csc.adapter.fileOperation.transform.header.outElement (name of output header element) |
-- | -- | -- | Y#1 | |
csc.adapter.fileOperation.transform.data.outElement (name of output data element) |
-- | -- | -- | Y | |
csc.adapter.fileOperation.transform.trailer.outElement (name of output trailer element) |
-- | -- | -- | Y#2 | |
csc.adapter.fileOperation.transform.outputTemplateXmlFile (file name of output template XML file) |
-- | -- | -- | Y | |
FDX file for output header | -- | -- | Y#1 | -- | |
FDX file for output data | -- | -- | Y | -- | |
FDX file for output trailer | -- | -- | Y#2 | -- | |
XML schema file for output header | -- | -- | -- | -- | |
XML schema file for output data | -- | -- | -- | -- | |
XML schema file for output trailer | -- | -- | -- | -- | |
Output template XML file | -- | -- | -- | Y | |
Input property for character code conversion UOC (common I/O file) csc_owncodeconvert.properties |
Y#3 | -- | Y#3 | -- | |
Input property for character code conversion UOC (for converting the input file) csc_owncodeconvert_in.properties |
Y#3 | -- | -- | -- | |
Input property for character code conversion UOC (for converting the output file) csc_owncodeconvert_out.properties |
-- | -- | Y#3 | -- |
All Rights Reserved. Copyright (C) 2015, Hitachi, Ltd.