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

Martin Denham mjdenham at gmail.com
Thu Jan 20 15:14:34 MST 2011


btw, this is also affected by the bug (JS-110) in the version validator
which would prevent a version like 1.0.1 being used.

On 20 January 2011 22:09, Martin Denham <mjdenham at gmail.com> wrote:

> 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,
> Thread.currentThread());
>         job.beginJob(jobName);
>
>         //use and-bible index location
>         String indexLocation = "/and-bible/indices/v1";
>         try {
>             String version =
> (String)book.getBookMetaData().getProperty("Version");
>             String versionSuffix = version!=null ? "-"+version : "";
>             download(job, indexLocation, book.getInitials()+versionSuffix +
> ZIP_SUFFIX, localDest);
>         } catch (InstallException ex) {
>             job.cancel();
>             throw ex;
>         } finally {
>             job.done();
>         }
>     }
>
> 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
> JSword.
>
> What do you think?
>
> Regards
> Martin
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.crosswire.org/pipermail/jsword-devel/attachments/20110120/138da2f9/attachment.html>


More information about the jsword-devel mailing list