From: <ha...@us...> - 2007-04-27 15:35:47
|
Revision: 7516 http://svn.sourceforge.net/jmol/?rev=7516&view=rev Author: hansonr Date: 2007-04-27 08:35:39 -0700 (Fri, 27 Apr 2007) Log Message: ----------- 11.1.30 -- new resolver (testing) Modified Paths: -------------- trunk/Jmol/applet.classes trunk/Jmol/build.xml trunk/Jmol/src/org/jmol/adapter/smarter/Resolver.java Modified: trunk/Jmol/applet.classes =================================================================== --- trunk/Jmol/applet.classes 2007-04-27 14:49:20 UTC (rev 7515) +++ trunk/Jmol/applet.classes 2007-04-27 15:35:39 UTC (rev 7516) @@ -1,6 +1,7 @@ JmolApplet.java JmolAppletControl.java org/jmol/adapter/smarter/*.java +org/jmol/adapter/readers/*.java org/jmol/api/*.java org/jmol/applet/*.java org/jmol/appletwrapper/*.java Modified: trunk/Jmol/build.xml =================================================================== --- trunk/Jmol/build.xml 2007-04-27 14:49:20 UTC (rev 7515) +++ trunk/Jmol/build.xml 2007-04-27 15:35:39 UTC (rev 7516) @@ -10,7 +10,7 @@ <!-- for some reason, I can't get ant to use this ${java.version} property as the value of the source parameter --> <property name="java.version" value="1.4" /> - <property name="debug" value="on" /> + <property name="debug" value="off" /> <property name="deprecation" value="off" /> <property name="optimization" value="off" /> @@ -517,10 +517,18 @@ <jar destfile="${jmol.applet.build.dir}/JmolApplet4.jar" manifest="manifest/applet4.txt" > <fileset dir="${applet.classes.dir}"> <include name="org/jmol/adapter/smarter/**" /> + <include name="org/jmol/adapter/readers/**" /> <include name="org/jmol/symmetry/**" /> </fileset> </jar> - + + <jar destfile="${jmol.applet.build.dir}/JmolApplet4b.jar" manifest="manifest/applet4b.txt" > + <fileset dir="${applet.classes.dir}"> + <include name="org/jmol/adapter/smarter/**" /> + <include name="org/jmol/symmetry/**" /> + </fileset> + </jar> + <jar destfile="${jmol.applet.build.dir}/JmolApplet5.jar" manifest="manifest/applet5.txt" > <fileset dir="${applet.classes.dir}"> <include name="org/openscience/jmol/**" /> Modified: trunk/Jmol/src/org/jmol/adapter/smarter/Resolver.java =================================================================== --- trunk/Jmol/src/org/jmol/adapter/smarter/Resolver.java 2007-04-27 14:49:20 UTC (rev 7515) +++ trunk/Jmol/src/org/jmol/adapter/smarter/Resolver.java 2007-04-27 15:35:39 UTC (rev 7516) @@ -27,12 +27,13 @@ import java.io.BufferedReader; import java.util.StringTokenizer; -import org.jmol.adapter.readers.XmlReader; import org.jmol.util.Logger; import java.util.Hashtable; class Resolver { + private final static String classBase = "org.jmol.adapter.readers."; + static String getFileType(BufferedReader br) { try { return determineAtomSetCollectionReader(br, false); @@ -47,7 +48,7 @@ static Object resolve(String name, BufferedReader bufferedReader, Hashtable htParams) throws Exception { - AtomSetCollectionReader atomSetCollectionReader; + AtomSetCollectionReader atomSetCollectionReader = null; String atomSetCollectionReaderName = determineAtomSetCollectionReader( bufferedReader, true); if (atomSetCollectionReaderName.indexOf("\n") >= 0) @@ -56,17 +57,28 @@ Logger.info("The Resolver thinks " + atomSetCollectionReaderName); String className = null; Class atomSetCollectionReaderClass; - String classBase = "org.jmol.adapter.readers."; + String err = null; try { className = classBase + atomSetCollectionReaderName + "Reader"; atomSetCollectionReaderClass = Class.forName(className); atomSetCollectionReader = (AtomSetCollectionReader) atomSetCollectionReaderClass .newInstance(); } catch (Exception e) { - String err = "File reader was not found:" + classBase + className; - Logger.error(err, e); - return err; + err = "File reader was not found:" + "./org/jmol/adapter/readers/" + className; + Logger.error(err, e); } + if (err != null) { + try { + className = atomSetCollectionReaderName + "Reader"; + atomSetCollectionReaderClass = Class.forName(className); + atomSetCollectionReader = (AtomSetCollectionReader) atomSetCollectionReaderClass + .newInstance(); + } catch (Exception e) { + err = "File reader was not found:" + className; + Logger.error(err, e); + return err; + } + } atomSetCollectionReader.initialize(htParams); AtomSetCollection atomSetCollection = atomSetCollectionReader .readAtomSetCollection(bufferedReader); @@ -76,10 +88,19 @@ } static Object DOMResolve(Object DOMNode) throws Exception { - AtomSetCollectionReader atomSetCollectionReader = new XmlReader(); - + String className = null; + Class atomSetCollectionReaderClass; + AtomSetCollectionReader atomSetCollectionReader; + try { + className = classBase + "XmlReader"; + atomSetCollectionReaderClass = Class.forName(className); + atomSetCollectionReader = (AtomSetCollectionReader) atomSetCollectionReaderClass.newInstance(); + } catch (Exception e) { + String err = "File reader was not found:" + "./org/jmol/adapter/readers/" + className; + Logger.error(err, e); + return err; + } atomSetCollectionReader.initialize(); - AtomSetCollection atomSetCollection = atomSetCollectionReader.readAtomSetCollectionFromDOM(DOMNode); return finalize(atomSetCollection, "DOM node"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |