For up-to-date product documentation, see the IBM MobileFirst Foundation Developer Center.


The Java adapter-descriptor file

Learn about the function and structure of the Java™ adapter-descriptor file.

We use the adapter.xml descriptor file to declare the display name, description, class name of the JAX-RS application and security checks procedures that are exposed by a Java 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 <Java_adapter>/src/main/.


The adapter element

The adapter element is the root element of the adapter configuration file. It has the following structure, which consists of both attributes and subelements:

<?xml version="1.0" encoding="UTF-8"?> <mfp:adapter name="JavaAdapter1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mfp="http://www.ibm.com/mfp/integration"> <displayName>JavaAdapter1</displayName> <description>JavaAdapter1</description> <JAXRSApplicationClass>com.acme.JavaAdapter1Application</JAXRSApplicationClass> <securityCheckDefinition name="UserAuthenticationSC" class="com.my_company.package.MyUserAuthenticationSecurityCheck"> <property name="maxAttempts" displayName="Maximum attempts" defaultValue="3" description="Maximum allowed user-authentication attempts"/> </securityCheckDefinition> <property name="path" description="The path after the host name" defaultValue="/feed"> </mfp:adapter>


The adapter element 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.

JAXRSApplicationClass

Mandatory for exposing an /adapter endpoint. Defines the class name of the JAX-RS application of this adapter. In the example, it is com.acme.JavaAdapter1Application. For more information, see Implementing the JAX-RS service of the adapter.

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 ConfigurationAPI interface and then further customized at run time. For more information, see Configuring adapters.
The property element has the following structure:

<property name="unique-name" description="value" defaultValue="value" type="value" /> 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.

Parent topic: MobileFirst Java adapters