Deleting a File from a Local File System 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. 4-210 Oracle Fusion Middleware Users Guide for Technology Adapters ■ TargetSchemaRoot: The root element in the target schema. ■ TargetType: The type of data. The other possible type is XML. ■ Xsl: Relative path to the Xsl file.

4.5.11.5 Moving a File from One Remote Directory to Another Remote Directory on the Same FTP Server

The IO use cases for the Oracle FTP Adapter are very similar to those for Oracle File Adapter. However, there are a few nuances that need attention. In this use case you will move a file within the same directory, which is similar to a rename operation on the same server. Most FTP servers support the RNFRRNTO FTP commands that let you rename a file on the FTP server. However, even if the RNFRRNTO commands are not supported, moving a file within the same directory is still possible because of a binding property, UseNativeRenameOperation. By default, this property is set to TRUE, and in this case the Oracle FTP Adapter uses the native RNFRRNTO commands. However, if this property is set to FALSE, then the Oracle FTP Adapter uses the Get and Put commands followed by a Delete command to emulate a move operation. You can model only a part of this procedure by using the wizard because the corresponding Adapter Configuration Wizard is not available. You must complete the remaining procedure by manually configuring the generated JCA file. You must perform the following steps to move a file from a remote directory to another remote directory on the same FTP server: 1. Create an empty BPEL process. 2. Drag and drop FTP Adapter from the Component Palette to the External References swim lane. The Adapter Configuration Wizard Welcome page is displayed.

3. Click Next. The Service Name page is displayed.

4. Enter a service name in the Service Name field.

5. Click Next. The Adapter Interface page is displayed.

6. Click Next. The FTP Server Connection page is displayed.

7. Enter the JNDI name for the FTP server, and click Next. The Operation page is

displayed.

8. Select Synchronous Get File, enter FTPMove in the Operation Name field, and

then click Next. The File Directories page is displayed. 9. Enter a dummy physical path for the directory for incoming files, and then click Next . The File name page is displayed. Note: You have selected Synchronous Get File as the operation because the WSDL file that is generated as a result of this operation is similar to the one required for the file IO operation. Note: The dummy directory is not used. You must manually change the directory in a later step.