[jsword-devel] How to integrate And Bible modified index download method

Martin Denham mjdenham at gmail.com
Thu Jan 20 15:09:56 MST 2011

I initially made a few tweaks to JSword to make And Bible work on Android
and over the past few months I have been trying either to undo the changes
or to feed them back into JSword in some way.  There are still a few changes
I have outstanding and the most significant relate to indexes.  There are i)
modified download method ii) new index download thread and iii) index
creation for low memory devices.

I have just modified the And Bible index creation code to make it more
consistent with JSword so I will leave that until it is better tested but
the index download method code has not changed for a while and I was
wondering if it would be possible to find a way to remove my need to hack
the JSword AbstractSwordInstaller after every check out.

It is very messy but here is my hack in AbstractSwordInstaller:

    public void downloadSearchIndex(Book book, URI localDest) throws
InstallException {
        // TRANSLATOR: Progress label for downloading one or more files.
        String jobName = UserMsg.gettext("Downloading files");
        Progress job = JobManager.createJob(jobName,

        //use and-bible index location
        String indexLocation = "/and-bible/indices/v1";
        try {
            String version =
            String versionSuffix = version!=null ? "-"+version : "";
            download(job, indexLocation, book.getInitials()+versionSuffix +
ZIP_SUFFIX, localDest);
        } catch (InstallException ex) {
            throw ex;
        } finally {

You can see that indexes include a version number as per PocketSword
resulting in file names like "ESV-1.0.1.zip" and are downloaded form a
folder I was allocated on the Crosswire site.

One possibility might be just to tidy the above, put it in
AbstractSwordInstaller and make it the default index download code for now.
 Another possibility might be to have (yet more) statics that either switch
the above index download method or set parameters used by the current
method.  The last possibility would be for me just to continue hacking

What do you think?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.crosswire.org/pipermail/jsword-devel/attachments/20110120/284867d5/attachment.html>

More information about the jsword-devel mailing list