org.crosswire.jsword.book.basic
Class AbstractBookMetaData

java.lang.Object
  extended by org.crosswire.jsword.book.basic.AbstractBookMetaData
All Implemented Interfaces:
Comparable<BookMetaData>, BookMetaData
Direct Known Subclasses:
DefaultBookMetaData, SwordBookMetaData

public abstract class AbstractBookMetaData
extends Object
implements BookMetaData

Author:
DM Smith
See Also:
for license details.
The copyright to this program is held by it's authors.

Field Summary
private  BookDriver driver
           
private  IndexStatus indexStatus
           
private  Map<String,Object> prop
          The single key version of the properties
 
Fields inherited from interface org.crosswire.jsword.book.BookMetaData
KEY_BOOK, KEY_CATEGORY, KEY_DRIVER, KEY_FONT, KEY_INDEXSTATUS, KEY_INITIALS, KEY_LIBRARY_URI, KEY_LOCATION_URI, KEY_NAME, KEY_VERSIFICATION, KEY_XML_LANG
 
Constructor Summary
AbstractBookMetaData()
           
 
Method Summary
 int compareTo(BookMetaData obj)
           
 boolean equals(Object obj)
           
 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?
 KeyType getKeyType()
          How this Book organizes it's keys.
 Language getLanguage()
          The language of the book.
 URI getLibrary()
          Get the base URI for library of this module.
 URI getLocation()
          Get the base URI for relative URIs in the document.
 String getOsisID()
          Calculated field: Get an OSIS identifier for the OsisText.setOsisIDWork() and the Work.setOsisWork() methods.
 Map<String,Object> getProperties()
          Get a list of all the properties available to do with this Book.
 Object getProperty(String key)
           
 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 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 putProperty(String key, Object value)
           
 void setDriver(BookDriver driver)
           
 void setIndexStatus(IndexStatus newValue)
          This method does not alter the index status, however it is for Indexers that are responsible for indexing and have changed the status themselves.
 void setLanguage(Language language)
           
 void setLibrary(URI library)
          Set the base URI for library of this module.
 void setLocation(URI location)
          Set the base URI for relative URIs in the document.
 void setProperties(Map<String,Object> newProperties)
           
 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.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.crosswire.jsword.book.BookMetaData
getBookCategory, getInitials, getName, isLeftToRight
 

Field Detail

prop

private Map<String,Object> prop
The single key version of the properties


driver

private BookDriver driver

indexStatus

private IndexStatus indexStatus
Constructor Detail

AbstractBookMetaData

public AbstractBookMetaData()
Method Detail

getKeyType

public KeyType getKeyType()
Description copied from interface: BookMetaData
How this Book organizes it's keys.

Specified by:
getKeyType in interface BookMetaData
Returns:
the organization of keys of this Book

getDriver

public BookDriver getDriver()
Description copied from interface: BookMetaData
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.

Specified by:
getDriver in interface BookMetaData

getDriverName

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

Specified by:
getDriverName in interface BookMetaData
Returns:
The driver name

hasFeature

public boolean hasFeature(FeatureType feature)
Description copied from interface: BookMetaData
Return whether the feature is supported by the book.

Specified by:
hasFeature in interface BookMetaData

getOsisID

public String getOsisID()
Description copied from interface: BookMetaData
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

Specified by:
getOsisID in interface BookMetaData
Returns:
The osis id of this book

isSupported

public boolean isSupported()
Description copied from interface: BookMetaData
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.

Specified by:
isSupported in interface BookMetaData
Returns:
true if the book is supported

isEnciphered

public boolean isEnciphered()
Description copied from interface: BookMetaData
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.

Specified by:
isEnciphered in interface BookMetaData
Returns:
true if the book is enciphered

isLocked

public boolean isLocked()
Description copied from interface: BookMetaData
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.

Specified by:
isLocked in interface BookMetaData
Returns:
true if the book is locked

unlock

public boolean unlock(String unlockKey)
Description copied from interface: BookMetaData
Unlocks a book with the given key.

Specified by:
unlock in interface BookMetaData
Parameters:
unlockKey - the key to try
Returns:
true if the unlock key worked.

getUnlockKey

public String getUnlockKey()
Description copied from interface: BookMetaData
Gets the unlock key for the module.

Specified by:
getUnlockKey in interface BookMetaData
Returns:
the unlock key, if any, null otherwise.

isQuestionable

public boolean isQuestionable()
Description copied from interface: BookMetaData
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.

Specified by:
isQuestionable in interface BookMetaData
Returns:
true if the book is questionable

getLanguage

public Language getLanguage()
Description copied from interface: BookMetaData
The language of the book.

Specified by:
getLanguage in interface BookMetaData
Returns:
the book's language

setLanguage

public void setLanguage(Language language)
Parameters:
language - The language to set.

getLibrary

public URI getLibrary()
Description copied from interface: BookMetaData
Get the base URI for library of this module.

Specified by:
getLibrary in interface BookMetaData
Returns:
the base URI or null if there is none

setLibrary

public void setLibrary(URI library)
                throws MissingDataFilesException
Description copied from interface: BookMetaData
Set the base URI for library of this module.

Specified by:
setLibrary in interface BookMetaData
Parameters:
library - the base URI or null if there is none
Throws:
MissingDataFilesException - indicates missing data files

setLocation

public void setLocation(URI location)
Description copied from interface: BookMetaData
Set the base URI for relative URIs in the document.

Specified by:
setLocation in interface BookMetaData
Parameters:
location - the base URI or null if there is none

getLocation

public URI getLocation()
Description copied from interface: BookMetaData
Get the base URI for relative URIs in the document.

Specified by:
getLocation in interface BookMetaData
Returns:
the base URI or null if there is none

getProperties

public Map<String,Object> getProperties()
Description copied from interface: BookMetaData
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.

Specified by:
getProperties in interface BookMetaData

setProperties

public void setProperties(Map<String,Object> newProperties)
Parameters:
newProperties -

getProperty

public Object getProperty(String key)
Specified by:
getProperty in interface BookMetaData
Parameters:
key - the key of the property.
Returns:
the value of the property

putProperty

public void putProperty(String key,
                        Object value)
Specified by:
putProperty in interface BookMetaData
Parameters:
key - the key of the property to set
value - the value of the property

getIndexStatus

public IndexStatus getIndexStatus()
Description copied from interface: BookMetaData
Has anyone generated a search index for this Book?

Specified by:
getIndexStatus in interface BookMetaData
See Also:
IndexManager

setIndexStatus

public void setIndexStatus(IndexStatus newValue)
Description copied from interface: BookMetaData
This method does not alter the index status, however it is for Indexers that are responsible for indexing and have changed the status themselves.

Specified by:
setIndexStatus in interface BookMetaData
See Also:
IndexManager

toOSIS

public org.jdom2.Document toOSIS()
Description copied from interface: BookMetaData
Get an OSIS representation of information concerning this Book.

Specified by:
toOSIS in interface BookMetaData

setDriver

public void setDriver(BookDriver driver)
Parameters:
driver - The driver to set.

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

compareTo

public int compareTo(BookMetaData obj)
Specified by:
compareTo in interface Comparable<BookMetaData>

toString

public String toString()
Overrides:
toString in class Object

Copyright ? 2003-2011