About producer file structures
A producer file structure contains a description of the basic content structure and naming conventions for files the producer sends. The Integration Architect specifies a pattern for the producer mailbox and a producer file structure when creating a routing channel template.
/${ProducerName}
The pattern can be specified using the following:- System facts (for example, /${ProducerName}/Inbox) where the actual name would be determined dynamically
- Explicit strings (for example, /${ProducerName}/myInbox)
- Provisioning facts (for example, /${ProducerName}/${myUserName} that are specified on the Provisioning Facts tab of the Routing Channel Template wizard
- A combination of system facts, explicit strings, and provisioning facts. The mailbox pattern must always start with /${ProducerName}
A producer file structure specifies the kind of file that producers are expected to send to Sterling File Gateway. A file structure is an ordered list of file layers, from outside to inside. A producer file structure may have one or more file layers. The layers are of a certain type, have a specific regular expression pattern, and may specify facts to be defined when a file matching the pattern is received.
- Container layers - contain other container or non-container layers.
For example, a PGP layer can contain a ZIP layer and a ZIP layer can
contain a TEXT layer. A zip file can only contain multiple files if
it is the outermost layer. All layers except the innermost layer must
be one of:
- ZIP
- GZIP
- PGP
- Non-container layers - or primitive layers, do not contain any
nested layers. The innermost layer must be a primitive layer of type:
- Text
- Unknown
There is no limit to the number of layers for a file structure. Certain processing operations, such as the special character handling feature, only apply to the outermost layer. Also, route identification occurs at the outermost layer, except in the case of an outer ZIP file layer. With an outer ZIP layer, the second layer is also used to perform route identification.
If the layer type of the consumer file structure is text, the layer types of every producer file structure must be text and must not be unknown. If the layer type of the consumer file structure is unknown, the producer file structure can include either unknown or text.
By using regular expressions, a powerful standardized pattern matching language, the Sterling File Gateway application can match file names and gather facts related to file names. In defining facts for a particular regular expression, you have the flexibility to use the following system facts:
Fact Name | Description |
---|---|
ConsumerFilename | The name of the ultimate consumer file. |
ConsumerName | The name of the consuming partner |
ConsumerCode | The code of the consuming partner Note: The
ConsumerCode may or may not be the same as the ConsumerName. The ConsumerCode
is derived from the consuming partner name and characters may be truncated
(if the partner name exceeds 24 characters), replaced (if the partner
name includes characters that are not alphanumeric), or removed (if
the partner name includes one or more spaces).
|
ProducerFilename | The name of the file the producer sent |
ProducerName | The name of the producing partner |
ProducerCode | The code of the producing partner |
RoutingTimestamp | Date and time when the producer file was received by the consumer. A 17-digit
string consisting of a 4-digit year, 2-digit month, 2-digit day, 3-digit minute, 3-digit second, and
3-digit millisecond. For example,
|
Or, you can create your own facts. User-created facts must be prefixed with the string "my" to clearly delineate between custom and system facts. You can specify a Provisioning Fact, as defined in the Routing Channel Template, in the file name pattern.
Facts are useful for describing the meaning of the regular expression language. The regular expression carries in it the definition of the file expected from the producer. Because a file name may carry different categories of information, it is helpful to divide those categories of information into groups. In the regular expression, each group of information is contained within parentheses "( )". Each group within the regular expression must have a corresponding fact, either system or custom. Consider the following example:
File Format in Regular Expression
(\p{Alnum}+[-_]?(\d{4})_(\d{2})_(\d{2})\.zip)
- the full expression, (\p{Alnum}+[-_]?(\d{4})_(\d{2})_(\d{2})\.zip), = capturing group 1 with fact = "mySanitizedFilename"
- (\d{4}) = capturing group 2 with fact = "myFileYear"
- (\d{2}) = capturing group 3 with fact = "myFileMonth"
- (\d{2}) = capturing group 4 with fact = "myFileDay"
The corresponding file name pattern group fact name entry for the above expression is:
mySanitizedFilename,myFileYear,myFileMonth,myFileDay
You can use the same fact in different layers of a producer file structure or in multiple file structures for the same routing channel template. During execution, the value of this fact must not change. If it does change, Sterling File Gateway generates an error.
The following table provides some examples of regular expressions for producer file structure.
Example Regular Expression | Matching Pattern |
---|---|
.+ | Matches any name containing one or more character, no facts are defined |
(?-i).+[.]txt | Matches file names with txt extension only. (The phrase (?-i) specifies that the match is case sensitive.) |
.+[.]txt | Matches file names with txt or TXT extensions |
.+[.](txt|xml) | Matches file names with txt, TXT, xml, or XML extensions |
The File name pattern as regular expression field is case insensitive when matching file names, unless (?-i) is specified.
After you specify a file layer type and click Next, you cannot change the file layer type. You can click Edit to change the fact names or regular expressions. To change the file layer type, click Delete, then click Add to create a new file layer.