org.crosswire.jsword.book.sword
Class ConfigEntryType

java.lang.Object
  extended by org.crosswire.jsword.book.sword.ConfigEntryType
All Implemented Interfaces:
Serializable

public class ConfigEntryType
extends Object
implements Serializable

Constants for the keys in a SwordConfig 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

Keys that might be available that we are ignoring for now:

  • DistributionLicense: single value coded string, a ';' separated string of license attributes There are mis-spellings, etc. so there is a need for a distributionLicenseAdditionalInfo field. (Ugh!) See also SwordConstants.DISTIBUTION_LICENSE_STRINGS.
         // Returns the distributionLicense - this is a 'flag type' field - the value
         // will be the result of several constants ORed. See the
         // DISTRIBUTION_LICENSE* constants in SwordConstants. It appears some
         // versions do not stick to this convention, because of this, there is an
         // additional menber distributionLicenseAdditionInfo, to store additional
         // information.
         private int distributionLicense;
         private String distributionLicenseAdditionalInfo = "";
         String licensesString = reader.getFirstValue("DistributionLicense");
         if (licensesString != null)
         {
             StringTokenizer tok = new StringTokenizer(licensesString, ";");
             while (tok.hasMoreTokens())
             {
                 String distributionLicenseString = tok.nextToken().trim();
                 int index = matchingIndex(SwordConstants.DISTIBUTION_LICENSE_STRINGS, distributionLicenseString, -1);
                 if (index != -1)
                 {
                     distributionLicense |= 1 << index;
                 }
                 else
                 {
                     if (!distributionLicenseAdditionalInfo.equals(""))
                     {
                         distributionLicenseAdditionalInfo += "; ";
                     }
                     distributionLicenseAdditionalInfo += distributionLicenseString;
                 }
             }
         }
         

    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

    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
    static ConfigEntryType CATEGORY
              The Category of the book.
    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.
    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_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
    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
    static String DIRECTION_RTOL
               
    static ConfigEntryType DISPLAY_LEVEL
              single value integer, unknown use, some indications that we ought to be using it
    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.
    static ConfigEntryType FEATURE
              A Feature describes a characteristic of the Book.
    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.
    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 LANG
              single value string, defaults to en, the language of the book
    static ConfigEntryType LANGUAGE
              single value string, unknown use While Lang is an IS0-639 or ethnolog value, this is a friendly representation of the same.
    static ConfigEntryType LANGUAGE_FROM
              For a GLOSSARY_FROM, this is the friendly version of the same.
    static ConfigEntryType LANGUAGE_TO
              For a GLOSSARY_TO, this is the friendly version of the same.
    static ConfigEntryType LCSH
              Library of Congress Subject Heading.
    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  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.
    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.
    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
     
    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.
     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

    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


    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_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 and Arabic is RtoL. Most are 'LtoR'. Some are 'bidi', bi-directional. E.g. hebrew-english glossary.


    DISPLAY_LEVEL

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


    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. TODO(DMS): layout the glossary based on the direction of the FROM.


    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. TODO(DMS): use this to present the user with a pick list of books for Strongs, and Heb/Greek Def/Parse. We should also use DailyDevotional to map the days to a date.


    FONT

    public static final ConfigEntryType FONT
    A recommended font to use for the book. TODO(DMS): Use this font. TODO(DMS): Allow a user to associate a font with a 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. Informational only.


    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.


    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.


    LANGUAGE

    public static final ConfigEntryType LANGUAGE
    single value string, unknown use While Lang is an IS0-639 or ethnolog value, this is a friendly representation of the same.


    LANGUAGE_FROM

    public static final ConfigEntryType LANGUAGE_FROM
    For a GLOSSARY_FROM, this is the friendly version of the same.


    LANGUAGE_TO

    public static final ConfigEntryType LANGUAGE_TO
    For a GLOSSARY_TO, this is the friendly version of the same.


    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


    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

    name

    private String name
    The name of 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

    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

    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-2006