Specifying Outbound Physical or Logical Directory Paths in Mediator Specifying the Outbound File Naming Convention

Oracle JCA Adapter for FilesFTP 4-51 1. Double-click the invoke activity. 2. Click the Browse Variables icon.

3. In the Variable Chooser dialog, click the Create an Object icon.

4. Create a variable MyDir of type xsd:string, as shown in Figure 4–27 . Figure 4–27 Create Variable Dialog

5. Drag and drop an Assign activity from the Component Palette in between the

Receive and Invoke activities in the design area.

6. Double-click the assign activity and click the Copy Operation tab.

7. Click Create and then Copy Operation. The Create Copy Operation dialog is

displayed.

8. In the Create Copy Operation dialog, select Expression from Type and specify the

directory name and path, as shown in Figure 4–28 . The output file is written to this directory. 4-52 Oracle Fusion Middleware Users Guide for Technology Adapters Figure 4–28 Create Copy Operation Dialog

9. Click OK in the Create Copy Operation dialog and then click OK in the Assign

dialog. The .bpel page is displayed.

10. Double-click the invoke activity. The Invoke dialog is displayed.

11. Click the Properties tab.

12. Select the jca.file.Directory property from the Properties column and set

the Value as MyDir the directory that you created in Step 4. Ensure that the Type column is set to input, as shown in Figure 4–29 . Oracle JCA Adapter for FilesFTP 4-53 Figure 4–29 The Invoke Dialog

4.3.2.2.4 Specifying the Outbound File Naming Convention

Specify the naming convention to use for outgoing files. You cannot enter completely static names such as po.txt. This is to ensure the uniqueness in names of outgoing files, which prevents files from being inadvertently overwritten. Instead, outgoing file names must be a combination of static and dynamic portions. The prefix and suffix portions of the file example shown in Figure 4–26 are static for example, po_ and .xml. The SEQ variable of the name is dynamic and can be a sequence number or a time stamp for example, po_yyMMddHHmmss.xml to create a file with a time stamp. If you choose a name starting with po_, followed by a sequence number and the extension txt as the naming convention of the outgoing files, then you must specify po_SEQ.txt. If you choose a name starting with po_, followed by a time stamp with the pattern yyyy.MM.dd and the extension txt as the naming convention of the outgoing file, then you must specify po_yyyy.MM.dd.txt. For example, the outgoing file name can be po_2004.11.29.txt. Additionally, you can combine file naming conventions. For example, you can specify the file naming convention as po_SEQ_yyyy.MM.dd_SEQ.txt. Note: When using dynamic directories, ensure that parameters such as NumberMessages, ElapsedTime, and FileSize are not defined in the outbound adapter service WSDL file. These parameters are not supported with dynamic directories. 4-54 Oracle Fusion Middleware Users Guide for Technology Adapters You cannot use a regular expression for outbound synchronous reads. In these cases, the exact file name must be known. A time stamp is specified by date and time pattern strings. Within date and time pattern strings, unquoted letters from A to Z and from a to z are interpreted as pattern letters representing the components of a date or time string. Text can be quoted using single quotation marks to avoid interpretation. The characters represent single quotation marks. All other characters are not interpreted. The Java pattern letters are defined in Table 4–6 . Different presentations in the pattern are as follows: Note: When you use the time stamp pattern, the same time stamp may be generated on subsequent calls and you may lose messages. The workaround is to combine the time-stamp pattern with a sequence pattern. Alternatively, you can use a time-stamp pattern closest to a millisecond, in which case the adapter handles the uniqueness of the file names. Table 4–6 Java Pattern Letters Letter Date or Time Component Presentation Examples G Era designator Text AD y Year Year 1996; 96 M Month in year Month July; Jul; 07 w Week in year Number 27 W Week in month Number 2 D Day in year Number 189 d Day in month Number 10 F Day of week in month Number 2 E Day in week Text Tuesday; Tue a AMPM marker Text PM H Hour in day 0-23 Number k Hour in day 1-24 Number 24 K Hour in AMPM 0-11 Number h Hour in AMPM 1-12 Number 12 m Minute in hour Number 30 s Second in minute Number 55 S Millisecond Number 978 z Time zone General Time Zone Pacific Standard Time; PST; GMT-08:00 Z Time zone RFC 822 Time Zone -0800 Oracle JCA Adapter for FilesFTP 4-55 ■ Text For formatting, if the number of pattern letters is four or more, then the full form is used; otherwise, a short or abbreviated form is used if available. For parsing, both forms are accepted, independent of the number of pattern letters. ■ Number For formatting, the number of pattern letters is the minimum number of digits, and shorter numbers are zero-padded to this number. For parsing, the number of pattern letters is ignored unless it is needed to separate two adjacent fields. ■ Year For formatting, if the number of pattern letters is two, then the year is truncated to two digits; otherwise, it is interpreted as a number. For parsing, if the number of pattern letters is more than two, then the year is interpreted literally, regardless of the number of digits. Using the pattern MMddyyyy, 011112 parses to Jan 11, 12 A.D. For parsing with the abbreviated year pattern y or yy, the abbreviated year is interpreted relative to some century. The date is adjusted to be within 80 years before and 20 years after the time instance is created. For example, using a pattern of MMddyy and Jan 1, 1997 is created; the string 011112 is interpreted as Jan 11, 2012, while the string 050464 is interpreted as May 4, 1964. During parsing, only strings consisting of exactly two digits are parsed into the default century. Any other numeric string, such as a one-digit string, a three-or-more-digit string, or a two-digit string that is not all digits for example, -1, is interpreted literally. So, 01023 or 0102003 is parsed using the same pattern as Jan 2, 3 AD. Likewise, 0102-3 is parsed as Jan 2, 4 BC. ■ Month If the number of pattern letters is 3 or more, then the month is interpreted as text; otherwise, it is interpreted as a number. ■ General time zone Time zones are interpreted as text if they have names. For time zones representing a GMT offset value, the following syntax is used: GMTOffsetTimeZone: GMT Sign Hours : Minutes Sign: one of + - Hours: Digit Digit Digit Minutes: Digit Digit Digit: one of 0 1 2 3 4 5 6 7 8 9 Hours must be between 0 and 23, and Minutes must be between 00 and 59. The format is locale-independent and digits must be taken from the Basic Latin block of the Unicode standard. For parsing, RFC 822 time zones are also accepted. For formatting, the RFC 822 4-digit time zone format is used: RFC822TimeZone: Sign TwoDigitHours Minutes 4-56 Oracle Fusion Middleware Users Guide for Technology Adapters TwoDigitHours: Digit Digit TwoDigitHours must be between 00 and 23. Other definitions are the same as for general time zones. For parsing, general time zones are also accepted.

4.3.2.2.5 Specifying a Dynamic Outbound File Name

For outbound operation, you can specify a dynamic outbound file name. You can set variables to specify dynamic outbound file names. ?xml version=1.0 encoding=UTF-8? adapter-config name=ReadAddressChunk adapter=File Adapter xmlns=http:platform.integration.oracleblocksadapterfwmetadata connection-factory location=eisFileAdapter adapterRef= endpoint-interaction operation=ChunkedRead interaction-spec className=oracle.tip.adapter.file.outbound.ChunkedInteractionSpec property name=PhysicalDirectory value=C:\foo property name=FileName value=dummy.txt property name=ChunkSize value=1 interaction-spec endpoint-interaction adapter-config In the preceding example, in the JCA file, the physical directory is set to C:\foo but during run time it is dynamically changed to the assigned value. In this example, the physical directory is dynamically changed to C:\out. You must perform the following steps to specify the dynamic outbound directory name: 1. Double-click the invoke activity. 2. Click the Browse Variables icon.

3. In the Variable Chooser dialog, click the Create an Object icon.

4. Create a variable file of type xsd:string, as shown in Figure 4–27 . 5. Drag and drop an Assign activity from the Component Palette in between the Receive and Invoke activities in the design area.

6. Double-click the assign activity and click the Copy Operation tab.

7. Click Create and then Copy Operation. The Create Copy Operation dialog is

displayed.

8. In the Create Copy Operation dialog, select Expression from Type and specify the

file name, as shown in Figure 4–28 . The output file is written to this file.

9. Click OK till you exit the assign activity dialog.

10. Double-click the invoke activity. The Invoke dialog is displayed.

11. Click the Properties tab.

12. Select the jca.file.FileName property from the Properties column and set the

Value as file the file that you created in Step 4. Ensure that the Type column is set to input, as shown in Figure 4–30 . Oracle JCA Adapter for FilesFTP 4-57 Figure 4–30 The Invoke Dialog

4.3.2.2.6 Batching Multiple Outbound Messages

In the simplest scenario, you specify writing a single file to a single message. You can also specify the outbound method for batch file writing. This method enables you to specify the number of messages to publish in one batch file. The following batch file settings are provided in the File Configuration page shown in Figure 4–26 : ■ Number of Messages Equals Specify a value which, when equaled, causes a new outgoing file to be created. ■ Elapsed Time Exceeds Specify a time which, when exceeded, causes a new outgoing file to be created. For example, if you specify that elapsed time exceeds 15 seconds, then the first message that is received is not written out, even after 15 seconds, as batching conditions are not valid. If a second message is received, then batching conditions become valid for the first one, and an output file is created when the elapsed time exceeds 15 seconds. ■ File Size Exceeds Specify a file size which, when equaled, causes an outgoing file to be created. For example, assume that you specify a value of 3 for the number of messages received and a value of 1 MB for the file size. When you receive two messages that when combined equal or exceed 1 MB, or three messages that are less than 1 MB, an output file is created. Note: When using dynamic files, ensure that parameters such as NumberMessages, ElapsedTime, and FileSize are not defined in the outbound adapter service WSDL file. These parameters are not supported with dynamic files. Note: The Elapsed Time Exceeds batching criteria is evaluated and a new outgoing file is created, only when an invocation happens.