Smart Sync API

 

Basics of Client Application Development

In this section, we will discuss

Essentials of Smart Sync Client Application Development

An Smart Synchronization client application using Mobile Infrastructure 2.1 is an application that uses JAVA server-side technology such as JAVA Servlet and JSP. What is different from a normal JAVA server-side application is that an Smart Synchronization client application runs on a client PC or PDA and uses the MI Client API to access the local object store, which also takes care of the data synchronization with an Web Application Server. That is, an application developer usually does not need to handle how the data is synchronized with a server, and therefore, can concentrate on how the local data should be presented to the application users and how the data should be updated locally on the client devices.

The following diagram illustrates how Smart Sync API used in Smart Synchronization client application interacts with the underlying MI framework for both the local data access layer and the synchronization layer. Since Smart Sync API manages the synchronization and local data access in the integrated manner, the client application does not need to manage the ‘delta’ data that needs to be uploaded to or downloaded from the Web Application Server.

The key deliverable of Smart Synchronization client application development is a packaged application such as a WAR or JAR file, which includes the SyncBO meta-data definition in XML format.

The MI client creates local object store files based on the definition in the meta-data XML file in the folder <MI root>/data.

Meta-data XML for SyncBO Object Model

The SyncBOs used in Smart Synchronization application can be accessed via the Smart Sync API. Smart Sync API access the SyncBOs based on the SyncBO names and field names defined in so-called meta-data XML, which can be generated from the SyncBO Builder. Therefore, an application developer will find it useful to refer to the XML to understand the names of SyncBOs and their fields while implementing data access logic of a client application.

For more information on the generation of meta-data XML, refer to Generate Meta-data XML for Client.

The following describes the structure of the meta-data XML:

The following describes some of the important elements and their attributes:

SyncBO

Defines a SyncBO
syncBOId Specifies the SyncBO ID; often referred in Smart Sync APIs
syncBOType Type of SyncBO (synchronization type)Possible values: download, upload or 2way (for 2-way or timed 2-way)

Structure

Defines a HEADER or ITEM structure of the SyncBO
id Specifies the structure ID; ITEM structure ID are often referred in Smart Sync APIsPossible values: TOP for the HEADER structure, 0n0 (n = 1,2,3…) for the ITEM structures

Field

Defines a field in the HEADER or ITEM structure of the SyncBO
name Specifies the name of the field; often referred in Smart Sync APIs
type

Specifies the field type Possible values:

  • N (NUMC) – String object in JAVA
  • C (CHAR) – String object in JAVA
  • I (INT4) – Integer object in JAVA
  • P (DEC) – FixedDecimal object in JAVA
  • T (TIMS) – Calendar object in JAVA
  • D (DATS) – Calendar object in JAVA
length Specifies the length of the field
decimalLength Specifies the decimal length of the field if the field type is P

 

The first Field element under Structure element is always SYNC_KEY field, which is used to uniquely identify the HEADER and ITEM instances of a SyncBO. For more information on SYNC_KEY, refer to Data Structure of SyncBO.

ForeignKey

Defines a relationship to another SyncBO
baseSyncBO Specifies the parent SyncBO ID; in the runtime, the field that has ForeignKey element holds SYNC_KEY of a HEADER instance of the parent SyncBO

 

Example

This meRepMeta.xml file describes SyncBO SAP_EXM00 that has one HEADER (contact) and 2 ITEMs (e-mail and address). It has been generated through the SyncBO Builder.