org.crosswire.jsword.book
Interface Book

All Superinterfaces:
Activatable, Comparable, KeyFactory
All Known Implementing Classes:
AbstractBook, AbstractPassageBook, ReadingsBook, SwordBook, SwordDailyDevotion, SwordDictionary

public interface Book
extends Activatable, KeyFactory, Comparable

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).

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

Method Summary
 void addIndexStatusListener(IndexStatusListener li)
          Adds a IndexStatusListener to the listener list.
 Key find(SearchRequest request)
          Retrieval: For a given search spec find a list of references to it.
 Key find(String request)
          Retrieval: For a given search spec find a list of references to it.
 BookCategory getBookCategory()
          What category of content is this, a Bible or a reference work like a Dictionary or Commentary.
 BookMetaData getBookMetaData()
          Meta-Information: What version of the Bible is this?
 BookData getData(Key key)
          Retrieval: Add to the given document some mark-up for the specified Verses.
 BookDriver getDriver()
          Accessor for the driver that runs this Book.
 String getDriverName()
          Calculated field: The name of the name, which could be helpful to distinguish similar Books available through 2 BookDrivers.
 String getFullName()
          Calculated field: The full name of the book, for example The format is "name, (Driver)"
 IndexStatus getIndexStatus()
          Has anyone generated a search index for this Book?
 String getInitials()
          The initials of this book - how people familiar with this book will know it, for example "NIV", "KJV".
 String getLanguage()
          The language of the book is the common name for the iso639 code.
 String getName()
          The name of the book, for example "King James Version" or "Bible in Basic English" or "Greek".
 String getOsisID()
          Calculated field: Get an OSIS identifier for the OsisText.setOsisIDWork() and the Work.setOsisWork() methods.
 Map getProperties()
          Get a list of all the properties available to do with this Book.
 String getRawData(Key key)
          Returns the raw text that getData(Key key) builds into OSIS.
 String getUnlockKey()
          Gets the unlock key for the module.
 boolean hasFeature(FeatureType feature)
          Return whether the feature is supported by the book.
 boolean isEnciphered()
          Indicate whether this book is enciphered.
 boolean isLeftToRight()
          Return the orientation of the language of the Book.
 boolean isLocked()
          Indicate whether this book is enciphered and without a key.
 boolean isQuestionable()
          Indicate whether this book is questionable.
 boolean isSupported()
          Indicate whether this book is supported by JSword.
 void removeIndexStatusListener(IndexStatusListener li)
          Removes a IndexStatusListener from the listener list.
 void setBookMetaData(BookMetaData bmd)
          Set the meta-information for this book.
 void setIndexStatus(IndexStatus status)
          This method does not alter the index status, however it is for Indexers that are responsible for indexing and have changed the status themselves.
 org.jdom.Document toOSIS()
          Get an OSIS representation of information concerning this Book.
 boolean unlock(String unlockKey)
          Unlocks a book with the given key.
 
Methods inherited from interface org.crosswire.common.activate.Activatable
activate, deactivate
 
Methods inherited from interface org.crosswire.jsword.passage.KeyFactory
createEmptyKeyList, getGlobalKeyList, getKey, getValidKey
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Method Detail

getBookMetaData

BookMetaData getBookMetaData()
Meta-Information: What version of the Bible is this?

Returns:
A Version for this Bible

setBookMetaData

void setBookMetaData(BookMetaData bmd)
Set the meta-information for this book.


getData

BookData getData(Key key)
                 throws BookException
Retrieval: Add to the given document some mark-up for the specified Verses.

Parameters:
key - The verses to search for
Returns:
The found Book data
Throws:
BookException - If anything goes wrong with this method

getRawData

String getRawData(Key key)
                  throws BookException
Returns the raw text that getData(Key key) builds into OSIS.

Parameters:
key - The verses to search for
Returns:
The found Book data
Throws:
BookException - If anything goes wrong with this method

find

Key find(SearchRequest request)
         throws BookException
Retrieval: For a given search spec find a list of references to it. If there are no matches then null should be returned, otherwise a valid Key.

Parameters:
request - The search spec.
Throws:
BookException - If anything goes wrong with this method

find

Key find(String request)
         throws BookException
Retrieval: For a given search spec find a list of references to it. If there are no matches then null should be returned, otherwise a valid Key.

Parameters:
request - The search spec.
Throws:
BookException - If anything goes wrong with this method

getName

String getName()
The name of the book, for example "King James Version" or "Bible in Basic English" or "Greek". In general it should be possible to deduce the initials from the name by removing all the non-capital letters. Although this is only a generalization. This method should not return null or a blank string.

Returns:
The name of this book

getBookCategory

BookCategory getBookCategory()
What category of content is this, a Bible or a reference work like a Dictionary or Commentary.

Returns:
The category of book

getDriver

BookDriver getDriver()
Accessor for the driver that runs this Book. Note this method should only be used to delete() Books. Everything else you should want to do to a Book should be available in other ways.


getLanguage

String getLanguage()
The language of the book is the common name for the iso639 code.

Returns:
the common name for the language

getInitials

String getInitials()
The initials of this book - how people familiar with this book will know it, for example "NIV", "KJV".

Returns:
The book's initials

getOsisID

String getOsisID()
Calculated field: Get an OSIS identifier for the OsisText.setOsisIDWork() and the Work.setOsisWork() methods. The response will generally be of the form [Bible][Dict..].getInitials

Returns:
The osis id of this book

getFullName

String getFullName()
Calculated field: The full name of the book, for example The format is "name, (Driver)"

Returns:
The full name of this book

isSupported

boolean isSupported()
Indicate whether this book is supported by JSword. Since the expectation is that all books are supported, abstract implementations should return true and let specific implementations return false if they cannot support the book.

Returns:
true if the book is supported

isEnciphered

boolean isEnciphered()
Indicate whether this book is enciphered. Since the expectation is that most books are unenciphered, abstract implementations should return false and let specific implementations return true otherwise.

Returns:
true if the book is enciphered

isLocked

boolean isLocked()
Indicate whether this book is enciphered and without a key. Since the expectation is that most books are unenciphered, abstract implementations should return false and let specific implementations return true otherwise.

Returns:
true if the book is locked

unlock

boolean unlock(String unlockKey)
Unlocks a book with the given key.

Parameters:
unlockKey - the key to try
Returns:
true if the unlock key worked.

getUnlockKey

String getUnlockKey()
Gets the unlock key for the module.

Returns:
the unlock key, if any, null otherwise.

isQuestionable

boolean isQuestionable()
Indicate whether this book is questionable. A book may be deemed questionable if it's quality or content has not been confirmed. Since the expectation is that all books are not questionable, abstract implementations should return false and let specific implementations return true if the book is questionable.

Returns:
true if the book is questionable

getDriverName

String getDriverName()
Calculated field: The name of the name, which could be helpful to distinguish similar Books available through 2 BookDrivers.

Returns:
The driver name

isLeftToRight

boolean isLeftToRight()
Return the orientation of the language of the Book. If a book contains more than one language, it refers to the dominate language of the book. This will be used to present Arabic and Hebrew in their propper orientation.

Returns:
true if the orientation for the dominate language is LeftToRight.

hasFeature

boolean hasFeature(FeatureType feature)
Return whether the feature is supported by the book.


getProperties

Map getProperties()
Get a list of all the properties available to do with this Book. The returned Properties will be read-only so any attempts to alter it will fail.


getIndexStatus

IndexStatus getIndexStatus()
Has anyone generated a search index for this Book?

See Also:
IndexManager

setIndexStatus

void setIndexStatus(IndexStatus status)
This method does not alter the index status, however it is for Indexers that are responsible for indexing and have changed the status themselves.

See Also:
IndexManager

toOSIS

org.jdom.Document toOSIS()
Get an OSIS representation of information concerning this Book.


addIndexStatusListener

void addIndexStatusListener(IndexStatusListener li)
Adds a IndexStatusListener to the listener list.

A IndexStatusEvent will get fired in response to setIndexStatus.

Parameters:
li - the IndexStatusListener to be added

removeIndexStatusListener

void removeIndexStatusListener(IndexStatusListener li)
Removes a IndexStatusListener from the listener list.

Parameters:
li - the IndexStatusListener to be removed

Copyright ยจ 2003-2006