org.crosswire.jsword.book.sword
Class SwordBookMetaData

java.lang.Object
  extended by org.crosswire.jsword.book.basic.AbstractBookMetaData
      extended by org.crosswire.jsword.book.sword.SwordBookMetaData
All Implemented Interfaces:
Comparable, BookMetaData

public class SwordBookMetaData
extends AbstractBookMetaData

A utility class for loading and representing Sword module configs.

Config file format. See also: http://sword.sourceforge.net/cgi-bin/twiki/view/Swordapi/ConfFileLayout

The contents of the About field are in rtf.

\ is used as a continuation line.

Distribution Licence:
JSword is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2 as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
The License is available on the internet here, or by writing to: Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
The copyright to this program is held by it's authors.

Version:
$Id: SwordBookMetaData.java,v 1.40 2005/03/21 02:37:28 dmsmith Exp $
Author:
Mark Goodwin [mark at thorubio dot org], Joe Walker [joe at eireneh dot com], Jacky Cheung, DM Smith [dmsmith555 at yahoo dot com]
See Also:
Licence

Field Summary
private  ConfigEntryTable cet
           
(package private) static Map ENCODING_JAVA
          The language strings need to be converted to Java charsets
 
Fields inherited from class org.crosswire.jsword.book.basic.AbstractBookMetaData
DEFAULT_LANG_CODE
 
Fields inherited from interface org.crosswire.jsword.book.BookMetaData
KEY_BOOK, KEY_DRIVER, KEY_INDEXSTATUS, KEY_INITIALS, KEY_LANGUAGE, KEY_NAME, KEY_TYPE
 
Constructor Summary
SwordBookMetaData(File file, String internal)
          Loads a sword config from a given File.
SwordBookMetaData(Reader in, String internal)
          Loads a sword config from a given Reader.
 
Method Summary
private  void buildProperties()
           
 String getConfPath()
           
 Filter getFilter()
          Returns the sourceType.
 String getInitials()
          The initials of this book - how people familiar with this book will know it, for example "NIV", "KJV".
 String getModuleCharset()
          Returns the Charset of the module based on the encoding attribute
 String getModulePath()
           
 ModuleType getModuleType()
          Returns the Module Type.
 String getName()
          The name of the book, for example "King James Version" or "Bible in Basic English" or "Greek".
 String getProperty(ConfigEntryType entry)
          Get the string value for the property or null if it is not defined.
 BookType getType()
          What type of content is this, a Bible or a reference work like a Dictionary or Commentary
 boolean hasFeature(FeatureType feature)
          Return whether the feature is supported by the book.
 boolean isLeftToRight()
          Return the orientation of the language of the Book.
 boolean isSupported()
          Is this one of the supported book types?
 org.jdom.Document toOSIS()
          Get an OSIS representation of information concerning this Book.
 
Methods inherited from class org.crosswire.jsword.book.basic.AbstractBookMetaData
addPropertyChangeListener, compareTo, equals, firePropertyChange, getDriver, getDriverName, getFullName, getIndexStatus, getLanguage, getLanguage, getOsisID, getProperties, getProperty, hashCode, putProperty, removePropertyChangeListener, setDriver, setIndexStatus, setProperties, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ENCODING_JAVA

static final Map ENCODING_JAVA
The language strings need to be converted to Java charsets


cet

private ConfigEntryTable cet
Constructor Detail

SwordBookMetaData

public SwordBookMetaData(File file,
                         String internal)
                  throws IOException
Loads a sword config from a given File. The returned BookMetaData object will not be associated with a Book so setBook() should be called before getBook() is expected to return anything other than null.

Throws:
IOException

SwordBookMetaData

public SwordBookMetaData(Reader in,
                         String internal)
                  throws IOException
Loads a sword config from a given Reader. The returned BookMetaData object will not be associated with a Book so setBook() should be called before getBook() is expected to return anything other than null.

Throws:
IOException
Method Detail

isSupported

public boolean isSupported()
Is this one of the supported book types?


getName

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

getModuleCharset

public String getModuleCharset()
Returns the Charset of the module based on the encoding attribute

Returns:
the charset of the module.

getModuleType

public ModuleType getModuleType()
Returns the Module Type.


getFilter

public Filter getFilter()
Returns the sourceType.


getConfPath

public String getConfPath()
Returns:
Returns the relative path of the module's conf.

getModulePath

public String getModulePath()
Returns:
the relative path of the module.

getType

public BookType getType()
Description copied from interface: BookMetaData
What type of content is this, a Bible or a reference work like a Dictionary or Commentary

Returns:
The type of book

toOSIS

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

Specified by:
toOSIS in interface BookMetaData
Overrides:
toOSIS in class AbstractBookMetaData

getInitials

public String getInitials()
Description copied from interface: BookMetaData
The initials of this book - how people familiar with this book will know it, for example "NIV", "KJV".

Returns:
The book's initials

getProperty

public String getProperty(ConfigEntryType entry)
Get the string value for the property or null if it is not defined. It is assumed that all properties gotten with this method are single line.

Parameters:
entry - the ConfigEntryType
Returns:
the property or null

isLeftToRight

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

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
Overrides:
hasFeature in class AbstractBookMetaData

buildProperties

private void buildProperties()

Copyright ? 2003-2004