|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.crosswire.jsword.book.sword.ConfigEntryTable
public class ConfigEntryTable
A utility class for loading the entries in a Sword module's conf file. Since the conf files are manually maintained, there can be all sorts of errors in them. This class does robust checking and reporting.
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. |
Licence
Field Summary | |
---|---|
static ConfigEntryType[] |
BASIC_INFO
|
static ConfigEntryType[] |
COPYRIGHT_INFO
|
static ConfigEntryType[] |
FEATURE_INFO
|
private String |
internal
The original name of this config file from mods.d. |
static ConfigEntryType[] |
LANG_INFO
|
private static Logger |
log
The log stream |
private ModuleType |
moduleType
The ModuleType for this ConfigEntry |
private String |
readahead
A helper for the reading of the conf file. |
static ConfigEntryType[] |
REQUIRED
These are the elements that JSword requires. |
private boolean |
supported
True if this module's config type can be used by JSword. |
static ConfigEntryType[] |
SYSTEM_INFO
|
private Map |
table
A map of lists of known config entries. |
Constructor Summary | |
---|---|
ConfigEntryTable(Reader in,
String moduleName)
Loads a sword config from a given Reader. |
Method Summary | |
---|---|
private void |
add(ConfigEntryType type,
String aValue)
A helper to create/replace a value for a given type. |
private void |
adjustBookType()
|
private void |
adjustLanguage()
|
private void |
adjustName()
|
private String |
advance(BufferedReader bin)
Get the next line from the input |
private void |
backup(String oops)
Read too far ahead and need to return a line. |
private void |
getContinuation(ConfigEntry configEntry,
BufferedReader bin,
StringBuffer buf)
Get continuation lines, if any. |
Iterator |
getKeys()
Returns an Enumeration of all the keys found in the config file. |
ModuleType |
getModuleType()
Returns an Enumeration of all the keys found in the config file. |
Object |
getValue(ConfigEntryType type)
Gets a particular ConfigEntry's value by its type |
private boolean |
isKeyLine(String line)
Does this line of text represent a key/value pair? |
boolean |
isSupported()
Determines whether the Sword Module's conf is supported by JSword. |
private void |
loadContents(BufferedReader in)
|
private void |
loadFile(Reader in)
|
private void |
loadInitials(BufferedReader in)
|
boolean |
match(ConfigEntryType type,
Object search)
Determine whether this ConfigEntryTable has the ConfigEntry and it matches the value. |
org.jdom.Element |
toOSIS()
Sort the keys for a more meaningful presentation order. |
private void |
toOSIS(OSISUtil.ObjectFactory factory,
org.jdom.Element ele,
String aTitle,
ConfigEntryType[] category)
Build an ordered map so that it displays in a consistent order. |
private void |
validate()
Determine which books are not supported. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final ConfigEntryType[] REQUIRED
public static final ConfigEntryType[] BASIC_INFO
public static final ConfigEntryType[] LANG_INFO
public static final ConfigEntryType[] COPYRIGHT_INFO
public static final ConfigEntryType[] FEATURE_INFO
public static final ConfigEntryType[] SYSTEM_INFO
private static final Logger log
private boolean supported
private ModuleType moduleType
private Map table
private String internal
private String readahead
Constructor Detail |
---|
public ConfigEntryTable(Reader in, String moduleName) throws IOException
IOException
Method Detail |
---|
public boolean isSupported()
public Iterator getKeys()
public ModuleType getModuleType()
public Object getValue(ConfigEntryType type)
type
- of the ConfigEntry
public boolean match(ConfigEntryType type, Object search)
type
- The kind of ConfigEntry to look forsearch
- the value to match against
public org.jdom.Element toOSIS()
private void loadFile(Reader in) throws IOException
IOException
private void loadContents(BufferedReader in) throws IOException
IOException
private void loadInitials(BufferedReader in) throws IOException
IOException
private void getContinuation(ConfigEntry configEntry, BufferedReader bin, StringBuffer buf) throws IOException
IOException
private String advance(BufferedReader bin) throws IOException
bin
- The reader to get data from
IOException
private void backup(String oops)
private boolean isKeyLine(String line)
private void add(ConfigEntryType type, String aValue)
type
- aValue
- private void adjustLanguage()
private void adjustBookType()
private void adjustName()
private void validate()
private void toOSIS(OSISUtil.ObjectFactory factory, org.jdom.Element ele, String aTitle, ConfigEntryType[] category)
|
Copyright ? 2003-2004 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |