[jsword-svn] r2028 - in trunk: bibledesktop/etc/installer/macosx/BibleDesktop.app/Contents bibledesktop/etc/jnlp jsword jsword/jar jsword/jar/jdom-1.1.1 jsword/src/main/java/org/crosswire/jsword/book/basic jsword/src/main/java/org/crosswire/jsword/book/filter jsword/src/main/java/org/crosswire/jsword/book/filter/osis jsword/src/main/java/org/crosswire/jsword/book/sword jsword-web/src/main/webapp/iBD
dmsmith at crosswire.org
dmsmith at crosswire.org
Tue Nov 30 07:17:06 MST 2010
Author: dmsmith
Date: 2010-11-30 07:17:06 -0700 (Tue, 30 Nov 2010)
New Revision: 2028
Added:
trunk/jsword/jar/jdom-1.1.1/
trunk/jsword/jar/jdom-1.1.1/LICENSE.txt
trunk/jsword/jar/jdom-1.1.1/README.txt
trunk/jsword/jar/jdom-1.1.1/jdom-1.1.1-src.zip
trunk/jsword/jar/jdom-1.1.1/jdom-1.1.1.jar
Removed:
trunk/jsword/jar/jdom-1.0/
Modified:
trunk/bibledesktop/etc/installer/macosx/BibleDesktop.app/Contents/Info.plist
trunk/bibledesktop/etc/jnlp/bibledesktop.jnlp
trunk/jsword-web/src/main/webapp/iBD/tutorial.html
trunk/jsword/.classpath
trunk/jsword/jar/HOWTO-UPGRADE.txt
trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/AbstractPassageBook.java
trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/FilterFactory.java
trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/osis/OSISFilter.java
trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordBook.java
trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordDictionary.java
trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordGenBook.java
Log:
JS-136: Upgrade from jdom-1.0 to jdom-1.1.1 and use fast reconfigure where possible.
Modified: trunk/bibledesktop/etc/installer/macosx/BibleDesktop.app/Contents/Info.plist
===================================================================
--- trunk/bibledesktop/etc/installer/macosx/BibleDesktop.app/Contents/Info.plist 2010-11-26 11:33:50 UTC (rev 2027)
+++ trunk/bibledesktop/etc/installer/macosx/BibleDesktop.app/Contents/Info.plist 2010-11-30 14:17:06 UTC (rev 2028)
@@ -44,7 +44,7 @@
<string>$JAVAROOT/lucene-snowball-2.9.1.jar</string>
<string>$JAVAROOT/lucene-analyzers-2.9.1.jar</string>
<string>$JAVAROOT/lucene-smartcn-2.9.1.jar</string>
- <string>$JAVAROOT/jdom-1.0.jar</string>
+ <string>$JAVAROOT/jdom-1.1.1.jar</string>
<string>$JAVAROOT/commons-codec-1.3.jar</string>
<string>$JAVAROOT/commons-httpclient-3.1.jar</string>
<string>$JAVAROOT/commons-logging-1.1.1.jar</string>
Modified: trunk/bibledesktop/etc/jnlp/bibledesktop.jnlp
===================================================================
--- trunk/bibledesktop/etc/jnlp/bibledesktop.jnlp 2010-11-26 11:33:50 UTC (rev 2027)
+++ trunk/bibledesktop/etc/jnlp/bibledesktop.jnlp 2010-11-30 14:17:06 UTC (rev 2028)
@@ -33,7 +33,7 @@
<jar href="jsword-common-swing- at release.version@.jar"/>
<jar href="jsword-common-aqua-1.0.6.jar"/>
<jar href="javatar-2.5.jar"/>
- <jar href="jdom-1.0.jar"/>
+ <jar href="jdom-1.1.1.jar"/>
<jar href="commons-codec-1.3.jar"/>
<jar href="commons-httpclient-3.1.jar"/>
<jar href="commons-logging-1.1.1.jar"/>
Modified: trunk/jsword/.classpath
===================================================================
--- trunk/jsword/.classpath 2010-11-26 11:33:50 UTC (rev 2027)
+++ trunk/jsword/.classpath 2010-11-30 14:17:06 UTC (rev 2028)
@@ -15,8 +15,8 @@
<classpathentry exported="true" kind="lib" path="jar/icu4j-4.0/icu4j-charsets-4_0.jar"/>
<classpathentry exported="true" kind="lib" path="jar/jaf-1.1/activation.jar"/>
<classpathentry exported="true" kind="lib" path="jar/javatar-2.5/javatar-2.5.jar"/>
- <classpathentry exported="true" kind="lib" path="jar/jdom-1.0/jdom-1.0.jar" sourcepath="jar/jdom-1.0/jdom-1.0.zip"/>
<classpathentry exported="true" kind="lib" path="jar/junit-3.8.1/junit.jar" sourcepath="jar/junit-3.8.1/junit-3.8.1-src.jar"/>
<classpathentry kind="lib" path="jar/icu4j-4.0/icu4j-4_0.jar" sourcepath="jar/icu4j-4.0/icu4j-4_0-src.jar"/>
+ <classpathentry exported="true" kind="lib" path="jar/jdom-1.1.1/jdom-1.1.1.jar" sourcepath="jar/jdom-1.1.1/jdom-1.1.1-src.zip"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Modified: trunk/jsword/jar/HOWTO-UPGRADE.txt
===================================================================
--- trunk/jsword/jar/HOWTO-UPGRADE.txt 2010-11-26 11:33:50 UTC (rev 2027)
+++ trunk/jsword/jar/HOWTO-UPGRADE.txt 2010-11-30 14:17:06 UTC (rev 2028)
@@ -24,3 +24,22 @@
In SVN remove the old Lucene directory.
If installing a x.9 release, look for deprecations and replace them.
+
+==================================================================================
+How to upgrade jdom
+
+Obtain the most recent version from
+http://jdom.org
+
+Uncompress the binary file into the jar directory.
+Rename it from jdom to jdom-1.1.1 (or whatever the version is)
+mv jdom-1.1.1/build/jdom.jar jdom-1.1.1/jdom-1.1.1.jar
+Create the src zip file (or jar file, if you like)
+cd jdom-1.1.1/src/java
+zip -r ../../jdom-1.1.1-src.zip org
+
+Delete everything but these two files, the license file and the readme.
+
+Change the references to the old directory to the new directory in the build path.
+
+
Added: trunk/jsword/jar/jdom-1.1.1/LICENSE.txt
===================================================================
--- trunk/jsword/jar/jdom-1.1.1/LICENSE.txt (rev 0)
+++ trunk/jsword/jar/jdom-1.1.1/LICENSE.txt 2010-11-30 14:17:06 UTC (rev 2028)
@@ -0,0 +1,56 @@
+/*--
+
+ $Id: LICENSE.txt,v 1.11 2004/02/06 09:32:57 jhunter Exp $
+
+ Copyright (C) 2000-2004 Jason Hunter & Brett McLaughlin.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions, and the disclaimer that follows
+ these conditions in the documentation and/or other materials
+ provided with the distribution.
+
+ 3. The name "JDOM" must not be used to endorse or promote products
+ derived from this software without prior written permission. For
+ written permission, please contact <request_AT_jdom_DOT_org>.
+
+ 4. Products derived from this software may not be called "JDOM", nor
+ may "JDOM" appear in their name, without prior written permission
+ from the JDOM Project Management <request_AT_jdom_DOT_org>.
+
+ In addition, we request (but do not require) that you include in the
+ end-user documentation provided with the redistribution and/or in the
+ software itself an acknowledgement equivalent to the following:
+ "This product includes software developed by the
+ JDOM Project (http://www.jdom.org/)."
+ Alternatively, the acknowledgment may be graphical using the logos
+ available at http://www.jdom.org/images/logos.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE JDOM AUTHORS OR THE PROJECT
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+
+ This software consists of voluntary contributions made by many
+ individuals on behalf of the JDOM Project and was originally
+ created by Jason Hunter <jhunter_AT_jdom_DOT_org> and
+ Brett McLaughlin <brett_AT_jdom_DOT_org>. For more information
+ on the JDOM Project, please see <http://www.jdom.org/>.
+
+ */
+
Added: trunk/jsword/jar/jdom-1.1.1/README.txt
===================================================================
--- trunk/jsword/jar/jdom-1.1.1/README.txt (rev 0)
+++ trunk/jsword/jar/jdom-1.1.1/README.txt 2010-11-30 14:17:06 UTC (rev 2028)
@@ -0,0 +1,109 @@
+Introduction to the JDOM project
+================================
+
+Please see the JDOM web site at http://jdom.org/.
+
+
+How to use JDOM
+===============
+
+Please see the web site http://jdom.org/downloads/docs.html. It has links to
+numerous articles and books covering JDOM.
+
+
+Installing the build tools
+==========================
+
+The JDOM build system is based on Jakarta Ant, which is a Java building tool
+originally developed for the Jakarta Tomcat project but now used in many other
+Apache projects and extended by many developers.
+
+Ant is a little but very handy tool that uses a build file written in XML
+(build.xml) as building instructions. For more information refer to
+"http://ant.apache.org".
+
+The only thing that you have to make sure of is that the "JAVA_HOME"
+environment property is set to match the top level directory containing the
+JVM you want to use. For example:
+
+C:\> set JAVA_HOME=C:\jdk1.2.2
+ (or jdk1.3.1, etc.)
+
+or on Unix:
+
+% setenv JAVA_HOME /usr/local/java
+ (csh)
+> JAVA_HOME=/usr/java; export JAVA_HOME
+ (ksh, bash)
+
+That's it!
+
+
+Building instructions
+=====================
+
+Ok, let's build the code. First, make sure your current working directory is
+where the build.xml file is located. Then type
+
+ ./build.sh (unix)
+ .\build.bat (win32)
+
+if everything is right and all the required packages are visible, this action
+will generate a file called "jdom.jar" in the "./build" directory. Note, that
+if you do further development, compilation time is reduced since Ant is able
+to detect which files have changed and recompile them as needed.
+
+If for some crazy reason you're still using JDK 1.1, please note that JDOM no
+longer supports JDK 1.1 compiles. If you're despreate for JDK 1.1 support,
+you can retrieve the CVS code from April 2nd, 2003, (use the -D flag). This
+was the last day JDK 1.1 was supported. Then run the "build11" scripts.
+
+If something went wrong, go to the FAQ at http://www.jdom.org/docs/faq.html.
+
+
+Build targets
+=============
+
+The build system is not only responsible for compiling JDOM into a jar file,
+but is also responsible for creating the HTML documentation in the form of
+javadocs.
+
+These are the meaningful targets for this build file:
+
+ - package [default] -> creates ./build/jdom.jar
+ - compile -> compiles the source code
+ - samples -> compiles example code
+ - javadoc -> generates the API documentation in ./build/javadocs
+ - clean -> restores the distribution to its original and clean state
+
+For example, to build the samples, type
+
+build samples
+(Windows)
+
+build.sh samples
+(Unix)
+
+To learn the details of what each target does, read the build.xml file. It is
+quite understandable.
+
+
+Bug Reports
+===========
+
+Bug reports go to the jdom-interest list at jdom.org. But *BEFORE YOU POST*
+make sure you've tested against the LATEST code available from CVS (or the
+daily snapshot). Odds are good your bug has already been fixed. If it hasn't
+been fixed in the latest version, then when posting *BE SURE TO SAY* which
+code version you tested against. For example, "CVS from October 3rd". Also
+be sure to include enough information to reproduce the bug and full exception
+stack traces. You might also want to read the FAQ at http://jdom.org to find
+out if your problem is not really a bug and just a common misunderstanding
+about how XML or JDOM works.
+
+
+Searching for Information
+=========================
+
+The JDOM mailing lists are archived and easily searched at
+http://jdom.markmail.org.
Added: trunk/jsword/jar/jdom-1.1.1/jdom-1.1.1-src.zip
===================================================================
(Binary files differ)
Property changes on: trunk/jsword/jar/jdom-1.1.1/jdom-1.1.1-src.zip
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/jsword/jar/jdom-1.1.1/jdom-1.1.1.jar
===================================================================
(Binary files differ)
Property changes on: trunk/jsword/jar/jdom-1.1.1/jdom-1.1.1.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/AbstractPassageBook.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/AbstractPassageBook.java 2010-11-26 11:33:50 UTC (rev 2027)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/AbstractPassageBook.java 2010-11-30 14:17:06 UTC (rev 2028)
@@ -55,17 +55,14 @@
super(bmd);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.crosswire.jsword.book.Book#getOsisIterator(org.crosswire.jsword.passage
- * .Key, boolean)
+ /* (non-Javadoc)
+ * @see org.crosswire.jsword.book.Book#getOsisIterator(org.crosswire.jsword.passage.Key, boolean)
*/
public Iterator getOsisIterator(Key key, boolean allowEmpty) throws BookException {
// Note: allowEmpty indicates parallel view
// TODO(DMS): make the iterator be demand driven
try {
+ Filter filter = getFilter();
List content = new ArrayList();
// For all the ranges in this Passage
@@ -91,7 +88,7 @@
// If the verse is empty then we shouldn't add the verse tag
if (allowEmpty || txt.length() > 0) {
- List osisContent = getFilter().toOSIS(this, verse, txt);
+ List osisContent = filter.toOSIS(this, verse, txt);
addOSIS(verse, content, osisContent);
}
}
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/FilterFactory.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/FilterFactory.java 2010-11-26 11:33:50 UTC (rev 2027)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/FilterFactory.java 2010-11-30 14:17:06 UTC (rev 2028)
@@ -23,6 +23,7 @@
import java.util.HashMap;
import java.util.Iterator;
+import java.util.Locale;
import java.util.Map;
import org.crosswire.common.util.Logger;
@@ -76,11 +77,12 @@
// the lookup table
Iterator it = map.entrySet().iterator();
+ Filter instance = null;
while (it.hasNext()) {
try {
Map.Entry entry = (Map.Entry) it.next();
Class clazz = (Class) entry.getValue();
- Filter instance = (Filter) clazz.newInstance();
+ instance = (Filter) clazz.newInstance();
addFilter((String) entry.getKey(), instance);
} catch (InstantiationException ex) {
log.error("Failed to add filter", ex);
@@ -91,7 +93,7 @@
// if the default didn't work then make a stab at an answer
if (deft == null) {
- deft = (Filter) filters.values().iterator().next();
+ deft = instance;
}
}
@@ -100,15 +102,7 @@
* not found then the default filter will be used.
*/
public static Filter getFilter(String lookup) {
- Filter reply = null;
- Iterator it = filters.keySet().iterator();
- while (it.hasNext()) {
- String key = (String) it.next();
- if (key.equalsIgnoreCase(lookup)) {
- reply = (Filter) filters.get(key);
- break;
- }
- }
+ Filter reply = (Filter) filters.get(lookup.toLowerCase());
if (reply == null) {
reply = deft;
@@ -128,6 +122,6 @@
* Add to our list of known filters
*/
public static void addFilter(String name, Filter instance) {
- filters.put(name, instance);
+ filters.put(name.toLowerCase(Locale.ENGLISH), instance);
}
}
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/osis/OSISFilter.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/osis/OSISFilter.java 2010-11-26 11:33:50 UTC (rev 2027)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/osis/OSISFilter.java 2010-11-30 14:17:06 UTC (rev 2028)
@@ -46,13 +46,17 @@
* @author Joe Walker [joe at eireneh dot com]
*/
public class OSISFilter implements Filter {
- /*
- * (non-Javadoc)
- *
- * @see
- * org.crosswire.jsword.book.filter.Filter#toOSIS(org.crosswire.jsword.book
- * .Book, org.crosswire.jsword.passage.Key, java.lang.String)
+ /**
+ * Default constructor of an OSISFilter
*/
+ public OSISFilter() {
+ builder = new SAXBuilder();
+ builder.setFastReconfigure(true);
+ }
+
+ /* (non-Javadoc)
+ * @see org.crosswire.jsword.book.filter.Filter#toOSIS(org.crosswire.jsword.book.Book, org.crosswire.jsword.passage.Key, java.lang.String)
+ */
public List toOSIS(Book book, Key key, String plain) {
DataPolice.setKey(key);
Element ele = null;
@@ -139,7 +143,6 @@
// create a root element to house our document fragment
StringReader in = new StringReader("<div>" + plain + "</div>");
InputSource is = new InputSource(in);
- SAXBuilder builder = new SAXBuilder();
Document doc = builder.build(is);
Element div = doc.getRootElement();
@@ -150,4 +153,9 @@
* The log stream
*/
private static final Logger log = Logger.getLogger(OSISFilter.class);
+
+ /**
+ * A reusable SAX Builder
+ */
+ private SAXBuilder builder;
}
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordBook.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordBook.java 2010-11-26 11:33:50 UTC (rev 2027)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordBook.java 2010-11-30 14:17:06 UTC (rev 2028)
@@ -49,7 +49,7 @@
public SwordBook(SwordBookMetaData sbmd, AbstractBackend backend) {
super(sbmd);
- this.sbmd = sbmd;
+ this.filter = sbmd.getFilter();
this.backend = backend;
}
@@ -201,7 +201,7 @@
* @see org.crosswire.jsword.book.basic.AbstractPassageBook#getFilter()
*/
protected Filter getFilter() {
- return sbmd.getFilter();
+ return filter;
}
/**
@@ -210,7 +210,7 @@
private AbstractBackend backend;
/**
- * The Sword configuration file
+ * The filter to use to convert to OSIS.
*/
- private SwordBookMetaData sbmd;
+ private Filter filter;
}
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordDictionary.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordDictionary.java 2010-11-26 11:33:50 UTC (rev 2027)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordDictionary.java 2010-11-30 14:17:06 UTC (rev 2028)
@@ -30,6 +30,7 @@
import org.crosswire.jsword.book.BookException;
import org.crosswire.jsword.book.OSISUtil;
import org.crosswire.jsword.book.basic.AbstractBook;
+import org.crosswire.jsword.book.filter.Filter;
import org.crosswire.jsword.book.filter.FilterException;
import org.crosswire.jsword.passage.DefaultKeyList;
import org.crosswire.jsword.passage.DefaultLeafKeyList;
@@ -52,8 +53,8 @@
protected SwordDictionary(SwordBookMetaData sbmd, AbstractBackend backend) {
super(sbmd);
- this.sbmd = sbmd;
this.backend = (AbstractKeyBackend) backend;
+ this.filter = sbmd.getFilter();
active = false;
}
@@ -78,7 +79,7 @@
String txt = backend.getRawText(key);
- List osisContent = sbmd.getFilter().toOSIS(this, key, txt);
+ List osisContent = filter.toOSIS(this, key, txt);
content.addAll(osisContent);
return content.iterator();
@@ -245,7 +246,7 @@
private AbstractKeyBackend backend;
/**
- * The Sword configuration file
+ * The filter to use to convert to OSIS.
*/
- private SwordBookMetaData sbmd;
+ private Filter filter;
}
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordGenBook.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordGenBook.java 2010-11-26 11:33:50 UTC (rev 2027)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordGenBook.java 2010-11-30 14:17:06 UTC (rev 2028)
@@ -31,6 +31,7 @@
import org.crosswire.common.activate.Lock;
import org.crosswire.jsword.book.BookException;
import org.crosswire.jsword.book.basic.AbstractBook;
+import org.crosswire.jsword.book.filter.Filter;
import org.crosswire.jsword.book.filter.FilterException;
import org.crosswire.jsword.passage.DefaultKeyList;
import org.crosswire.jsword.passage.Key;
@@ -52,8 +53,8 @@
protected SwordGenBook(SwordBookMetaData sbmd, AbstractBackend backend) {
super(sbmd);
- this.sbmd = sbmd;
this.backend = backend;
+ this.filter = sbmd.getFilter();
map = null;
set = null;
global = null;
@@ -126,7 +127,7 @@
String txt = backend.getRawText(key);
- List osisContent = sbmd.getFilter().toOSIS(this, key, txt);
+ List osisContent = filter.toOSIS(this, key, txt);
content.addAll(osisContent);
return content.iterator();
@@ -308,7 +309,7 @@
private AbstractBackend backend;
/**
- * The Sword configuration file
+ * The filter to use to convert to OSIS.
*/
- private SwordBookMetaData sbmd;
+ private Filter filter;
}
Modified: trunk/jsword-web/src/main/webapp/iBD/tutorial.html
===================================================================
--- trunk/jsword-web/src/main/webapp/iBD/tutorial.html 2010-11-26 11:33:50 UTC (rev 2027)
+++ trunk/jsword-web/src/main/webapp/iBD/tutorial.html 2010-11-30 14:17:06 UTC (rev 2028)
@@ -31,9 +31,8 @@
|-- dwr.xml
|-- lib (populate this with all the jsword jars, its dependent jars and dwr)
|-- jsword-1.6.jar
- |-- jsword-common-1.6.jar
|-- javatar-2.5.jar
- |-- jdom-1.0.jar
+ |-- jdom-1.1.1.jar
|-- commons-codec-1.3.jar
|-- commons-httpclient-3.1.jar
|-- commons-logging-1.1.1.jar
More information about the jsword-svn
mailing list