Introduction
This week started nicely for Oracle Mobile Application Framework (MAF) developers as the new MAF 2.3 release has been made available. Details about this new release can be found in this blog from MAF product management. We will end the week with even better news: a new version of the A-Team Mobile Persistence Accelerator (AMPA) has been released, and Oracle has decided that AMPA will be productized and integrated with the next version of MAF. Read on for more info!
Main Article
For those of you that are new to AMPA, let me first explain what it is. AMPA is a lightweight persistence and data synchronization framework that works on top of Oracle MAF, and is available on GitHub under open source license . AMPA eases the consumption of RESTful services and provides a complete persistence layer that allows you to use the mobile application in offline mode. You can read and write data while not connected to the internet, and synchronize any pending data changes later when you are online again. The design-time wizards that are integrated with JDeveloper enable you to build (generate) a first-cut mobile application with offline capabilities within minutes without any Java coding. Does this sound to good to be true? Well, then you might want to check out the video Building Oracle MAF Application with Offline Sync against Oracle Mobile Cloud Service that hopefully convinces you of the power of AMPA.
While the video shows you how to build an application consuming Oracle MCS REST services, AMPA can be used with any RESTful services. For example, the tutorial Consuming and persisting REST/JSON services with Oracle MAF and the A-Team Mobile Persistence Accelerator shows you how to create RESTful services using JPA/EclipseLink technology and then consume these REST service in a MAF application using AMPA.
There is also an AMPA Overview Presentation that provides a comprehensive overview of all features.
New AMPA 12.2.1 Release
A new release of AMPA, build 12.2.1.0.68, is now available. This release (only) works with MAF 2.3 and JDeveloper 12.2.1. Focus of this release has been on enhanced Oracle MCS integration but there is much more. Here is a list of the main new features:
- Support for MCS Analytics in Offline Mode: You can register MCS analytics events in offline mode, AMPA will batch them up and sync them when you are online again.
- Support for MCS Storage: AMPA now provides easy read and write access to MCS storage collections, including offline support, you can add or modify files in an MCS storage collection while offline, the files will be synced later when you are online again.
- Support for MCS Device registration: you can register or unregister a device with MCS push notifications service using a simple Java method call.
Support for parallel REST calls: Background REST calls were executed sequentially to prevent multiple background threads writing REST results to SQLite DB. The code has now been re-organized to allow the REST calls to be executed in parallel while the DB write actions are still done sequentially. This behavior can be controlled using the new property enable.parallel.rest.calls in mobile-persistence-config.properties. - Choose Target Project for Java Generation: You can choose the target project for the data object classes and service classes generated by the AMPA wizard. By choosing the ApplicationController project as target, you can share the same instance of a class across features and you can access the classes in application lifecycle listener methods.
- Support for ADF Business Components Describe: The Business Objects from Rest Service wizard now includes an option to use the ADF BC Describe metadata format to discover data objects and associated CRUD resources.
- Various enhancements to Business Objects from Rest Service wizard: the wizard now includes a Runtime Options panel which allows you to set persistence options that previously could only be set by directly modifying the persistence-mapping XML file. In addition, the Data Object Attributes panel now includes the payload attribute name, and the Resource Details panel includes fields to set the “attributes to exclude” attribute and the option to delete local rows prior to executing the REST resource.
- Global Synchronization of Offline Transactions: When performing a data sync operation, this will now sync all pending transactions for all data objects. In previous versions, the data synchronization happened in the context of an Entity CRUD service, it only synchronized the data object of the entity CRUD service and its child data objects (if applicable). For backwards compatibility, the synchronize method on the entity CRUD Service is still supported, however it will now synchronize all data objects. As a result, the EL expression to check for pending data sync actions is no longer data object specific, you can now use the following expressions: #{applicationScope.ampa_hasDataSyncActions} and #{applicationScope.ampa_dataSyncActionsCount}. In addition, when navigating to the reusable data sync feature, you no longer have to set the data object (entity) class for which you want to see the pending sync actions.
- Ability to Force Offline Mode: You can now force AMPA to behave as if the device is an offline mode while in reality the device is online. This might for example be handy if you want to batch up multiple transactions, and/or prevent network traffic when the device is on a low-bandwidth network connection. To force/unforce offline mode, you can call the boolean method oracle.ateam.sample.mobile.controller.bean.Connectivity.forceOffline and/or include an application-scoped managed bean that uses this class, and then use a setPropertyListener to set this boolean property using the expression #{Connectivity.forceOffline}. If you use the MAF User Interface Generator, this managed bean is automatically created, and the generated pages have a menu option to toggle force offline mode.
- Easy Database Search on Multiple Attributes: A new method on DBPersistenceManager class allows you to pass in an attribute key-value map to search on. AMPA will generate the SQL SELECT statement using the = operator to match the attribute value and multiple attributes will be combined using the AND operator.
While this list is impressive, probably the best new feature is not mentioned here. If you belief in the saying “A framework is as good as its documentation” then we have to admit that AMPA was a pretty lousy framework in the past…. With the new comprehensive Developer’s Guide we dare to say that AMPA has become an outstanding framework. A-Team has put a lot of effort in putting this guide together so hopefully you will find it useful. And if it does not contain the information you are looking for, you can still post your AMPA questions on the MAF discussion forum. Please mention AMPA in the title of your post, this makes it easier for A-Team to identify the AMPA-related posts we should be answering.
Full release notes are available on the GitHub wiki.
AMPA Productization
Oracle has decided that AMPA will be productized and integrated into Oracle MAF as the Client Data Model (CDM). CDM will be fully supported by Oracle Support as part of Oracle MAF. The MAF release that includes CDM is expected later this calendar year (2016). The current AMPA 12.2.1 production release is the baseline for this integration. The first release of MAF that includes CDM will be very similar to AMPA 12.2.1, changes will be mostly limited to those imposed by productization requirements. Oracle will try to make the migration path from AMPA to CDM as smooth as possible, but some code changes (like changes of package names) are inevitable. Oracle MAF product management will come later with a more detailed statement of direction.
All content listed on this page is the property of Oracle Corp. Redistribution not allowed without written permission