ADF Mobile Configuration Service provides a mechanism for ADF Mobile Apps to update the end-points after they have been deployed to devices. This service allows any end-points configured in connections.xml to be updated on the server and have the deployed Apps uptake the changes without having to go through the normal App update process. All the end-points configured in the connections.xml like Web Service WSDL URI, REST Service URI, LoginServer URI, Remote URL etc can be updated using the Configuration Service.
1. Test to Production : When Apps are built they are configured to use dev/test end-points used by the developers for testing during development. Typically these end points are configured by administrators to point to production instances as part of application provisioning. Using Configuration Service allows mobile application administrators to configure the end-points a part of App provisioning.
2. Updating Configuration for Apps in production : In certain cases one may need to change the end points used by an App after deployment to a production environment due to maintenance or some other reason. Configuration Service & checkForNewConfiguration() API can be used for the configuration changes to be propagated to the mobile apps in production.
Configuration Uptake Flow
First time App start up:
1. When Configuration Service is enabled in an ADF Mobile App, the user is prompted with a dialog to provide the credentials and URI for the Configuration Service. A default URL is populated for the Config Service URL field based on the seeded URL entry in adf-config.xml. User can change this to any end-point provided by the administrator
2. After the user enters the credentials and submits the FWK downloads connections.xml from the Configuration Service and restarts the App with the new configuration.
3. During the Application restart the FWK checks for the presence of the downloaded connections.xml and continues with the normal startup flow.
Configuration updates after deployment:
Developers can use oracle.adfmf.framework.api.AdfmfContainerUtilities.checkForNewConfiguration() API to check if the connections.xml on Configuration Service has changed and if so, download a new version of the connections.xml file from the server. If a new version of the file is downloaded, the application is restarted with the new configuration. Developers can either invoke the API through some UI as shown in the attached sample app or do the check automatically as part of Application or Feature Lifecycle listeners at a certain event point in the App lifecycle.
Enabling Configuration Service
Configuration Service can be enabled using the following configuration in adf-config.xml. This file is in <App root>/.adf/META-INF folder
<!-- Enable Configuration Service Check at Startup-->
<adf-property name="use-configuration-service-at-startup" value="true"/>
<!-- Seeded Configuration Service URL -->
<adf-property name="adfmf-configuration-service-seed-url" value="http://192.168.1.9:7101/ConfigService-ViewController-context-root/"/>
Server Side Configuration Service Setup
Configuration Service can be implemented as a WebDav service or as a Service that accepts HTTP GET and returns connections.xml. The URL used by the Config Service Client is of the following format : <URL Configured in adf-config.xml>/<application bundle id>/connections.xml. The Config Service end-point can be secured using Basic-Auth or Basic-Auth over SSL.
The provided sample application has :
1. ADF MF App (ConfigServiceTest)
: This App has two features ; 1. remote URL feature pointing to google.com 2. Config feature with a page to check for config changes on the server. The App is configured to check for configuration during initial start-up. The URL used by the remote URL feature is configured in connections.xml. This URL can be changed in the Configuration Service App to point to say, for ex: http://m.bing.com and the mobile app can pick up this change using Config feature.
2. J2EE app(ConfigService)
that contains connections.xml at HTML root/<application bundle id> . This App does not have to be a J2EE App. In fact, it can be any endpoint that accepts HTTP GET and returns connections.xml using the specified URL format.
Steps to try the sample:
1. Deploy the ADF Mobile App to a simulator or device.
2. Deploy the WAR file to a WLS instance(tested with integrated WLS shipped with JDev 188.8.131.52.0).
3. Start the mobile App. Enter the Config Service URL from step2 in the Config Service dialog displayed during the app startup as shown below. Make sure you change the host and port to point to the WLS instance used in step2.
4. The App will download the connections.xml from Config Service and restart.
5. When the App restarts Search feature will display google search page
6. Change the remote URL in connections.xml in the Config Service App to http://m.bing.com. Make sure the changed end point is visible in the connections.xml by accessing the file from a browser
7. In the mobile app, access the Config feature and click on the "Check For Config Changes" button to detect the config change and download the new connections.xml.
8. The App will restart after downloading the new configuration. This time the search feature will display the bing search page.
This approach can be used to change any end points used by the app like WSDL URI, REST Service URI, Login Server URI etc.