webMethods CloudStreams 10.3 | webMethods CloudStreams Documentation 10.3 | Cloud Connections, Services, and Connector Listeners | Understanding REST Parameters | Parameter Formatters for REST Connector Services | Using the Default Parameter Formatter
 
Using the Default Parameter Formatter
For convenience, CloudStreams provides a default formatter implementation that handles the most common formatter usage:
wm.cloudstreams.service.util.formatters:paramFormatter
This formatter allows you to specify a complex IS document type, and to implement the desired output. The input will typically be data in a complex structure, for example, an IS document type. The output will be a data organized in a desired output format, for example, a URL query string. The format in which the output data is generated depends on the implementation of the formatter. Typically, the formatter is used in conjunction with the QUERYSTRING_PARAM parameter type.
* Example of using the default parameter formatter
Consider a SaaS back-end expecting the following parameter:
BlockDeviceMapping.n.DeviceName
BlockDeviceMapping.n.VirtualName
BlockDeviceMapping.n.Ebs.NoDevice
BlockDeviceMapping.n.Ebs.VolumeSize
where n represents a number.
1. Create IS document types for the above parameter definition.
The IS document structure would look like this:
BlockDeviceMapping[]
+ DeviceName
+ VirtualName
+ Ebs
+ NoDevice
+ VolumeSize
2. Set the dataType of the parameter to Record.
3. Set the document reference (documentRef) to the newly created IS document type in step 1.
4. Specify a formatter element within the parameter element, along with the service name (service attribute) and type (type attribute).
5. In case the implementation contains supported arguments, specify any customization by adding the appropriate argument name and value.
The parameter definition for a resource using the above, within the Connector Descriptor, would look like this:
<parameter name="BlockDeviceMapping" dataType="Record"
documentRef="document.paramType:BlockDeviceList" style="QUERYSTRING_PARAM">
<formatter service = "wm.cloudstreams.service.util.formatters:paramFormatter"
type = "paramFormatter">
<arg name="startIndex" value="1" />
<arg name="format" value="." />
</formatter>
</parameter>
Note: The default value for the type attribute within the scope of a parameter definition is "paramFormatter". This type refers to the bundled IS Specification:
wm.cloudstreams.service.common.lookup.specs:formatterSpec
The generated representation of the above parameter would look like this:
BlockDeviceMapping.1.DeviceName=/dev/sdj&;BlockDeviceMapping
.1.Ebs.NoDevice=true&;BlockDeviceMapping
.2.DeviceName=/dev/sdh&;BlockDeviceMapping
.2.Ebs.VolumeSize=300&;BlockDeviceMapping
.3.DeviceName=/dev/sdc&;BlockDeviceMapping
.3.VirtualName=ephemeral1
The default formatter can be configured with the following supported arguments:
Argument
Default Value
Description
startIndex
0
Determines the index values of the keys e.g. should the n present in BlockDeviceMapping.n.DeviceName start with 0 or 1 or some number of your choice.
format
. (period)
Specifies how the document entries be separated. For example, BlockDeviceMapping.3.DeviceName is separated by a period (.).

Copyright © 2013-2018 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.