copyright © 2001 sean c. sullivan* third party trademarks are property of their respective owners...

44
Copyright © 2001 Sean C. Sullivan * Third party trademarks are property of their respective owners Data Synchronization Data Synchronization with SyncML with SyncML * * and sync4j and sync4j Sean C. Sullivan <sean> at <seansullivan> <.com>

Upload: dennis-bond

Post on 23-Dec-2015

219 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Copyright © 2001 Sean C. Sullivan* Third party trademarks are property of their respective owners Data Synchronization with SyncML * and sync4j Sean C

Copyright © 2001 Sean C. Sullivan * Third party trademarks are property of their respective owners

Data Synchronization with Data Synchronization with SyncMLSyncML** and sync4j and sync4j

Sean C. Sullivan

<sean> at <seansullivan> <.com>

Page 2: Copyright © 2001 Sean C. Sullivan* Third party trademarks are property of their respective owners Data Synchronization with SyncML * and sync4j Sean C

Copyright © 2001 Sean C. Sullivan * Third party trademarks are property of their respective owners

Agenda

Data synchronization SyncML sync4j Q & A

Page 3: Copyright © 2001 Sean C. Sullivan* Third party trademarks are property of their respective owners Data Synchronization with SyncML * and sync4j Sean C

Copyright © 2001 Sean C. Sullivan * Third party trademarks are property of their respective owners

What is data synchronization?

Data synchronization “is the process of making two sets of data look identical” (syncml.org whitepaper)

Page 4: Copyright © 2001 Sean C. Sullivan* Third party trademarks are property of their respective owners Data Synchronization with SyncML * and sync4j Sean C

Copyright © 2001 Sean C. Sullivan * Third party trademarks are property of their respective owners

Data Synchronization

Conflict resolution

Datastore1

Data modifications

Datastore2

A CB C A BA CB

Page 5: Copyright © 2001 Sean C. Sullivan* Third party trademarks are property of their respective owners Data Synchronization with SyncML * and sync4j Sean C

Copyright © 2001 Sean C. Sullivan * Third party trademarks are property of their respective owners

What is a “data synchronization protocol”?

Communication syntax and semantics for a data synchronization session

Protocol includes:– naming and identification of records– common protocol commands– identification and resolution of

synchronization conflicts

Page 6: Copyright © 2001 Sean C. Sullivan* Third party trademarks are property of their respective owners Data Synchronization with SyncML * and sync4j Sean C

Copyright © 2001 Sean C. Sullivan * Third party trademarks are property of their respective owners

SyncML defined…“SyncML is a new industry initiative to develop and

promote a single, common data synchronization protocol that can be used industry-wide.” (syncml.org)

“SyncML is a specification for a common data synchronization framework and XML-based format […] for synchronizing data on networked devices.” (syncml.org)

“SyncML is a […] protocol for conveying data synchronization operations.” (syncml.org)

Page 7: Copyright © 2001 Sean C. Sullivan* Third party trademarks are property of their respective owners Data Synchronization with SyncML * and sync4j Sean C

Copyright © 2001 Sean C. Sullivan * Third party trademarks are property of their respective owners

SyncML sponsors

Page 8: Copyright © 2001 Sean C. Sullivan* Third party trademarks are property of their respective owners Data Synchronization with SyncML * and sync4j Sean C

Copyright © 2001 Sean C. Sullivan * Third party trademarks are property of their respective owners

SyncML: clients & servers

SyncMLserver

server modifications

client modifications

Page 9: Copyright © 2001 Sean C. Sullivan* Third party trademarks are property of their respective owners Data Synchronization with SyncML * and sync4j Sean C

Copyright © 2001 Sean C. Sullivan * Third party trademarks are property of their respective owners

SyncML data identification

LUID Data

23 A

382 B

61 C

GUID Data

189 A

3982 B

89 C

Client Server

GUID LUID

189 23

3982 382

89 61

Page 10: Copyright © 2001 Sean C. Sullivan* Third party trademarks are property of their respective owners Data Synchronization with SyncML * and sync4j Sean C

Copyright © 2001 Sean C. Sullivan * Third party trademarks are property of their respective owners

SyncML Synchronization Types

Two-way sync Slow sync One-way sync from client only Refresh sync from client only

Page 11: Copyright © 2001 Sean C. Sullivan* Third party trademarks are property of their respective owners Data Synchronization with SyncML * and sync4j Sean C

Copyright © 2001 Sean C. Sullivan * Third party trademarks are property of their respective owners

SyncML Synchronization Types (cont.) One-way sync from server only Refresh sync from server only Server alerted sync

Page 12: Copyright © 2001 Sean C. Sullivan* Third party trademarks are property of their respective owners Data Synchronization with SyncML * and sync4j Sean C

Copyright © 2001 Sean C. Sullivan * Third party trademarks are property of their respective owners

SyncML features

Synchronize any type of data Multiple protocol bindings

– HTTP, WSP, OBEX Security Interoperability

Page 13: Copyright © 2001 Sean C. Sullivan* Third party trademarks are property of their respective owners Data Synchronization with SyncML * and sync4j Sean C

Copyright © 2001 Sean C. Sullivan * Third party trademarks are property of their respective owners

SyncML terminology

Message Package Command Status code

Datastore Device Info Meta Info Capabilities

exchange

Page 14: Copyright © 2001 Sean C. Sullivan* Third party trademarks are property of their respective owners Data Synchronization with SyncML * and sync4j Sean C

Copyright © 2001 Sean C. Sullivan * Third party trademarks are property of their respective owners

SyncML and XML

Abbreviated naming convention– Ex: ”protocol version” is <VerProto>

XML prolog is not required WBXML

– WAP Binary XML

Page 15: Copyright © 2001 Sean C. Sullivan* Third party trademarks are property of their respective owners Data Synchronization with SyncML * and sync4j Sean C

Copyright © 2001 Sean C. Sullivan * Third party trademarks are property of their respective owners

SyncML documents

<SyncML> DTD Meta info DTD Device info DTD

Page 16: Copyright © 2001 Sean C. Sullivan* Third party trademarks are property of their respective owners Data Synchronization with SyncML * and sync4j Sean C

Copyright © 2001 Sean C. Sullivan * Third party trademarks are property of their respective owners

<SyncML> document<?xml version="1.0"?><!DOCTYPE … ><SyncML><SyncHdr>…</SyncHdr><SyncBody>…</SyncBody></SyncML>

“A SyncML Message is a well-formed, but not necessarily valid, XML document.” (syncml.org)

Contains data synchronization commands (operations)

Page 17: Copyright © 2001 Sean C. Sullivan* Third party trademarks are property of their respective owners Data Synchronization with SyncML * and sync4j Sean C

Copyright © 2001 Sean C. Sullivan * Third party trademarks are property of their respective owners

<SyncHdr> element

<SyncHdr>

<VerDTD>1.0</VerDTD>

<VerProto>1.0</VerProto>

<SessionID>session41</SessionID>

<MsgID>msg80386</MsgID>

</SyncHdr>

Page 18: Copyright © 2001 Sean C. Sullivan* Third party trademarks are property of their respective owners Data Synchronization with SyncML * and sync4j Sean C

Copyright © 2001 Sean C. Sullivan * Third party trademarks are property of their respective owners

<SyncBody> element

<SyncBody>

<Delete>

<CmdID>cmd80486</CmdID>

<Item>…</Item>

</Delete>

</SyncBody>

Page 19: Copyright © 2001 Sean C. Sullivan* Third party trademarks are property of their respective owners Data Synchronization with SyncML * and sync4j Sean C

Copyright © 2001 Sean C. Sullivan * Third party trademarks are property of their respective owners

Meta Info document

Contains sync session parameters

<MetInf><Format>…</Format><Type>…</Type>…<MaxMsgSize>586</MaxMsgSize>…</MetInf>

Page 20: Copyright © 2001 Sean C. Sullivan* Third party trademarks are property of their respective owners Data Synchronization with SyncML * and sync4j Sean C

Copyright © 2001 Sean C. Sullivan * Third party trademarks are property of their respective owners

Device Info document

Describes device capabilities

For both client and server

<DevInf>

<SwV>0.99</SwV>

<HwV>3.14</HwV>

<DevTyp>pda</DevTyp>

</DevInf>

Page 21: Copyright © 2001 Sean C. Sullivan* Third party trademarks are property of their respective owners Data Synchronization with SyncML * and sync4j Sean C

Copyright © 2001 Sean C. Sullivan * Third party trademarks are property of their respective owners

SyncML commands Add Alert Atomic Copy Delete Exec Get Map

Put Replace Results Search Sequence Status Sync

Page 22: Copyright © 2001 Sean C. Sullivan* Third party trademarks are property of their respective owners Data Synchronization with SyncML * and sync4j Sean C

Copyright © 2001 Sean C. Sullivan * Third party trademarks are property of their respective owners

sync4j

Java implementation of SyncML protocol

sync4j client & sync4j Server open source designed for J2SE platform http://sync4j.sourceforge.net

Page 23: Copyright © 2001 Sean C. Sullivan* Third party trademarks are property of their respective owners Data Synchronization with SyncML * and sync4j Sean C

Copyright © 2001 Sean C. Sullivan * Third party trademarks are property of their respective owners

Open source licensing Licensing options:

– GPL?– LGPL?– BSD?– Apache Public License?– JDOM public license?– Mozilla Public License (MPL)?

sync4j license is virtually identical to JDOM license

Page 24: Copyright © 2001 Sean C. Sullivan* Third party trademarks are property of their respective owners Data Synchronization with SyncML * and sync4j Sean C

Copyright © 2001 Sean C. Sullivan * Third party trademarks are property of their respective owners

sync4j audience

developers who know Java but don’t know SyncML

developers who know SyncML but may not know Java

commercial application developers & open source application developers

Page 25: Copyright © 2001 Sean C. Sullivan* Third party trademarks are property of their respective owners Data Synchronization with SyncML * and sync4j Sean C

Copyright © 2001 Sean C. Sullivan * Third party trademarks are property of their respective owners

API design ideas SAX API

– standard set of interfaces– multiple implementations– usage model: callbacks

JDOM API– concrete classes; single implementation– root Document object contains Element

objects

Page 26: Copyright © 2001 Sean C. Sullivan* Third party trademarks are property of their respective owners Data Synchronization with SyncML * and sync4j Sean C

Copyright © 2001 Sean C. Sullivan * Third party trademarks are property of their respective owners

API design ideas (cont.) Servlet API

– usage model: developer builds a new servlet by subclassing HTTPServlet

Auto-generate classes from DTD using an XML data-binding tool??– Sun’s JAXB– Enhydra’s Zeus

Page 27: Copyright © 2001 Sean C. Sullivan* Third party trademarks are property of their respective owners Data Synchronization with SyncML * and sync4j Sean C

Copyright © 2001 Sean C. Sullivan * Third party trademarks are property of their respective owners

Design goals Hide complexity of the SyncML

specification from Java programmers– XML documents, XML parsing– multiple transport protocols

A complete SyncML implementation Interoperability

– with existing SyncML clients & servers

Page 28: Copyright © 2001 Sean C. Sullivan* Third party trademarks are property of their respective owners Data Synchronization with SyncML * and sync4j Sean C

Copyright © 2001 Sean C. Sullivan * Third party trademarks are property of their respective owners

Design goals (cont.) API should be natural and familiar to

Java programmers– direct object instantiation– exceptions– use Collection API / arrays, where

appropriate– event notification via event listeners– familiar naming conventions

Page 29: Copyright © 2001 Sean C. Sullivan* Third party trademarks are property of their respective owners Data Synchronization with SyncML * and sync4j Sean C

Copyright © 2001 Sean C. Sullivan * Third party trademarks are property of their respective owners

Design goals (cont.)

API must be familiar to developers who already know the SyncML DTD’s

API must enforce any restrictions that are defined in the SyncML specification

Target platform: J2SE

Page 30: Copyright © 2001 Sean C. Sullivan* Third party trademarks are property of their respective owners Data Synchronization with SyncML * and sync4j Sean C

Copyright © 2001 Sean C. Sullivan * Third party trademarks are property of their respective owners

Design goals (cont.)

Modular design:– “core” protocol support– transport protocol libraries– extensible client framework– extensible server framework– client application– server application

Page 31: Copyright © 2001 Sean C. Sullivan* Third party trademarks are property of their respective owners Data Synchronization with SyncML * and sync4j Sean C

Copyright © 2001 Sean C. Sullivan * Third party trademarks are property of their respective owners

sync4j implementation

Immutable objects Exception class for each SyncML

“status code” Declaration of constants

– public final static variables Command object hierarchy

Page 32: Copyright © 2001 Sean C. Sullivan* Third party trademarks are property of their respective owners Data Synchronization with SyncML * and sync4j Sean C

Copyright © 2001 Sean C. Sullivan * Third party trademarks are property of their respective owners

sync4j command hierarchyAbstractCommand

ResponseCommandRequestCommand

AddCommand, DeleteCommand,

ReplaceCommand,…

ResultsCommand,StatusCommand,

Page 33: Copyright © 2001 Sean C. Sullivan* Third party trademarks are property of their respective owners Data Synchronization with SyncML * and sync4j Sean C

Copyright © 2001 Sean C. Sullivan * Third party trademarks are property of their respective owners

sync4j toolsetTool URL

Jakarta Ant jakarta.apache.org

JDOM www.jdom.org

Apache Xerces-J xml.apache.org

CVS www.cygwin.com

log4j www.log4j.org

JDK 1.3.1 java.sun.com

JUnit www.junit.org

SourceForge www.sourceforge.net

Page 34: Copyright © 2001 Sean C. Sullivan* Third party trademarks are property of their respective owners Data Synchronization with SyncML * and sync4j Sean C

Copyright © 2001 Sean C. Sullivan * Third party trademarks are property of their respective owners

sync4j packages

sync4j.core sync4j.client sync4j.server

sync4j.http sync4j.wsp sync4j.obex sync4j.tests

Page 35: Copyright © 2001 Sean C. Sullivan* Third party trademarks are property of their respective owners Data Synchronization with SyncML * and sync4j Sean C

Copyright © 2001 Sean C. Sullivan * Third party trademarks are property of their respective owners

sync4j key classes

SyncMLMessage DeviceInfo MetaInfo Command classes:

– AddCommand– DeleteCommand– ReplaceCommand

Page 36: Copyright © 2001 Sean C. Sullivan* Third party trademarks are property of their respective owners Data Synchronization with SyncML * and sync4j Sean C

Copyright © 2001 Sean C. Sullivan * Third party trademarks are property of their respective owners

sync4j.core.SyncMLMessage

Two ways to construct:– from a String of XML– from more basic sync4j objects

Page 37: Copyright © 2001 Sean C. Sullivan* Third party trademarks are property of their respective owners Data Synchronization with SyncML * and sync4j Sean C

Copyright © 2001 Sean C. Sullivan * Third party trademarks are property of their respective owners

SyncMLMessage example 1String strXML = “<SyncML> … </SyncML>”;SyncMLMessage msg;try{ msg = new SyncMLMessage(strXML);}catch (InvalidSyncMLException ex){}catch (XMLSyntaxException ex){}

Page 38: Copyright © 2001 Sean C. Sullivan* Third party trademarks are property of their respective owners Data Synchronization with SyncML * and sync4j Sean C

Copyright © 2001 Sean C. Sullivan * Third party trademarks are property of their respective owners

SyncMLMessage example 2SyncHeader header = new SyncHeader(...);SyncBody body = new SyncBody(...);SyncMLMessage msg;msg = new SyncMLMessage(header, body);String strXML = msg.toXML();

Page 39: Copyright © 2001 Sean C. Sullivan* Third party trademarks are property of their respective owners Data Synchronization with SyncML * and sync4j Sean C

Copyright © 2001 Sean C. Sullivan * Third party trademarks are property of their respective owners

Algorithms Base64

– encode, decode WBXML

– encode, decode MD5

– java.security.MessageDigest

Page 40: Copyright © 2001 Sean C. Sullivan* Third party trademarks are property of their respective owners Data Synchronization with SyncML * and sync4j Sean C

Copyright © 2001 Sean C. Sullivan * Third party trademarks are property of their respective owners

sync4j future issues

Compliance testing, interoperability tests

move to JDK 1.4?– Assert facility– Java Logging API– New I/O classes: java.nio– SSL class library

Page 41: Copyright © 2001 Sean C. Sullivan* Third party trademarks are property of their respective owners Data Synchronization with SyncML * and sync4j Sean C

Copyright © 2001 Sean C. Sullivan * Third party trademarks are property of their respective owners

Summary SyncML is both complex and powerful sync4j hides the complexity of SyncML

from Java programmers The sync4j API is consistent with many

familiar Java programming idioms http://sync4j.sourceforge.net/

Page 42: Copyright © 2001 Sean C. Sullivan* Third party trademarks are property of their respective owners Data Synchronization with SyncML * and sync4j Sean C

Copyright © 2001 Sean C. Sullivan * Third party trademarks are property of their respective owners

Data Synchronization with Data Synchronization with SyncMLSyncML** and sync4j and sync4j

Sean C. Sullivan

<sean> at <seansullivan> <.com>

Page 43: Copyright © 2001 Sean C. Sullivan* Third party trademarks are property of their respective owners Data Synchronization with SyncML * and sync4j Sean C

Copyright © 2001 Sean C. Sullivan * Third party trademarks are property of their respective owners

The following slides are miscellaneous material.

Page 44: Copyright © 2001 Sean C. Sullivan* Third party trademarks are property of their respective owners Data Synchronization with SyncML * and sync4j Sean C

Copyright © 2001 Sean C. Sullivan * Third party trademarks are property of their respective owners

SyncML authentication

<Chal> <Cred> Authentication types:

– basic– MD5