DevTools:JSword

From CrossWire Bible Society
Revision as of 02:44, 3 July 2008 by SurtaX (talk | contribs) (External Links)

Jump to: navigation, search

About JSword

JSword is an implementation of the SWORD API.

That said, it should be noted that it is not a port.

The JSword Project is a group of free programs that work together to bring Bible study to a wide range of people using the Java platform. It includes Bible Desktop, a free desktop based Bible study tool.

Since it is written in Java (JDK 1.4) it will run on most computers. Currently we regularly test on Windows, Linux and MacOS X, but it ought to work on Solaris and other places where JDK 1.4 or higher is available, and could be easily extended to work on set-top boxes and PDAs.

The software produced by the JSword project is open source software so it is freely available to anyone. It is licensed under the LGPL for the libraries and GPL for the application.

There are several components to the JSword project, the most commonly used is Bible Desktop. The core API is called JSword and there are two generic libraries of useful utilities called common and common-swing. For a complete listing see instructions on getting the code


Basic API Functions: APIExamples.java

The structure of the JSword engine, much like the original Sword engine, it is essentially a Library of Books with powerful search, install and output features. If you're a beginner to the Sword project, the APIExamples.api under /src/main/java -> org.crosswire.jsword.examples will be most helpful to you. In this you will find the most basic functioning of the key classes of the JSword engine.

Installer and Install Manager

Before you can use, read and perform any functions on Bible or other texts, you must first obtain the actual text. (However sometimes the KJV Bible text is already bundled with the download) The JSword engine has some abstracted functions whih allow you to very cleanly install texts onto your program without knowledge of the acutal install tasks. This is done using the Installer and InstallManager.

InstallManager - A manager to abstract out the non-view specific book installation tasks.

Installer -An interface that allows us to download from a specific source of Bible data. It is important that implementor of this interface define equals() and hashcode() properly.

Looking at API examples you are able to see how these work together to install a text. In installBook() you can see that getInstallers() of InstallManager is used to find all the Installers (sources of Bible Data) online which can be used to obtain texts. Similarly if you already know which installer you want to use eg. the CrossWire server, you can directly put that into the getInstallers("CrossWire") arguement to return the correct installer. Now that an Installer is selected we can now check what books are available on that server.

As you can see the list of books is refreshed by the reloadBookList() and then the list of available books on that installer is obtained by running getBooks() of the installer.

Book- Book is the most basic store of textual data - It can retrieve data either as an XML document or as plain text - It uses Keys to refer to parts of itself, and can search for words (returning Keys).

Here you will find many different versions of the Bible and also commentaries and devotions. The book can then be downloaded and installed with the function install(book) of the installer. This will then automatically download the text from the designated server and install the files to the correct directory so that the text can be viewed and searched by other functions.

External Links

You can find more about it here: JSword's home page

Java Documentation of all Classes,Interface and Methods of Jsword: JavaDoc

Walkthrough on how to setup the Jsword Code: Guide