org.crosswire.jsword.book.sword
Class SwordBookDriver

java.lang.Object
  extended by org.crosswire.jsword.book.basic.AbstractBookDriver
      extended by org.crosswire.jsword.book.sword.SwordBookDriver
All Implemented Interfaces:
BookDriver, BookProvider

public class SwordBookDriver
extends AbstractBookDriver

This represents all of the Sword Books (aka modules).

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

Field Summary
private static BookDriver INSTANCE
          A shared instance of this driver.
private static org.slf4j.Logger log
          The log stream
 
Constructor Summary
SwordBookDriver()
          Some basic name initialization
 
Method Summary
private  Book createBook(SwordBookMetaData sbmd)
          Create a Book appropriate for the BookMetaData
 void delete(Book dead)
          Delete this Book from the system.
 Book[] getBooks()
          Provide books.
private  void getBooks(List<Book> valid, File bookDir)
           
 String getDriverName()
          A short name for this BookDriver
static BookDriver instance()
          Get the singleton instance of this driver.
 boolean isDeletable(Book dead)
          Is this book able to be deleted.
static void registerNewBook(SwordBookMetaData sbmd)
          A helper class for the SwordInstaller to tell us that it has copied a new Book into our install directory
 
Methods inherited from class org.crosswire.jsword.book.basic.AbstractBookDriver
create, getFirstBook, isWritable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

private static final BookDriver INSTANCE
A shared instance of this driver.


log

private static final org.slf4j.Logger log
The log stream

Constructor Detail

SwordBookDriver

public SwordBookDriver()
Some basic name initialization

Method Detail

getDriverName

public String getDriverName()
Description copied from interface: BookDriver
A short name for this BookDriver


getBooks

public Book[] getBooks()
Description copied from interface: BookProvider
Provide books.

Returns:
the books

getBooks

private void getBooks(List<Book> valid,
                      File bookDir)

isDeletable

public boolean isDeletable(Book dead)
Description copied from interface: BookDriver
Is this book able to be deleted.

Specified by:
isDeletable in interface BookDriver
Overrides:
isDeletable in class AbstractBookDriver
Parameters:
dead - the book to be deleted
Returns:
whether the book can be deleted.

delete

public void delete(Book dead)
            throws BookException
Description copied from interface: BookDriver
Delete this Book from the system. Take care with this method for obvious reasons. For most implementations of Book etc, this method will throw up because most will be read-only.

Specified by:
delete in interface BookDriver
Overrides:
delete in class AbstractBookDriver
Throws:
BookException - If the Book can't be deleted.

instance

public static BookDriver instance()
Get the singleton instance of this driver.

Returns:
this driver instance

registerNewBook

public static void registerNewBook(SwordBookMetaData sbmd)
                            throws BookException
A helper class for the SwordInstaller to tell us that it has copied a new Book into our install directory

Parameters:
sbmd - The SwordBookMetaData object for the new Book
Throws:
BookException

createBook

private Book createBook(SwordBookMetaData sbmd)
                 throws BookException
Create a Book appropriate for the BookMetaData

Throws:
BookException

Copyright ? 2003-2011