[jsword-svn] jsword/java/jsword/org/crosswire/jsword/book/sword s

jswordcvs at crosswire.org jswordcvs at crosswire.org
Sat Jun 11 13:41:06 MST 2005


Update of /cvs/jsword/jsword/java/jsword/org/crosswire/jsword/book/sword
In directory www.crosswire.org:/tmp/cvs-serv27268/java/jsword/org/crosswire/jsword/book/sword

Modified Files:
	GZIPBackend.java SwordBookDriver.java ConfigEntryType.java 
	RawLDBackend.java SwordBook.java package.html Msg.java 
	RawBackend.java BlockType.java ConfigEntryTable.java 
	Msg.properties ConfigEntry.java SwordBookMetaData.java 
Added Files:
	BookType.java 
Removed Files:
	ModuleType.java 
Log Message:
Made showing the sidebar a default and set it to no.
Cleaned up the code to consistently use "book" to refer to "module"

Index: SwordBookMetaData.java
===================================================================
RCS file: /cvs/jsword/jsword/java/jsword/org/crosswire/jsword/book/sword/SwordBookMetaData.java,v
retrieving revision 1.44
retrieving revision 1.45
diff -C2 -d -r1.44 -r1.45
*** SwordBookMetaData.java	17 May 2005 00:43:15 -0000	1.44
--- SwordBookMetaData.java	11 Jun 2005 20:41:04 -0000	1.45
***************
*** 31,35 ****
  import java.util.Map;
  
! import org.crosswire.jsword.book.BookType;
  import org.crosswire.jsword.book.FeatureType;
  import org.crosswire.jsword.book.basic.AbstractBookMetaData;
--- 31,35 ----
  import java.util.Map;
  
! import org.crosswire.jsword.book.BookCategory;
  import org.crosswire.jsword.book.FeatureType;
  import org.crosswire.jsword.book.basic.AbstractBookMetaData;
***************
*** 39,43 ****
  
  /**
!  * A utility class for loading and representing Sword module configs.
   *
   * <p>Config file format. See also:
--- 39,43 ----
  
  /**
!  * A utility class for loading and representing Sword book configs.
   *
   * <p>Config file format. See also:
***************
*** 110,117 ****
  
      /**
!      * Returns the Charset of the module based on the encoding attribute
!      * @return the charset of the module.
       */
!     public String getModuleCharset()
      {
          return (String) ENCODING_JAVA.get(getProperty(ConfigEntryType.ENCODING));
--- 110,117 ----
  
      /**
!      * Returns the Charset of the book based on the encoding attribute
!      * @return the charset of the book.
       */
!     public String getBookCharset()
      {
          return (String) ENCODING_JAVA.get(getProperty(ConfigEntryType.ENCODING));
***************
*** 119,127 ****
  
      /**
!      * Returns the Module Type.
       */
!     public ModuleType getModuleType()
      {
!         return cet.getModuleType();
      }
  
--- 119,127 ----
  
      /**
!      * Returns the Book Type.
       */
!     public BookType getBookType()
      {
!         return cet.getBookType();
      }
  
***************
*** 136,140 ****
  
      /**
!      * @return Returns the relative path of the module's conf.
       */
      public String getConfPath()
--- 136,140 ----
  
      /**
!      * @return Returns the relative path of the book's conf.
       */
      public String getConfPath()
***************
*** 144,150 ****
  
      /**
!      * @return the relative path of the module.
       */
!     public String getModulePath()
      {
          // The path begins with ./
--- 144,150 ----
  
      /**
!      * @return the relative path of the book.
       */
!     public String getBookPath()
      {
          // The path begins with ./
***************
*** 153,157 ****
          // files name, not a directory name.
          // Lots of paths end with '/'
!         if (getType() == BookType.DICTIONARY
              || dataPath.charAt(dataPath.length() - 1) == '/')
          {
--- 153,157 ----
          // files name, not a directory name.
          // Lots of paths end with '/'
!         if (getType() == BookCategory.DICTIONARY
              || dataPath.charAt(dataPath.length() - 1) == '/')
          {
***************
*** 164,170 ****
       * @see org.crosswire.jsword.book.BookMetaData#getType()
       */
!     public BookType getType()
      {
!         return getModuleType().getBookType();
      }
  
--- 164,170 ----
       * @see org.crosswire.jsword.book.BookMetaData#getType()
       */
!     public BookCategory getType()
      {
!         return getBookType().getBookCategory();
      }
  

Index: RawBackend.java
===================================================================
RCS file: /cvs/jsword/jsword/java/jsword/org/crosswire/jsword/book/sword/RawBackend.java,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** RawBackend.java	17 May 2005 00:43:15 -0000	1.27
--- RawBackend.java	11 Jun 2005 20:41:04 -0000	1.28
***************
*** 130,134 ****
      {
          checkActive();
!         String charset = getBookMetaData().getModuleCharset();
  
          Verse verse = KeyUtil.getVerse(key);
--- 130,134 ----
      {
          checkActive();
!         String charset = getBookMetaData().getBookCharset();
  
          Verse verse = KeyUtil.getVerse(key);

--- NEW FILE: BookType.java ---
/**
 * Distribution License:
 * 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 at:
 *       http://www.gnu.org/copyleft/gpl.html
 * or by writing to:
 *      Free Software Foundation, Inc.
 *      59 Temple Place - Suite 330
 *      Boston, MA 02111-1307, USA
 *
 * Copyright: 2005
 *     The copyright to this program is held by it's authors.
 *
 * ID: $Id: BookType.java,v 1.1 2005/06/11 20:41:04 dmsmith Exp $
 */
package org.crosswire.jsword.book.sword;

import java.io.File;
import java.io.Serializable;

import org.crosswire.jsword.book.Book;
import org.crosswire.jsword.book.BookCategory;
import org.crosswire.jsword.book.BookException;

/**
 * Data about book types.
 * 
 * @see gnu.gpl.License for license details.
 *      The copyright to this program is held by it's authors.
 * @author Joe Walker [joe at eireneh dot com]
 * @author DM Smith [dmsmith555 at yahoo dot com]
 */
public abstract class BookType implements Serializable
{
    /**
     * Uncompressed Bibles
     */
    public static final BookType RAW_TEXT = new BookType("RawText", BookCategory.BIBLE) //$NON-NLS-1$ //$NON-NLS-2$
    {
        protected Book getBook(SwordBookMetaData sbmd, AbstractBackend backend)
        {
            return new SwordBook(sbmd, backend);
        }

        protected AbstractBackend getBackend(SwordBookMetaData sbmd, File rootPath) throws BookException
        {
            return new RawBackend(sbmd, rootPath);
        }

        /**
         * Serialization ID
         */
        private static final long serialVersionUID = 3544385920414529336L;
    };

    /**
     * Compressed Bibles
     */
    public static final BookType Z_TEXT = new BookType("zText", BookCategory.BIBLE) //$NON-NLS-1$ //$NON-NLS-2$
    {
        protected Book getBook(SwordBookMetaData sbmd, AbstractBackend backend)
        {
            return new SwordBook(sbmd, backend);
        }

        protected AbstractBackend getBackend(SwordBookMetaData sbmd, File rootPath) throws BookException
        {
            return getCompressedBackend(sbmd, rootPath);
        }

        protected boolean isBackendSupported(SwordBookMetaData sbmd)
        {
            return isCompressedBackendSupported(sbmd);
        }

        /**
         * Serialization ID
         */
        private static final long serialVersionUID = 3257846571620906039L;
    };

    /**
     * Uncompressed Commentaries
     */
    public static final BookType RAW_COM = new BookType("RawCom", BookCategory.COMMENTARY) //$NON-NLS-1$ //$NON-NLS-2$
    {
        protected Book getBook(SwordBookMetaData sbmd, AbstractBackend backend)
        {
            return new SwordBook(sbmd, backend);
        }

        protected AbstractBackend getBackend(SwordBookMetaData sbmd, File rootPath) throws BookException
        {
            return new RawBackend(sbmd, rootPath);
        }

        /**
         * Serialization ID
         */
        private static final long serialVersionUID = 3258129141898294837L;
    };

    /**
     * Compressed Commentaries
     */
    public static final BookType Z_COM = new BookType("zCom", BookCategory.COMMENTARY) //$NON-NLS-1$ //$NON-NLS-2$
    {
        protected Book getBook(SwordBookMetaData sbmd, AbstractBackend backend)
        {
            return new SwordBook(sbmd, backend);
        }

        protected AbstractBackend getBackend(SwordBookMetaData sbmd, File rootPath) throws BookException
        {
            return getCompressedBackend(sbmd, rootPath);
        }

        protected boolean isBackendSupported(SwordBookMetaData sbmd)
        {
            return isCompressedBackendSupported(sbmd);
        }

        /**
         * Serialization ID
         */
        private static final long serialVersionUID = 3257569516166002487L;
    };

    /**
     * Uncompresses HREF Commentaries
     */
    public static final BookType HREF_COM = new BookType("HREFCom", BookCategory.COMMENTARY) //$NON-NLS-1$ //$NON-NLS-2$
    {
        protected Book getBook(SwordBookMetaData sbmd, AbstractBackend backend)
        {
            return new SwordBook(sbmd, backend);
        }

        protected AbstractBackend getBackend(SwordBookMetaData sbmd, File rootPath) throws BookException
        {
            return new RawBackend(sbmd, rootPath);
        }

        /**
         * Serialization ID
         */
        private static final long serialVersionUID = 3256439209706338354L;
    };

    /**
     * Uncompressed Commentaries
     */
    public static final BookType RAW_FILES = new BookType("RawFiles", BookCategory.COMMENTARY) //$NON-NLS-1$ //$NON-NLS-2$
    {
        protected Book getBook(SwordBookMetaData sbmd, AbstractBackend backend)
        {
            return new SwordBook(sbmd, backend);
        }

        protected AbstractBackend getBackend(SwordBookMetaData sbmd, File rootPath) throws BookException
        {
            return new RawBackend(sbmd, rootPath);
        }

        /**
         * Serialization ID
         */
        private static final long serialVersionUID = 3256446901875325236L;
    };

    /**
     * 2-Byte Index Uncompressed Dictionaries
     */
    public static final BookType RAW_LD = new BookType("RawLD", BookCategory.DICTIONARY) //$NON-NLS-1$ //$NON-NLS-2$
    {
        protected Book getBook(SwordBookMetaData sbmd, AbstractBackend backend)
        {
            return new SwordDictionary(sbmd, backend);
        }

        protected AbstractBackend getBackend(SwordBookMetaData sbmd, File rootPath) throws BookException
        {
            return new RawLDBackend(sbmd, rootPath, 2);
        }

        /**
         * Serialization ID
         */
        private static final long serialVersionUID = 3257290240195442745L;
    };

    /**
     * 4-Byte Index Uncompressed Dictionaries
     */
    public static final BookType RAW_LD4 = new BookType("RawLD4", BookCategory.DICTIONARY) //$NON-NLS-1$ //$NON-NLS-2$
    {
        protected Book getBook(SwordBookMetaData sbmd, AbstractBackend backend)
        {
            return new SwordDictionary(sbmd, backend);
        }

        protected AbstractBackend getBackend(SwordBookMetaData sbmd, File rootPath) throws BookException
        {
            return new RawLDBackend(sbmd, rootPath, 4);
        }

        /**
         * Serialization ID
         */
        private static final long serialVersionUID = 3689067356945331762L;
    };

    /**
     * Compressed Dictionaries
     */
    public static final BookType Z_LD = new BookType("zLD", BookCategory.DICTIONARY) //$NON-NLS-1$ //$NON-NLS-2$
    {
        protected Book getBook(SwordBookMetaData sbmd, AbstractBackend backend)
        {
            return new SwordDictionary(sbmd, backend);
        }

        protected AbstractBackend getBackend(SwordBookMetaData sbmd, File rootPath) throws BookException
        {
            return new ZLDBackend(sbmd, rootPath);
        }

        protected boolean isBackendSupported(SwordBookMetaData sbmd)
        {
            return false;
        }

        /**
         * Serialization ID
         */
        private static final long serialVersionUID = 3691037673259414067L;
    };

    /**
     * Generic Books
     */
    public static final BookType RAW_GEN_BOOK = new BookType("RawGenBook", null) //$NON-NLS-1$ //$NON-NLS-2$
    {
        protected Book getBook(SwordBookMetaData sbmd, AbstractBackend backend)
        {
            return new SwordBook(sbmd, backend);
        }

        protected AbstractBackend getBackend(SwordBookMetaData sbmd, File rootPath) throws BookException
        {
            return new RawBackend(sbmd, rootPath);
        }

        /**
         * Serialization ID
         */
        private static final long serialVersionUID = 3257290218703892528L;
    };

    /**
     * Simple ctor
     */
    public BookType(String name, BookCategory type)
    {
        this.name = name;
        this.type = type;
    }

    /**
     * Find a BookType from a name.
     * @param name The name of the BookType to look up
     * @return The found BookType or null if the name is not found
     */
    public static BookType getBookType(String name)
    {
        for (int i = 0; i < VALUES.length; i++)
        {
            BookType mod = VALUES[i];
            if (mod.name.equalsIgnoreCase(name))
            {
                return mod;
            }
        }

        throw new IllegalArgumentException(Msg.UNDEFINED_BOOK_TYPE.toString(name));
    }

    /**
     * The category of this book
     */
    public BookCategory getBookCategory()
    {
        return type;
    }

    /**
     * Given a SwordBookMetaData determine whether this BookType
     * will work for it.
     * @param sbmd the BookMetaData that this BookType works upon
     * @return true if this is a useable BookType
     */
    public boolean isSupported(SwordBookMetaData sbmd)
    {
        return type != null && isBackendSupported(sbmd);
    }

    /**
     * By default the backend is supported if the BookMetaData is not null.
     * @return true if this is a useable BackEnd
     */
    protected boolean isBackendSupported(SwordBookMetaData sbmd)
    {
        return sbmd != null;
    }

    /**
     * Create a Book appropriate for the BookMetaData
     * @throws BookException
     */
    public Book createBook(SwordBookMetaData sbmd, File progdir) throws BookException
    {
        AbstractBackend backend = getBackend(sbmd, progdir);
        Book book = getBook(sbmd, backend);
        return book;
    }

    /**
     * Create a Book with the given backend
     */
    protected abstract Book getBook(SwordBookMetaData sbmd, AbstractBackend backend);

    /**
     * Create a the appropriate backend for this type of book
     */
    protected abstract AbstractBackend getBackend(SwordBookMetaData sbmd, File rootPath) throws BookException;

    /**
     * 
     */
    protected static AbstractBackend getCompressedBackend(SwordBookMetaData sbmd, File rootPath) throws BookException
    {
        String cStr = sbmd.getProperty(ConfigEntryType.COMPRESS_TYPE);
        if (cStr != null)
        {
            return CompressionType.fromString(cStr).getBackend(sbmd, rootPath);
        }
        throw new BookException(Msg.COMPRESSION_UNSUPPORTED, new Object[] { cStr });
    }

    /**
     * 
     */
    protected static boolean isCompressedBackendSupported(SwordBookMetaData sbmd)
    {
        String cStr = sbmd.getProperty(ConfigEntryType.COMPRESS_TYPE);
        if (cStr != null)
        {
            return CompressionType.fromString(cStr).isSupported();
        }
        return false;
    }

    /**
     * The name of the BookType
     */
    private String name;

    /**
     * What category is this book
     */
    private BookCategory type;

    /**
     * Lookup method to convert from a String
     */
    public static BookType fromString(String name)
    {
        for (int i = 0; i < VALUES.length; i++)
        {
            BookType mod = VALUES[i];
            if (mod.name.equalsIgnoreCase(name))
            {
                return mod;
            }
        }

        throw new ClassCastException(Msg.UNDEFINED_DATATYPE.toString(name));
    }

    /**
     * Prevent subclasses from overriding canonical identity based Object methods
     * @see java.lang.Object#equals(java.lang.Object)
     */
    public final boolean equals(Object o)
    {
        return super.equals(o);
    }

    /**
     * Prevent subclasses from overriding canonical identity based Object methods
     * @see java.lang.Object#hashCode()
     */
    public final int hashCode()
    {
        return super.hashCode();
    }

    /* (non-Javadoc)
     * @see java.lang.Object#toString()
     */
    public String toString()
    {
        return name;
    }

    // Support for serialization
    private static int nextObj;
    private final int obj = nextObj++;

    Object readResolve()
    {
        return VALUES[obj];
    }

    private static final BookType[] VALUES =
    {
        RAW_TEXT,
        Z_TEXT,
        RAW_COM,
        Z_COM,
        RAW_COM,
        HREF_COM,
        RAW_FILES,
        RAW_LD,
        RAW_LD4,
        Z_LD,
        RAW_GEN_BOOK,
    };
}

Index: Msg.java
===================================================================
RCS file: /cvs/jsword/jsword/java/jsword/org/crosswire/jsword/book/sword/Msg.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** Msg.java	17 May 2005 00:43:15 -0000	1.18
--- Msg.java	11 Jun 2005 20:41:04 -0000	1.19
***************
*** 39,43 ****
      static final Msg MISSING_FILE = new Msg("GZIPBackend.MissingFile"); //$NON-NLS-1$
      static final Msg READ_FAIL = new Msg("GZIPBackend.ReadFail"); //$NON-NLS-1$
!     static final Msg COMPRESSION_UNSUPPORTED = new Msg("ModuleType.CompressionUnsupported"); //$NON-NLS-1$
      static final Msg TYPE_UNSUPPORTED = new Msg("SwordBookDriver.TypeUnsuported"); //$NON-NLS-1$
      static final Msg DELETE_FAILED = new Msg("SwordBookDriver.DeleteFailed"); //$NON-NLS-1$
--- 39,43 ----
      static final Msg MISSING_FILE = new Msg("GZIPBackend.MissingFile"); //$NON-NLS-1$
      static final Msg READ_FAIL = new Msg("GZIPBackend.ReadFail"); //$NON-NLS-1$
!     static final Msg COMPRESSION_UNSUPPORTED = new Msg("BookType.CompressionUnsupported"); //$NON-NLS-1$
      static final Msg TYPE_UNSUPPORTED = new Msg("SwordBookDriver.TypeUnsuported"); //$NON-NLS-1$
      static final Msg DELETE_FAILED = new Msg("SwordBookDriver.DeleteFailed"); //$NON-NLS-1$
***************
*** 45,50 ****
      static final Msg MISSING_BACKEND = new Msg("SwordDictionary.MissingBackend"); //$NON-NLS-1$
      static final Msg DRIVER_READONLY = new Msg("SwordBook.DriverReadonly"); //$NON-NLS-1$
!     static final Msg UNDEFINED_MODULE = new Msg("ModuleType.UndefinedModule"); //$NON-NLS-1$
!     static final Msg UNDEFINED_DATATYPE = new Msg("ModuleType.UndefinedDatatype"); //$NON-NLS-1$
  
      /**
--- 45,50 ----
      static final Msg MISSING_BACKEND = new Msg("SwordDictionary.MissingBackend"); //$NON-NLS-1$
      static final Msg DRIVER_READONLY = new Msg("SwordBook.DriverReadonly"); //$NON-NLS-1$
!     static final Msg UNDEFINED_BOOK_TYPE = new Msg("BookType.UndefinedBookType"); //$NON-NLS-1$
!     static final Msg UNDEFINED_DATATYPE = new Msg("BookType.UndefinedDatatype"); //$NON-NLS-1$
  
      /**

Index: ConfigEntryTable.java
===================================================================
RCS file: /cvs/jsword/jsword/java/jsword/org/crosswire/jsword/book/sword/ConfigEntryTable.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** ConfigEntryTable.java	17 May 2005 00:43:15 -0000	1.8
--- ConfigEntryTable.java	11 Jun 2005 20:41:04 -0000	1.9
***************
*** 32,36 ****
  
  import org.crosswire.common.util.Logger;
! import org.crosswire.jsword.book.BookType;
  import org.crosswire.jsword.book.OSISUtil;
  import org.crosswire.jsword.book.basic.AbstractBookMetaData;
--- 32,36 ----
  
  import org.crosswire.common.util.Logger;
! import org.crosswire.jsword.book.BookCategory;
  import org.crosswire.jsword.book.OSISUtil;
  import org.crosswire.jsword.book.basic.AbstractBookMetaData;
***************
*** 38,42 ****
  
  /**
!  * 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.
--- 38,42 ----
  
  /**
!  * A utility class for loading the entries in a Sword book'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.
***************
*** 62,68 ****
       * @throws IOException
       */
!     public ConfigEntryTable(Reader in, String moduleName) throws IOException
      {
!         internal = moduleName;
          supported = true;
  
--- 62,68 ----
       * @throws IOException
       */
!     public ConfigEntryTable(Reader in, String bookName) throws IOException
      {
!         internal = bookName;
          supported = true;
  
***************
*** 75,79 ****
  
      /**
!      * Determines whether the Sword Module's conf is supported by JSword.
       */
      public boolean isSupported()
--- 75,79 ----
  
      /**
!      * Determines whether the Sword Book's conf is supported by JSword.
       */
      public boolean isSupported()
***************
*** 92,98 ****
       * Returns an Enumeration of all the keys found in the config file.
       */
!     public ModuleType getModuleType()
      {
!         return moduleType;
      }
  
--- 92,98 ----
       * Returns an Enumeration of all the keys found in the config file.
       */
!     public BookType getBookType()
      {
!         return bookType;
      }
  
***************
*** 486,498 ****
          }
  
!         moduleType = ModuleType.getModuleType(modTypeName);
!         if (getModuleType() == null)
          {
!             log.error("Book not supported: malformed conf file for " + internal + " no module type found"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
              supported = false;
              return;
          }
  
!         BookType type = getModuleType().getBookType();
          if (type == null)
          {
--- 486,498 ----
          }
  
!         bookType = BookType.getBookType(modTypeName);
!         if (getBookType() == null)
          {
!             log.error("Book not supported: malformed conf file for " + internal + " no book type found"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
              supported = false;
              return;
          }
  
!         BookCategory type = getBookType().getBookCategory();
          if (type == null)
          {
***************
*** 500,504 ****
              if (!modTypeName.equals("RawGenBook")) //$NON-NLS-1$
              {
!                 log.debug("Book not supported: " + internal + " because missing book type for ModuleType (" + modTypeName + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
              }
              supported = false;
--- 500,504 ----
              if (!modTypeName.equals("RawGenBook")) //$NON-NLS-1$
              {
!                 log.debug("Book not supported: " + internal + " because missing book type for BookType (" + modTypeName + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
              }
              supported = false;
***************
*** 525,529 ****
      private void validate()
      {
!         // Only locked modules that have a key can be used.
          String cipher = (String) getValue(ConfigEntryType.CIPHER_KEY);
          if (cipher != null && cipher.length() == 0)
--- 525,529 ----
      private void validate()
      {
!         // Only locked books that have a key can be used.
          String cipher = (String) getValue(ConfigEntryType.CIPHER_KEY);
          if (cipher != null && cipher.length() == 0)
***************
*** 644,655 ****
  
      /**
!      * True if this module's config type can be used by JSword.
       */
      private boolean supported;
  
      /**
!      * The ModuleType for this ConfigEntry
       */
!     private ModuleType moduleType;
  
      /**
--- 644,655 ----
  
      /**
!      * True if this book's config type can be used by JSword.
       */
      private boolean supported;
  
      /**
!      * The BookType for this ConfigEntry
       */
!     private BookType bookType;
  
      /**

Index: ConfigEntryType.java
===================================================================
RCS file: /cvs/jsword/jsword/java/jsword/org/crosswire/jsword/book/sword/ConfigEntryType.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** ConfigEntryType.java	17 May 2005 00:43:15 -0000	1.8
--- ConfigEntryType.java	11 Jun 2005 20:41:04 -0000	1.9
***************
*** 28,32 ****
  import java.util.regex.Pattern;
  
! import org.crosswire.jsword.book.BookType;
  import org.crosswire.jsword.book.basic.AbstractBookMetaData;
  
--- 28,32 ----
  import java.util.regex.Pattern;
  
! import org.crosswire.jsword.book.BookCategory;
  import org.crosswire.jsword.book.basic.AbstractBookMetaData;
  
***************
*** 84,88 ****
  {
      /**
!      * Contains rtf that describes the module.
       */
      public static final ConfigEntryType ABOUT = new ConfigEntryType("About") //$NON-NLS-1$
--- 84,88 ----
  {
      /**
!      * Contains rtf that describes the book.
       */
      public static final ConfigEntryType ABOUT = new ConfigEntryType("About") //$NON-NLS-1$
***************
*** 201,205 ****
  
      /**
!      * The Category of the module. Used on the web to classify books into a tree.
       */
      public static final ConfigEntryType CATEGORY = new ConfigEntryType("Category") //$NON-NLS-1$
--- 201,205 ----
  
      /**
!      * The Category of the book. Used on the web to classify books into a tree.
       */
      public static final ConfigEntryType CATEGORY = new ConfigEntryType("Category") //$NON-NLS-1$
***************
*** 239,243 ****
  
      /**
!      * If this exists in the conf, then the module is encrypted. The value is used to
       * unlock the book. The encryption algorithm is Sapphire. This has yet to be implemented
       * in JSword.
--- 239,243 ----
  
      /**
!      * If this exists in the conf, then the book is encrypted. The value is used to
       * unlock the book. The encryption algorithm is Sapphire. This has yet to be implemented
       * in JSword.
***************
*** 449,453 ****
  
      /**
!      * The full name of this module
       */
      public static final ConfigEntryType DESCRIPTION = new ConfigEntryType("Description"); //$NON-NLS-1$
--- 449,453 ----
  
      /**
!      * The full name of this book
       */
      public static final ConfigEntryType DESCRIPTION = new ConfigEntryType("Description"); //$NON-NLS-1$
***************
*** 592,596 ****
  
      /**
!      * Similar to DataPath. It gives where on the Crosswire server the module can be found.
       * Informational only.
       */
--- 592,596 ----
  
      /**
!      * Similar to DataPath. It gives where on the Crosswire server the book can be found.
       * Informational only.
       */
***************
*** 761,765 ****
  
      /**
!      * The installed size of the module in bytes. This is not the size of the zip that is downloaded.
       */
      public static final ConfigEntryType INSTALL_SIZE = new ConfigEntryType("InstallSize") //$NON-NLS-1$
--- 761,765 ----
  
      /**
!      * The installed size of the book in bytes. This is not the size of the zip that is downloaded.
       */
      public static final ConfigEntryType INSTALL_SIZE = new ConfigEntryType("InstallSize") //$NON-NLS-1$
***************
*** 788,792 ****
  
      /**
!      * A Feature describes a characteristic of the Module.
       * 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.
--- 788,792 ----
  
      /**
!      * 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.
***************
*** 839,850 ****
  
      /**
!      * A recommended font to use for the module.
       * TODO(DMS): Use this font.
!      * TODO(DMS): Allow a user to associate a font with a module.
       */
      public static final ConfigEntryType FONT = new ConfigEntryType("Font"); //$NON-NLS-1$
  
      /**
!      * single value string, defaults to en, the language of the module
       */
      public static final ConfigEntryType LANG = new ConfigEntryType("Lang") //$NON-NLS-1$
--- 839,850 ----
  
      /**
!      * 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.
       */
      public static final ConfigEntryType FONT = new ConfigEntryType("Font"); //$NON-NLS-1$
  
      /**
!      * single value string, defaults to en, the language of the book
       */
      public static final ConfigEntryType LANG = new ConfigEntryType("Lang") //$NON-NLS-1$
***************
*** 866,875 ****
      /**
       * Library of Congress Subject Heading.
!      * Typically this is of the form BookType Scope Language, where scope is typically O.T., N.T.
       */
      public static final ConfigEntryType LCSH = new ConfigEntryType("LCSH"); //$NON-NLS-1$
  
      /**
!      * This indicates how the module was stored.
       */
      public static final ConfigEntryType MOD_DRV = new ConfigEntryType("ModDrv") //$NON-NLS-1$
--- 866,875 ----
      /**
       * Library of Congress Subject Heading.
!      * Typically this is of the form BookCategory Scope Language, where scope is typically O.T., N.T.
       */
      public static final ConfigEntryType LCSH = new ConfigEntryType("LCSH"); //$NON-NLS-1$
  
      /**
!      * This indicates how the book was stored.
       */
      public static final ConfigEntryType MOD_DRV = new ConfigEntryType("ModDrv") //$NON-NLS-1$
***************
*** 915,919 ****
  
      /**
!      * single value version number, lowest sword c++ version that can read this module
       * JSword does not use this value.
       */
--- 915,919 ----
  
      /**
!      * single value version number, lowest sword c++ version that can read this book
       * JSword does not use this value.
       */
***************
*** 937,941 ****
  
      /**
!      * A list of prior "initials" for the current module. Informational only.
       */
      public static final ConfigEntryType OBSOLETES = new ConfigEntryType("Obsoletes") //$NON-NLS-1$
--- 937,941 ----
  
      /**
!      * A list of prior "initials" for the current book. Informational only.
       */
      public static final ConfigEntryType OBSOLETES = new ConfigEntryType("Obsoletes") //$NON-NLS-1$
***************
*** 1030,1034 ****
  
      /**
!      * The date that this version of the module was last updated. Informational only.
       */
      public static final ConfigEntryType SWORD_VERSION_DATE = new ConfigEntryType("SwordVersionDate") //$NON-NLS-1$
--- 1030,1034 ----
  
      /**
!      * The date that this version of the book was last updated. Informational only.
       */
      public static final ConfigEntryType SWORD_VERSION_DATE = new ConfigEntryType("SwordVersionDate") //$NON-NLS-1$
***************
*** 1051,1055 ****
  
      /**
!      * Information on where the module's text was obtained.
       */
      public static final ConfigEntryType TEXT_SOURCE = new ConfigEntryType("TextSource") //$NON-NLS-1$
--- 1051,1055 ----
  
      /**
!      * Information on where the book's text was obtained.
       */
      public static final ConfigEntryType TEXT_SOURCE = new ConfigEntryType("TextSource") //$NON-NLS-1$
***************
*** 1132,1136 ****
  
      /**
!      * The abbreviated name by which this module is known. This is in the [] on the first non-blank
       * line of the conf. JSword uses this for display and access purposes.
       */
--- 1132,1136 ----
  
      /**
!      * 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.
       */
***************
*** 1170,1174 ****
          public Object getDefault()
          {
!             return BookType.OTHER.toString(); //$NON-NLS-1$
          }
  
--- 1170,1174 ----
          public Object getDefault()
          {
!             return BookCategory.OTHER.toString(); //$NON-NLS-1$
          }
  
***************
*** 1335,1339 ****
  
      /**
!      * Synthetic keys are those that are not in the Sword Module's conf,
       * but are needed by the program. Typically, these are derived by the program
       * from the other entries.
--- 1335,1339 ----
  
      /**
!      * 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.
***************
*** 1376,1380 ****
          }
          // should not get here.
!         // But there are typos in the keys in the module conf files
          // And this allows for the addition of new fields in
          // advance of changing JSword
--- 1376,1380 ----
          }
          // should not get here.
!         // But there are typos in the keys in the book conf files
          // And this allows for the addition of new fields in
          // advance of changing JSword

Index: SwordBookDriver.java
===================================================================
RCS file: /cvs/jsword/jsword/java/jsword/org/crosswire/jsword/book/sword/SwordBookDriver.java,v
retrieving revision 1.43
retrieving revision 1.44
diff -C2 -d -r1.43 -r1.44
*** SwordBookDriver.java	17 May 2005 00:43:15 -0000	1.43
--- SwordBookDriver.java	11 Jun 2005 20:41:04 -0000	1.44
***************
*** 166,170 ****
          }
  
!         File moduleDir = new File(downloadDir, sbmd.getModulePath());
  
          // Delete the conf
--- 166,170 ----
          }
  
!         File bookDir = new File(downloadDir, sbmd.getBookPath());
  
          // Delete the conf
***************
*** 172,181 ****
          if (failures.size() == 0)
          {
!             // If the conf is gone, then we cannot get to the module
              // and then we can download it again.
!             // But if the conf is present and the module is gone,
              // then we get errors.
!             // Delete the download module's dir
!             failures = FileUtil.delete(moduleDir);
              Books.installed().removeBook(dead);
          }
--- 172,181 ----
          if (failures.size() == 0)
          {
!             // If the conf is gone, then we cannot get to the book
              // and then we can download it again.
!             // But if the conf is present and the book is gone,
              // then we get errors.
!             // Delete the download book's dir
!             failures = FileUtil.delete(bookDir);
              Books.installed().removeBook(dead);
          }
***************
*** 223,228 ****
      private Book createBook(SwordBookMetaData sbmd, File progdir) throws BookException
      {
!         ModuleType modtype = sbmd.getModuleType();
!         if (modtype.getBookType() == null)
          {
              // LATER(joe): how do we support books?
--- 223,228 ----
      private Book createBook(SwordBookMetaData sbmd, File progdir) throws BookException
      {
!         BookType modtype = sbmd.getBookType();
!         if (modtype.getBookCategory() == null)
          {
              // LATER(joe): how do we support books?

Index: package.html
===================================================================
RCS file: /cvs/jsword/jsword/java/jsword/org/crosswire/jsword/book/sword/package.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** package.html	8 May 2003 12:55:23 -0000	1.1
--- package.html	11 Jun 2005 20:41:04 -0000	1.2
***************
*** 4,8 ****
  <p>
    An implementation of the Book interfaces that reads from SWORD project
!   modules.
  </p>
  
--- 4,8 ----
  <p>
    An implementation of the Book interfaces that reads from SWORD project
!   books (modules).
  </p>
  

Index: Msg.properties
===================================================================
RCS file: /cvs/jsword/jsword/java/jsword/org/crosswire/jsword/book/sword/Msg.properties,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Msg.properties	19 Mar 2005 01:56:47 -0000	1.2
--- Msg.properties	11 Jun 2005 20:41:04 -0000	1.3
***************
*** 12,16 ****
  GZIPBackend.MissingFile=Missing data files for old and new testaments in {0}.
  GZIPBackend.ReadFail=Error reading {0}
! ModuleType.CompressionUnsupported=Unsupported compression type
  SwordBookDriver.TypeUnsuported=Unsupported type: {0} when reading {1}
  SwordBookDriver.DeleteFailed=Unable to delete: {0}
--- 12,16 ----
  GZIPBackend.MissingFile=Missing data files for old and new testaments in {0}.
  GZIPBackend.ReadFail=Error reading {0}
! BookType.CompressionUnsupported=Unsupported compression type
  SwordBookDriver.TypeUnsuported=Unsupported type: {0} when reading {1}
  SwordBookDriver.DeleteFailed=Unable to delete: {0}
***************
*** 18,21 ****
  SwordDictionary.MissingBackend=Configuration error: Missing backend engine.
  SwordBook.DriverReadonly=This driver is read only. Sorry.
! ModuleType.UndefinedModule=ModuleType {0} is not defined!
! ModuleType.UndefinedDatatype=DataType {0} is not defined!
--- 18,21 ----
  SwordDictionary.MissingBackend=Configuration error: Missing backend engine.
  SwordBook.DriverReadonly=This driver is read only. Sorry.
! BookType.UndefinedBookType=BookType {0} is not defined!
! BookType.UndefinedDatatype=DataType {0} is not defined!

Index: SwordBook.java
===================================================================
RCS file: /cvs/jsword/jsword/java/jsword/org/crosswire/jsword/book/sword/SwordBook.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** SwordBook.java	17 May 2005 00:43:15 -0000	1.20
--- SwordBook.java	11 Jun 2005 20:41:04 -0000	1.21
***************
*** 36,40 ****
  
  /**
!  * SwordBook is a base class for all sword type modules.
   * 
   * @see gnu.gpl.License for license details.
--- 36,40 ----
  
  /**
!  * SwordBook is a base class for all sword type books.
   * 
   * @see gnu.gpl.License for license details.

Index: RawLDBackend.java
===================================================================
RCS file: /cvs/jsword/jsword/java/jsword/org/crosswire/jsword/book/sword/RawLDBackend.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** RawLDBackend.java	17 May 2005 00:43:15 -0000	1.21
--- RawLDBackend.java	11 Jun 2005 20:41:04 -0000	1.22
***************
*** 206,210 ****
          checkActive();
  
!         String charset = getBookMetaData().getModuleCharset();
  
          if (!(key instanceof IndexKey))
--- 206,210 ----
          checkActive();
  
!         String charset = getBookMetaData().getBookCharset();
  
          if (!(key instanceof IndexKey))

--- ModuleType.java DELETED ---

Index: BlockType.java
===================================================================
RCS file: /cvs/jsword/jsword/java/jsword/org/crosswire/jsword/book/sword/BlockType.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** BlockType.java	17 May 2005 00:43:15 -0000	1.6
--- BlockType.java	11 Jun 2005 20:41:04 -0000	1.7
***************
*** 92,96 ****
      /**
       * Return a character indicating the kind of blocking.
!      * This is used in the names of compressed sword modules.
       *
       * @return the indicator
--- 92,96 ----
      /**
       * Return a character indicating the kind of blocking.
!      * This is used in the names of compressed sword books.
       *
       * @return the indicator

Index: GZIPBackend.java
===================================================================
RCS file: /cvs/jsword/jsword/java/jsword/org/crosswire/jsword/book/sword/GZIPBackend.java,v
retrieving revision 1.35
retrieving revision 1.36
diff -C2 -d -r1.35 -r1.36
*** GZIPBackend.java	17 May 2005 00:43:15 -0000	1.35
--- GZIPBackend.java	11 Jun 2005 20:41:04 -0000	1.36
***************
*** 217,221 ****
          checkActive();
  
!         String charset = getBookMetaData().getModuleCharset();
  
          Verse verse = KeyUtil.getVerse(key);
--- 217,221 ----
          checkActive();
  
!         String charset = getBookMetaData().getBookCharset();
  
          Verse verse = KeyUtil.getVerse(key);

Index: ConfigEntry.java
===================================================================
RCS file: /cvs/jsword/jsword/java/jsword/org/crosswire/jsword/book/sword/ConfigEntry.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** ConfigEntry.java	17 May 2005 00:43:15 -0000	1.16
--- ConfigEntry.java	11 Jun 2005 20:41:04 -0000	1.17
***************
*** 47,56 ****
       * Create a ConfigEntry whose type is not certain
       * and whose value is not known.
!      * @param moduleName the internal name of the module
       * @param aName the name of the ConfigEntry.
       */
!     public ConfigEntry(String moduleName, String aName)
      {
!         internal = moduleName;
          name = aName;
          type = ConfigEntryType.fromString(aName);
--- 47,56 ----
       * Create a ConfigEntry whose type is not certain
       * and whose value is not known.
!      * @param bookName the internal name of the book
       * @param aName the name of the ConfigEntry.
       */
!     public ConfigEntry(String bookName, String aName)
      {
!         internal = bookName;
          name = aName;
          type = ConfigEntryType.fromString(aName);
***************
*** 59,69 ****
      /**
       * Create a ConfigEntry directly with an initial value.
!      * @param moduleName the internal name of the module
       * @param aType the kind of ConfigEntry
       * @param aValue the initial value for the ConfigEntry
       */
!     public ConfigEntry(String moduleName, ConfigEntryType aType, String aValue)
      {
!         internal = moduleName;
          name = aType.getName();
          type = aType;
--- 59,69 ----
      /**
       * Create a ConfigEntry directly with an initial value.
!      * @param bookName the internal name of the book
       * @param aType the kind of ConfigEntry
       * @param aValue the initial value for the ConfigEntry
       */
!     public ConfigEntry(String bookName, ConfigEntryType aType, String aValue)
      {
!         internal = bookName;
          name = aType.getName();
          type = aType;



More information about the jsword-svn mailing list