Qorus Integration Engine®
4.0.3.p2_git
|
Mappers are developed in text files, loaded into the system schema with oload and participate in releases built with make-release.
Each mapper has its own sandboxed Program container that contains the mapping logic and any library objects imported into it. Mapper Program objects have the following sandboxing restrictions set by default:
For mapper library code, the following parse option is also set to restrict code from performing I/O or logging:
Note that workflows, services, and jobs must declare mappers to be able to access them. The following api call should be used to acquire a mapper in your interface code:
The return type of the above function will be compatible with Mapper::Mapper, but the exact type of object depends on the mapper type.
Mapper files defining new system mappers take the filename suffix: ".qmapper"
.
As with function, class, constant objects, services, jobs, and value maps, mappers are defined by adding metadata tags in the form of specially-formatted comments to normal text files containing a complete mapper definition. The tags are parsed by oload, which will create the mappers in the Qorus database according to the information in the file.
The file consists of tags defining the mapper and then option and field definitions. At the end of the mapper definition, the END
tag terminates the mapper.
Mapper Definition File Tags
Key | Mand.? | Description |
name | Y | The name of the mapper |
version | Y | Version string for the mapper object; multiple versions of the same mapper can exist in the database and interfaces (workflows, services, and jobs) must refer to the mapper using its explicit version |
patch | N | A descriptive patchlevel attribute that does not affect version compatibility |
desc | Y | Description of the mapper object |
author | N | The optional author of the mapper object |
parse_options | N | A comma separated list of local parse options for the mapper code; one or more of (options must be given as shown without any namespace prefixes): - PO_REQUIRE_TYPES - PO_REQUIRE_PROTOTYPES - PO_STRICT_ARGS - PO_ASSUME_LOCAL - PO_ALLOW_BARE_REFS |
type | Y | The type of mapper; must be a system type or a type provided by a mapper module |
classes | N | An optional list of class objects to load into the mapper program object (subject to %lockdown sandboxing restrictions; see Mapper Library Objects for more information) |
constants | N | An optional list of constant objects to load into the mapper program object (subject to %lockdown sandboxing restrictions; see Mapper Library Objects for more information) |
functions | N | An optional list of functions to load into the mapper program object (subject to %lockdown sandboxing restrictions; see Mapper Library Objects for more information) |
define-group | N | Allows interface groups to be defined; format is: name: description ; see below for an example |
groups | N | one or more interface groups that the mapper is a member of for access purposes (mappers cannot be enabled or disabled) |
Mapper example:
"output"
option is not defined since it's defined automatically by the InboundTableMapper mapper typeThe following mapper types are provided by the system:
"Mapper"
: implemented by OMQ::MapperType; provides a Mapper::Mapper object at runtime"InboundTableMapper"
: implemented by OMQ::InboundTableMapperType; provides a OMQ::QorusInboundTableMapper object at runtime"QorusSqlStatementOutboundMapper"
: implemented by OMQ::QorusSqlStatementOutboundMapperType; provides a OMQ::QorusSqlStatementOutboundMapper object at runtime"QorusRawSqlStatementOutboundMapper"
: implemented by OMQ::QorusRawSqlStatementOutboundMapperType; provides a OMQ::QorusRawSqlStatementOutboundMapper object at runtimeAdditional mapper types can be provided by implementing a mapper module; see Mapper Module Developent for more information.
Common options for all mappers are defined by the Mapper class here: Mapper Options, but each mapper type can extend this list with its own options, some of which may be required as well.
Mappers object must provide the input and output options by default, but these may be generated automatically by the particular mapper type (for example, the OMQ::InboundTableMapperType class automatically generates the output option based on the target table); see the mapper type documentation for more information.
Mapper input options are specified with the following syntax:
OPTION:
option_name:
expressionWhere:
See the example in the preceding section.
This option is a hash that describes the input data structures; see the "input"
key of Mapper Options for more information.
Note that only input field names defined as keys in this hash can be used as input field names in mapper field definitions.
While all mapper ojects generated by a mapper type must define the "input"
and "output"
keys, mapper types may define these automatically (for example, the OMQ::InboundTableMapperType class automatically generates the output option based on the target table); see the mapper type documentation for more information.
This option is a hash that describes the output data structures; see the "output"
key of Mapper Options for more information.
Note that only output field names defined as keys in this hash can be used as Mapper Fields.
While all mapper ojects generated by a mapper type must define the "input"
and "output"
keys, mapper types may define these automatically (for example, the OMQ::InboundTableMapperType class automatically generates the output option based on the target table); see the mapper type documentation for more information.
Mapper field transformations are based on Mapper Specification Format and are specified with the following syntax:
FIELD:
output_field:
expressionWhere:
All Qorus mapper field descriptions support the following two additional keys which are added at runtime to all mapper:
"context"
: any string value assigned to this key will be used as the argument to UserApi::expandTemplatedValue(); the return value of this method call will be used as the value of the field"template"
: if assigned to True; the value of the field will be passed as the sole argument to UserApi::expandTemplatedValue(); the return value of this method call will be used as the value of the fieldMappers support library objects in way similar to workflows, services, and jobs, however mapper library objects are subject to %lockdown sandboxing restrictions, so every library object imported into a mapper Program object must meet this criterion or it cannot be used in a mapper.
%lockdown prohibts any I/O; also logging is not allowed from within a mapper, so generally library code used elsewhere in Qorus workflows, services, and jobs is not suitable for use in a mapper.
Mapper library objects can be used in workflows, services, and jobs however.
New mapper types can be added to the system by implementing mapper modules and placing them in $OMQ_DIR/user/modules/
and adding the modules' names to the qorus.mapper-modules system option.
Each module must call the map_register_mapper() function in the module's init
closure or call reference.
Example module: