[jsword-svn] r1165 - in trunk: bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install jsword/src/main/java/org/crosswire/jsword/book jsword/src/main/java/org/crosswire/jsword/book/basic jsword/src/main/java/org/crosswire/jsword/book/install/sword jsword/src/main/java/org/crosswire/jsword/book/sword jsword/src/main/java/org/crosswire/jsword/passage jsword/src/main/java/org/crosswire/jsword/versification

dmsmith at www.crosswire.org dmsmith at www.crosswire.org
Tue Oct 17 18:02:47 MST 2006


Author: dmsmith
Date: 2006-10-17 18:02:25 -0700 (Tue, 17 Oct 2006)
New Revision: 1165

Modified:
   trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install/Msg.properties
   trunk/jsword/src/main/java/org/crosswire/jsword/book/BookMetaData.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/AbstractBookMetaData.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/install/sword/AbstractSwordInstaller.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordBookMetaData.java
   trunk/jsword/src/main/java/org/crosswire/jsword/passage/Msg.java
   trunk/jsword/src/main/java/org/crosswire/jsword/passage/VerseRange.java
   trunk/jsword/src/main/java/org/crosswire/jsword/versification/BibleInfo.java
   trunk/jsword/src/main/java/org/crosswire/jsword/versification/Msg.properties
Log:
Fixed an install bug.

Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install/Msg.properties
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install/Msg.properties	2006-10-17 19:48:42 UTC (rev 1164)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install/Msg.properties	2006-10-18 01:02:25 UTC (rev 1165)
@@ -9,8 +9,8 @@
 BookChooser.OK=OK
 BookChooser.Title=Select a Bible
 
-Librarian.AvailableBooks=Available Books
-Librarian.Local=Installed Books
+SitesPane.AvailableBooks=Available Books
+SitesPane.Local=Installed Books
 
 SitePane.KBSize={0} is {1,number,###,###,###.#}KB. Continue?
 SitePane.MBSize={0} is {1,number,###,###,###.#}MB. Continue?

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/BookMetaData.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/BookMetaData.java	2006-10-17 19:48:42 UTC (rev 1164)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/BookMetaData.java	2006-10-18 01:02:25 UTC (rev 1165)
@@ -184,6 +184,13 @@
     URL getLibrary();
 
     /**
+     * Set the base URL for library of this module.
+     * 
+     * @param library the base URL or null if there is none
+     */
+    void setLibrary(URL library);
+
+    /**
      * Get the base URL for relative urls in the document.
      * 
      * @return the base URL or null if there is none
@@ -191,6 +198,13 @@
     URL getLocation();
 
     /**
+     * Set the base URL for relative urls in the document.
+     * 
+     * @param library the base URL or null if there is none
+     */
+    void setLocation(URL library);
+
+    /**
      * Get a list of all the properties available to do with this Book.
      * The returned Properties will be read-only so any attempts to alter it
      * will fail.

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/AbstractBookMetaData.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/AbstractBookMetaData.java	2006-10-17 19:48:42 UTC (rev 1164)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/AbstractBookMetaData.java	2006-10-18 01:02:25 UTC (rev 1165)
@@ -190,6 +190,22 @@
     }
 
     /* (non-Javadoc)
+     * @see org.crosswire.jsword.book.BookMetaData#setLibrary(java.net.URL)
+     */
+    public void setLibrary(URL library)
+    {
+        putProperty(KEY_LIBRARY_URL, library.toExternalForm());        
+    }
+
+    /* (non-Javadoc)
+     * @see org.crosswire.jsword.book.BookMetaData#setLocation(java.net.URL)
+     */
+    public void setLocation(URL location)
+    {
+        putProperty(KEY_LOCATION_URL, location.toExternalForm());        
+    }
+
+    /* (non-Javadoc)
      * @see org.crosswire.jsword.book.BookMetaData#getLocation()
      */
     public URL getLocation()

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/install/sword/AbstractSwordInstaller.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/install/sword/AbstractSwordInstaller.java	2006-10-17 19:48:42 UTC (rev 1164)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/install/sword/AbstractSwordInstaller.java	2006-10-18 01:02:25 UTC (rev 1165)
@@ -50,8 +50,8 @@
 import org.crosswire.jsword.book.sword.SwordBook;
 import org.crosswire.jsword.book.sword.SwordBookDriver;
 import org.crosswire.jsword.book.sword.SwordBookMetaData;
+import org.crosswire.jsword.book.sword.SwordBookPath;
 import org.crosswire.jsword.book.sword.SwordConstants;
-import org.crosswire.jsword.book.sword.SwordBookPath;
 import org.crosswire.jsword.util.Project;
 
 import com.ice.tar.TarEntry;
@@ -195,11 +195,12 @@
 
                     // Once the unzipping is started, we need to continue
                     job.setInterruptable(false);
-                    File dldir = SwordBookPath.getDownloadDir();
                     if (!job.isFinished())
                     {
+                        File dldir = SwordBookPath.getDownloadDir();
                         IOUtil.unpackZip(NetUtil.getAsFile(temp), dldir);
                         job.setProgress(Msg.JOB_CONFIG.toString());
+                        sbmd.setLibrary(NetUtil.getURL(dldir));
                         SwordBookDriver.registerNewBook(sbmd);
                     }
 

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordBookMetaData.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordBookMetaData.java	2006-10-17 19:48:42 UTC (rev 1164)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordBookMetaData.java	2006-10-18 01:02:25 UTC (rev 1165)
@@ -23,7 +23,6 @@
 
 import java.io.File;
 import java.io.IOException;
-import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -72,12 +71,7 @@
     {
         cet = new ConfigEntryTable(internal);
         cet.load(file);
-        cet.add(ConfigEntryType.LIBRARY_URL, bookRootPath.toExternalForm());
-        // Currently all DATA_PATH entries end in / to indicate dirs or not to indicate file prefixes
-        String datapath = getProperty(ConfigEntryType.DATA_PATH);
-        datapath = datapath.substring(0, datapath.lastIndexOf('/'));
-        URL location = NetUtil.lengthenURL(bookRootPath, datapath);
-        cet.add(ConfigEntryType.LOCATION_URL, location.toExternalForm());
+        setLibrary(bookRootPath);
         buildProperties();
     }
 
@@ -193,29 +187,24 @@
         return SwordConstants.DIR_CONF + '/' + getInitials().toLowerCase(Locale.ENGLISH) + SwordConstants.EXTENSION_CONF;
     }
 
-    /**
-     * @return the absolute path of the book as an URL.
+    /* (non-Javadoc)
+     * @see org.crosswire.jsword.book.basic.AbstractBookMetaData#setLibrary(java.net.URL)
      */
-    public URL getLocation()
+    public void setLibrary(URL library)
     {
-        URL url = null;
-        try
-        {
-            String loc = getProperty(ConfigEntryType.LOCATION_URL);
-            if (loc != null)
-            {
-                url = new URL(loc);
-            }
-            return url;
-        }
-        catch (MalformedURLException e)
-        {
-            return null;
-        }
+        cet.add(ConfigEntryType.LIBRARY_URL, library.toExternalForm());
+        super.setLibrary(library);
+
+        // Currently all DATA_PATH entries end in / to indicate dirs or not to indicate file prefixes
+        String datapath = getProperty(ConfigEntryType.DATA_PATH);
+        datapath = datapath.substring(0, datapath.lastIndexOf('/'));
+        URL location = NetUtil.lengthenURL(library, datapath);
+        cet.add(ConfigEntryType.LOCATION_URL, location.toExternalForm());
+        super.setLocation(location);
     }
 
     /* (non-Javadoc)
-     * @see org.crosswire.jsword.book.BookMetaData#getType()
+     * @see org.crosswire.jsword.book.BookMetaData#getBookCategory()
      */
     public BookCategory getBookCategory()
     {

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/Msg.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/Msg.java	2006-10-17 19:48:42 UTC (rev 1164)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/Msg.java	2006-10-18 01:02:25 UTC (rev 1165)
@@ -54,7 +54,6 @@
     static final Msg VERSE_PARTS = new Msg("Verse.Parts"); //$NON-NLS-1$
     static final Msg VERSE_PARSE = new Msg("Verse.Parse"); //$NON-NLS-1$
 
-    static final Msg ERROR_CASE = new Msg("BibleInfo.ErrorCase"); //$NON-NLS-1$
     static final Msg ERROR_PATCH = new Msg("Verse.ErrorPatch"); //$NON-NLS-1$
 
     static final Msg PASSAGE_UNKNOWN = new Msg("PassageUtil.Unknown"); //$NON-NLS-1$

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/VerseRange.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/VerseRange.java	2006-10-17 19:48:42 UTC (rev 1164)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/VerseRange.java	2006-10-18 01:02:25 UTC (rev 1165)
@@ -149,17 +149,17 @@
         }
 
         // Cache these we're going to be using them a lot.
-        int start_book = start.getBook();
-        int start_chapter = start.getChapter();
-        int start_verse = start.getVerse();
-        int end_book = end.getBook();
-        int end_chapter = end.getChapter();
-        int end_verse = end.getVerse();
+        int startBook = start.getBook();
+        int startChapter = start.getChapter();
+        int startVerse = start.getVerse();
+        int endBook = end.getBook();
+        int endChapter = end.getChapter();
+        int endVerse = end.getVerse();
 
         try
         {
             // If this is in 2 separate books
-            if (start_book != end_book)
+            if (startBook != endBook)
             {
                 // This range is exactly a whole book
                 if (isWholeBooks())
@@ -167,19 +167,19 @@
                     // Just report the name of the book, we don't need to worry about the
                     // base since we start at the start of a book, and should have been
                     // recently normalized()
-                    return BibleInfo.getBookName(start_book)
+                    return BibleInfo.getBookName(startBook)
                          + VerseRange.RANGE_PREF_DELIM
-                         + BibleInfo.getBookName(end_book);
+                         + BibleInfo.getBookName(endBook);
                 }
 
                 // If this range is exactly a whole chapter
                 if (isWholeChapters())
                 {
                     // Just report book and chapter names
-                    return BibleInfo.getBookName(start_book)
-                         + Verse.VERSE_PREF_DELIM1 + start_chapter
-                         + VerseRange.RANGE_PREF_DELIM + BibleInfo.getBookName(end_book)
-                         + Verse.VERSE_PREF_DELIM1 + end_chapter;
+                    return BibleInfo.getBookName(startBook)
+                         + Verse.VERSE_PREF_DELIM1 + startChapter
+                         + VerseRange.RANGE_PREF_DELIM + BibleInfo.getBookName(endBook)
+                         + Verse.VERSE_PREF_DELIM1 + endChapter;
                 }
 
                 return start.getName(base) + VerseRange.RANGE_PREF_DELIM + end.getName(base);
@@ -191,39 +191,39 @@
                 // Just report the name of the book, we don't need to worry about the
                 // base since we start at the start of a book, and should have been
                 // recently normalized()
-                return BibleInfo.getBookName(start_book);
+                return BibleInfo.getBookName(startBook);
             }
 
             // If this is 2 separate chapters
-            if (start_chapter != end_chapter)
+            if (startChapter != endChapter)
             {
                 // If this range is a whole number of chapters
                 if (isWholeChapters())
                 {
                     // Just report the name of the book and the chapters
-                    return BibleInfo.getBookName(start_book)
-                         + Verse.VERSE_PREF_DELIM1 + start_chapter
-                         + VerseRange.RANGE_PREF_DELIM + end_chapter;
+                    return BibleInfo.getBookName(startBook)
+                         + Verse.VERSE_PREF_DELIM1 + startChapter
+                         + VerseRange.RANGE_PREF_DELIM + endChapter;
                 }
 
                 return start.getName(base)
-                     + VerseRange.RANGE_PREF_DELIM + end_chapter
-                     + Verse.VERSE_PREF_DELIM2 + end_verse;
+                     + VerseRange.RANGE_PREF_DELIM + endChapter
+                     + Verse.VERSE_PREF_DELIM2 + endVerse;
             }
 
             // If this range is exactly a whole chapter
             if (isWholeChapter())
             {
                 // Just report the name of the book and the chapter
-                return BibleInfo.getBookName(start_book)
-                     + Verse.VERSE_PREF_DELIM1 + start_chapter;
+                return BibleInfo.getBookName(startBook)
+                     + Verse.VERSE_PREF_DELIM1 + startChapter;
             }
 
             // If this is 2 separate verses
-            if (start_verse != end_verse)
+            if (startVerse != endVerse)
             {
                 return start.getName(base)
-                     + VerseRange.RANGE_PREF_DELIM + end_verse;
+                     + VerseRange.RANGE_PREF_DELIM + endVerse;
             }
 
             // The range is a single verse

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/versification/BibleInfo.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/versification/BibleInfo.java	2006-10-17 19:48:42 UTC (rev 1164)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/versification/BibleInfo.java	2006-10-18 01:02:25 UTC (rev 1165)
@@ -387,7 +387,7 @@
             Object[] params = new Object[]
             {
                 new Integer(chaptersInBook(book)),
-                getBookName(book - 1), new Integer(chapter),
+                getBookName(book), new Integer(chapter),
             };
             throw new NoSuchVerseException(Msg.BOOKS_CHAPTER, params);
         }
@@ -398,7 +398,7 @@
             Object[] params = new Object[]
             {
                 new Integer(versesInChapter(book, chapter)),
-                getBookName(book - 1),
+                getBookName(book),
                 new Integer(chapter),
                 new Integer(verse),
             };

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/versification/Msg.properties
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/versification/Msg.properties	2006-10-17 19:48:42 UTC (rev 1164)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/versification/Msg.properties	2006-10-18 01:02:25 UTC (rev 1165)
@@ -5,12 +5,13 @@
 # The MessageName should be mixed case, with a leading capital.
 # It should have no spaces or other punctuation (e.g. _, -, ', ...)
 
-BibleInfo.Book=Book must be between 1 and 66. (Given {0,number,integer}).
-BibleInfo.Section=Section must be between 1 and 8. (Given {0,number,integer}).
+BibleInfo.Book=Book must be between 1 and 66 (given {0,number,integer}).
+BibleInfo.Section=Section must be between 1 and 8 (given {0,number,integer}).
 BibleInfo.Number=The string "{0}" can''t be a book, because it is a number.
 BibleInfo.Find=Can not understand "{0}" as a book.
-BibleInfo.BookChap=Book must be between 1 and 66. (Given {0,number,integer}), and Chapter must be valid for this book. (Given {1,number,integer}).
+BibleInfo.BookChap=Book must be between 1 and 66 (given {0,number,integer}), and Chapter must be valid for this book (given {1,number,integer}).
 BibleInfo.Ordinal=Must be 3 parts to the reference.
-BibleInfo.Decode=Ordinal must be between 1 and {0,number,integer}. (Given {1,number,integer}).
+BibleInfo.Decode=Ordinal must be between 1 and {0,number,integer} (given {1,number,integer}).
 BibleInfo.Chapter=Chapter should be between 1 and {0,number,integer} for {1} (given {2,number,integer}).
-BibleInfo.Verse=Verse should be between 1 and {0,number,integer} for {1} {2,number,integer} (given {3,number,integer})
+BibleInfo.Verse=Verse should be between 1 and {0,number,integer} for {1} {2,number,integer} (given {3,number,integer}).ß
+BibleInfo.ErrorCase=Unknown case setting: {0}




More information about the jsword-svn mailing list