Java dependencies update
authorBill Erickson <berick@esilibrary.com>
Fri, 24 Feb 2012 21:28:27 +0000 (16:28 -0500)
committerDan Scott <dscott@laurentian.ca>
Tue, 28 Feb 2012 15:35:09 +0000 (10:35 -0500)
As of Java 6, XML Stax parsing is natively supported.  This change
removes the external Stax dependencies and updates how the JSON libs are
fetched (in deps.sh), which now come from github.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Dan Scott <dscott@laurentian.ca>
src/java/deps.sh
src/java/org/opensrf/net/xmpp/XMPPReader.java
src/java/org/opensrf/util/XMLFlattener.java

index 0d7a7bf..c6302ca 100755 (executable)
@@ -2,31 +2,22 @@
 # Utility script for fetching the OpenSRF Java dependencies
 # ----------------------------------------------------------------
 
-. deps.inc
-STAX=stax-api-1.0.1.jar
-WSTX=wstx-lgpl-3.2.1.jar
-MEMCACHE=java_memcached-release_1.5.1.jar
-JSON=json.zip
+MEMCACHE=java_memcached-release_2.0.1.jar
+MEMCACHE_URL=http://img.whalin.com/memcached/jdk6/standard/$MEMCACHE
+JSON_URL=https://github.com/douglascrockford/JSON-java/zipball/master
 JSON_ZIP=json.zip
-
-STAX_URL=http://woodstox.codehaus.org/$STAX
-WSTX_URL=http://woodstox.codehaus.org/3.2.1/$WSTX
-MEMCACHE_URL=http://img.whalin.com/memcached/jdk5/standard/$MEMCACHE
-JSON_URL=http://www.json.org/java/$JSON
-
-JAVAC="javac -J-Xmx256m"
-JAVA="java -Xmx256m"
+JSON_JAR=json.jar
 
 mkdir -p deps
-if [ ! -f deps/$STAX ]; then wget $STAX_URL -O deps/$STAX; fi 
-if [ ! -f deps/$WSTX ]; then wget $WSTX_URL -O deps/$WSTX; fi
 if [ ! -f deps/$MEMCACHE ]; then wget $MEMCACHE_URL -O deps/$MEMCACHE; fi
-if [ ! -f deps/$JSON ]; then 
-    mkdir -p deps 
+if [ ! -f deps/$JSON_JAR ]; then 
     cd deps 
-    wget "$JSON_URL"
-    unzip $JSON && $JAVAC org/json/*.java; 
-    jar cf json.jar org
+    wget "$JSON_URL" -O $JSON_ZIP
+    unzip $JSON_ZIP
+    mkdir -p org/json/
+    cp douglascrockford*/*.java org/json/
+    javac org/json/*.java
+    jar cf $JSON_JAR org/json/*.class
 fi
 
 
@@ -38,3 +29,9 @@ else
     echo "example: INSTALLDIR=/path/to/java $0"
     echo ""
 fi
+
+echo ""
+echo "To compile OpenSRF java:"
+echo ""
+echo "CLASSPATH=deps/$MEMCACHE:deps/$JSON_JAR javac org/opensrf/*.java org/opensrf/net/xmpp/*.java org/opensrf/util/*.java org/opensrf/test/*.java"
+echo ""
index dcaf8bd..406298a 100644 (file)
@@ -9,8 +9,6 @@ import java.util.concurrent.ConcurrentLinkedQueue;
 import java.util.Date;
 import org.opensrf.util.Logger;
 
-import com.ctc.wstx.stax.WstxInputFactory;
-
 /**
  * Slim XMPP Stream reader.  This reader only understands enough XMPP
  * to handle logins and recv messages.  It's implemented as a StAX parser.
@@ -162,8 +160,7 @@ public class XMPPReader implements Runnable {
 
         try {
 
-            //XMLInputFactory factory = XMLInputFactory.newInstance();
-            XMLInputFactory factory = new com.ctc.wstx.stax.WstxInputFactory();
+            XMLInputFactory factory = XMLInputFactory.newInstance();
 
             /** disable as many unused features as possible to speed up the parsing */
             factory.setProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES, Boolean.FALSE);
index 5a8561d..7abefe0 100644 (file)
@@ -12,8 +12,6 @@ import java.io.InputStream;
 import org.opensrf.util.JSONWriter;
 import org.opensrf.util.JSONReader;
 
-import com.ctc.wstx.stax.WstxInputFactory;
-
 /**
  * Flattens an XML file into a properties map.  Values are stored as JSON strings or arrays.
  * An array is created if more than one value resides at the same key.
@@ -57,8 +55,7 @@ public class XMLFlattener {
      */
     public Map read() throws javax.xml.stream.XMLStreamException {
 
-        //XMLInputFactory factory = XMLInputFactory.newInstance();
-        XMLInputFactory factory = new com.ctc.wstx.stax.WstxInputFactory();
+        XMLInputFactory factory = XMLInputFactory.newInstance();
 
         /** disable as many unused features as possible to speed up the parsing */
         factory.setProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES, Boolean.TRUE);