For up-to-date product documentation, see the IBM MobileFirst Foundation Developer Center.
Commands for adapters
When we call the mfpadm Ant task, we can include various commands for adapters.
The list-adapters command
The list-adapters command returns a list of the adapters deployed for a given runtime. It has the following attributes.
Table 1. list-adapters command attributes Attribute Description Required Default runtime Name of the runtime. Yes Not available output Name of output file. No Not applicable outputproperty Name of Ant property for the output. No Not applicable
Example
<list-adapters runtime="mfp"/>
This command is based on the Adapters (GET) REST service.
The deploy-adapter command
The deploy-adapter command deploys an adapter in a runtime. It has the following attributes.
Table 2. deploy-adapter command attributes Attribute Description Required Default runtime Name of the runtime. Yes Not available file Binary adapter file (.adapter). Yes Not available
Example
<deploy-adapter runtime="mfp" file="MyAdapter.adapter"/>
This command is based on the Adapter (POST) REST service.
The show-adapter command
The show-adapter command shows details about an adapter. It has the following attributes.
Table 3. show-adapter command attributes Attribute Description Required Default runtime Name of the runtime. Yes Not available name Name of an adapter. Yes Not available output Name of output file. No Not applicable outputproperty Name of Ant property for the output. No Not applicable
Example
<show-adapter runtime="mfp" name="MyAdapter"/>
This command is based on the Adapter (GET) REST service.
The delete-adapter command
The delete-adapter command removes (undeploys) an adapter from a runtime. It has the following attributes.
Table 4. delete-adapter command attributes Attribute Description Required Default runtime Name of the runtime. Yes Not available name Name of an adapter. Yes Not available
Example
<delete-adapter runtime="mfp" name="MyAdapter"/>
This command is based on the Adapter (DELETE) REST service.
The adapter command group
The adapter command group has the following attributes.
Table 5. adapter command group attributes Attribute Description Required Default runtime Name of the runtime. Yes Not available name Name of an adapter. Yes Not available The adapter command supports the following elements.
Table 6. adapter command group elements Element Description Count get-binary Gets the binary data. 0..∞ show-user-config Shows the user configuration. 0..∞ set-user-config Specifies the user configuration. 0..∞
The get-binary command
The get-binary command inside an <adapter> element returns the binary adapter file. It has the following attributes.
Table 7. get-binary command attributes Attribute Description Required Default tofile Name of the output file. Yes Not available
Example
<adapter runtime="mfp" name="MyAdapter"> <get-binary tofile="/tmp/MyAdapter.adapter"/> </adapter>
This command is based on the Adapter (GET) REST service.
The show-user-config command
The show-user-config command, inside an <adapter> element, shows the user configuration of the adapter. It has the following attributes.
Table 8. show-user-config command attributes Attribute Description Required Default format Specifies the output format. Either json or xml. Yes Not available output Name of a file in which to store the output. No Not applicable outputproperty Name of an Ant property in which to store the output. No Not applicable
Example
<adapter runtime="mfp" name="MyAdapter"> <show-user-config format="xml"/> </adapter>
This command is based on the Adapter Configuration (GET) REST service.
The set-user-config command
The set-user-config command, inside an <adapter> element, specifies the user configuration of the adapter. It has the following attributes for setting the entire configuration.
Table 9. set-user-config command attributes Attribute Description Required Default file Name of the JSON or XML file that contains the new configuration. Yes Not available The command has the following attributes for setting a single property in the configuration.
Table 10. set-user-config command attributes Attribute Description Required Default property Name of the JSON property. For a nested property, use the syntax prop1.prop2.....propN. For a JSON array element, use the index instead of a property name. Yes Not available value The value of the property. Yes Not available
Examples
<adapter runtime="mfp" name="MyAdapter"> <set-user-config file="myconfig.json"/> </adapter>
<adapter runtime="mfp" name="MyAdapter"> <set-user-config property="timeout" value="240"/> </adapter>
This command is based on the Application Configuration (PUT) REST service.
Parent topic: Administering MobileFirst applications through Ant