org.crosswire.jsword.bridge
Class BookInstaller

java.lang.Object
  extended by org.crosswire.jsword.bridge.BookInstaller

public class BookInstaller
extends Object

Exports the Book in SWORD's imp format. This is identical to SWORD's mod2imp. Note: it does not work with GenBook.

Author:
DM Smith
See Also:
The GNU Lesser General Public License for details.

Field Summary
private  InstallManager installManager
           
 
Constructor Summary
BookInstaller()
           
 
Method Summary
 void deleteBook(Book book)
          Uninstall a book.
 Book getBook(String repositoryName, String bookName)
          Get a Book from the repository.
static Book getInstalledBook(String bookInitials)
          Get a particular installed book by initials.
static List<Book> getInstalledBooks()
          Get a list of all installed books.
static List<Book> getInstalledBooks(BookFilter filter)
          Get a list of installed books by BookFilter.
static List<Book> getInstalledBooks(String filterSpec)
          Get a list of books by CustomFilter specification
 Map<String,Installer> getInstallers()
          Get a list of all known installers.
 Book getRepositoryBook(String repositoryName, String bookInitials)
          Get a particular installed book by initials.
 List<Book> getRepositoryBooks(String repositoryName)
          Get a list of all known books for an installer.
 List<Book> getRepositoryBooks(String repositoryName, BookFilter filter)
          Get a list of books in a repository by BookFilter.
 List<Book> getRepositoryBooks(String repositoryName, String filterSpec)
          Get a list of books in a repository by CustomFilter specification
 void installBook(String repositoryName, Book book)
          Install a book, overwriting it if the book to be installed is newer.
static void main(String[] args)
          BookInstaller can manage the installation of books with the following capabilities.
 void reloadBookList(String repositoryName)
          Reload the local cache for a remote repository.
static void usage()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

installManager

private InstallManager installManager
Constructor Detail

BookInstaller

public BookInstaller()
Method Detail

deleteBook

public void deleteBook(Book book)
                throws BookException
Uninstall a book.

Parameters:
book - the book to delete
Throws:
BookException

getInstallers

public Map<String,Installer> getInstallers()
Get a list of all known installers.

Returns:
the list of installers

getInstalledBooks

public static List<Book> getInstalledBooks()
Get a list of all installed books.

Returns:
the list of installed books

getInstalledBooks

public static List<Book> getInstalledBooks(BookFilter filter)
Get a list of installed books by BookFilter.

Parameters:
filter - The book filter
Returns:
the list of matching books
See Also:
BookFilter, Books

getInstalledBooks

public static List<Book> getInstalledBooks(String filterSpec)
Get a list of books by CustomFilter specification

Parameters:
filterSpec - The filter string
Returns:
the list of matching books
See Also:
BookFilters.getCustom(java.lang.String), Books

getInstalledBook

public static Book getInstalledBook(String bookInitials)
Get a particular installed book by initials.

Parameters:
bookInitials - The book name to search for
Returns:
The found book. Null otherwise.

getRepositoryBooks

public List<Book> getRepositoryBooks(String repositoryName)
Get a list of all known books for an installer.

Parameters:
repositoryName -
Returns:
the list of books at that repository

getRepositoryBooks

public List<Book> getRepositoryBooks(String repositoryName,
                                     BookFilter filter)
Get a list of books in a repository by BookFilter.

Parameters:
repositoryName - The name of the repository
filter - The book filter
Returns:
the matching books
See Also:
BookFilter, Books

getRepositoryBooks

public List<Book> getRepositoryBooks(String repositoryName,
                                     String filterSpec)
Get a list of books in a repository by CustomFilter specification

Parameters:
repositoryName - the name of the repository
filterSpec - The filter string
Returns:
the list of books
See Also:
BookFilters.getCustom(java.lang.String), Books

getRepositoryBook

public Book getRepositoryBook(String repositoryName,
                              String bookInitials)
Get a particular installed book by initials.

Parameters:
repositoryName - the name of the repository
bookInitials - The book name to search for
Returns:
The found book. Null otherwise.

reloadBookList

public void reloadBookList(String repositoryName)
                    throws InstallException
Reload the local cache for a remote repository.

Parameters:
repositoryName -
Throws:
InstallException

getBook

public Book getBook(String repositoryName,
                    String bookName)
Get a Book from the repository. Note this does not install it.

Parameters:
repositoryName - the repository from which to get the book
bookName - the name of the book to get
Returns:
the Book

installBook

public void installBook(String repositoryName,
                        Book book)
                 throws BookException,
                        InstallException
Install a book, overwriting it if the book to be installed is newer.

Parameters:
repositoryName - the name of the repository from which to get the book
book - the book to get
Throws:
BookException
InstallException

main

public static void main(String[] args)
BookInstaller can manage the installation of books with the following capabilities.

Usage: BookInstaller [option]

Options
uninstall bookName Uninstall book
sources   List source repositories
list   List installed books
list repositoryName list available books from a repository
reload repositoryName Reload the local cache for a repository
install repositoryName bookName Install a book from a repository

Parameters:
args -

usage

public static void usage()

Copyright ยจ 2003-2015