IBM BPM, V8.0.1, All platforms > Authoring services in Integration Designer > Services and service-related functions > Access external services with adapters > Configure and using adapters > IBM WebSphere Adapters > Flat Files > Overview of WebSphere Adapter for Flat Files > Technical overview > Inbound processing

Function selectors

During inbound processing, a function selector returns the appropriate operation to be called on the service. You choose a function selector when you configure the adapter for inbound processing in the external service wizard. The adapter provides three function selectors, FilenameFunctionSelector, EmbeddedNameFunctionSelector, and RootNameFunctionSelector.


FilenameFunctionSelector

FilenameFunctionSelector is a rule-based function selector that provides object name resolution based on regular expressions that map to file names. A regular expression is a string used to describe or match a set of strings according to certain syntax rules.

The following table shows examples of matching rules, where a rule consists of the ObjectName and Rule fields.

Examples of matching rules for FilenameFunctionSelector
FileName ObjectName Rule
Customer0001.txt
Customer
CUST.*TXT
2231ORZ93.z21 Order [0-9]*OR[A-Z][0-9]{2}.*
2231ORZ93.z21 Order *OR.*

The rules in the second and third rows resolve to the same name, but the rule in the second row is less “greedy” because it requires a specific sequence of numbers and letters in order for the file name to match, whereas the rule in the third row resolves anything with the characters “OR” in the file name. The character combination “.*” indicates that any character can occur any number of times.

To generate the native function name, the function selector prefixes emit to the object name that you provide.

For example, if the object name is Customer, the function selector returns the function name emitCustomer. The object name must be the payload object name, for example, Customer or Order, and not the wrapper or business graph name. For pass-through scenarios, use FlatFile as the object name.

You can configure FilenameFunctionSelector with multiple rules, each containing an object name, and a regular expression to match against the file name. If more than one rule matches, the function selector returns the object name based on the first matching rule. If no rule matches, the adapter generates an error. If no rules are present in the configuration, the function selector uses the function name emitFlatFile.

For a detailed explanation of the rules governing the use of regular expressions, see the Java™ Class Pattern documentation at https://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/Pattern.html.


EmbeddedNameFunctionSelector

EmbeddedNameFunctionSelector is used for content-specific business objects, where the object name is embedded in the event file. It returns the function name based on the content data, and not on the wrapper.

For example, if the content-specific business object is CustomerWrapperBG, the function returned by the function selector is emitCustomer.

EmbeddedNameFunctionSelector must be configured with a data handler. The data binding must be the adapter-specific WrapperDataBinding, and it must be configured to use the same data handler that is configured with the function selector.


RootNameFunctionSelector

RootNameFunctionSelector is used only for global elements in business objects, where the global element name is the root element name in the event XML file. It returns the function name based on the global element name.

For example, if the global element name is CustomerType1, the function returned by the root name function selector is ‘emit CustomerType1'.

RootNameFunctionSelector is used only for global elements with XML Datahandler or UTF8XMLDatahandler.

To use global Elements with Delimited Datahandler or FixedWidth Datahandler, use FilenameFunctionSelector instead of RootNameFunctionSelector.

RootNameFunctionSelector does not need any configuration, as it does not depends on the data handler to get the correct function name.

Inbound processing


Related reference:

Connection properties for the wizard