Copying a File from a Local Directory on the File System to Another Local Directory

Oracle JCA Adapter for FilesFTP 4-209

4.5.11.4 Using a Large CSV Source File

Consider the following scenario, where you have a large CSV file of size 1 gigabyte coming on the source directory, and you must perform the following:

1. Translate the CSV into XML.

2. Transform the resulting XML using XSL.

3. Translate the result from the transform operation into a fixed length file.

This use case is similar to the FlatStructure sample in the BPEL samples directory. The difference is that the three steps occur in a single File IO interaction. To use a large CSV file and perform the operations listed in the preceding scenario, you must perform the following steps:

1. Copy the address-csv.xsd and address-fixedLength.xsd files from the

FlatStructure sample into the xsd directory of your project. 2. Copy addr1Toaddr2.xsl from the FlatStructure sample into the xsl directory of your project.

3. Configure the File IO interaction, as shown in the following example. At a high

level, you must specify the source schema, the target schema, and the XSL in the interaction specification along with the source and target directory or file details, as shown in the following example: adapter-config name=FileMove adapter=File Adapter xmlns=http:platform.integration.oracleblocksadapterfwmetadata connection-factory location=eisFileAdapter adapterRef= endpoint-interaction portType=FileMove_ptt operation=FileMove interaction-spec className=oracle.tip.adapter.file.outbound.FileIoInteractionSpec property name=SourcePhysicalDirectory value=foo1 property name=SourceFileName value=bar1 property name=SourceSchema value=xsdaddress-csv.xsd property name=SourceSchemaRoot value=Root-Element property name=SourceType value=native property name=TargetPhysicalDirectory value=foo2 property name=TargetFileName value=bar2 property name=TargetSchema value=xsdaddress-fixedLength.xsd property name=TargetSchemaRoot value=Root-Element property name=TargetType value=native property name=Xsl value=xsladdr1Toaddr2.xsl property name=Type value=MOVE interaction-spec endpoint-interaction adapter-config Note that you have provided the following additional parameters: ■ SourceSchema: Relative path to the source schema. ■ SourceSchemaRoot: The root element in the source schema. ■ SourceType: The type of data. The other possible type is XML. ■ TargetSchema: Relative path to the target schema. Note: All the three steps occur in a single File IO interaction. This works only if all the records in the data file are of the same type.