1 / 44

Data Synchronization with SyncML * and sync4j

Data Synchronization with SyncML * and sync4j. Sean C. Sullivan <sean> at <seansullivan> <.com>. Agenda. Data synchronization SyncML sync4j Q & A. What is data synchronization?. Data synchronization “is the process of making two sets of data look identical” (syncml.org whitepaper).

vivien
Download Presentation

Data Synchronization with SyncML * and sync4j

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Data Synchronization with SyncML* and sync4j Sean C. Sullivan <sean> at <seansullivan> <.com>

  2. Agenda • Data synchronization • SyncML • sync4j • Q & A

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

  4. Datastore1 A B C • Data modifications A B C A B C Data Synchronization Datastore2 • Conflict resolution

  5. 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

  6. 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)

  7. SyncML sponsors

  8. server modifications client modifications SyncML: clients & servers SyncML server

  9. SyncML data identification Server Client

  10. SyncML Synchronization Types • Two-way sync • Slow sync • One-way sync from client only • Refresh sync from client only

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

  12. SyncML features • Synchronize any type of data • Multiple protocol bindings • HTTP, WSP, OBEX • Security • Interoperability

  13. SyncML terminology • Message • Package • Command • Status code • Datastore • Device Info • Meta Info • Capabilities exchange

  14. SyncML and XML • Abbreviated naming convention • Ex: ”protocol version” is <VerProto> • XML prolog is not required • WBXML • WAPBinary XML

  15. SyncML documents • <SyncML> DTD • Meta info DTD • Device info DTD

  16. <?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) <SyncML> document

  17. <SyncHdr> element <SyncHdr> <VerDTD>1.0</VerDTD> <VerProto>1.0</VerProto> <SessionID>session41</SessionID> <MsgID>msg80386</MsgID> … </SyncHdr>

  18. <SyncBody> element <SyncBody> <Delete> <CmdID>cmd80486</CmdID> … <Item>…</Item> </Delete> </SyncBody>

  19. Contains sync session parameters <MetInf> <Format>…</Format> <Type>…</Type> … <MaxMsgSize>586 </MaxMsgSize> … </MetInf> Meta Info document

  20. Describes device capabilities For both client and server <DevInf> … <SwV>0.99</SwV> <HwV>3.14</HwV> … <DevTyp>pda</DevTyp> … </DevInf> Device Info document

  21. SyncML commands • Put • Replace • Results • Search • Sequence • Status • Sync • Add • Alert • Atomic • Copy • Delete • Exec • Get • Map

  22. sync4j • Java implementation of SyncML protocol • sync4j client & sync4j Server • open source • designed for J2SE platform • http://sync4j.sourceforge.net

  23. 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

  24. 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

  25. 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

  26. 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

  27. 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

  28. 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

  29. 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

  30. Design goals (cont.) • Modular design: • “core” protocol support • transport protocol libraries • extensible client framework • extensible server framework • client application • server application

  31. sync4j implementation • Immutable objects • Exception class for each SyncML “status code” • Declaration of constants • public final static variables • Command object hierarchy

  32. sync4j command hierarchy AbstractCommand RequestCommand ResponseCommand AddCommand, DeleteCommand, ReplaceCommand, … ResultsCommand, StatusCommand,

  33. sync4j toolset

  34. sync4j packages • sync4j.core • sync4j.client • sync4j.server • sync4j.http • sync4j.wsp • sync4j.obex • sync4j.tests

  35. sync4j key classes • SyncMLMessage • DeviceInfo • MetaInfo • Command classes: • AddCommand • DeleteCommand • ReplaceCommand

  36. sync4j.core.SyncMLMessage • Two ways to construct: • from a String of XML • from more basic sync4j objects

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

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

  39. Algorithms • Base64 • encode, decode • WBXML • encode, decode • MD5 • java.security.MessageDigest

  40. 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

  41. 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/

  42. Data Synchronization with SyncML* and sync4j Sean C. Sullivan <sean> at <seansullivan> <.com>

  43. The following slides are miscellaneous material.

  44. SyncML authentication • <Chal> • <Cred> • Authentication types: • basic • MD5

More Related