org.crosswire.jsword.book.install

## Interface Installer

- All Superinterfaces:
    BookList
  All Known Implementing Classes:
    AbstractSwordInstaller, HttpSwordInstaller

      public interface Installer
      extends BookList

  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.

  To start with I only envisage that we use Sword sourced Bible data however the rest of the system is designed to be able to use data from e-Sword, OLB, etc.

  Author:
    Joe Walker, DM Smith
  See Also:
    `The GNU Lesser General Public License for details.`

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` remove the cached book list to clear memory
    `void` | `downloadSearchIndex(Book book, URI tempDest)` Download a search index for the given Book.
    `Book` | `getBook(String book)` Get a Book matching the name from the local cache.
    `List<Book>` | `getBooks()` Get a list of BookMetaData objects that represent downloadable books.
    `String` | `getInstallerDefinition()` Accessor for the URI
    `int` | `getSize(Book book)` Return true if the book is not installed or there is a newer version to install.
    `String` | `getType()` Get the type of the Installer.
    `void` | `install(Book book)` Download and install a book locally.
    `boolean` | `isNewer(Book book)` Return true if the book is not installed or there is a newer version to install.
    `void` | `reloadBookList()` Re-fetch a list of names from the remote source.
    `URI` | `toRemoteURI(Book book)`

    - ### Methods inherited from interface org.crosswire.jsword.book.BookList

      `addBooksListener, getBooks, removeBooksListener`

- - ### Method Detail

    - #### getType

          String getType()

      Get the type of the Installer.
      Returns:
        the type of the installer

    - #### getInstallerDefinition

          String getInstallerDefinition()

      Accessor for the URI
      Returns:
        the source URI

    - #### toRemoteURI

          URI toRemoteURI(Book book)

      Parameters:
        `book` - The book meta-data to get a URI from.
      Returns:
        the remote URI for the BookMetaData

    - #### getBooks

          List<Book> getBooks()

      Get a list of BookMetaData objects that represent downloadable books. If no list has been retrieved from the remote source using reloadIndex() then we should just return an empty list and not attempt to contact the remote source. See notes on reload for more information.
      Specified by:
        `getBooks` in interface `BookList`
      Returns:
        the list of books
      See Also:
        `reloadBookList()`

    - #### getBook

          Book getBook(String book)

      Get a Book matching the name from the local cache. Null if none is found.
      Parameters:
        `book` - the book name
      Returns:
        the instantiated book

    - #### getSize

          int getSize(Book book)

      Return true if the book is not installed or there is a newer version to install.
      Parameters:
        `book` - The book meta-data to check on.
      Returns:
        whether there is a newer version to install

    - #### isNewer

          boolean isNewer(Book book)

      Return true if the book is not installed or there is a newer version to install.
      Parameters:
        `book` - The book meta-data to check on.
      Returns:
        whether there is a newer version to install

    - #### reloadBookList

          void reloadBookList()
                              throws InstallException

      Re-fetch a list of names from the remote source. It would make sense if the user was warned about the implications of this action. If the user lives in a country that persecutes Christians then this action might give the game away.
      Throws:
        `InstallException`

    - #### install

          void install(Book book)
                       throws InstallException

      Download and install a book locally. The name should be one from an index list retrieved from getIndex() or reloadIndex()
      Parameters:
        `book` - The book to install
      Throws:
        `InstallException`

    - #### downloadSearchIndex

          void downloadSearchIndex(Book book,
                                 URI tempDest)
                                   throws InstallException

      Download a search index for the given Book. The installation of the search index is the responsibility of the BookIndexer.
      Parameters:
        `book` - The book to download a search index for.
        `tempDest` - A temporary URI for downloading to. Passed to the BookIndexer for installation.
      Throws:
        `InstallException`

    - #### close

          void close()

      remove the cached book list to clear memory