Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.crosswire.jsword.book.install.sword
Class AbstractSwordInstaller

    java.lang.Object
      org.crosswire.jsword.book.basic.AbstractBookList
          org.crosswire.jsword.book.install.sword.AbstractSwordInstaller

All Implemented Interfaces:
  Comparable, BookList, Installer

Direct Known Subclasses:
  HttpSwordInstaller

    public abstract class AbstractSwordInstaller

extends AbstractBookList
implements Installer, Comparable

.

Author:
  Joe Walker [joe at eireneh dot com], DM Smith [dmsmith555 at yahoo dot com]
See Also:
  `for license details. The copyright to this program is held by it's authors.`

Field Summary
`protected String` | `directory` The directory containing books on the `host`.
`protected static String` | `DOWNLOAD_PREFIX` When we cache a download index
`protected Map` | `entries` A map of the entries in this download area
`protected static String` | `FILE_LIST_GZ` The sword index file
`protected String` | `host` The remote hostname.
`private static String` | `LIST_DIR` The relative path of the dir holding the index file
`protected boolean` | `loaded` Do we need to reload the index file
`private static Logger` | `log` The log stream
`protected static String` | `PACKAGE_DIR` The relative path of the dir holding the zip files
`protected String` | `proxyHost` The remote proxy hostname.
`protected Integer` | `proxyPort` The remote proxy port.
`protected static String` | `SEARCH_DIR` The relative path of the dir holding the search index files
`protected static String` | `ZIP_SUFFIX` The suffix of zip books on this server

Constructor Summary
`AbstractSwordInstaller()`

Method Summary
`int` | `compareTo(Object arg0)`
`protected abstract void` | `download(Job job, String dir, String file, URL dest)` Utility to download a file from a remote site
`void` | `downloadSearchIndex(Book book, URL localDest)` Download a search index for the given Book.
`boolean` | `equals(Object object)`
`protected boolean` | `equals(String string1, String string2)` Quick utility to check to see if 2 (potentially null) strings are equal
`List` | `getBooks()` Get a list of all the Books of all types.
`protected URL` | `getCachedIndexFile()` The URL for the cached index file for this installer
`String` | `getDirectory()`
`String` | `getHost()`
`String` | `getInstallerDefinition()` Accessor for the URL
`String` | `getProxyHost()`
`Integer` | `getProxyPort()`
`private static String` | `getTempFileExtension(String host, String directory)` What are we using as a temp filename?
`int` | `hashCode()`
`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.
`private void` | `loadCachedIndex()` Load the cached index file into memory
`void` | `reloadBookList()` Refetch a list of names from the remote source.
`void` | `setDirectory(String newDirectory)`
`void` | `setHost(String newHost)`
`void` | `setProxyHost(String newProxyHost)`
`void` | `setProxyPort(Integer newProxyPort)`

Methods inherited from class org.crosswire.jsword.book.basic.AbstractBookList
`addBooksListener, fireBooksChanged, getBooks, removeBooksListener`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface org.crosswire.jsword.book.install.Installer
`getSize, getType, toRemoteURL`

Methods inherited from interface org.crosswire.jsword.book.BookList
`addBooksListener, getBooks, removeBooksListener`

Field Detail

### PACKAGE_DIR

    protected static final String PACKAGE_DIR

  The relative path of the dir holding the zip files

  See Also:
    Constant Field Values

### LIST_DIR

    private static final String LIST_DIR

  The relative path of the dir holding the index file

  See Also:
    Constant Field Values

### entries

    protected Map entries

  A map of the entries in this download area

### host

    protected String host

  The remote hostname.

### proxyHost

    protected String proxyHost

  The remote proxy hostname.

### proxyPort

    protected Integer proxyPort

  The remote proxy port.

### directory

    protected String directory

  The directory containing books on the `host`.

### loaded

    protected boolean loaded

  Do we need to reload the index file

### FILE_LIST_GZ

    protected static final String FILE_LIST_GZ

  The sword index file

  See Also:
    Constant Field Values

### ZIP_SUFFIX

    protected static final String ZIP_SUFFIX

  The suffix of zip books on this server

  See Also:
    Constant Field Values

### log

    private static final Logger log

  The log stream

### SEARCH_DIR

    protected static final String SEARCH_DIR

  The relative path of the dir holding the search index files

  See Also:
    Constant Field Values

### DOWNLOAD_PREFIX

    protected static final String DOWNLOAD_PREFIX

  When we cache a download index

  See Also:
    Constant Field Values

Constructor Detail

### AbstractSwordInstaller

    public AbstractSwordInstaller()

Method Detail

### download

    protected abstract void download(Job job,
                                     String dir,
                                     String file,
                                     URL dest)
                              throws InstallException

  Utility to download a file from a remote site

  Parameters:
    `job` - The way of noting progress
    `dir` - The directory from which to download the file
    `file` - The file to download
  Throws:
    `InstallException`

### getInstallerDefinition

    public String getInstallerDefinition()

  Description copied from interface: `Installer`
  Accessor for the URL

  Specified by:
    `getInstallerDefinition` in interface `Installer`
  Returns:
    the source url

### isNewer

    public boolean isNewer(Book book)

  Description copied from interface: `Installer`
  Return true if the book is not installed or there is a newer version to install.

  Specified by:
    `isNewer` in interface `Installer`
  Parameters:
    `book` - The book meta-data to check on.
  Returns:
    whether there is a newer version to install

### getBooks

    public List getBooks()

  Description copied from interface: `BookList`
  Get a list of all the Books of all types.

  Specified by:
    `getBooks` in interface `BookList`
  Specified by:
    `getBooks` in interface `Installer`
  See Also:
    `Installer.reloadBookList()`

### install

    public void install(Book book)

  Description copied from interface: `Installer`
  Download and install a book locally. The name should be one from an index list retrieved from getIndex() or reloadIndex()

  Specified by:
    `install` in interface `Installer`
  Parameters:
    `book` - The book to install

### reloadBookList

    public void reloadBookList()
                        throws InstallException

  Description copied from interface: `Installer`
  Refetch 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.

  Specified by:
    `reloadBookList` in interface `Installer`
  Throws:
    `InstallException`

### downloadSearchIndex

    public void downloadSearchIndex(Book book,
                                    URL localDest)
                             throws InstallException

  Description copied from interface: `Installer`
  Download a search index for the given Book. The installation of the search index is the responsibility of the IndexManager.

  Specified by:
    `downloadSearchIndex` in interface `Installer`
  Parameters:
    `book` - The book to download a search index for.
    `localDest` - A temporary URL for downloading to. Passed to the IndexManager for installation.
  Throws:
    `InstallException`

### loadCachedIndex

    private void loadCachedIndex()
                          throws InstallException

  Load the cached index file into memory

  Throws:
    `InstallException`

### getDirectory

    public String getDirectory()

  Returns:
    Returns the directory.

### setDirectory

    public void setDirectory(String newDirectory)

  Parameters:
    `newDirectory` - The directory to set.

### getHost

    public String getHost()

  Returns:
    Returns the host.

### setHost

    public void setHost(String newHost)

  Parameters:
    `newHost` - The host to set.

### getProxyHost

    public String getProxyHost()

  Returns:
    Returns the proxyHost.

### setProxyHost

    public void setProxyHost(String newProxyHost)

  Parameters:
    `newProxyHost` - The proxyHost to set.

### getProxyPort

    public Integer getProxyPort()

  Returns:
    Returns the proxyPort.

### setProxyPort

    public void setProxyPort(Integer newProxyPort)

  Parameters:
    `newProxyPort` - The proxyPort to set.

### getCachedIndexFile

    protected URL getCachedIndexFile()
                              throws InstallException

  The URL for the cached index file for this installer

  Throws:
    `InstallException`

### getTempFileExtension

    private static String getTempFileExtension(String host,
                                               String directory)

  What are we using as a temp filename?

### equals

    public boolean equals(Object object)

  Overrides:
    `equals` in class `Object`

### compareTo

    public int compareTo(Object arg0)

  Specified by:
    `compareTo` in interface `Comparable`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `Object`

### equals

    protected boolean equals(String string1,
                             String string2)

  Quick utility to check to see if 2 (potentially null) strings are equal

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Copyright ? 2003-2006
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD