Download presentation
Presentation is loading. Please wait.
Published byNeal Strickland Modified over 8 years ago
1
Session # 1481 - Copyright 2002 Sean C. Sullivan Data Synchronization with SyncML and Sync4j Sean C. Sullivan Software Architect Sync4j project
2
Session # 1481 - Copyright 2002 Sean C. Sullivan2 Overall Presentation Goal or Primary Purpose Beginning Learn about the SyncML data synchronization protocol and the Sync4j project
3
Session # 1481 - Copyright 2002 Sean C. Sullivan3 Learning Objectives As a result of this presentation, you will: –Understand the SyncML communication protocol –Understand the format and structure of SyncML messages –Understand the goals and architecture of the Sync4j project Beginning
4
Session # 1481 - Copyright 2002 Sean C. Sullivan4 Speaker’s Qualifications Sean C. Sullivan is the Software Architect for the Sync4j project Sean has been building Java applications since March 1996 Sean is the author of “Programming with the Java Media Framework” Beginning
5
Session # 1481 - Copyright 2002 Sean C. Sullivan5 Bridging the gap The SyncML data synchronization protocol bridges the gap between mobile applications and J2EE-based server applications. Beginning
6
Session # 1481 - Copyright 2002 Sean C. Sullivan6 Presentation Agenda Data synchronization SyncML Sync4j Q & A Beginning
7
Session # 1481 - Copyright 2002 Sean C. Sullivan7 What is data synchronization? Data synchronization “is the process of making two sets of data look identical” (source: syncml.org white paper)
8
Session # 1481 - Copyright 2002 Sean C. Sullivan8 Data Synchronization Datastore1 Datastore2 ACBCABACB l Exchange data modifications l Resolve conflicts
9
Session # 1481 - Copyright 2002 Sean C. Sullivan9 What is a “data synchronization protocol”? Method of communication for a data synchronization session Protocol features: –naming and identification of records –common protocol commands –identification and resolution of synchronization conflicts
10
Session # 1481 - Copyright 2002 Sean C. Sullivan10 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)
11
Session # 1481 - Copyright 2002 Sean C. Sullivan11 SyncML sponsors
12
Session # 1481 - Copyright 2002 Sean C. Sullivan12 SyncML features Synchronize any type of data Multiple protocol bindings –HTTP, WSP, OBEX Security Interoperability
13
Session # 1481 - Copyright 2002 Sean C. Sullivan13 client modifications SyncML: clients & servers SyncML server server modifications
14
Session # 1481 - Copyright 2002 Sean C. Sullivan14 SyncML synchronization types Two-way sync Slow sync One-way sync from client only Refresh sync from client only
15
Session # 1481 - Copyright 2002 Sean C. Sullivan15 SyncML synchronization types (cont.) One-way sync from server only Refresh sync from server only Server alerted sync
16
Session # 1481 - Copyright 2002 Sean C. Sullivan16 SyncML terminology Message Package Command Status code Datastore Device info Meta info Capabilities exchange
17
Session # 1481 - Copyright 2002 Sean C. Sullivan17 SyncML and XML Abbreviated naming convention –Ex: ”protocol version” is XML prolog is not required WBXML – WAP Binary XML
18
Session # 1481 - Copyright 2002 Sean C. Sullivan18 SyncML documents DTD Meta info DTD Device info DTD
19
Session # 1481 - Copyright 2002 Sean C. Sullivan19 document … … “A SyncML Message is a well-formed, but not necessarily valid, XML document.” (syncml.org) Contains data synchronization commands (operations)
20
Session # 1481 - Copyright 2002 Sean C. Sullivan20 element 1.0 SyncML/1.0 session41 msg80386 …
21
Session # 1481 - Copyright 2002 Sean C. Sullivan21 element cmd80486 …
22
Session # 1481 - Copyright 2002 Sean C. Sullivan22 SyncML commands
23
Session # 1481 - Copyright 2002 Sean C. Sullivan23 Meta Info document Contains sync session parameters … 586 …
24
Session # 1481 - Copyright 2002 Sean C. Sullivan24 Device Info document Describes device capabilities For both client and server … 0.99 3.14 … pda …
25
Session # 1481 - Copyright 2002 Sean C. Sullivan25 Sync4j project Java implementation of SyncML protocol Sync4j client Sync4j server open source
26
Session # 1481 - Copyright 2002 Sean C. Sullivan26 Sync4j audience developers who: –know Java but don’t know SyncML –know SyncML but may not know Java commercial application developers open source application developers
27
Session # 1481 - Copyright 2002 Sean C. Sullivan27 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
28
Session # 1481 - Copyright 2002 Sean C. Sullivan28 API design ideas (cont.) Servlet API –usage model: developer builds a new servlet by subclassing HTTPServlet Auto-generate API classes from DTD using an XML data-binding tool - ?
29
Session # 1481 - Copyright 2002 Sean C. Sullivan29 Sync4j 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
30
Session # 1481 - Copyright 2002 Sean C. Sullivan30 Sync4j 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
31
Session # 1481 - Copyright 2002 Sean C. Sullivan31 Sync4j 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
32
Session # 1481 - Copyright 2002 Sean C. Sullivan32 Sync4j’s modular design “core” protocol message library transport protocol libraries extensible client framework extensible server framework client application server application
33
Session # 1481 - Copyright 2002 Sean C. Sullivan33 Sync4j implementation Immutable objects Exception class for each SyncML “status code” Declaration of constants –public final static variables Command object hierarchy
34
Session # 1481 - Copyright 2002 Sean C. Sullivan34 Sync4j command hierarchy AbstractCommand ResponseCommandRequestCommand AddCommand, DeleteCommand, ReplaceCommand, … ResultsCommand, StatusCommand
35
Session # 1481 - Copyright 2002 Sean C. Sullivan35 Sync4j toolset Jakarta Ant JDOM Apache Xerces-J CVS log4j Sun JDK 1.4.0 Sun J2EE SDK JUnit Apache Tomcat Netbeans
36
Session # 1481 - Copyright 2002 Sean C. Sullivan36 Sync4j packages sync4j.core sync4j.transport sync4j.framework sync4j.client sync4j.server sync4j.tests
37
Session # 1481 - Copyright 2002 Sean C. Sullivan37 Sync4j core classes Message DeviceInfo MetaInfo Command classes: –AddCommand –DeleteCommand –ReplaceCommand
38
Session # 1481 - Copyright 2002 Sean C. Sullivan38 sync4j.core.Message Two ways to construct a Message object: –from a String of XML –from more basic sync4j objects
39
Session # 1481 - Copyright 2002 Sean C. Sullivan39 Sync4j Message example 1 String strXML = “ … ”; Message msg; try { msg = new Message(strXML); } catch (InvalidMarkupException ex) { } catch (XMLSyntaxException ex) { }
40
Session # 1481 - Copyright 2002 Sean C. Sullivan40 Sync4j Message example 2 SyncHeader header = new SyncHeader(...); SyncBody body = new SyncBody(...); Message msg; msg = new Message(header, body); String strXML = msg.toXML();
41
Session # 1481 - Copyright 2002 Sean C. Sullivan41 Summary Use SyncML to synchronize data between mobile applications and server applications SyncML is a complex and powerful data synchronization protocol Sync4j hides the complexity of SyncML from Java programmers End
42
Session # 1481 - Copyright 2002 Sean C. Sullivan42 For more information… End Please visit http://sync4j.sourceforge.net/
43
Session # 1481 - Copyright 2002 Sean C. Sullivan
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.