Directory Scanner

Overview

The Directory Scanner enables you to scan a specified directory on the filesystem for files containing XML messages. When the messages have been read, they can be passed into the core message pipeline, where the full collection of message processing filters can act on them.

The Directory Scanner is typically used in cases where an external application is dropping XML files (perhaps by FTP) on to the file system so that they can be validated, modified, and potentially routed onwards over HTTP or JMS. Alternatively, they can simply be stored to another directory where the application can pick them up again.

This sort of protocol mediation is very useful in cases where legacy systems are involved. Instead of making drastic changes to the legacy system by adding an HTTP engine, for example, the API Gateway can be used to pull the files from the file system, and then route them on over HTTP to another back-end system. The added benefit is that messages are exposed to the full compliment of message processing filters made available by the API Gateway. This ensures that only properly validated messages are routed on to the target system.

To add a new Directory Scanner, in the Policy Studio tree, under the Listeners node, right-click the name of the Process (for example, Oracle API Gateway), and select the Directory Scanner -> Add menu option. This topic describes how to configure the fields on the Directory Scanner Settings dialog.

Directory to Scan

The fields configured in this section determine what files to scan, where to scan for them, and when to scan.

Name:

Enter or browse to the directory that the API Gateway scans for XML files.

File Name Pattern:

If you wish to scan only for files based on some pattern, you can specify the pattern as a regular expression. For example, if you wish to scan only for files with a particular file extension, such as .xml, you can enter a regular expression such as the following:

^[a-zA-Z\s]*.xml

Similarly, if a particular naming scheme is used when dropping the files into the configured directory, you can enter a regular expression to scan only for these files. For example, the following regular expression scans only files named using a yyyy-mm-dd date format:

^(\d{4})[- /.]((1[012])|(0?[1-9]))[- /.]((3[01])|([012]?[1-9])|([12]0))$

Poll Rate:

The poll rate entered in milliseconds determines how often the API Gateway scans the directory for new XML files.

Directory for Output

When the Directory Scanner has finished scanning the files it moves them to another directory to avoid processing them again. The fields configured in this section determine where processed files are placed and what they are called.

Name:

Enter the name of the directory to place the processed files. This may be the response from the Web Service (after the policy has routed it onwards and received a response), or a modified message in cases where the policy has inserted a security token into the message, or converted the message (for example, using XSLT).

File Prefix:

If you would like to save processed files into the directory above with a prefix added to the filename, enter the prefix here. For example, you may want to prepend _PROCESSED to all processed files.

File Suffix:

Similarly, you can add a suffix to the output files by entering the suffix in this field.

Completed Directory

Processed files are removed from the source directory and placed into this directory post-processing to avoid re-processing the same files over and over again.

Working Directory

Files are moved to the temporary directory specified here during processing. This is necessary in cases where the poll rate is quite low, and there is a chance that the file may be scanned again before it is processed fully and moved to the completed directory.

Policy to Use

The messages in the scanned XML files are passed into the policy selected here. If the policy routes messages to a Web Service, the response from the service is placed in the output directory specified above. Similarly, if the policy modifies the request, for example, by signing it or adding a security token to it, the updated message is also placed in the output directory.