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, wait
contains, createEmptyKeyList, getGlobalKeyList, getKey, getOsisIterator, getRawText, getValidKey, isWritable, setAliasKey, setRawText
private 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()
Book
Book.getGlobalKeyList()
, however for a Bible, it will
get the references that are actually in the book.public final BookMetaData getBookMetaData()
Book
getBookMetaData
in interface Book
public final void setBookMetaData(BookMetaData bmd)
Book
setBookMetaData
in interface Book
bmd
- the BookMetaData that describes this book.public final Backend getBackend()
public void activate(Lock lock)
Activatable
activate
in interface Activatable
lock
- An attempt to ensure that only the Activator calls this methodpublic void deactivate(Lock lock)
Activatable
deactivate
in interface Activatable
lock
- An attempt to ensure that only the Activator calls this methodpublic Key find(String request) throws BookException
Book
find
in interface Book
request
- The search spec.BookException
- If anything goes wrong with this methodpublic Key find(SearchRequest request) throws BookException
Book
find
in interface Book
request
- The search spec.BookException
- If anything goes wrong with this methodpublic Book getBook()
public BookDriver getDriver()
Book
public String getDriverName()
Book
getDriverName
in interface Book
public boolean match(String name)
Book
public IndexStatus getIndexStatus()
Book
getIndexStatus
in interface Book
IndexManager
public void setIndexStatus(IndexStatus newStatus)
Book
setIndexStatus
in interface Book
newStatus
- the status to set for this bookIndexManager
public String getAbbreviation()
Book
getAbbreviation
in interface Book
public String getInitials()
Book
getInitials
in interface Book
public Language getLanguage()
Book
getLanguage
in interface Book
public String getName()
Book
public String getOsisID()
Book
public Set<String> getPropertyKeys()
Book
getPropertyKeys
in interface Book
public String getProperty(String key)
Book
getProperty
in interface Book
key
- the key of the property.public void putProperty(String key, String value)
Book
putProperty
in interface Book
key
- the key of the property.value
- the value of the propertypublic void putProperty(String key, String value, boolean forFrontend)
Book
putProperty
in interface Book
key
- the entry that we are savingvalue
- the value of the entryforFrontend
- when true
save to front end storage, else in shared storagepublic BookCategory getBookCategory()
Book
getBookCategory
in interface Book
public boolean isLeftToRight()
Book
isLeftToRight
in interface Book
public boolean isSupported()
Book
isSupported
in interface Book
public boolean isEnciphered()
Book
isEnciphered
in interface Book
public boolean isLocked()
Book
public boolean unlock(String unlockKey)
Book
private boolean isUnlockKeyValid()
protected abstract List<org.jdom2.Content> getOsis(Key key, RawTextToXmlProcessor noOpRawTextProcessor) throws BookException
BookException
public String getUnlockKey()
Book
getUnlockKey
in interface Book
public boolean isQuestionable()
Book
isQuestionable
in interface Book
public boolean hasFeature(FeatureType feature)
Book
hasFeature
in interface Book
feature
- the type of the Feature to checkpublic void addIndexStatusListener(IndexStatusListener listener)
Book
IndexStatusListener
to the listener list.
A IndexStatusEvent
will get fired in response to
setIndexStatus
.
addIndexStatusListener
in interface Book
listener
- the IndexStatusListener
to be addedpublic void removeIndexStatusListener(IndexStatusListener listener)
Book
IndexStatusListener
from the listener list.removeIndexStatusListener
in interface Book
listener
- 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()
Book
public int compareTo(Book obj)
compareTo
in interface Comparable<Book>