org.crosswire.jsword.book.sword
Class ConfigEntryType

java.lang.Object
  extended by org.crosswire.jsword.book.sword.ConfigEntryType
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
ConfigEntryType.ConfigEntryPickType, ConfigEntryType.ConfigEntrySyntheticType

public class ConfigEntryType
extends Object
implements Serializable

Constants for the keys in a Sword Config file. Taken from http://sword.sourceforge.net/cgi-bin/twiki/view/Swordapi/ConfFileLayout now located at http://www.crosswire.org/ucgi-bin/twiki/view/Swordapi/ConfFileLayout now located at http://www.crosswire.org/wiki/index.php/DevTools:Modules

Author:
Joe Walker [joe at eireneh dot com], DM Smith [dmsmith555 at yahoo dot com]
See Also:
for license details. The copyright to this program is held by it's authors., Serialized Form

Nested Class Summary
static class ConfigEntryType.ConfigEntryPickType
          A ConfigEntryPickType is a ConfigEntryType that allows values from a pick list.
static class ConfigEntryType.ConfigEntrySyntheticType
          Represents a ConfigEntryType that is not actually represented by the Sword Config file.
 
Field Summary
static ConfigEntryType ABOUT
          Contains rtf that describes the book.
static ConfigEntryType BLOCK_COUNT
          single value integer, unknown use, some indications that we ought to be using it
static ConfigEntryType BLOCK_TYPE
          The level at which compression is applied, BOOK, CHAPTER, or VERSE
private static String[] BLOCK_TYPE_PICKS
           
private static String[] BOOLEAN_PICKS
           
static ConfigEntryType CATEGORY
          The Category of the book.
private static String[] CATEGORY_PICKS
           
static ConfigEntryType CIPHER_KEY
          If this exists in the conf, then the book is encrypted.
static ConfigEntryType COMPRESS_TYPE
          The type of compression in use.
private static String[] COMPRESS_TYPE_PICKS
           
static ConfigEntryType COPYRIGHT
          Informational copyright notice.
static ConfigEntryType COPYRIGHT_CONTACT_ADDRESS
          Copyright info.
static ConfigEntryType COPYRIGHT_CONTACT_EMAIL
          Copyright info.
static ConfigEntryType COPYRIGHT_CONTACT_NAME
          Copyright info.
static ConfigEntryType COPYRIGHT_CONTACT_NOTES
          Copyright info.
static ConfigEntryType COPYRIGHT_DATE
          Copyright info.
static ConfigEntryType COPYRIGHT_HOLDER
          single value string, unknown use
static ConfigEntryType COPYRIGHT_NOTES
          Copyright info.
static ConfigEntryType DATA_PATH
          Relative path to the data files, some issues with this
private  Object defaultValue
          The default for the ConfigEntryType
static ConfigEntryType DESCRIPTION
          The full name of this book
static ConfigEntryType DIRECTION
          The layout direction of the text in the book.
static String DIRECTION_BIDI
           
static String DIRECTION_LTOR
          Constants for direction
private static String[] DIRECTION_PICKS
           
static String DIRECTION_RTOL
           
static ConfigEntryType DISPLAY_LEVEL
          Display level is used by GenBooks to do auto expansion in the tree.
static ConfigEntryType DISTRIBUTION_LICENSE
          Copyright info.
static ConfigEntryType DISTRIBUTION_NOTES
          Copyright info.
static ConfigEntryType DISTRIBUTION_SOURCE
          Similar to DataPath.
static ConfigEntryType ENCODING
          The character encoding.
private static String[] ENCODING_PICKS
           
static ConfigEntryType FEATURE
          A Feature describes a characteristic of the Book.
private static String[] FEATURE_PICKS
           
static ConfigEntryType FONT
          A recommended font to use for the book.
static ConfigEntryType GLOBAL_OPTION_FILTER
          Global Option Filters are the names of routines in Sword that can be used to display the data.
private static String[] GLOBAL_OPTION_FILTER_PICKS
           
static ConfigEntryType GLOSSARY_FROM
          Books with a Feature of Glossary are used to map words FROM one language TO another.
static ConfigEntryType GLOSSARY_TO
          Books with a Feature of Glossary are used to map words FROM one language TO another.
static ConfigEntryType HISTORY
          multiple values starting with History, some sort of change-log.
static ConfigEntryType INITIALS
          The abbreviated name by which this book is known.
static ConfigEntryType INSTALL_SIZE
          The installed size of the book in bytes.
static ConfigEntryType KEY_TYPE
          The kind of key that a Generic Book uses.
private static String[] KEY_TYPE_PICKS
           
static ConfigEntryType LANG
          single value string, defaults to en, the language of the book
static ConfigEntryType LCSH
          Library of Congress Subject Heading.
static ConfigEntryType LIBRARY_URL
          The location of a collection of modules.
private static String[] LICENSE_PICKS
           
static ConfigEntryType LOCATION_URL
          The location of the module.
static ConfigEntryType MINIMUM_VERSION
          single value version number, lowest sword c++ version that can read this book JSword does not use this value.
static ConfigEntryType MOD_DRV
          This indicates how the book was stored.
private static String[] MOD_DRV_PICKS
           
private  String name
          The name of the ConfigEntryType
private static int nextObj
           
private  int obj
           
static ConfigEntryType OBSOLETES
          A list of prior "initials" for the current book.
static ConfigEntryType OSIS_Q_TO_TICK
          When false do not show quotation marks for OSIS text that has elements.
static ConfigEntryType OSIS_VERSION
          single value version number, lowest sword c++ version that can read this book JSword does not use this value.
private static long serialVersionUID
          Serialization ID
static ConfigEntryType SHORT_COPYRIGHT
          A one line copyright statement, required by Lockman for NASB
static ConfigEntryType SHORT_PROMO
          A one line promo statement, required by Lockman for NASB
static ConfigEntryType SOURCE_TYPE
          This indicates the kind of markup used for the book.
private static String[] SOURCE_TYPE_PICKS
           
static ConfigEntryType SWORD_VERSION_DATE
          The date that this version of the book was last updated.
static ConfigEntryType TEXT_SOURCE
          Information on where the book's text was obtained.
private static ConfigEntryType[] VALUES
           
static ConfigEntryType VERSION
          An informational string indicating the current version of the book.
 
Constructor Summary
protected ConfigEntryType(String name)
          Simple ctor
protected ConfigEntryType(String name, Object defaultValue)
          Simple ctor
 
Method Summary
 boolean allowsContinuation()
          While most fields are single line or single value, some allow continuation.
 boolean allowsRTF()
          RTF is allowed in a few config entries.
 Object convert(String input)
          Convert the string value from the conf into the representation of this ConfigEntryType.
 boolean equals(Object o)
          Prevent subclasses from overriding canonical identity based Object methods
 String filter(String value)
          Modify the value if necessary.
static ConfigEntryType fromInteger(int i)
          Lookup method to convert from an integer
static ConfigEntryType fromString(String name)
          Lookup method to convert from a String
 Object getDefault()
          Some ConfigEntryTypes have defaults.
 String getName()
          Returns the normalized name of this ConfigEntry.
protected  boolean hasChoices()
          Some keys can repeat.
 int hashCode()
          Prevent subclasses from overriding canonical identity based Object methods
 boolean isAllowed(String value)
          Determines whether the string is allowed.
 boolean isSynthetic()
          Synthetic keys are those that are not in the Sword Book's conf, but are needed by the program.
 boolean mayRepeat()
          Some keys can repeat.
(package private)  Object readResolve()
           
 boolean reportDetails()
          Determines the level of detail stored in the histogram.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DIRECTION_LTOR

public static final String DIRECTION_LTOR
Constants for direction

See Also:
Constant Field Values

DIRECTION_RTOL

public static final String DIRECTION_RTOL
See Also:
Constant Field Values

DIRECTION_BIDI

public static final String DIRECTION_BIDI
See Also:
Constant Field Values

BLOCK_TYPE_PICKS

private static final String[] BLOCK_TYPE_PICKS

BOOLEAN_PICKS

private static final String[] BOOLEAN_PICKS

KEY_TYPE_PICKS

private static final String[] KEY_TYPE_PICKS

CATEGORY_PICKS

private static final String[] CATEGORY_PICKS

COMPRESS_TYPE_PICKS

private static final String[] COMPRESS_TYPE_PICKS

DIRECTION_PICKS

private static final String[] DIRECTION_PICKS

LICENSE_PICKS

private static final String[] LICENSE_PICKS

ENCODING_PICKS

private static final String[] ENCODING_PICKS

GLOBAL_OPTION_FILTER_PICKS

private static final String[] GLOBAL_OPTION_FILTER_PICKS

FEATURE_PICKS

private static final String[] FEATURE_PICKS

MOD_DRV_PICKS

private static final String[] MOD_DRV_PICKS

SOURCE_TYPE_PICKS

private static final String[] SOURCE_TYPE_PICKS

ABOUT

public static final ConfigEntryType ABOUT
Contains rtf that describes the book.


BLOCK_COUNT

public static final ConfigEntryType BLOCK_COUNT
single value integer, unknown use, some indications that we ought to be using it


BLOCK_TYPE

public static final ConfigEntryType BLOCK_TYPE
The level at which compression is applied, BOOK, CHAPTER, or VERSE


KEY_TYPE

public static final ConfigEntryType KEY_TYPE
The kind of key that a Generic Book uses.


CATEGORY

public static final ConfigEntryType CATEGORY
The Category of the book. Used on the web to classify books into a tree.


CIPHER_KEY

public static final ConfigEntryType CIPHER_KEY
If this exists in the conf, then the book is encrypted. The value is used to unlock the book. The encryption algorithm is Sapphire.


COMPRESS_TYPE

public static final ConfigEntryType COMPRESS_TYPE
The type of compression in use. JSword does not support LZSS. While it is the default, it is not used. At least so far.


COPYRIGHT

public static final ConfigEntryType COPYRIGHT
Informational copyright notice.


COPYRIGHT_CONTACT_ADDRESS

public static final ConfigEntryType COPYRIGHT_CONTACT_ADDRESS
Copyright info. Informational only.


COPYRIGHT_CONTACT_EMAIL

public static final ConfigEntryType COPYRIGHT_CONTACT_EMAIL
Copyright info. Informational only.


COPYRIGHT_CONTACT_NAME

public static final ConfigEntryType COPYRIGHT_CONTACT_NAME
Copyright info. Informational only.


COPYRIGHT_CONTACT_NOTES

public static final ConfigEntryType COPYRIGHT_CONTACT_NOTES
Copyright info. Informational only.


COPYRIGHT_DATE

public static final ConfigEntryType COPYRIGHT_DATE
Copyright info. Informational only. This is a year, a year range or a comma separated list of these.


COPYRIGHT_HOLDER

public static final ConfigEntryType COPYRIGHT_HOLDER
single value string, unknown use


COPYRIGHT_NOTES

public static final ConfigEntryType COPYRIGHT_NOTES
Copyright info. Informational only.


DATA_PATH

public static final ConfigEntryType DATA_PATH
Relative path to the data files, some issues with this


DESCRIPTION

public static final ConfigEntryType DESCRIPTION
The full name of this book


DIRECTION

public static final ConfigEntryType DIRECTION
The layout direction of the text in the book. Hebrew, Arabic and Farsi RtoL. Most are 'LtoR'. Some are 'bidi', bi-directional. E.g. hebrew-english glossary.


DISPLAY_LEVEL

public static final ConfigEntryType DISPLAY_LEVEL
Display level is used by GenBooks to do auto expansion in the tree. A level of 2 indicates that the first two levels should be shown.


DISTRIBUTION_LICENSE

public static final ConfigEntryType DISTRIBUTION_LICENSE
Copyright info. Informational only.


DISTRIBUTION_NOTES

public static final ConfigEntryType DISTRIBUTION_NOTES
Copyright info. Informational only.


DISTRIBUTION_SOURCE

public static final ConfigEntryType DISTRIBUTION_SOURCE
Similar to DataPath. It gives where on the CrossWire server the book can be found. Informational only.


ENCODING

public static final ConfigEntryType ENCODING
The character encoding. Only Latin-1 and UTF-8 are supported.


GLOBAL_OPTION_FILTER

public static final ConfigEntryType GLOBAL_OPTION_FILTER
Global Option Filters are the names of routines in Sword that can be used to display the data. These are not used by JSword.


GLOSSARY_FROM

public static final ConfigEntryType GLOSSARY_FROM
Books with a Feature of Glossary are used to map words FROM one language TO another.


GLOSSARY_TO

public static final ConfigEntryType GLOSSARY_TO
Books with a Feature of Glossary are used to map words FROM one language TO another.


HISTORY

public static final ConfigEntryType HISTORY
multiple values starting with History, some sort of change-log. In the conf these are of the form History_x.y. We strip off the x.y and prefix the value with it. The x.y corresponds to a current or prior Version value.


INSTALL_SIZE

public static final ConfigEntryType INSTALL_SIZE
The installed size of the book in bytes. This is not the size of the zip that is downloaded.


FEATURE

public static final ConfigEntryType FEATURE
A Feature describes a characteristic of the Book.


FONT

public static final ConfigEntryType FONT
A recommended font to use for the book.


LANG

public static final ConfigEntryType LANG
single value string, defaults to en, the language of the book


LCSH

public static final ConfigEntryType LCSH
Library of Congress Subject Heading. Typically this is of the form BookCategory Scope Language, where scope is typically O.T., N.T.


MOD_DRV

public static final ConfigEntryType MOD_DRV
This indicates how the book was stored.


MINIMUM_VERSION

public static final ConfigEntryType MINIMUM_VERSION
single value version number, lowest sword c++ version that can read this book JSword does not use this value.


OBSOLETES

public static final ConfigEntryType OBSOLETES
A list of prior "initials" for the current book. TODO(dms): when a user installs a book with an obsoletes that matches an installed book, offer the user the opportunity to delete the old book.


SOURCE_TYPE

public static final ConfigEntryType SOURCE_TYPE
This indicates the kind of markup used for the book.


SWORD_VERSION_DATE

public static final ConfigEntryType SWORD_VERSION_DATE
The date that this version of the book was last updated. Informational only.


TEXT_SOURCE

public static final ConfigEntryType TEXT_SOURCE
Information on where the book's text was obtained.


VERSION

public static final ConfigEntryType VERSION
An informational string indicating the current version of the book.


OSIS_Q_TO_TICK

public static final ConfigEntryType OSIS_Q_TO_TICK
When false do not show quotation marks for OSIS text that has elements.


OSIS_VERSION

public static final ConfigEntryType OSIS_VERSION
single value version number, lowest sword c++ version that can read this book JSword does not use this value.


INITIALS

public static final ConfigEntryType INITIALS
The abbreviated name by which this book is known. This is in the [] on the first non-blank line of the conf. JSword uses this for display and access purposes.


SHORT_PROMO

public static final ConfigEntryType SHORT_PROMO
A one line promo statement, required by Lockman for NASB


SHORT_COPYRIGHT

public static final ConfigEntryType SHORT_COPYRIGHT
A one line copyright statement, required by Lockman for NASB


LIBRARY_URL

public static final ConfigEntryType LIBRARY_URL
The location of a collection of modules. JSword uses this to install and delete a module.


LOCATION_URL

public static final ConfigEntryType LOCATION_URL
The location of the module. JSword uses this to access a module.


name

private String name
The name of the ConfigEntryType


defaultValue

private Object defaultValue
The default for the ConfigEntryType


serialVersionUID

private static final long serialVersionUID
Serialization ID

See Also:
Constant Field Values

nextObj

private static int nextObj

obj

private final int obj

VALUES

private static final ConfigEntryType[] VALUES
Constructor Detail

ConfigEntryType

protected ConfigEntryType(String name)
Simple ctor


ConfigEntryType

protected ConfigEntryType(String name,
                          Object defaultValue)
Simple ctor

Method Detail

getName

public String getName()
Returns the normalized name of this ConfigEntry.

Returns:
the name

isAllowed

public boolean isAllowed(String value)
Determines whether the string is allowed. For some config entries, the value is expected to be one of a group, for others the format is defined.

Parameters:
value - the string to be checked
Returns:
true if the string is allowed

filter

public String filter(String value)
Modify the value if necessary.

Parameters:
value - the input
Returns:
either value or a modified version of it.

allowsRTF

public boolean allowsRTF()
RTF is allowed in a few config entries.

Returns:
true if rtf is allowed

allowsContinuation

public boolean allowsContinuation()
While most fields are single line or single value, some allow continuation. A continuation mark is a backslash at the end of a line. It is not to be followed by whitespace.

Returns:
true if continuation is allowed

mayRepeat

public boolean mayRepeat()
Some keys can repeat. When this happens each is a single value pick from a list of choices.

Returns:
true if this ConfigEntryType can occur more than once

reportDetails

public boolean reportDetails()
Determines the level of detail stored in the histogram.

Returns:
true if the ConfigEntry should report histogram for repetitions

hasChoices

protected boolean hasChoices()
Some keys can repeat. When this happens each is a single value pick from a list of choices.

Returns:
true if this ConfigEntryType can occur more than once

isSynthetic

public boolean isSynthetic()
Synthetic keys are those that are not in the Sword Book's conf, but are needed by the program. Typically, these are derived by the program from the other entries.

Returns:
true if this is synthetic

getDefault

public Object getDefault()
Some ConfigEntryTypes have defaults.

Returns:
the default, if there is one, null otherwise

convert

public Object convert(String input)
Convert the string value from the conf into the representation of this ConfigEntryType.

Returns:
the converted object

fromString

public static ConfigEntryType fromString(String name)
Lookup method to convert from a String


fromInteger

public static ConfigEntryType fromInteger(int i)
Lookup method to convert from an integer


equals

public final boolean equals(Object o)
Prevent subclasses from overriding canonical identity based Object methods

Overrides:
equals in class Object
See Also:
Object.equals(java.lang.Object)

hashCode

public final int hashCode()
Prevent subclasses from overriding canonical identity based Object methods

Overrides:
hashCode in class Object
See Also:
Object.hashCode()

toString

public String toString()
Overrides:
toString in class Object

readResolve

Object readResolve()

Copyright ยจ 2003-2007