Core Implementations of Data APIs
The previous section provided a summary of the four primary data
APIs available at this time. This section works through the two
implementations provided by Core—the ItemFileReadStore and ItemFileWriteStore. As you'll see, the
ItemFileReadStore implements the
Read and Identity APIs, and the ItemFileWriteStore implements all four APIs
discussed. A good understanding of these two stores equips you with
enough familiarity to augment these existing stores to suit your own
needs—or to implement your own.
Tip
Although not explicitly discussed in this book, the dojox.data subproject contains a powerful
assortment of dojo.data
implementations for common tasks such as interfacing to CSV stores,
Flickr, XML, OPML, Picasa, and other handy stores. Since they all
follow the same APIs as you're learning about here, picking them up
should be a snap.
ItemFileReadStore
Although it is quite likely that your particular situation may
benefit from a custom implementation of dojo.data.api.Read to maximize efficiency
and impedance mismatching, the toolkit does include the ItemFileReadStore, which implements the
Read and Identity interfaces and consumes a
flexible JSON representation. For situations in which you need to
quickly get something up and running, you need to do little more
than have your application's business logic output data in the
format that the ItemFileReadStore
expects, and voilà, you may use the store as
needed.
Tip
One thing to know up front is that the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access