[jsword-devel] Make AbstractSwordInstaller.downloadSearchIndex configurable

Martin Denham mjdenham at gmail.com
Tue Apr 9 14:15:26 MST 2013


Could JSword's AbstractSwordInstaller be enhanced to make the location that
pre-built search indexes are downloaded from configurable.  I modified the
previous JSword to make the indexes be picked up from the correct place.

I think that it is only And Bible that utilises this method which would
make the change simpler.

And Bible copied the index storage structures used by PocketSword.
And Bible's pre-built indexes are stored here:
http://www.crosswire.org/and-bible/indices/v1/
And Bible index zip files are named "MODULE_NAME-VERSION.zip" (eg
KJV-1.3.zip)

This is the modified method currently being used by And Bible:
    public void downloadSearchIndex(Book book, URI localDest) throws
InstallException {
        // TRANSLATOR: Progress label for downloading one or more files.
        String jobName = JSMsg.gettext("Downloading files");
        Progress job = JobManager.createJob(jobName,
Thread.currentThread());
        job.beginJob(jobName);

        //MJD START
        //use and-bible index location
        String indexLocation = "/and-bible/indices/v1";
        try {
            Version versionObj =
(Version)book.getBookMetaData().getProperty("Version");
            // if a module has no version then default version is blank
            String versionSuffix = "";
            if (versionObj!=null && versionObj.toString()!=null) {
                versionSuffix = "-"+versionObj.toString();
            }
            download(job, indexLocation, book.getInitials()+versionSuffix +
ZIP_SUFFIX, localDest);
            //MJD END
//orig:     download(job, packageDirectory + '/' + SEARCH_DIR,
book.getInitials() + ZIP_SUFFIX, localDest);
        } catch (InstallException ex) {
            job.cancel();
            throw ex;
        } finally {
            job.done();
        }
    }

Martin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.crosswire.org/pipermail/jsword-devel/attachments/20130409/841c8966/attachment.html>


More information about the jsword-devel mailing list