*** empty log message ***

This commit is contained in:
travismccauley 2004-07-02 00:39:52 +00:00
parent 66cdf866c6
commit 117475a161
7 changed files with 117 additions and 103 deletions

104
build.xml
View file

@ -60,33 +60,18 @@ jmeterhome=../jmeter
</fileset> </fileset>
<!--point to org/thdl/users--> <!--point to org/thdl/users-->
<pathelement location="${build}/WEB-INF/classes"/> <pathelement location="${build}/WEB-INF/classes"/>
<pathelement location="${build}/WEB-INF/tld"/>
</path> </path>
<!-- Executable Targets --> <!-- Executable Targets -->
<target name="copy" description="copy jsp, html, css, js, and other files into the build directory"> <target name="copy" description="copy jsp, html, css, js, and other files into the build directory">
<copy todir="${build}"> <copy todir="${build}">
<fileset dir="${source}/jsp"> <fileset dir="${basedir}/web">
<include name="*.jsp"/> <include name="**/*.jsp"/>
<include name="*.jsf"/> <include name="**/*.jsf"/>
</fileset> <include name="**/*.css"/>
</copy> <include name="**/*.js"/>
<copy todir="${build}/jsp">
<fileset dir="${source}/jsp/jsp">
<include name="*.jsp"/>
<include name="*.jsf"/>
</fileset>
</copy>
<copy todir="${build}/css">
<fileset dir="${source}/css">
<include name="*.css"/>
</fileset>
</copy>
<copy todir="${build}/js">
<fileset dir="${source}/js">
<include name="*.js"/>
</fileset> </fileset>
</copy> </copy>
@ -95,8 +80,8 @@ jmeterhome=../jmeter
</copy> </copy>
<copy todir="${build}/WEB-INF"> <copy todir="${build}/WEB-INF">
<fileset dir="${basedir}/config"> <fileset dir="${basedir}/web/WEB-INF">
<filename name="web.xml"/>
</fileset> </fileset>
</copy> </copy>
@ -117,9 +102,12 @@ jmeterhome=../jmeter
<fileset dir="${basedir}/lib/jstl"> <fileset dir="${basedir}/lib/jstl">
<include name="*.jar"/> <include name="*.jar"/>
</fileset> </fileset>
<fileset dir="${basedir}/lib/hibernate"> <fileset dir="${basedir}/lib/hibernate">
<include name="*.jar"/> <include name="*.jar"/>
<exclude name="commons-dbcp.jar"/>
</fileset> </fileset>
<fileset dir="${basedir}/lib/thdl"> <fileset dir="${basedir}/lib/thdl">
<include name="*.jar"/> <include name="*.jar"/>
</fileset> </fileset>
@ -127,9 +115,14 @@ jmeterhome=../jmeter
<fileset dir="${basedir}/lib/commons"> <fileset dir="${basedir}/lib/commons">
<include name="*.jar"/> <include name="*.jar"/>
</fileset> </fileset>
<fileset dir="${basedir}/lib/jwebunit"> <fileset dir="${basedir}/lib/jwebunit">
<include name="*.jar"/> <include name="*.jar"/>
</fileset> </fileset>
<fileset dir="${basedir}/lib/log4j">
<include name="*.jar"/>
</fileset>
<!--<fileset dir="${basedir}/lib/dlese-oai"> <!--<fileset dir="${basedir}/lib/dlese-oai">
<include name="*.jar"/> <include name="*.jar"/>
</fileset> </fileset>
@ -145,8 +138,6 @@ jmeterhome=../jmeter
<javac srcdir="${thdluser.home}/src/java" destdir="${build}/WEB-INF/classes" deprecation="on" classpathref="classpath" debug="on"></javac> <javac srcdir="${thdluser.home}/src/java" destdir="${build}/WEB-INF/classes" deprecation="on" classpathref="classpath" debug="on"></javac>
<javac destdir="${build}/WEB-INF/classes" classpathref="classpath" debug="on" listfiles="no"> <javac destdir="${build}/WEB-INF/classes" classpathref="classpath" debug="on" listfiles="no">
<src path="${source}/java"/> <src path="${source}/java"/>
<include name="org/thdl/lex/util/DictionaryImporter.java"/>
<include name="org/thdl/lex/**"/>
<exclude name="**/old/**"/> <exclude name="**/old/**"/>
<exclude name="**/test/**"/> <exclude name="**/test/**"/>
<exclude name="**/util/**"/> <exclude name="**/util/**"/>
@ -154,6 +145,30 @@ jmeterhome=../jmeter
</javac> </javac>
</target> </target>
<target name="compile-jsp">
<mkdir dir="${basedir}/src/jspc"/>
<jspc srcdir="${basedir}/web"
destdir="${basedir}/src/jspc"
package="org.thdl.lex.jsp"
classpathref="classpath"
webinc="${basedir}/web/webinc.include"
compiler="jasper41"
verbose="9">
<include name="**/*.jsp" />
<include name="**/*.jsf" />
</jspc>
</target>
<target name="build" depends="compile, compile-jsp"/>
<target name="compile-util" description="Compile util classes" depends="compile">
<mkdir dir="${build}/WEB-INF/classes"/>
<javac srcdir="${thdluser.home}/src/java" destdir="${build}/WEB-INF/classes" deprecation="on" classpathref="classpath" debug="on"></javac>
<javac destdir="${build}/WEB-INF/classes" classpathref="classpath" debug="on" listfiles="no">
<src path="${source}/java/org/thdl/lex/util"/>
</javac>
</target>
<target name="javadoc" description="Create Javadocs"> <target name="javadoc" description="Create Javadocs">
<javadoc destdir="${build}/apidocs/" classpathref="classpath" author="true" version="true" use="true" windowtitle="THDL Tibetan Collaborative Dictionary API"> <javadoc destdir="${build}/apidocs/" classpathref="classpath" author="true" version="true" use="true" windowtitle="THDL Tibetan Collaborative Dictionary API">
@ -172,7 +187,7 @@ jmeterhome=../jmeter
</javadoc> </javadoc>
</target> </target>
<target name="install" description="Install web application" depends="compile"> <target name="install" description="Install web application" depends="build">
<install url="${url}" username="${username}" password="${password}" path="${path}" config="file://${basedir}/${lex.context.config}" war="file://${build}"/> <install url="${url}" username="${username}" password="${password}" path="${path}" config="file://${basedir}/${lex.context.config}" war="file://${build}"/>
</target> </target>
@ -190,7 +205,7 @@ jmeterhome=../jmeter
<antcall target="install"/> <antcall target="install"/>
</target> </target>
<target name="reload" description="Reload web application" depends="compile"> <target name="reload" description="Reload web application" depends="build">
<reload url="${url}" username="${username}" password="${password}" path="${path}"/> <reload url="${url}" username="${username}" password="${password}" path="${path}"/>
</target> </target>
@ -315,8 +330,8 @@ jmeter.save.saveservice.output_format=xml
</schemaupdate> </schemaupdate>
</target> </target>
<target name="convert-to-new-mapping" description="convert old data to a new db mapping" depends="copy, compile"> <target name="convert-to-new-mapping" description="convert old data to a new db mapping" depends="compile-util">
<java classname="org.thdl.lex.ConvertDataToNewMapping" classpathref="classpath" fork="yes"> <java classname="org.thdl.lex.utilConvertDataToNewMapping" classpathref="classpath" fork="yes">
<classpath> <classpath>
<pathelement location="${build}/WEB-INF/classes"/> <pathelement location="${build}/WEB-INF/classes"/>
</classpath> </classpath>
@ -324,13 +339,11 @@ jmeter.save.saveservice.output_format=xml
</java> </java>
</target> </target>
<target name="importer-dm" description="Imports Dan Martin's dictionary into database. " depends="copy, compile"> <target name="import-dm" description="Imports Dan Martin's dictionary into database. " depends="compile-util">
<java classname="org.thdl.lex.util.DictionaryImporter" classpathref="classpath" fork="yes"> <java classname="org.thdl.lex.util.DictionaryImporter" classpathref="classpath" fork="yes">
<classpath> <classpath>
<pathelement location="${build}/WEB-INF/classes"/> <pathelement location="${build}/WEB-INF/classes"/>
</classpath> </classpath>
<!-- Pass Command-line arguments to the Dictionary Importer. The first argument must always be the Hibernate config file.
<arg value="${source}/java/hibernate.cfg.xml"/>-->
<arg value="-manual"/> <arg value="-manual"/>
<arg value="-format"/><arg value="UTF-16"/> <arg value="-format"/><arg value="UTF-16"/>
<arg value="-tab"/> <arg value="-tab"/>
@ -341,13 +354,11 @@ jmeter.save.saveservice.output_format=xml
<arg value="dicts/DanMartin.txt"/> <arg value="dicts/DanMartin.txt"/>
</java> </java>
</target> </target>
<target name="importer-jh" description="Imports Jeffrey Hopkins' dictionary into database. " depends="copy, compile"> <target name="import-jh" description="Imports Jeffrey Hopkins' dictionary into database. " depends="compile-util">
<java classname="org.thdl.lex.util.DictionaryImporter" classpathref="classpath" fork="yes"> <java classname="org.thdl.lex.util.DictionaryImporter" classpathref="classpath" fork="yes">
<classpath> <classpath>
<pathelement location="${build}/WEB-INF/classes"/> <pathelement location="${build}/WEB-INF/classes"/>
</classpath> </classpath>
<!-- Pass Command-line arguments to the Dictionary Importer. The first argument must always be the Hibernate config file.
<arg value="${source}/java/hibernate.cfg.xml"/>-->
<arg value="-manual"/> <arg value="-manual"/>
<arg value="-format"/><arg value="UTF-16"/> <arg value="-format"/><arg value="UTF-16"/>
<arg value="-tab"/> <arg value="-tab"/>
@ -358,13 +369,11 @@ jmeter.save.saveservice.output_format=xml
<arg value="dicts/JHTabUnicode.txt"/> <arg value="dicts/JHTabUnicode.txt"/>
</java> </java>
</target> </target>
<target name="importer-tc" description="Imports The Great Tibetan-Chinese Dictionary into database. " depends="copy, compile"> <target name="import-tc" description="Imports The Great Tibetan-Chinese Dictionary into database. " depends="compile-util">
<java classname="org.thdl.lex.util.DictionaryImporter" classpathref="classpath" fork="yes"> <java classname="org.thdl.lex.util.DictionaryImporter" classpathref="classpath" fork="yes">
<classpath> <classpath>
<pathelement location="${build}/WEB-INF/classes"/> <pathelement location="${build}/WEB-INF/classes"/>
</classpath> </classpath>
<!-- Pass Command-line arguments to the Dictionary Importer. The first argument must always be the Hibernate config file.
<arg value="${source}/java/hibernate.cfg.xml"/>-->
<arg value="-manual"/> <arg value="-manual"/>
<arg value="-tab"/> <arg value="-tab"/>
<arg value="-creator"/><arg value="80"/> <arg value="-creator"/><arg value="80"/>
@ -375,13 +384,11 @@ jmeter.save.saveservice.output_format=xml
<arg value="dicts/tshig.tab"/> <arg value="dicts/tshig.tab"/>
</java> </java>
</target> </target>
<target name="importer-ry" description="Imports Rangjung Yeshe's dictionary into database. " depends="copy, compile"> <target name="import-ry" description="Imports Rangjung Yeshe's dictionary into database. " depends="compile-util">
<java classname="org.thdl.lex.util.DictionaryImporter" classpathref="classpath" fork="yes"> <java classname="org.thdl.lex.util.DictionaryImporter" classpathref="classpath" fork="yes">
<classpath> <classpath>
<pathelement location="${build}/WEB-INF/classes"/> <pathelement location="${build}/WEB-INF/classes"/>
</classpath> </classpath>
<!-- Pass Command-line arguments to the Dictionary Importer. The first argument must always be the Hibernate config file.
<arg value="${source}/java/hibernate.cfg.xml"/>-->
<arg value="-manual"/> <arg value="-manual"/>
<arg value="-creator"/><arg value="4"/> <arg value="-creator"/><arg value="4"/>
<arg value="-proj"/><arg value="16"/> <arg value="-proj"/><arg value="16"/>
@ -390,13 +397,11 @@ jmeter.save.saveservice.output_format=xml
<arg value="dicts/ry-dic2003-prop.txt"/> <arg value="dicts/ry-dic2003-prop.txt"/>
</java> </java>
</target> </target>
<target name="importer-jv" description="Imports Jim Valby's dictionary into database. " depends="copy, compile"> <target name="import-jv" description="Imports Jim Valby's dictionary into database. " depends="compile-util">
<java classname="org.thdl.lex.util.DictionaryImporter" classpathref="classpath" fork="yes"> <java classname="org.thdl.lex.util.DictionaryImporter" classpathref="classpath" fork="yes">
<classpath> <classpath>
<pathelement location="${build}/WEB-INF/classes"/> <pathelement location="${build}/WEB-INF/classes"/>
</classpath> </classpath>
<!-- Pass Command-line arguments to the Dictionary Importer. The first argument must always be the Hibernate config file.
<arg value="${source}/java/hibernate.cfg.xml"/>-->
<arg value="-manual"/> <arg value="-manual"/>
<arg value="-creator"/><arg value="96"/> <arg value="-creator"/><arg value="96"/>
<arg value="-proj"/><arg value="21"/> <arg value="-proj"/><arg value="21"/>
@ -406,13 +411,11 @@ jmeter.save.saveservice.output_format=xml
</java> </java>
</target> </target>
<target name="importer-rb" description="Imports Richard Barron's dictionary into database. " depends="copy, compile"> <target name="import-rb" description="Imports Richard Barron's dictionary into database. " depends="compile-util">
<java classname="org.thdl.lex.util.DictionaryImporter" classpathref="classpath" fork="yes"> <java classname="org.thdl.lex.util.DictionaryImporter" classpathref="classpath" fork="yes">
<classpath> <classpath>
<pathelement location="${build}/WEB-INF/classes"/> <pathelement location="${build}/WEB-INF/classes"/>
</classpath> </classpath>
<!-- Pass Command-line arguments to the Dictionary Importer. The first argument must always be the Hibernate config file.
<arg value="${source}/java/hibernate.cfg.xml"/>-->
<arg value="-manual"/> <arg value="-manual"/>
<arg value="-creator"/><arg value="97"/> <arg value="-creator"/><arg value="97"/>
<arg value="-proj"/><arg value="22"/> <arg value="-proj"/><arg value="22"/>
@ -422,13 +425,11 @@ jmeter.save.saveservice.output_format=xml
</java> </java>
</target> </target>
<target name="importer-iw" description="Imports Ives Waldo's dictionary into database. " depends="copy, compile"> <target name="import-iw" description="Imports Ives Waldo's dictionary into database. " depends="compile-util">
<java classname="org.thdl.lex.util.DictionaryImporter" classpathref="classpath" fork="yes"> <java classname="org.thdl.lex.util.DictionaryImporter" classpathref="classpath" fork="yes">
<classpath> <classpath>
<pathelement location="${build}/WEB-INF/classes"/> <pathelement location="${build}/WEB-INF/classes"/>
</classpath> </classpath>
<!-- Pass Command-line arguments to the Dictionary Importer. The first argument must always be the Hibernate config file.
<arg value="${source}/java/hibernate.cfg.xml"/>-->
<arg value="-manual"/> <arg value="-manual"/>
<arg value="-creator"/><arg value="98"/> <arg value="-creator"/><arg value="98"/>
<arg value="-proj"/><arg value="23"/> <arg value="-proj"/><arg value="23"/>
@ -437,4 +438,7 @@ jmeter.save.saveservice.output_format=xml
<arg value="dicts/IvesWaldo.txt"/> <arg value="dicts/IvesWaldo.txt"/>
</java> </java>
</target> </target>
<!-- <target name="import-all" depends="import-dm, import-jh, import-tc, import-ry import-jv,import-rb, import-iw"/> -->
<target name="import-all" depends="import-dm, import-jh, import-tc, import-jv,import-rb, import-iw"/>
</project> </project>

View file

@ -72,14 +72,14 @@ public class LexActionServlet extends HttpServlet
config.getServletContext().setAttribute( "flatData", new LexFlatDataRepository() ); config.getServletContext().setAttribute( "flatData", new LexFlatDataRepository() );
LexSourceRepository sources = LexSourceRepository.getInstance(); /* LexSourceRepository sources = LexSourceRepository.getInstance();
sources.setOaiServer( config.getServletContext().getInitParameter( "oaiServer" ) ); sources.setOaiServer( config.getServletContext().getInitParameter( "oaiServer" ) );
sources.setOaiMetadataPrefix( config.getServletContext().getInitParameter( "oaiMetadataPrefix" ) ); sources.setOaiMetadataPrefix( config.getServletContext().getInitParameter( "oaiMetadataPrefix" ) );
sources.setOaiHome( config.getServletContext().getInitParameter( "oaiHome" ) ); sources.setOaiHome( config.getServletContext().getInitParameter( "oaiHome" ) );
sources.setOaiLocalCopy( config.getServletContext().getInitParameter( "oaiLocalCopy" ) ); sources.setOaiLocalCopy( config.getServletContext().getInitParameter( "oaiLocalCopy" ) );
//int oaiDelay = Integer.parseInt( config.getServletContext().getInitParameter( "oaiRefreshDelay" ) ); //int oaiDelay = Integer.parseInt( config.getServletContext().getInitParameter( "oaiRefreshDelay" ) );
sources.setOaiRefreshDelay( 24 ); sources.setOaiRefreshDelay( 24 );
config.getServletContext().setAttribute( "sources", sources ); config.getServletContext().setAttribute( "sources", sources ); */
String delay = config.getInitParameter( "globalDataRefreshDelay" ); String delay = config.getInitParameter( "globalDataRefreshDelay" );
long refreshDelay = Long.parseLong( delay ) * 1000; long refreshDelay = Long.parseLong( delay ) * 1000;
String recent = config.getInitParameter( "recentItems" ); String recent = config.getInitParameter( "recentItems" );

View file

@ -1,4 +1,4 @@
package org.thdl.lex.util; package org.thdl.lex;
import junit.framework.*; import junit.framework.*;
import org.thdl.lex.*; import org.thdl.lex.*;
@ -20,7 +20,7 @@ public class ConvertDataToNewMapping
{ {
public static File file = null; public static File file = null;
public static void convertLexComponents() public static void convertLexComponents( String[] args )
{ try { try
{ {
@ -86,7 +86,7 @@ public class ConvertDataToNewMapping
file = new java.io.File( args[0] ); file = new java.io.File( args[0] );
//ConvertDataToNewMapping.convertLexComponents(); //ConvertDataToNewMapping.convertLexComponents();
//ConvertDataToNewMapping.convertTerms(); //ConvertDataToNewMapping.convertTerms();
ConvertDataToNewMapping.writeCredits(); //ConvertDataToNewMapping.writeCredits();
} }
} }

View file

@ -28,6 +28,10 @@ public class DictionaryImporter
private static Integer label; private static Integer label;
private static Statement sqlStatement; private static Statement sqlStatement;
private static Connection conn; private static Connection conn;
private static Connection conn2;
private static Connection conn3;
private static Connection conn4;
private static Connection conn5;
private static PreparedStatement insertMetaStmt; private static PreparedStatement insertMetaStmt;
private static PreparedStatement selectMetaStmt; private static PreparedStatement selectMetaStmt;
private static PreparedStatement insertTermStmt; private static PreparedStatement insertTermStmt;
@ -38,6 +42,8 @@ public class DictionaryImporter
public final static int delimiterAcip=1; public final static int delimiterAcip=1;
public final static int delimiterDash=2; public final static int delimiterDash=2;
private static int counter = 0;
//helpers //helpers
public void doImport() throws Exception public void doImport() throws Exception
{ {
@ -107,89 +113,83 @@ public class DictionaryImporter
int metaID, metaIDTrans, prec; int metaID, metaIDTrans, prec;
String currentDef; String currentDef;
insertMetaStmt.setString( 1, creator.toString() );
insertMetaStmt.setString( 2, creator.toString() );
insertMetaStmt.setString( 3, proj.toString() );
insertMetaStmt.setString( 4, proj.toString() );
insertMetaStmt.setString( 5, note );
// These escapes should not be needed since we're using Prepared Statements
definition = Manipulate.replace(definition, "\\", "@@@@"); /* definition = Manipulate.replace(definition, "\\", "@@@@");
definition = Manipulate.replace(definition, "@@@@", "\\\\"); definition = Manipulate.replace(definition, "@@@@", "\\\\");
definition = Manipulate.replace(definition, "\"", "@@@@"); definition = Manipulate.replace(definition, "\"", "@@@@");
definition = Manipulate.replace(definition, "@@@@", "\\\""); definition = Manipulate.replace(definition, "@@@@", "\\\""); */
// displaying for debugging purposes only // displaying for debugging purposes only
// System.out.println(term); // System.out.println(term);
// Check to see if term is already there // Check to see if term is already there
selectMetaStmt.setString( 1 , term ); selectMetaStmt.setString( 1 , term );
set = selectMetaStmt.getResultSet(); set = selectMetaStmt.executeQuery();
// if it is get its metaID, else add it // if it is get its metaID, else add it
if (!set.first()) if (!set.first())
{ {
insertMetaStmt.execute(); insertMetaStmt.executeUpdate();
sqlStatement.execute("SELECT MAX(metaid) FROM META"); set=sqlStatement.executeQuery("SELECT MAX(metaid) FROM META");
set = sqlStatement.getResultSet();
set.first(); set.first();
metaID = set.getInt(1); metaID = set.getInt(1);
insertTermStmt.setInt( 1, metaID ); insertTermStmt.setInt( 1, metaID );
insertTermStmt.setString(2, term ); insertTermStmt.setString(2, term );
insertTermStmt.execute(); insertTermStmt.executeUpdate();
} }
else metaID = set.getInt(1); else metaID = set.getInt(1);
// See if there is an associated TransitionalData with this term and project // See if there is an associated TransitionalData with this term and project
sqlStatement.execute("SELECT transitionaldatatext, transitionaldata.metaid FROM transitionaldata, meta where transitionaldata.parentid = " + metaID + " and transitionaldata.metaid = meta.metaid and createdbyprojsub = " + proj.toString()); set = sqlStatement.executeQuery("SELECT transitionaldatatext, transitionaldata.metaid FROM transitionaldata, meta where transitionaldata.parentid = " + metaID + " and transitionaldata.metaid = meta.metaid and createdbyprojsub = " + proj.toString());
set = sqlStatement.getResultSet();
// if there is, append the definition if it is different. If not add it. // if there is, append the definition if it is different. If not add it.
if (set.first()) if (set.first())
{ {
currentDef = set.getString(1).trim(); currentDef = set.getString(1).trim();
currentDef = Manipulate.replace(currentDef, "\\", "@@@@"); // These escapes should not be needed since we're using Prepared Statements
/* currentDef = Manipulate.replace(currentDef, "\\", "@@@@");
currentDef = Manipulate.replace(currentDef, "@@@@", "\\\\"); currentDef = Manipulate.replace(currentDef, "@@@@", "\\\\");
currentDef = Manipulate.replace(currentDef, "\"", "@@@@"); currentDef = Manipulate.replace(currentDef, "\"", "@@@@");
currentDef = Manipulate.replace(currentDef, "@@@@", "\\\""); currentDef = Manipulate.replace(currentDef, "@@@@", "\\\""); */
if (currentDef.indexOf(definition)<0) if (currentDef.indexOf(definition)<0)
{ {
if (!currentDef.equals("")) definition = currentDef + ". " + definition; if (!currentDef.equals("")) definition = currentDef + ". " + definition;
metaIDTrans = set.getInt(2); metaIDTrans = set.getInt(2);
updateTransStmt.setString( 1, currentDef ); updateTransStmt.setString( 1, definition );
updateTransStmt.setInt( 1, metaIDTrans ); updateTransStmt.setInt( 2, metaIDTrans );
updateTransStmt.execute(); updateTransStmt.executeUpdate();
} }
} }
else else
{ {
sqlStatement.execute(insertMeta); insertMetaStmt.executeUpdate();
sqlStatement.execute("SELECT MAX(metaid) FROM META"); set = sqlStatement.executeQuery("SELECT MAX(metaid) FROM META");
set = sqlStatement.getResultSet();
set.first(); set.first();
metaIDTrans = set.getInt(1); metaIDTrans = set.getInt(1);
sqlStatement.execute("SELECT precedence FROM transitionaldata WHERE parentid = " + metaID + " ORDER BY precedence DESC"); set = sqlStatement.executeQuery("SELECT precedence FROM transitionaldata WHERE parentid = " + metaID + " ORDER BY precedence DESC");
set = sqlStatement.getResultSet();
if (set.first()) prec = set.getInt(1)+1; if (set.first()) prec = set.getInt(1)+1;
else prec = 0; else prec = 0;
insertTransStmt.setInt( 1, metaIDTrans ); insertTransStmt.setInt( 1, metaIDTrans );
insertTransStmt.setInt( 2, metaID ); insertTransStmt.setInt( 2, metaID );
insertTransStmt.setInt( 3, prec ); insertTransStmt.setInt( 3, prec );
insertTransStmt.setInt( 4, label ); insertTransStmt.setInt( 4, label.intValue() );
insertTransStmt.setInt( 5, publicCons ); insertTransStmt.setString( 5, publicCons );
insertTransStmt.setString( 6, definition ); insertTransStmt.setString( 6, definition );
insertTransStmt.execute(); insertTransStmt.executeUpdate();
} }
} }
private void addRecord(String term, String definition) throws Exception private void addRecord(String term, String definition) throws Exception
{ {
if ( counter++ % 1000 == 0 )
{
System.out.println( "Adding term " + counter + " " + term );
}
term = Manipulate.replace(term, " ", " "); term = Manipulate.replace(term, " ", " ");
if (out!=null) out.println(term + " - " + definition); if (out!=null) out.println(term + " - " + definition);
else if (sqlStatement!=null) addRecordManually(term, definition); else if (sqlStatement!=null) addRecordManually(term, definition);
@ -379,7 +379,7 @@ public class DictionaryImporter
int argNum = args.length, currentArg=0; int argNum = args.length, currentArg=0;
String option; String option;
boolean file=false; boolean file=false;
boolean manual=false;
out = null; out = null;
delimiterType = delimiterDash; delimiterType = delimiterDash;
@ -408,6 +408,7 @@ public class DictionaryImporter
{ {
initConnections(); initConnections();
initStatements(); initStatements();
manual=true;
} else if (option.equals("format")) } else if (option.equals("format"))
{ {
if (argNum<=currentArg) if (argNum<=currentArg)
@ -508,6 +509,15 @@ public class DictionaryImporter
in = new BufferedReader(new InputStreamReader(is, format)); in = new BufferedReader(new InputStreamReader(is, format));
} }
if ( manual )
{
insertMetaStmt.setString( 1, creator.toString() );
insertMetaStmt.setString( 2, creator.toString() );
insertMetaStmt.setString( 3, proj.toString() );
insertMetaStmt.setString( 4, proj.toString() );
insertMetaStmt.setString( 5, note );
}
new DictionaryImporter().doImport(); new DictionaryImporter().doImport();
} }
} }

View file

@ -1,4 +1,4 @@
package org.thdl.lex.util; package org.thdl.lex;
import net.sf.hibernate.*; import net.sf.hibernate.*;
import net.sf.hibernate.cfg.*; import net.sf.hibernate.cfg.*;
@ -10,7 +10,7 @@ import java.io.File;
* @author Hibernate WIKI * @author Hibernate WIKI
* @created October 1, 2003 * @created October 1, 2003
*/ */
public class HibernateSessionTEMP public class HibernateSessionDataTransfer
{ {
private static SessionFactory sessionFactory; private static SessionFactory sessionFactory;
@ -25,7 +25,7 @@ public class HibernateSessionTEMP
public static File config; public static File config;
public static String configResource; public static String configResource;
public static void setConfigResource(String configResource) { public static void setConfigResource(String configResource) {
HibernateSessionTEMP.configResource = configResource; HibernateSessionDataTransfer.configResource = configResource;
} }
public static String getConfigResource() { public static String getConfigResource() {
return configResource; return configResource;
@ -33,18 +33,18 @@ public static String getConfigResource() {
/** /**
* Sets the config attribute of the HibernateSessionTEMP object * Sets the config attribute of the HibernateSessionDataTransfer object
* *
* @param config The new config value * @param config The new config value
*/ */
public static void setConfig( File config ) public static void setConfig( File config )
{ {
HibernateSessionTEMP.config = config; HibernateSessionDataTransfer.config = config;
} }
/** /**
* Gets the config attribute of the HibernateSessionTEMP object * Gets the config attribute of the HibernateSessionDataTransfer object
* *
* @return The config value * @return The config value
*/ */

View file

@ -1,4 +1,4 @@
package org.thdl.lex.util; package org.thdl.lex;
import net.sf.hibernate.*; import net.sf.hibernate.*;
import net.sf.hibernate.cfg.*; import net.sf.hibernate.cfg.*;
@ -10,7 +10,7 @@ import net.sf.hibernate.cfg.*;
* @author Hibernate WIKI * @author Hibernate WIKI
* @created October 1, 2003 * @created October 1, 2003
*/ */
public class HibernateTransactionTEMP public class HibernateTransactionDataTransfer
{ {
/** /**
@ -31,7 +31,7 @@ public class HibernateTransactionTEMP
Transaction t = (Transaction) transaction.get(); Transaction t = (Transaction) transaction.get();
if ( t == null ) if ( t == null )
{ {
t = HibernateSessionTEMP.currentSession().beginTransaction(); t = HibernateSessionDataTransfer.currentSession().beginTransaction();
transaction.set( t ); transaction.set( t );
} }
} }

View file

@ -15,7 +15,7 @@ import org.thdl.lex.component.*;
* @author travis * @author travis
* @created October 1, 2003 * @created October 1, 2003
*/ */
public class LexComponentRepositoryTEMP public class LexComponentRepositoryDataTransfer
{ {
/** /**
@ -111,7 +111,7 @@ public class LexComponentRepositoryTEMP
*/ */
protected static Session getSession() throws HibernateException protected static Session getSession() throws HibernateException
{ {
Session session = HibernateSessionTEMP.currentSession(); Session session = HibernateSessionDataTransfer.currentSession();
if ( !session.isConnected() ) if ( !session.isConnected() )
{ {
//session.reconnect(); //session.reconnect();
@ -129,7 +129,7 @@ public class LexComponentRepositoryTEMP
{ {
try try
{ {
HibernateTransactionTEMP.beginTransaction(); HibernateTransactionDataTransfer.beginTransaction();
} }
catch ( HibernateException he ) catch ( HibernateException he )
{ {
@ -150,7 +150,7 @@ public class LexComponentRepositoryTEMP
{ {
try try
{ {
HibernateTransactionTEMP.endTransaction( commit ); HibernateTransactionDataTransfer.endTransaction( commit );
} }
catch ( HibernateException he ) catch ( HibernateException he )
{ {
@ -764,7 +764,7 @@ public class LexComponentRepositoryTEMP
try try
{ {
endTransaction( false ); endTransaction( false );
HibernateSessionTEMP.closeSession(); HibernateSessionDataTransfer.closeSession();
} }
catch ( HibernateException he ) catch ( HibernateException he )
{ {