public abstract class AbstractBook extends Object implements Book
The GNU Lesser General Public License for details.| Modifier and Type | Field and Description |
|---|---|
private Backend |
backend
To read the data from the Book
|
private BookMetaData |
bmd
The meta data for this book
|
private List<IndexStatusListener> |
listeners
The list of property change listeners
|
private Searcher |
searcher
How do we perform searches
|
| Constructor and Description |
|---|
AbstractBook(BookMetaData bmd,
Backend backend)
Construct an AbstractBook given the BookMetaData and the AbstractBackend.
|
| Modifier and Type | Method and Description |
|---|---|
void |
activate(Lock lock)
Called to indicate that the Book should initialize itself, and consume
whatever system resources it needs to be able to respond to other
queries.
|
void |
addIndexStatusListener(IndexStatusListener listener)
Adds a
IndexStatusListener to the listener list. |
int |
compareTo(Book obj) |
void |
deactivate(Lock lock)
Called to indicate that the Book should release whatever system resources
it can to make way for other uses.
|
boolean |
equals(Object obj) |
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.
|
protected void |
firePropertyChange(IndexStatus oldStatus,
IndexStatus newStatus)
Reports bound property changes.
|
String |
getAbbreviation()
The abbreviation of this book - how people familiar with this book will know
it, for example "NIV", "KJV".
|
Backend |
getBackend() |
Book |
getBook()
Get this book.
|
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?
|
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.
|
IndexStatus |
getIndexStatus()
Has anyone generated a search index for this Book?
|
String |
getInitials()
The internal name of this book.
|
Language |
getLanguage()
The language of the book.
|
String |
getName()
The name of the book, for example "King James Version" or
"Bible in Basic English" or "Greek".
|
protected abstract List<org.jdom2.Content> |
getOsis(Key key,
RawTextToXmlProcessor noOpRawTextProcessor) |
String |
getOsisID()
Calculated field: Get an OSIS identifier for the OsisText.setOsisIDWork()
and the Work.setOsisWork() methods.
|
String |
getProperty(String key)
Retrieve a single property for this book.
|
Set<String> |
getPropertyKeys()
Get a list of all the properties available to do with this Book.
|
Key |
getScope()
Get a complete list of entries.
|
String |
getUnlockKey()
Gets the unlock key for the module.
|
boolean |
hasFeature(FeatureType feature)
Return whether the feature is supported by the book.
|
int |
hashCode() |
boolean |
isEnciphered()
Indicate whether this book is enciphered.
|
boolean |
isLeftToRight()
Return the orientation of the script 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.
|
private boolean |
isUnlockKeyValid()
This is a heuristic that tries out the key.
|
boolean |
match(String name)
Return the likelihood that we have a match.
|
void |
putProperty(String key,
String value)
Set a property for this book.
|
void |
putProperty(String key,
String value,
boolean forFrontend)
Saves an entry to a particular configuration file.
|
void |
removeIndexStatusListener(IndexStatusListener listener)
Removes a
IndexStatusListener from the listener list. |
void |
setBookMetaData(BookMetaData bmd)
Set the meta-information for this book.
|
void |
setIndexStatus(IndexStatus newStatus)
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.jdom2.Document |
toOSIS()
Get an OSIS representation of information concerning this Book.
|
String |
toString() |
boolean |
unlock(String unlockKey)
Unlocks a book with the given key.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, waitcontains, createEmptyKeyList, getGlobalKeyList, getKey, getOsisIterator, getRawText, getValidKey, isWritable, setAliasKey, setRawTextprivate Searcher searcher
private BookMetaData bmd
private Backend backend
private List<IndexStatusListener> listeners
public AbstractBook(BookMetaData bmd, Backend backend)
bmd - the metadata that describes the bookbackend - the means by which the resource is accessedpublic Key getScope()
BookBook.getGlobalKeyList(), however for a Bible, it will
get the references that are actually in the book.public final BookMetaData getBookMetaData()
BookgetBookMetaData in interface Bookpublic final void setBookMetaData(BookMetaData bmd)
BooksetBookMetaData in interface Bookbmd - the BookMetaData that describes this book.public final Backend getBackend()
public void activate(Lock lock)
Activatableactivate in interface Activatablelock - An attempt to ensure that only the Activator calls this methodpublic void deactivate(Lock lock)
Activatabledeactivate in interface Activatablelock - An attempt to ensure that only the Activator calls this methodpublic Key find(String request) throws BookException
Bookfind in interface Bookrequest - The search spec.BookException - If anything goes wrong with this methodpublic Key find(SearchRequest request) throws BookException
Bookfind in interface Bookrequest - The search spec.BookException - If anything goes wrong with this methodpublic Book getBook()
public BookDriver getDriver()
Bookpublic String getDriverName()
BookgetDriverName in interface Bookpublic boolean match(String name)
Bookpublic IndexStatus getIndexStatus()
BookgetIndexStatus in interface BookIndexManagerpublic void setIndexStatus(IndexStatus newStatus)
BooksetIndexStatus in interface BooknewStatus - the status to set for this bookIndexManagerpublic String getAbbreviation()
BookgetAbbreviation in interface Bookpublic String getInitials()
BookgetInitials in interface Bookpublic Language getLanguage()
BookgetLanguage in interface Bookpublic String getName()
Bookpublic String getOsisID()
Bookpublic Set<String> getPropertyKeys()
BookgetPropertyKeys in interface Bookpublic String getProperty(String key)
BookgetProperty in interface Bookkey - the key of the property.public void putProperty(String key, String value)
BookputProperty in interface Bookkey - the key of the property.value - the value of the propertypublic void putProperty(String key, String value, boolean forFrontend)
BookputProperty in interface Bookkey - the entry that we are savingvalue - the value of the entryforFrontend - when true save to front end storage, else in shared storagepublic BookCategory getBookCategory()
BookgetBookCategory in interface Bookpublic boolean isLeftToRight()
BookisLeftToRight in interface Bookpublic boolean isSupported()
BookisSupported in interface Bookpublic boolean isEnciphered()
BookisEnciphered in interface Bookpublic boolean isLocked()
Bookpublic boolean unlock(String unlockKey)
Bookprivate boolean isUnlockKeyValid()
protected abstract List<org.jdom2.Content> getOsis(Key key, RawTextToXmlProcessor noOpRawTextProcessor) throws BookException
BookExceptionpublic String getUnlockKey()
BookgetUnlockKey in interface Bookpublic boolean isQuestionable()
BookisQuestionable in interface Bookpublic boolean hasFeature(FeatureType feature)
BookhasFeature in interface Bookfeature - the type of the Feature to checkpublic void addIndexStatusListener(IndexStatusListener listener)
BookIndexStatusListener to the listener list.
A IndexStatusEvent will get fired in response to
setIndexStatus.
addIndexStatusListener in interface Booklistener - the IndexStatusListener to be addedpublic void removeIndexStatusListener(IndexStatusListener listener)
BookIndexStatusListener from the listener list.removeIndexStatusListener in interface Booklistener - the IndexStatusListener to be removedprotected void firePropertyChange(IndexStatus oldStatus, IndexStatus newStatus)
oldValue and
newValue are not equal and the
PropertyChangeEvent listener list isn't empty, then fire a
PropertyChange event to each listener.oldStatus - the old value of the property (as an Object)newStatus - the new value of the property (as an Object)public org.jdom2.Document toOSIS()
Bookpublic int compareTo(Book obj)
compareTo in interface Comparable<Book>