[jsword-devel] Valid module keys

Greg Hellings greg.hellings at gmail.com
Sun Jan 12 00:38:01 MST 2014


On Sat, Jan 11, 2014 at 11:30 PM, Greg Hellings <greg.hellings at gmail.com>wrote:
>
> It's this presentation that is tripping me up. To continue using Pilgrim's
> Progress as an example, the following call works:
>
> Book book = Books.installed().getBook("Pilgrim");
> Key baseKey = book.getKey("SOURCE");
>
> This call, prints out the exception message,
> "org.crosswire.jsword.passage.NoSuchKeyException: No entry for 'PART_I' in
> Pilgrim.":
>
> Book book = Books.installed().getBook("Pilgrim");
> Key baseKey = book.getKey("PART_I");
>
> However, when I iterate the results of getGlobalKeyList I see PART_I
> listed as a sub-key of the module. I'm guessing that in BibleDesktop you're
> expanding a tree in the UI whose nodes already have a reference to the Key
> itself, so you don't need to retrieve an arbitrary key out of a GenBook?
> I'm looking at this from the context of a web service where a request could
> come in with any arbitrary key depth.
>
>
>
Here's the full context: https://github.com/greg-hellings/jsword-json

It's a simple read-only REST resource/WebSocket server that fetches back a
list of installed modules, a list of the top-level keys in that module, and
any parse-able key's worth of data in JSON. It's super simple and is only
intended to be a proof of concept that hitting a Sword module to fetch out
JSON is not very difficult. You can sample it running at
http://thehellings.com:10001/ or over WebSockets at ws://
thehellings.com:10002/, though please be gentle. I've included a
rudimentary amount of app-side caching to improve performance of some of
the longer-running requests (e.g. "Please feed me /KJV/Gen-Rev"). I'm
looking for any set of ways to improve its quality so it's a less bad demo
of how simply modules can be generically accessed.

Every time I hear people talking about wanting access to Sword materials in
JavaScript it keeps reminding me of how simple it is to build a web service
in Java to allow people to access that data in a web-happier way rather
than trying to read and parse modules in JavaScript.

--Greg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.crosswire.org/pipermail/jsword-devel/attachments/20140112/198c7471/attachment.html>


More information about the jsword-devel mailing list