Getting Started with the A-Team Mobile Persistence Accelerator

Introduction

The Oracle Mobile A-TEAM is happy to announce a new (and slightly renamed) version of the A-Team Mobile Persistence Accelerator (AMPA). AMPA is a lightweight persistence and data synchronization framework that works on top of Oracle Mobile Application Framework (MAF). It 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 a fully functional mobile application within minutes.

This new version is hosted on GitHub and is available as an open source framework. This article explains how to install the accelerator and how to get up and running.

Main Article

Installation Instructions

These instructions assume you already installed JDeveloper 12.1.3 with the Oracle MAF 2.1 extension.

While the screen shots show older AMPA build numbers for MAF 2.0, these instructions have been updated for AMPA release 12.1.3.1.x that is compliant with MAF 2.1.

Go to the AMPA GitHub Home Page and click on the Download ZIP button to download the source code to your computer.

GitHub

Unzip the zip file to a directory of your choice and start JDeveloper 12.1.3.
In JDeveloper choose File -> Open and select file MobilePersistenceAccelerator.jws, located under \mobile-persistence-master\Projects\Framework.

Click on the Runtime project node in the application navigator. In the JDeveloper menu bar, choose Build -> Run Ant on Runtime.jpr.

RunAntRT

Click on the DesignTime project node in the application navigator. In the JDeveloper menu bar, choose Build -> Run Ant on DesignTime.jpr.

RunANt

In about 10-20 seconds the installation zip file ateam-mobile-persistence.12.1.3.1.xx-install.zip is created in directory \mobile-persistence-master\Projects\Framework\stage.

AntLog

We are now ready to install the accelerator as JDeveloper extension.

In the JDeveloper menu bar, choose Help -> Check for Updates. In the Check for Updates dialog that appears, select the radio button Install from Local File.

CFU

Use the Browse.. button to select the install zip file ateam-mobile-persistence.12.1.3.1.xx-install.zip you just created. Click Next and then  Finish and click Yes in the Confirm Exit dialog to restart JDeveloper.
After JDeveloper has restarted the A-Team Mobile Accelerator read-me file should appear and you are ready to go!

ReadMe

If the Read Me file does not display, then try to restart JDeveloper again. You can also check the version you installed by going to the Help -> About menu and then click on Extensions.

CheckVersion

Getting Started

The best way to get started is to do the tutorial, read the articles we published earlier, and to study and run the sample application, and to view the presentation and videos that show the overall development process. In the near future, we will add comprehensive documentation to the GitHub wiki pages.

Tutorial

The tutorial Consuming REST web services with A-Team Mobile Persistence Accelerator for Oracle MAF takes you through all the basic steps. It teaches you how to install the extension, how to build a JSON-REST service, and how to build a MAF application using AMPA that consumes this REST service.

Articles

    • Going Mobile with ADF – Implementing Data Caching and Syncing for Working Offline Part I. This article explains the runtime architecture of AMPA and is based on the previous version of the persistence extension for ADF Mobile, but most information in this article is still valid with the new MAF version. The only difference is that the generated Java classes and persistenceMapping.xml look slightly different. Some of the configuration code that was previously generated in the constructor of the service classes has now moved to the persistenceMapping.xml file. In addition, the generated service classes now contain a number of convenience methods invoking generic superclass methods that should make it more intuitive to use the data control.
    • Going Mobile with ADF – Implementing Data Caching and Syncing for Working Offline Part II. This article discusses the design-time wizards to create a mobile persistence layer based on either a SOAP-based web service or a RESTful service, and the wizard to generate a default CRUD-style user interface that you can use to test the persistence layer and data syncing functionality.
    • A-Team Mobile Persistence Accelerator for Oracle MAF. This article discusses the wizard to generate a persistence layer based on RESTful services in great detail. 

Videos

The videos below are still based on the previous version that worked with ADF Mobile, but the overall development process is pretty much the same.

  • Creating a Mobile Application Using SOAP Web Service: This video demonstrates how to generate a fully functional MAF application that reads and writes data using an ADF BC SOAP web service. All data retrieved through web service calls is stored locally on the device in the SQLite database, allowing you to use the application in offline mode. The video also demonstrates the data synchronization functionality that is provided to process transactions made in offline mode.
  • Creating the Business Objects Layer in a Mobile Application Using REST Web Service: This video demonstrates how to generate the business objects layer when using a REST-JSON web service. Generation of the mobile user interface layer is not included in this video as the process is the same as shown in the previous video.

You can also take a look at this presentation which includes some more screenshots to illustrate the development process.

Sample Applications

We have created a simple CRUD demo application based on the tables from HR schema.For employees and departments we consume Restful services and for regions, cpountries and locations we use a SOAP-based service. The demo MAF application is generated with the User Interface Generator that comes with AMPA and has not been modified afterwards. In other words, the demo is meant to showcase the functionality of AMPA, the user interface is not very fancy. Here are the demo files:

  • HrDemoRest.zip: This is the web application that uses JPA persistence and TopLink data services to expose CRUD functionality as RESTful web services used as the example back-end application in this article. To use this application, unzip the HrDemoRest zip file, open the HrDemoRest.jws in JDeveloper 12.1.3 and modify the connection details in persistence.xml as needed to connect to your local HR schema. Deploy the application by selecting the ViewController project node, right-mouse click and choose “Deploy”. To test whether the deployment is successful, enter http://host:port/HrDemoRest/persistence/v1.0/Model1/query/Department.findAll in your browser.
  • HrDemoSOAP.zip: This is an ADF BC application that exposes ADF BC CRUD functionality as SDO SOAP web services. To use this application, unzip the HrDemoSOAP zip file. Open the HrDemoSoap.jws in JDeveloper and modify the connection details as needed to connect to your local HR schema. Deploy the HRDemoSoap Model application by right-mouse-clicking on HRServiceServiceImpl.java (inside serviceinterface package) and choosing Run. To test the deployed web service, right-mouse-click on HRServiceService.wsdl and choose Test Web Service. The HTTP Analyzer window will appear. Select the findDepartments method in the Operations field, and click the Send Request button. The departments and its employees should now be displayed in response window.
  • HrCrudMobile.zip: This zip contains the finished MAF application that uses the above HrDemoRest and HrDemoSoap applications as remote persistence providers. After unzipping, open HrCrudMobile.jws in JDeveloper to view and deploy the application to a simulator or real device. Make sure you change the IP addresses in connections.xml before you run the sample.

Getting Help

First, we need to make clear that AMPA is an open source framework, so its not covered under Oracle Support Policy. Based on that the code is provided as is and allows you to extend and use it under the Open Source License Agreement.

You can raise your issues or ask questions at the Oracle MAF discussion forum, A-Team is closely following this forum.

 

Comments

  1. bharat.dev says:

    downloaded HrDemoRest.zip and created web service but when i am running url its returning nothing.

    HrDemoRest/persistence/v1.0/Model1/query/Department.findAll

  2. SOME COUPLE OF QUESTIONS
    First:Hi after my succesful integration of this extension “mobile-persistence-master.zip” from https://github.com/oracle/mobile-persistence.
    My Jdeveloper 12c on lunching display this extension error every now and then ERROR= “oracle.ateam.mobile.persistence-
    Error: The tag is not valid for actions in the trigger-hooks hook; use the controllers hook.”

    Second :I followed this tutorial from begining to the end “tutorial url =http://docs.oracle.com/cd/E53569_01/tutorials/tut_jdev_maf_persistance/tut_jdev_maf_persistance_3.html”
    i manually populated some datas to the table i created on mysql database .After building both Json restful and the persistence App ,i run persistence app my andriod emulator screen is always blank,
    if i test the json restful url on android emulator web browser all the json datas from my DB table are shown.
    please if you wouldn’t mind could you help me solve these challengs ?
    thanks i appreciate your contribution in advance.

  3. Hello please i followed as stipulated on this tutorial http://docs.oracle.com/cd/E53569_01/tutorials/tut_jdev_maf_persistance/tut_jdev_maf_persistance_3.html,
    but at the end when i deploy the app to android emulator i got a blank screen on my android emulator, no data of the department information retrieved, just blank screen.if i try the Restful url on emulators web browser it gives me correct result please what should i do .pleae send the anwser to omisaye_infotech@yahoo.com .Thanks

  4. Can you guys post the jDeveloper 11g ADF Mobile version as well? For those of us who can’t migrate to 12c yet.
    Thanks.

    • Steven Davelaar says:

      A-Team only has legal approvals for publishing the MAF version. IN addition, A-Team is only working on supporting further versions for MAF. Why can’t you upgrade to Oracle MAF?

      Steven Davelaar
      Oracle Mobile A-Team.

  5. Theresa Strepek says:

    I welcome Oracle Mobile to the open source world on gitHub! This is a decision that will move Oracle in a competitive direction.

Add Your Comment