partner webcast – oracle adf mobile - implementing data caching and syncing for working off line

92
Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 1 CUSTOMER LOGO This slide format serves to call attention to a quote from a prominent customer, executive, or thought leader in regards to a particular topic. Name Title, Company Name Stay Connected BLOGS.ORACLE.COM/IMC TWITTER.COM/ORACLEIMC YOUTUBE.COM/ORACLEIMCTEAM FACEBOOK.COM/ORACLEIMC

Upload: oracleimc-isv-migration-center

Post on 10-May-2015

773 views

Category:

Technology


4 download

DESCRIPTION

Mobile access to enterprise applications is fast becoming a standard part of corporate life. Such applications increase organizational efficiency because mobile devices are more readily at hand than their desktop counterparts. A Mobile Application Framework enables rapid and declarative development of rich, on-device mobile applications. In most cases, your Oracle ADF Mobile application will need to integrate with a remote data source to provide up-to-date data in the mobile application. [Read More @ https://blogs.oracle.com/imc/entry/oracle_adf_mobile_sync]

TRANSCRIPT

Page 1: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 1

CUSTOMER LOGO

“This slide format serves to call attention to a quote from a prominent customer, executive, or thought leader in regards to a particular topic.” Name

Title, Company Name

Stay Connected

BLOGS.ORACLE.COM/IMC

TWITTER.COM/ORACLEIMC

YOUTUBE.COM/ORACLEIMCTEAM

FACEBOOK.COM/ORACLEIMC

Page 2: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 2

Implementing Data Caching Strategies for ADF Mobile

Steven Davelaar

ADF/Webcenter A-Team

Oracle Corporation

@stevendavelaar

Page 3: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 3

Disclaimer

The following is intended to outline our general product direction. It is

intended for information purposes only, and may not be incorporated into

any contract.

It is not a commitment to deliver any material, code, or functionality, and

should not be relied upon in making purchasing decisions. The

development, release, and timing of any features or functionality

described for Oracle’s products remains at the sole discretion of Oracle.

Page 4: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 4

Agenda

Data Caching and Data Sync Strategies

Implementing Data Caching and Synching Using A-

Team Mobile Persistence Extension

Page 5: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 5

ADF Mobile Architecture

Device

Services

PhoneGap/

Cordova

Device Native Container

Web

View

Server

HTML

ADF Mobile

AMX View

Third Party

Web Sites

Server or Cloud

backend

Oracle IDM

Oracle IAM

Mobile

Device

Local

HTML

HTML5 & JavaScript Presentation

Configuration

Server

ADF Controller

Cre

de

ntia

l Ma

na

ge

me

nt,

SS

O &

Ac

ce

ss

Co

ntro

l

Ap

p

Co

nfig

Server

SOAP & REST

Web Services

Java VM

Business

Logic

ADF Model

Encrypted

SQLite DB

JD

BC

SQLite

Page 6: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 6

ADF Mobile Architecture

Device

Services

PhoneGap/

Cordova

Device Native Container

Web

View

Server

HTML

ADF Mobile

AMX View

Third Party

Web Sites

Server or Cloud

backend

Oracle IDM

Oracle IAM

Mobile

Device

Local

HTML

HTML5 & JavaScript Presentation

Configuration

Server

ADF Controller

Cre

de

ntia

l Ma

na

ge

me

nt,

SS

O &

Ac

ce

ss

Co

ntro

l

Ap

p

Co

nfig

Server

SOAP & REST

Web Services

Java VM

Business

Logic

ADF Model

Encrypted

SQLite DB

JD

BC

SQLite

Page 7: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 7

Data Sources for ADF Mobile Applications

The data within an ADF Mobile application comes from 1 of 3 places

– Remote web services (SOAP, REST)

– Simple Java POJOs

– Local SQLite database

Typically all 3 are used in combination to allow your application to

– Web services: Retrieve and update data from/with remote servers

– Java POJOs: Cache that data locally for live access when disconnected

– Database: Persist & restore data when the application is stopped & restarted

Page 8: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 8

Data Caching and Synching Challenges

Mobile devices can lose/turn off connectivity

Offline access to data is a common requirement

But it will increase the complexity of your application

If you cache data locally you must consider

– When to cache the data

– How much data to cache

– When to synchronize updates

– Recording the order of updates

– How to deal with synchronization conflicts

– Security of the data if the device is lost

Security

Page 9: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 9

1. Online Read/Write

• Needs to be continuously

connected

• Does not cache any data locally

• No synchronization required

• No risk of data theft if the device is

stolen

Data Caching Strategies

2. Cached Reads, Online Write

• Caches data as it is accessed

or on startup

• Updates are via web service

calls

• No synchronization required

• Small risk of data theft

3. Cached Reads, Offline Writes

• Caches data as it is accessed

• Edits to cached data are saved

locally

• Edits to the local data are

periodically flushed to the server

• Greater risk of data theft

4. Full Synchronization

• All data is synchronized to the

device on startup

• Edits to cached data are saved

locally

• Edits to the local data are

periodically flushed to the server

Page 10: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 10

ADF Mobile – Model Layer

Data Object

– Java class to hold attributes of an object

– Represents a single “row” of a collection

– Can contain sub-collections of other Data Objects to form complex object

hierarchies

Service Object

– Java class that provides CRUD operations

– Returns arrays of Data Objects in the get methods

– Exposed as Data Control to create UI using drag and drop

Page 11: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 12

Java VM

ADF Model

Model Layer – Caching Data

Service

Object

Da

ta C

on

tro

l

Data Object

JDBC code

Encrypted

SQLite DB

Page 12: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 13

Using the SQLite Database in ADF Mobile

Typically used by a single user

SQLite libraries and JDBC drivers are embedded in ADF Mobile

container

Encryption for the SQLite Database File is provided with ADF Mobile

Zero configuration

No Object-Relational Mapping (ORM) layer provided

– Access using plain JDBC statements

Page 13: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 14

Initialize the Database

Start()

1. Creates the DB

2. Creates Connection

3. Connects

4. Populates DB

call Start()

LifeCycleListenerImpl.java

Application starts up

Note:

Need to add LifeCycleListenerImpl.java to the LifeCycleEvent

Listener Field of the adfmf-application.xml file.

Page 14: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 15

JDBC Example – Get Departments public void retrieveDepartmentsFromDB() {

try {

Connection conn = DBConnectionFactory.getConnection();

s_departments.clear();

conn.setAutoCommit(false);

PreparedStatement stat = conn.prepareStatement("SELECT * from DEPARTMENTS");

ResultSet rs = stat.executeQuery();

while (rs.next()) {

int id = rs.getInt("DEPARTMENT_ID");

String deptName = rs.getString("DEPARTMENT_NAME");

int mgrId = rs.getInt("MANAGER_ID");

int locId = rs.getInt("LOCATION_ID");

Department d = new Department(id, deptName, mgrId, locId);

s_departments.add(d);

}

rs.close();…

Page 15: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 16

SQLite More Info

Check out SQLite website : http://www.sqlite.org/

Check out ADF Insider Essentials video by Frederic Desbiens

– http://www.youtube.com/watch?v=-XzE1n_j5Nc

Page 16: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 17

Java VM

ADF Model

Model Layer – Caching Data

Service

Object

Da

ta C

on

tro

l

Data Object

JDBC code

Encrypted

SQLite DB

RestServiceAdapter

REST(JSON/XML)

SOAP/REST-XML

Page 17: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 18

What is JSON?

JavaScript Object Notation

– text-based open standard designed

for human-readable data

interchange. It is derived from the

JavaScript scripting language for

representing simple data structures

and associative arrays, called

objects. Despite its relationship to

JavaScript, it is language-

independent, with parsers available

for many languages.

Page 18: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 19

Using JSON REST Service

Create a URL Connection that points to the JSON data host

This URL should be based on the root of all JSON services

– For example, for a JSON service that returns employees and departments

(http://server:port/service/employees and

http://server:port/service/departments), the URL Data Control should point

to http://server:port/service/.

Use RestServiceAdaptor to invoke service

Page 19: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 20

RestServiceAdaptor Example

Page 20: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 21

Java VM

ADF Model

Model Layer – Caching Data

Service

Object

Da

ta C

on

tro

l

Data Object

JDBC code

Encrypted

SQLite DB

restServiceAdapter

REST(JSON/XML)

SOAP/REST-XML

SOAP/REST-XML Web Services

Da

ta

Co

ntr

ol

AdfmfJavaUtilities

invokeDataControlMethod

Page 21: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 22

Using SOAP XML Service – Run Web Service Data Control Wizard

Page 22: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 23

Invoking SOAP Web Service Programmatically

Page 23: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 24

Implementing Data Caching Strategies

ADF Mobile provides basic support to implement strategy 2: Cached

Reads – Online Writes

– Java coding required to convert web service payload to Java data objects

and vice versa

– Extensive JDBC coding required when caching should survive application

stop/start, and/or flexible data filtering is needed

Would be really nice to have an ORM mapping framework that auto

generates the JDBC code…

Implementing strategies 3 and 4 with offline writes is much more

complex…

Page 24: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 25

Agenda

Data Caching and Data Sync Strategies

Implementing Data Caching and Synching Using A-

Team Mobile Persistence Extension

Page 25: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 26

A-Team Mobile Persistence Extension

Sample code created by Oracle Fusion Middleware A-Team

Significantly speeds up implementation of data caching and data

synching

Provided “as-is”, no support, no updates

Installable as Free JDeveloper extension

Will be included in ADF Mobile later this year

Page 26: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 27

Local and Remote Persistence

Extension runtime library contains generic Java code to perform CRUD

operations against SQLite database and against remote web services.

– Service objects extend EntiyCRUDService class

– Service objects use DBPersistenceManager for CRUD operations

against SQLite database

– Service object can use a remote persistence manager for CRUD

operations against web service

The generic code in EntiyCRUDService class and persistence

managers is driven by metadata stored in persistence mapping XML

file

Page 27: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 28

Remote Persistence Managers

Classes that perform appropriate web service

calls based on the CRUD operation performed

by the user and the persistence mapping

information

Currently persistence managers are available

for REST web services in both JSON and XML

format, and SOAP (ADF BC) web services

You can easily create custom persistence

managers as needed

– Extend from abstract class that contains

convenience methods

Page 28: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 29

ADF Model

Runtime Persistence Architecture

DepartmentService

Data Control

Department

DepartmentService EntityCRUDService extends

DBPersistence

Manager

Persistence

Mapping XML

DEPARTMENTS

table

SQLite

uses

JDBC

Statements

references

REST(JSON/XML)

REST-JSON

PersistenceManager

HTTP

Requests

Page 29: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 30

Other Runtime Persistence Features

Encryption of database

Auto-cleaning of unused database segments

Lazy loading of child collections (a.k.a “Indirection”)

Entity caching to minimize object creation

FindEntityByKey

– Checks cache first, then database

Designed for customization

– Easy to override and extend default behavior

Page 30: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 31

Mobile Persistence Extension - JDeveloper Wizards

Three wizard are provided to create the artefacts needed for this

runtime persistence architecture:

– Mobile Business Objects From Web Service Data Control Wizard

– Mobile Business Objects From REST Web Service Wizard

– Mobile Business Objects From Database Tables (Local persistence only)

Another wizard is provided to generate a default CRUD user interface

on top of the business layer created by one of the above wizards.

Page 31: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 32

Rest Wizard Demo - Toplink Data Services http://192.168.1.112:7101/ToplinkRest/persistence/v1.0/Model1/query

/Department.findAll

Page 32: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 33

Wizards for Creating Runtime Persistence Artefacts

Page 33: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 34

Business Objects From REST Web Service

Page 34: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 35

Business Objects From REST Web Service

Page 35: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 36

Business Objects From REST Web Service

Page 36: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 37

Business Objects From REST Web Service

Page 37: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 38

Business Objects From REST Web Service

Page 38: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 39

Business Objects From REST Web Service

Page 39: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 40

Business Objects From REST Web Service

Page 40: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 41

Business Objects From REST Web Service

Page 41: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 42

Business Objects From REST Web Service

Page 42: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 43

Business Objects From REST Web Service

Page 43: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 44

Business Objects From REST Web Service

Page 44: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 45

Business Objects From REST Web Service

Page 45: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 46

Business Objects From REST Web Service

Page 46: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 47

Business Objects From REST Web Service

Page 47: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 48

Business Objects From REST Web Service

Page 48: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 49

Business Objects From REST Web Service

Page 49: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 50

Business Objects From REST Web Service

Page 50: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 51

Business Objects From REST Web Service

Page 51: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 52

Business Objects From REST Web Service

Page 52: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 53

Business Objects From REST Web Service

Page 53: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 54

Business Objects From REST Web Service

Page 54: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 55

Business Objects From REST Web Service

Page 55: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 56

SOAP Demo – ADF BC SDO Services

Page 56: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 57

Run SOAP Web Service Data Control Wizard

Page 57: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 58

Run SOAP Web Service Data Control Wizard

Page 58: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 59

Mobile Business Objects from WS Data Control

Page 59: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 60

Mobile Business Objects from WS Data Control

Page 60: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 61

Mobile Business Objects from WS Data Control

Page 61: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 62

Mobile Business Objects from WS Data Control

Page 62: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 63

Mobile Business Objects from WS Data Control

Page 63: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 64

Mobile Business Objects from WS Data Control

Page 64: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 65

Mobile Business Objects from WS Data Control

Page 65: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 66

Mobile Business Objects from WS Data Control

Page 66: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 67

Mobile Business Objects from WS Data Control

Page 67: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 68

Generated Data Object Classes

Page 68: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 69

Generated Service Object Classes

Page 69: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 70

Generated SQL DDL Script

Page 70: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 71

Generated Persistence Mapping File

Page 71: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 72

Generated Persistence Mapping File RESTful resource calls

Page 72: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 73

Generated Persistence Mapping File SOAP method calls

Page 73: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 74

Generated Config File

Page 74: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 75

Configured InitDBLifecycleListener

Page 75: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 76

Create Data Control For Service Classes

Page 76: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 77

Creating the Mobile User Interface

Build Using Drag and Drop

from DataControl Palette

Generate Using ADF

Mobile User Interface

Generator Wizard

Two Options

Page 77: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 78

Building the User Interface

Page 78: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 79

Building the User Interface

Page 79: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 80

Building the User Interface

Page 80: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 81

Using the Mobile User Interface Generator

Page 81: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 82

Using the Mobile User Interface Generator

Page 82: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 83

Generated User Interface Artefacts

Page 83: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 84

1. Online Read/Write

• Needs to be continuously

connected

• Does not cache any data locally

• No synchronization required

• No risk of data theft if the device is

stolen

Data Caching Strategies

2. Cached Reads, Online Write

• Caches data as it is accessed

• Updates are via web service

calls

• No synchronization required

• Small risk of data theft

3. Cached Reads, Offline Writes

• Caches data as it is accessed

• Edits to cached data are saved

locally

• Edits to the local data are

periodically flushed to the server

• Greater risk of data theft

4. Full Synchronization

• All data is synchronized to the

device on startup

• Edits to cached data are saved

locally

• Edits to the local data are

periodically flushed to the server

Page 84: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 85

A-Team Mobile Persistence Extension- Offline Writes and Data Syncing

If a remote persistence manager is configured, and CUD service call

fails, the service call is registered as “pending” data synch action

– Failure reason registered (device offline, service not available, etc)

On next service call, the pending synch actions are processed first in

order of creation

– When failing again, the still pending synch action is updated with date of

last synch attempt and last error message

Out-of-the-box feature: NO Java coding required

Page 85: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 86

Viewing Pending Data Sync Actions

A reusable “DataSync” feature is provided that can be added to your

mobile application

Register the feature in adfmf-application.xml

Page 86: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 87

Viewing Pending Data Sync Actions

Add a button that navigates to the data sync feature

Page 87: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 88

Viewing Pending Data Synch Actions

Page 88: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 89

Notes on Data Sync Functionality

Pending changes can become obsolete because of updates in server

data by other clients

– The server–side code should identify this and throw an error when the data

sync action sends stale data

– Stale data detection can be done by including a data revision number or

‘last-modified” timestamp in payload. This number or timestamp should

match with server-side data record

Data sync actions that keep failing need to be removed manually

– Local database might be out-of-sync, app needs to offer reconcile action

Page 89: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 90

More Info

A-Team Chronicles: http://www.ateam-oracle.com/?p=22331

Includes download links to

– A-Team Mobile Persistence Extension - JDeveloper Install File

– A-Team Mobile Persistence Videos

– A-Team Mobile Persistence Demo applications

Page 90: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 91

Summary

Using the A-Team Mobile Persistence Extension significantly speeds

up and eases implemention of data caching and syncing using the on-

device SQLite database

Using the A-Team Mobile Persistence Extension significantly speeds

up and eases the use of RESTful web services

You need to think about how your end users should handle failed data

sync actions, and how to prevent updates based on stale data

Essential parts of A-Team Mobile Persistence Extension will be

included in future version of core product

Page 91: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 92

CONNECT WITH US

COMMUNICATE WITH US [email protected]

oracle.com/subscribe

ASSISTING YOU ADOPT & IMPLEMENT THE LATEST ORACLE TECHNOLOGY

blogs.oracle.com/IMC

twitter.com/oracleIMC

youtube.com/OracleIMCTeam

facebook.com/oracleIMC

ORACLE.COM/PARTNERS/GOTO/HUB-ECEMEA

Page 92: Partner Webcast – Oracle ADF Mobile - Implementing Data Caching and Syncing for Working Off Line

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 93