Learn how you can override properties during run time, without having to redeploy adapters.
Starting with V8.0.0 of MobileFirst Server, administrators can use the MobileFirst Operations Console to modify the behavior of an adapter that has been deployed. After configuration has been modified, the changes take effect in the server immediately, without the need to redeploy the adapter, or restart the server. For more information, see Configuring adapter properties with MobileFirst Operations Console in this page.
There are two levels of properties that can be modified on-the-fly:
Assume that you have deployed a JavaScript adapter JavaSQL to MobileFirst Server. Assume that the adapter.xml descriptor file contains three user-defined properties, as follows:
<mfp:adapter name="JavaSQL"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mfp="http://www.ibm.com/mfp/integration"
xmlns:sql="http://www.ibm.com/mfp/integration/sql">
<displayName>JavaSQL</displayName>
<description>JavaSQL</description>
<connectivity>
<connectionPolicy xsi:type="sql:SQLConnectionPolicy">
<dataSourceDefinition>
<driverClass>com.mysql.jdbc.Driver</driverClass>
<url>jdbc:mysql://localhost:3306/mydb</url>
<user>myUsername</user>
<password>myPassword</password>
</dataSourceDefinition>
</connectionPolicy>
</connectivity>
<!-- Procedures -->
<procedure name="procedure1"/>
<!-- Custom properties -->
<property name="DB_url" displayName="Database URL" defaultValue="jdbc:mysql://127.0.0.1:3306/mobilefirst_training" />
<property name="DB_username" displayName="Database username" defaultValue="mobilefirst" />
<property name="DB_password" displayName="Database password" defaultValue="mobilefirst" />
</mfp:adapter>
You can view the configuration settings
by clicking the Configurations tab under mfp
Runtime > adapter_name. The predefined
connection policy parameters are displayed under Connectivity.
Beneath them, under Parameters, are the user-defined
properties settings. In this example, Database URL, Database
username, and Database password.
Administrators can modify the values that are shown and save. The changes take effect immediately, without redeploying the adapter.
There are both Java and JavaScript server-side APIs that enable you to retrieve properties defined in the adapter.xml file or in MobileFirst Operations Console.
@Context
ConfigurationAPI configurationAPI ;
Then you can use the configurationAPI instance
to get properties:configurationAPI.getPropertyValue ("DB_url");
When the adapter configuration is modified from the MobileFirst Operations console, the JAX-RS application class is reloaded and its init method is called again.
MFP.Server.getPropertyValue("name");