*** 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

106
build.xml
View File

@ -60,43 +60,28 @@ jmeterhome=../jmeter
</fileset>
<!--point to org/thdl/users-->
<pathelement location="${build}/WEB-INF/classes"/>
<pathelement location="${build}/WEB-INF/tld"/>
</path>
<!-- Executable Targets -->
<target name="copy" description="copy jsp, html, css, js, and other files into the build directory">
<copy todir="${build}">
<fileset dir="${source}/jsp">
<include name="*.jsp"/>
<include name="*.jsf"/>
<fileset dir="${basedir}/web">
<include name="**/*.jsp"/>
<include name="**/*.jsf"/>
<include name="**/*.css"/>
<include name="**/*.js"/>
</fileset>
</copy>
<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>
</copy>
<copy todir="${build}/images">
<fileset dir="${basedir}/images"></fileset>
</copy>
<copy todir="${build}/WEB-INF">
<fileset dir="${basedir}/config">
<filename name="web.xml"/>
<fileset dir="${basedir}/web/WEB-INF">
</fileset>
</copy>
@ -117,9 +102,12 @@ jmeterhome=../jmeter
<fileset dir="${basedir}/lib/jstl">
<include name="*.jar"/>
</fileset>
<fileset dir="${basedir}/lib/hibernate">
<include name="*.jar"/>
<exclude name="commons-dbcp.jar"/>
</fileset>
<fileset dir="${basedir}/lib/thdl">
<include name="*.jar"/>
</fileset>
@ -127,9 +115,14 @@ jmeterhome=../jmeter
<fileset dir="${basedir}/lib/commons">
<include name="*.jar"/>
</fileset>
<fileset dir="${basedir}/lib/jwebunit">
<include name="*.jar"/>
</fileset>
<fileset dir="${basedir}/lib/log4j">
<include name="*.jar"/>
</fileset>
<!--<fileset dir="${basedir}/lib/dlese-oai">
<include name="*.jar"/>
</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 destdir="${build}/WEB-INF/classes" classpathref="classpath" debug="on" listfiles="no">
<src path="${source}/java"/>
<include name="org/thdl/lex/util/DictionaryImporter.java"/>
<include name="org/thdl/lex/**"/>
<exclude name="**/old/**"/>
<exclude name="**/test/**"/>
<exclude name="**/util/**"/>
@ -154,6 +145,30 @@ jmeterhome=../jmeter
</javac>
</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">
<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>
</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}"/>
</target>
@ -190,7 +205,7 @@ jmeterhome=../jmeter
<antcall target="install"/>
</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}"/>
</target>
@ -315,8 +330,8 @@ jmeter.save.saveservice.output_format=xml
</schemaupdate>
</target>
<target name="convert-to-new-mapping" description="convert old data to a new db mapping" depends="copy, compile">
<java classname="org.thdl.lex.ConvertDataToNewMapping" classpathref="classpath" fork="yes">
<target name="convert-to-new-mapping" description="convert old data to a new db mapping" depends="compile-util">
<java classname="org.thdl.lex.utilConvertDataToNewMapping" classpathref="classpath" fork="yes">
<classpath>
<pathelement location="${build}/WEB-INF/classes"/>
</classpath>
@ -324,13 +339,11 @@ jmeter.save.saveservice.output_format=xml
</java>
</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">
<classpath>
<pathelement location="${build}/WEB-INF/classes"/>
</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="-format"/><arg value="UTF-16"/>
<arg value="-tab"/>
@ -341,13 +354,11 @@ jmeter.save.saveservice.output_format=xml
<arg value="dicts/DanMartin.txt"/>
</java>
</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">
<classpath>
<pathelement location="${build}/WEB-INF/classes"/>
</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="-format"/><arg value="UTF-16"/>
<arg value="-tab"/>
@ -358,13 +369,11 @@ jmeter.save.saveservice.output_format=xml
<arg value="dicts/JHTabUnicode.txt"/>
</java>
</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">
<classpath>
<pathelement location="${build}/WEB-INF/classes"/>
</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="-tab"/>
<arg value="-creator"/><arg value="80"/>
@ -375,13 +384,11 @@ jmeter.save.saveservice.output_format=xml
<arg value="dicts/tshig.tab"/>
</java>
</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">
<classpath>
<pathelement location="${build}/WEB-INF/classes"/>
</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="-creator"/><arg value="4"/>
<arg value="-proj"/><arg value="16"/>
@ -390,13 +397,11 @@ jmeter.save.saveservice.output_format=xml
<arg value="dicts/ry-dic2003-prop.txt"/>
</java>
</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">
<classpath>
<pathelement location="${build}/WEB-INF/classes"/>
</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="-creator"/><arg value="96"/>
<arg value="-proj"/><arg value="21"/>
@ -406,13 +411,11 @@ jmeter.save.saveservice.output_format=xml
</java>
</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">
<classpath>
<pathelement location="${build}/WEB-INF/classes"/>
</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="-creator"/><arg value="97"/>
<arg value="-proj"/><arg value="22"/>
@ -422,13 +425,11 @@ jmeter.save.saveservice.output_format=xml
</java>
</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">
<classpath>
<pathelement location="${build}/WEB-INF/classes"/>
</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="-creator"/><arg value="98"/>
<arg value="-proj"/><arg value="23"/>
@ -437,4 +438,7 @@ jmeter.save.saveservice.output_format=xml
<arg value="dicts/IvesWaldo.txt"/>
</java>
</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>

View File

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

View File

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

View File

@ -28,6 +28,10 @@ public class DictionaryImporter
private static Integer label;
private static Statement sqlStatement;
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 selectMetaStmt;
private static PreparedStatement insertTermStmt;
@ -37,6 +41,8 @@ public class DictionaryImporter
public final static int delimiterGeneric=0;
public final static int delimiterAcip=1;
public final static int delimiterDash=2;
private static int counter = 0;
//helpers
public void doImport() throws Exception
@ -107,89 +113,83 @@ public class DictionaryImporter
int metaID, metaIDTrans, prec;
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 );
definition = Manipulate.replace(definition, "\\", "@@@@");
// 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, "@@@@", "\\\""); */
// displaying for debugging purposes only
// System.out.println(term);
// Check to see if term is already there
selectMetaStmt.setString( 1 , term );
set = selectMetaStmt.getResultSet();
set = selectMetaStmt.executeQuery();
// if it is get its metaID, else add it
if (!set.first())
{
insertMetaStmt.execute();
sqlStatement.execute("SELECT MAX(metaid) FROM META");
set = sqlStatement.getResultSet();
insertMetaStmt.executeUpdate();
set=sqlStatement.executeQuery("SELECT MAX(metaid) FROM META");
set.first();
metaID = set.getInt(1);
insertTermStmt.setInt( 1, metaID );
insertTermStmt.setString(2, term );
insertTermStmt.execute();
insertTermStmt.executeUpdate();
}
else metaID = set.getInt(1);
// 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.getResultSet();
set = sqlStatement.executeQuery("SELECT transitionaldatatext, transitionaldata.metaid FROM transitionaldata, meta where transitionaldata.parentid = " + metaID + " and transitionaldata.metaid = meta.metaid and createdbyprojsub = " + proj.toString());
// if there is, append the definition if it is different. If not add it.
if (set.first())
{
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, "@@@@", "\\\""); */
if (currentDef.indexOf(definition)<0)
{
if (!currentDef.equals("")) definition = currentDef + ". " + definition;
metaIDTrans = set.getInt(2);
updateTransStmt.setString( 1, currentDef );
updateTransStmt.setInt( 1, metaIDTrans );
updateTransStmt.execute();
updateTransStmt.setString( 1, definition );
updateTransStmt.setInt( 2, metaIDTrans );
updateTransStmt.executeUpdate();
}
}
else
{
sqlStatement.execute(insertMeta);
sqlStatement.execute("SELECT MAX(metaid) FROM META");
set = sqlStatement.getResultSet();
insertMetaStmt.executeUpdate();
set = sqlStatement.executeQuery("SELECT MAX(metaid) FROM META");
set.first();
metaIDTrans = set.getInt(1);
sqlStatement.execute("SELECT precedence FROM transitionaldata WHERE parentid = " + metaID + " ORDER BY precedence DESC");
set = sqlStatement.getResultSet();
set = sqlStatement.executeQuery("SELECT precedence FROM transitionaldata WHERE parentid = " + metaID + " ORDER BY precedence DESC");
if (set.first()) prec = set.getInt(1)+1;
else prec = 0;
insertTransStmt.setInt( 1, metaIDTrans );
insertTransStmt.setInt( 2, metaID );
insertTransStmt.setInt( 3, prec );
insertTransStmt.setInt( 4, label );
insertTransStmt.setInt( 5, publicCons );
insertTransStmt.setInt( 4, label.intValue() );
insertTransStmt.setString( 5, publicCons );
insertTransStmt.setString( 6, definition );
insertTransStmt.execute();
insertTransStmt.executeUpdate();
}
}
private void addRecord(String term, String definition) throws Exception
{
if ( counter++ % 1000 == 0 )
{
System.out.println( "Adding term " + counter + " " + term );
}
term = Manipulate.replace(term, " ", " ");
if (out!=null) out.println(term + " - " + definition);
else if (sqlStatement!=null) addRecordManually(term, definition);
@ -379,7 +379,7 @@ public class DictionaryImporter
int argNum = args.length, currentArg=0;
String option;
boolean file=false;
boolean manual=false;
out = null;
delimiterType = delimiterDash;
@ -408,6 +408,7 @@ public class DictionaryImporter
{
initConnections();
initStatements();
manual=true;
} else if (option.equals("format"))
{
if (argNum<=currentArg)
@ -507,7 +508,16 @@ public class DictionaryImporter
else
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();
}
}

View File

@ -1,4 +1,4 @@
package org.thdl.lex.util;
package org.thdl.lex;
import net.sf.hibernate.*;
import net.sf.hibernate.cfg.*;
@ -10,7 +10,7 @@ import java.io.File;
* @author Hibernate WIKI
* @created October 1, 2003
*/
public class HibernateSessionTEMP
public class HibernateSessionDataTransfer
{
private static SessionFactory sessionFactory;
@ -25,7 +25,7 @@ public class HibernateSessionTEMP
public static File config;
public static String configResource;
public static void setConfigResource(String configResource) {
HibernateSessionTEMP.configResource = configResource;
HibernateSessionDataTransfer.configResource = configResource;
}
public static String getConfigResource() {
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
*/
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
*/

View File

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

View File

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