For up-to-date product documentation, see the IBM MobileFirst Foundation Developer Center.
The JavaScript adapter-descriptor file
Learn about the function and structure of the Java™ adapter-descriptor file.
We use the adapter.xml descriptor file to configure adapter connectivity to the back-end system and to declare the procedures that are exposed by the adapter to applications and to other adapters. The elements, subelements, and attributes of the JavaScript adapter XML file are described in the following sections.
The adapter.xml descriptor file is located in the adapter-resources folder, under <JavaScript_adapter>/src/main/.
The adapter element
The adapter element is the root element of the adapter configuration file. The following example shows the structure, which consists of both attributes and subelements:
<mfp:adapter name="Backend_adap" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mfp="http://www.ibm.com/mfp/integration" xmlns:http="http://www.ibm.com/mfp/integration/http"> <displayName>Backend_adap</displayName> <description>Backend_adap</description> <connectivity> <connectionPolicy>...</connectionPolicy> </connectivity> </mfp:adapter>
The adapter element attributes
The <adapter> element contains the following attributes.
- name
Mandatory.
The name of the adapter. This name must be unique within the MobileFirst Server. It can contain alphanumeric characters and underscores, and must start with a letter. After you define and deploy an adapter, we cannot modify its name.
The adapter element subelements
The adapter element has the following subelements.
- displayName
Optional.
The name of the adapter that is displayed in the MobileFirst Operations Console. If this element is not specified, the value of the name attribute is used instead.
- description
Optional.
Additional information about the adapter. Displayed in the MobileFirst Operations Console.
- connectivity
Mandatory.
Defines the mechanism by which the adapter connects to the back-end application. It contains the connectionPolicy subelement. The connectionPolicy subelement is mandatory, and it defines connection properties. The structure of this subelement depends on the integration technology of the back-end application. For more information about connectionPolicy, see HTTP adapter connectionPolicy element and SQL adapter connectionPolicy element.
- procedure
Mandatory.
Defines a process for accessing a service that is exposed by a back-end application. Occurs once for each procedure that is exposed by the adapter. An example is shown in Implementing JavaScript SQL adapters.
The procedure element has the following structure:
<procedure name="unique-name" audit="value" scope="value" secured="value" />The procedure element has the following attributes.
- name
Mandatory.
The name of the procedure. This name must be unique within the adapter. It can contain alphanumeric characters and underscores, and must start with a letter.
- audit
Optional.
Defines whether calls to the procedure are logged in the audit log. The log file is Project Name/server/log/audit/audit.log.
The following values are valid.
- true: Calls to the procedure are logged in the audit log.
- false: Default. Calls to the procedure are not logged in the audit log.
- scope
Optional.
The security scope that protects the adapter resource procedure, as a string of zero or more space-separated scope elements. A scope element can be a keyword that is mapped to a security check, or the name of a security check. The default value of the scope attribute is an empty string. When the value of the secured attribute is false, the scope attribute is ignored.
For information on OAuth resource protection, see OAuth resource protection. For detailed instructions on how to configure resource protection for a JavaScript resource procedure, including how to configure a protecting scope, see Configure protection of JavaScript resources.
- secured
Optional.
Defines whether the adapter resource procedure is protected by the MobileFirst security framework. The following values are valid:
- true: Default. The procedure is protected. Calls to the procedure require a valid access token.
- false: The procedure is not protected. Calls to the procedure do not require an access token. When this value is set, the scope attribute is ignored. To understand the implications of disabling resource protection, see Unprotected resources.
For information on OAuth resource protection, see OAuth resource protection. For detailed instructions on how to configure resource protection for a JavaScript resource procedure, including how to disable resource protection, see Configure protection of JavaScript resources.
securityCheckDefinition Optional.
Defines a security-check object. For a full reference of the securityCheckDefinition element, see The <securityCheckDefinition> element.
property Optional.
Declares a user-defined property.
- User-defined properties are shown in the MobileFirst Operations Console in the Configurations tab for the relevant adapter. The values that developers assign to them during the creation of the adapter can be overridden in the console, without redeploying the adapter.
- User-defined properties can be read using the MFP.Server.getPropertyValue and then further customized at run time. For more information, see Configure adapters.
The property element has the following structure:
<property name="unique-name" description="value" defaultValue="value" type="value" />
Note: If the adapter.xml file of a JavaScript adapter contains <procedure> elements, the <property> elements must always appear below them. The property element has the following attributes.
- name
Mandatory.
The name of the property. This name must be unique within the adapter. It can contain alphanumeric characters and underscores, and must start with a letter.
- description
Optional.
A user-friendly description of the property. This is the name that is displayed in the MobileFirst Operations Console.
- defaultValue
Mandatory.
Defines the default value of this property. This is the value the property will have if it is not overridden.
- type
Optional.
The property type. If not specified, a string is assumed. The following values are valid:
- string: Default. Any string value is allowed.
- integer: Any integer value is allowed.
- boolean: Only true or false are allowed.
- enumerator: Only specific values are allowed. This is specified by using a JSON array notation. For example the enumerator ['first', 'second'] allows only the values first and second.
- HTTP adapter connectionPolicy element
The connectionPolicy element of the adapter-descriptor file lets you configure settings for our adapter's HTTP connection.- SQL adapter connectionPolicy element
The connectionPolicy element of the adapter-descriptor file lets you configure settings for our adapter's SQL connection.
Parent topic: MobileFirst JavaScript adapters