Skip to content
This repository was archived by the owner on Mar 28, 2019. It is now read-only.

Using MCS Platform APIs

Steven Davelaar edited this page Mar 25, 2016 · 7 revisions

AMPA has extensive support for the following Oracle MCS platform API's:

To be able to use this AMPA MCS functionality, you should check the MCS Connection checkbox and fill in the mobile backend ID and (anonymous) access key in the REST Connection panel of the Business Objects from Rest Service wizard. After completing the wizard, this information is then stored in mobile-persistence-config.properties where you can modify it if needed:

# MCS connection details, applicationScope EL Expressions are allowed for backend ID and anonymous key
mcs.connection=MCS
mcs.mobile-backend-id=bcda8418-8c23-4d92-b656-9299d691e120
mcs.anonymous-key=c3RldmVuLmtpbmc6U3RhYWYyMDE1IQ==

The access key is used to create the Authorization header when the app is accessing an MCS platform API or custom API before you have authenticated with MCS. Note that after you authenticated against MCS, MAF will automatically inject the Authorization header in every REST call based on the user login credentials, ignoring the anonymous access key that is specified in mobile-persistence-config.properties.

All MCS Platform API calls are handled by the MCSPersistenceManager class. By default, this class will use the settings from mobile-persistence-config.properties to connect to MCS but you can override these settings by calling methods setConnectionName, setMobileBackendId, setAnonymousKey, setAuthHeader or login.

If your app needs to support dynamic MCS connections, you can also specify an EL expression in the mobile backend ID and access key fields in mobile-persistence-config.properties. The actual URL of the MCS connection can be changed at runtime using method AdfmfJavaUtilities.overrideConnectionProperty. Here is a sample code snippet to dynamically set the MCS connection URL based on a user preference:

String mcsHost = (String)AdfmfJavaUtilities.evaluateELExpression("#{preferenceScope.application.connection.host}");
AdfmfJavaUtilities.clearSecurityConfigOverrides("MCS");
AdfmfJavaUtilities.overrideConnectionProperty("MCS", "restconnection", "url", mcsHost+"/mobile");

You will typically include this code in your application lifecylelistener start() method.

Clone this wiki locally