Changeset 259

Show
Ignore:
Timestamp:
01/05/08 15:29:23 (1 year ago)
Author:
chris
Message:

Add a context listener to try to shut everything down when the context
is removed, to try to solve/reduce memory leaks.

Add shutdown ability to Wordnet database, Emdros database pools,
ontology database.

Specify that emdros methods can throw EmdrosException?, as required
by Emdros 2.0.6.

Remove HebrewMorphemeGenerator? dependency on Emdros.

Generate word glosses from lexicon rather than ontology database
and Wordnet.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • lex/trunk/.settings/org.eclipse.core.resources.prefs

    r216 r259  
    1 #Fri Dec 28 01:47:54 CET 2007 
     1#Wed Jan 02 17:36:47 CET 2008 
    22eclipse.preferences.version=1 
     3encoding//jsp/attributes.jsp=UTF-8 
    34encoding//jsp/auth.jsp=UTF-8 
    45encoding//jsp/clause.jsp=UTF-8 
     
    67encoding//jsp/dump.jsp=UTF-8 
    78encoding//jsp/error.jsp=UTF-8 
     9encoding//jsp/export.jsp=UTF-8 
     10encoding//jsp/footer.jsp=UTF-8 
    811encoding//jsp/gen-export.jsp=UTF-8 
    9 encoding//jsp/header.jsp=UTF-8 
     12encoding//jsp/header2.jsp=UTF-8 
    1013encoding//jsp/index.jsp=UTF-8 
    1114encoding//jsp/login.jsp=UTF-8 
     
    1316encoding//jsp/navclause.jsp=UTF-8 
    1417encoding//jsp/parse.jsp=UTF-8 
     18encoding//jsp/published.jsp=UTF-8 
    1519encoding//jsp/rules.jsp=UTF-8 
     20encoding//jsp/search.jsp=UTF-8 
    1621encoding/<project>=UTF-8 
  • lex/trunk/jsp/clause.jsp

    r256 r259  
    99<%@ page import="com.qwirx.lex.parser.*" %> 
    1010<%@ page import="com.qwirx.lex.morph.*" %> 
     11<%@ page import="com.qwirx.lex.lexicon.*" %> 
    1112<%@ page import="com.qwirx.crosswire.kjv.KJV" %> 
    1213<%@ page import="org.crosswire.jsword.book.*" %> 
     
    129130            } 
    130131        } 
    131          
     132 
    132133        BorderTableRenderer rend = new BorderTableRenderer(); 
    133134         
     
    157158                StringBuffer hebrewText = new StringBuffer(); 
    158159                List morphEdges = new ArrayList(); 
    159                 HebrewMorphemeGenerator generator = new HebrewMorphemeGenerator(emdros); 
     160                HebrewMorphemeGenerator generator = new HebrewMorphemeGenerator(); 
    160161                 
    161162                /* Prescan to find the predicate lexeme and populate the chart */ 
     
    272273                                                        !phrases.hasNext() && !words.hasNext()); 
    273274                                                 
    274                                         generator.parse(word, hfc, true); 
     275                                        generator.parse(word, hfc, true, sql); 
    275276                                        isFirstWord = false; 
    276277                                         
     
    460461                         
    461462                        SheafConstIterator phrases = clause.getSheaf().const_iterator(); 
    462                         while (phrases.hasNext()) { 
     463                        while (phrases.hasNext()) 
     464                        { 
    463465                                MatchedObject phrase = 
    464466                                        phrases.next().const_iterator().next(); 
     
    480482                                                words.next().const_iterator().next(); 
    481483                                        column++; 
    482                                         boolean canWriteToWord = emdros.canWriteTo(word); 
    483484                                         
    484485                                        if (type.equals("word")) 
    485486                                        { 
    486                                                 String lexeme = HebrewConverter.wordTranslitToHtml(word,  
    487                                                         generator); 
    488                                                 String part_of_speech = (String) 
    489                                                         parts_of_speech.get(word.getEMdFValue("phrase_dependent_part_of_speech") 
    490                                                                 .toString()); 
     487                                                Lexeme lexeme = Lexeme.findOrBuild(sql, word); 
     488                                                 
     489                                                String part_of_speech = word.getFeatureAsString( 
     490                                                        word.getEMdFValueIndex( 
     491                                                                "phrase_dependent_part_of_speech")); 
     492                                                boolean canWriteToWord = emdros.canWriteTo(word); 
    491493                                                         
    492494                                                Cell cell = new Cell(); 
    493                                                 cell.label = lexeme
     495                                                cell.label = lexeme.getTranslit()
    494496                                                cell.columns = 1; 
    495497                                                word_row.addElement(cell); 
    496498                                                 
    497499                                                int wid = word.getID_D(); 
    498                                                  
    499                                                 PreparedStatement stmt = sql.prepareSelect( 
    500                                                         "SELECT ID, Gloss FROM lexicon_entries "+ 
    501                                                         "WHERE Lexeme = ?"); 
    502                                                 stmt.setString(1, lexeme); 
    503                                                 ResultSet rs = sql.select(); 
    504                                                 String lexiconGloss = ""; 
    505                                                 int lexId = -1; 
    506                                                 if (rs.next())  
    507                                                 { 
    508                                                         lexId = rs.getInt(1); 
    509                                                         lexiconGloss = rs.getString(2); 
    510                                                         if (lexiconGloss == null) lexiconGloss = ""; 
    511                                                 } 
    512                                                 sql.finish(); 
    513                                                  
     500 
    514501                                                // lexicon gloss 
    515502                                                { 
     
    520507                                                                request.getParameter("ewgs") != null)  
    521508                                                        { 
    522                                                                 lexiconGloss = request.getParameter("gloss"); 
    523                                                                 Change ch; 
    524                                                                 if (lexId == -1)  
    525                                                                 { 
    526                                                                         ch = sql.createChange( 
    527                                                                                 SqlChange.INSERT, "lexicon_entries", null); 
    528                                                                         ch.setString("Lexeme", lexeme); 
    529                                                                 }  
    530                                                                 else  
    531                                                                 { 
    532                                                                         ch = sql.createChange( 
    533                                                                                 SqlChange.UPDATE, "lexicon_entries",  
    534                                                                                 "ID = "+lexId); 
    535                                                                 } 
    536                                                                 ch.setString("Gloss", lexiconGloss); 
    537                                                                 ch.execute(); 
     509                                                                lexeme.setGloss(request.getParameter("gloss")); 
     510                                                                lexeme.save(); 
     511                                                                lexeme = Lexeme.load(sql, word); 
    538512                                                                ewgId = -1; 
    539513                                                        } 
     514                                                         
     515                                                        String lexiconGloss = lexeme.getGloss(); 
    540516                                                         
    541517                                                        if (ewgId == wid)  
    542518                                                        { 
     519                                                                if (lexiconGloss == null) 
     520                                                                { 
     521                                                                        lexiconGloss = ""; 
     522                                                                } 
    543523                                                                glossCell.html = "<form method=\"post\">\n" + 
    544524                                                                        "<input type=\"hidden\" name=\"ewg\"" + 
    545525                                                                        " value=\"" + wid + "\">\n" + 
    546526                                                                        "<input name=\"gloss\" size=\"10\" value=\"" + 
    547                                                                         lexiconGloss.replaceAll("<", "&lt;") 
    548                                                                                 .replaceAll(">", "&gt;") + 
     527                                                                        HebrewConverter.toHtml(lexiconGloss) + 
    549528                                                                        "\">\n" + 
    550529                                                                        "<input type=\"submit\" name=\"ewgs\""+ 
     
    554533                                                        else  
    555534                                                        { 
     535                                                                if (lexiconGloss == null) 
     536                                                                { 
     537                                                                        lexiconGloss = "(gloss)"; 
     538                                                                } 
    556539                                                                glossCell.html = "<a href=\"clause.jsp?ewg=" +  
    557                                                                         wid + "\">" +  
    558                                                                         (lexiconGloss.equals("") ? "(gloss)" :  
    559                                                                                 lexiconGloss) + 
    560                                                                         "</a>"; 
     540                                                                        wid + "\">" + lexiconGloss + "</a>"; 
    561541                                                        } 
    562542                                                } 
  • lex/trunk/jsp/gen-export.jsp

    r257 r259  
    6868                        "attachment; filename=export.gen"); 
    6969                response.getWriter().print( 
    70                         new GenExporter(emdros).export(clause, verseData)); 
     70                        new GenExporter().export(clause, verseData, sql)); 
    7171        } 
    7272        finally 
  • lex/trunk/jsp/header2.jsp

    r247 r259  
    7878        try 
    7979        { 
    80                 emdros = Lex.getEmdrosDatabase(username, hostname); 
     80                emdros = Lex.getEmdrosDatabase(username, hostname, sql); 
    8181                int min_m = emdros.getMinM(), max_m = emdros.getMaxM(); 
    8282                int real_min_m = min_m, real_max_m = max_m; 
  • lex/trunk/jsp/navclause.jsp

    r245 r259  
    3333                } 
    3434        }  
    35          
     35 
    3636        { 
    3737                boolean foundBook = false; 
     
    8282                                if (min_m < new_min_m) min_m = new_min_m; 
    8383                                if (max_m > new_max_m) max_m = new_max_m; 
     84                                if (min_m > max_m) max_m = min_m + 1; 
    8485                                // System.out.println("book restricts to " + min_m + "-" + max_m); 
    8586                        } 
     
    170171                                int new_min_m = Integer.parseInt(monad_row.getColumn(2));        
    171172                                int new_max_m = Integer.parseInt(monad_row.getColumn(3));        
     173                                System.out.println("before chapter was " + min_m + "-" + max_m); 
    172174                                if (min_m < new_min_m) min_m = new_min_m; 
    173175                                if (max_m > new_max_m) max_m = new_max_m; 
    174                                 // System.out.println("chapter restricts to " + min_m + "-" + max_m); 
     176                                if (min_m > max_m) max_m = min_m + 1; 
     177                                System.out.println("chapter restricts to " + min_m + "-" + max_m); 
    175178                        } 
    176179                         
     
    196199<% 
    197200        int selVerseNum = 1; 
     201        System.out.println("4"); 
    198202         
    199203        { 
     
    261265<% 
    262266        int selClauseId = 0; 
     267                System.out.println("5"); 
    263268         
    264269        { 
     
    280285                boolean foundSelectedClause = false; 
    281286                int defaultClauseId = 0; 
    282                 HebrewMorphemeGenerator generator = new HebrewMorphemeGenerator(emdros); 
     287                HebrewMorphemeGenerator generator = new HebrewMorphemeGenerator(); 
    283288         
    284289                Sheaf sheaf = emdros.getSheaf 
  • lex/trunk/jsp/parse.jsp

    r239 r259  
    263263                "                    type_id, macrorole_number "+ 
    264264                "          [word GET lexeme, phrase_dependent_part_of_speech, "+ 
    265                 "                    tense, wordnet_gloss, wordnet_synset, " + 
     265                "                    tense, stem, wordnet_gloss, wordnet_synset, " + 
    266266                "                    graphical_preformative, " + 
    267267                "                    graphical_locative, " + 
     
    305305                { 
    306306                        TreeNode root = new TreeNode("root"); 
    307                         HebrewMorphemeGenerator gen = new HebrewMorphemeGenerator(emdros); 
     307                        HebrewMorphemeGenerator gen = new HebrewMorphemeGenerator(); 
    308308                         
    309309                        { 
     
    364364                                                        morphEdges); 
    365365                                                 
    366                                                 gen.parse(word, hfc, true); 
     366                                                gen.parse(word, hfc, true, sql); 
    367367                                                 
    368368                                                hebrewText.append(" ");                                          
  • lex/trunk/jsp/published.jsp

    r254 r259  
    4545                <table class="search_results"> 
    4646                        <tr> 
    47                                 <th>Reference</th> 
    4847                                <th>Verb</th> 
    4948                                <th>Logical Structure</th> 
     49                                <th>Reference</th> 
    5050                        </tr> 
    5151                <% 
     
    5757                        %> 
    5858                        <tr> 
    59                                 <td><a href="result.getLinkUrl()"><%= result.getLocation() %></a></td> 
    60                                 <td><%= HebrewConverter.toHebrew(result.getPredicate()) %></td> 
    61                                 <td><%= HebrewConverter.toHtml(result.getLogicalStructure()) %></td> 
     59                                <td><%= 
     60                                        HebrewConverter.toHebrew(result.getPredicate()) 
     61                                %></td> 
     62                                <td><%= 
     63                                        HebrewConverter.toHtml(result.getLogicalStructure()) 
     64                                %></td> 
     65                                <td><a href="<%= result.getLinkUrl() %>"><%= 
     66                                        result.getLocation() 
     67                                %></a></td> 
    6268                        </tr> 
    6369                        <% 
  • lex/trunk/jsp/WEB-INF/web.xml

    r26 r259  
    11<?xml version="1.0" encoding="ISO-8859-1"?> 
     2 
    23<!DOCTYPE web-app 
    3     PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" 
    4     "http://java.sun.com/dtd/web-app_2_3.dtd"> 
     4  PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" 
     5  "http://java.sun.com/j2ee/dtds/web-app_2_3.dtd"> 
    56 
    67<web-app> 
    78        <display-name>Lex</display-name> 
    89        <description>Lex</description> 
     10 
     11        <!-- lifecycle listeners --> 
     12         
     13        <listener> 
     14            <listener-class>com.qwirx.lex.LexContextListener</listener-class> 
     15        </listener> 
    916         
    1017        <!-- Filters --> 
  • lex/trunk/src/com/qwirx/crosswire/kjv/KJV.java

    r249 r259  
    77import java.util.List; 
    88import java.util.Map; 
    9 import java.util.Set; 
    10 import java.util.TreeSet; 
    119 
    1210import jemdros.Table; 
  • lex/trunk/src/com/qwirx/db/sql/SqlDatabase.java

    r213 r259  
    3232public class SqlDatabase implements Database 
    3333{ 
    34         private Connection conn; 
     34        private Connection m_Connection; 
    3535        private PreparedStatement stmt; 
    3636        private ResultSet rs; 
     
    4242        throws DatabaseException 
    4343    { 
    44                 this.conn = conn; 
     44                this.m_Connection = conn; 
    4545                this.username = username; 
    4646                this.database = database; 
     
    8888                } 
    8989        } 
    90          
     90     
     91    public Connection getConnection() 
     92    { 
     93        return m_Connection; 
     94    } 
     95     
    9196        public void executeDirect(String sql) throws DatabaseException  
    9297    { 
     
    9499        { 
    95100            long startTime = System.currentTimeMillis(); 
    96                         PreparedStatement s = conn.prepareStatement(sql); 
     101                        PreparedStatement s = m_Connection.prepareStatement(sql); 
    97102                        s.executeUpdate(); 
    98103                        s.close(); 
     
    121126                try  
    122127        { 
    123                         stmt = conn.prepareStatement(sql); 
     128                        stmt = m_Connection.prepareStatement(sql); 
    124129                }  
    125130        catch (SQLException e)  
     
    184189        { 
    185190                return new SqlChange(username, database,  
    186                         (SqlChange.Type)type, table, (String)conditions, conn); 
     191                        (SqlChange.Type)type, table, (String)conditions, m_Connection); 
    187192        } 
    188193         
    189194        public void close() throws SQLException 
    190195        { 
    191                 conn.close(); 
     196                m_Connection.close(); 
    192197        } 
    193198         
  • lex/trunk/src/com/qwirx/lex/emdros/EmdrosDatabase.java

    r234 r259  
    1818import jemdros.BadMonadsException; 
    1919import jemdros.EmdrosEnv; 
     20import jemdros.EmdrosException; 
    2021import jemdros.FlatSheaf; 
    2122import jemdros.MatchedObject; 
     
    4647{ 
    4748        private EmdrosEnv env; 
    48         private Connection conn
     49        private Connection m_LogDatabase
    4950        private String username, userhost, database; 
    5051    private static final Logger m_LOG = Logger.getLogger(EmdrosDatabase.class); 
     
    5253        public EmdrosDatabase(String dbHost, String dbName, String dbUser, 
    5354        String dbPass, String logUser, String logFrom, Connection logDb)  
    54     throws DatabaseException 
     55    throws DatabaseException, EmdrosException 
    5556    { 
    5657        env = new EmdrosEnv(eOutputKind.kOKConsole,  
     
    6364        } 
    6465 
    65         this.conn = logDb; 
     66        m_LogDatabase = logDb; 
    6667        this.username = logUser; 
    6768        this.userhost = logUser + "@" + logFrom; 
     
    7273    { 
    7374        return env.connectionOk(); 
     75    } 
     76     
     77    public void setLogConnection(Connection logDb) 
     78    { 
     79        m_LogDatabase = logDb; 
    7480    } 
    7581     
     
    301307     
    302308    public SetOfMonads intersect(SetOfMonads set, int min_m, int max_m) 
    303     { 
     309    throws EmdrosException 
     310    { 
     311        System.out.println(set.toString()); 
     312        System.out.println(min_m + " : " + max_m); 
    304313        return SetOfMonads.intersect(set, new SetOfMonads(min_m, max_m)); 
    305314    } 
    306315     
    307316        public Change createChange(ChangeType changeType, String objectType,  
    308                         Object objectIds) throws DatabaseException 
     317                        Object objectIds) 
     318    throws DatabaseException 
    309319        { 
    310320        int [] id_ds = (int [])objectIds; 
     
    319329            } 
    320330        } 
    321         catch (DatabaseException e) 
     331        catch (Exception e) 
    322332        { 
    323333            throw new DatabaseException("Failed to determine object access", 
     
    326336         
    327337                return new EmdrosChange(username+"@"+userhost, database,  
    328                         (EmdrosChange.Type)changeType, objectType, conn, this,  
     338                        (EmdrosChange.Type)changeType, objectType, m_LogDatabase, this,  
    329339                        id_ds); 
    330340        } 
     
    394404 
    395405    public SetOfMonads getVisibleMonads() 
    396     throws SQLException 
    397     { 
    398         PreparedStatement stmt = conn.prepareStatement 
     406    throws SQLException, EmdrosException 
     407    { 
     408        PreparedStatement stmt = m_LogDatabase.prepareStatement 
    399409        ( 
    400410            "SELECT Monad_First, Monad_Last " + 
     
    437447 
    438448    public boolean canWriteTo(String objectType, int objectId) 
    439     throws DatabaseException 
     449    throws DatabaseException, EmdrosException 
    440450    { 
    441451        return canWriteTo(objectType, new int[]{objectId}); 
     
    443453     
    444454    public boolean canWriteTo(String objectType, int[] objectIds) 
    445     throws DatabaseException 
     455    throws DatabaseException, EmdrosException 
    446456    { 
    447457        String query = "GET MONADS FROM OBJECTS WITH ID_DS = "; 
     
    493503        try 
    494504        { 
    495             stmt = conn.prepareStatement(query); 
     505            stmt = m_LogDatabase.prepareStatement(query); 
    496506            stmt.setString(1, username); 
    497507            rs = stmt.executeQuery(); 
  • lex/trunk/src/com/qwirx/lex/GenExporter.java

    r220 r259  
    22 
    33import java.io.IOException; 
     4import java.sql.SQLException; 
    45 
     6import jemdros.EmdrosException; 
    57import jemdros.MatchedObject; 
    68import jemdros.SheafConstIterator; 
     
    1113 
    1214import com.qwirx.db.DatabaseException; 
    13 import com.qwirx.lex.emdros.EmdrosDatabase; 
     15import com.qwirx.db.sql.SqlDatabase; 
    1416import com.qwirx.lex.hebrew.HebrewConverter; 
    1517import com.qwirx.lex.morph.HebrewMorphemeGenerator; 
     
    1820public class GenExporter 
    1921{ 
    20     private HebrewMorphemeGenerator m_Generator; 
    21      
    22     public GenExporter(EmdrosDatabase emdros) 
    23     throws IOException, DatabaseException, SAXException 
    24     { 
    25         m_Generator = new HebrewMorphemeGenerator(emdros); 
    26     } 
    27      
    28     public String export(MatchedObject object, BookData verse) 
    29     throws IOException, BookException 
     22    public String export(MatchedObject object, BookData verse, SqlDatabase sql) 
     23    throws IOException, BookException, SAXException,  
     24        DatabaseException, SQLException, EmdrosException 
    3025    { 
    3126        StringBuffer buf = new StringBuffer(); 
     
    4439            "\n"); 
    4540         
    46         exportObject(object, verse, buf); 
     41        exportObject(object, verse, buf, sql); 
    4742         
    4843        return buf.toString(); 
     
    6358            boolean lastMorpheme, String desc, 
    6459            String morphNode) 
     60        throws EmdrosException 
    6561        { 
    6662            String raw = m_Word.getEMdFValue(surface).getString(); 
     
    8278 
    8379    private void exportObject(MatchedObject object, BookData verse, 
    84         StringBuffer buf) 
    85     throws IOException, BookException 
     80        StringBuffer buf, SqlDatabase sql) 
     81    throws IOException, BookException, SAXException, 
     82        DatabaseException, SQLException, EmdrosException 
    8683    { 
    8784        if (object.getObjectTypeName().equals("word")) 
     
    9087                new HebrewFeatureConverter(object, buf); 
    9188             
    92             m_Generator.parse(object, hfc, true); 
     89            new HebrewMorphemeGenerator().parse(object, hfc, true, sql); 
    9390        } 
    9491         
     
    9996            { 
    10097                MatchedObject child = straws.next().const_iterator().next(); 
    101                 exportObject(child, verse, buf); 
     98                exportObject(child, verse, buf, sql); 
    10299            } 
    103100        } 
  • lex/trunk/src/com/qwirx/lex/hebrew/HebrewConverter.java

    r241 r259  
    11package com.qwirx.lex.hebrew; 
    22 
    3 import java.io.IOException; 
    4  
    5 import org.xml.sax.SAXException; 
    6  
     3import jemdros.EmdrosException; 
    74import jemdros.MatchedObject; 
    85 
    9 import com.qwirx.db.DatabaseException; 
    106import com.qwirx.lex.emdros.EmdrosDatabase; 
    117import com.qwirx.lex.morph.HebrewMorphemeGenerator; 
     
    271267            String substr = input.substring(i); 
    272268            char c = input.charAt(i); 
     269             
     270            /* 
    273271            char c2 = 0xffff; 
    274272            if (i < input.length() - 1) 
     
    276274                c2 = input.charAt(i + 1); 
    277275            } 
     276            */ 
    278277 
    279278            if (substr.matches("[BGDKPT]\\.[@AEIOUW;:].*")) 
     
    382381    } 
    383382     
    384     static class Transliterator implements MorphemeHandler 
     383    public static class Transliterator implements MorphemeHandler 
    385384    { 
    386385        private MatchedObject m_Word; 
     
    393392        } 
    394393         
    395         public void convert(String surface,  
    396             boolean lastMorpheme, String desc, 
     394        public void convert(String surface, boolean lastMorpheme, String desc, 
    397395            String morphNode) 
     396        throws EmdrosException 
    398397        { 
    399398            String raw = m_Word.getEMdFValue(surface).getString(); 
     
    414413        } 
    415414         
    416         public void convert(String surface,  
    417             boolean lastMorpheme, String desc, 
     415        public void convert(String surface, boolean lastMorpheme, String desc, 
    418416            String morphNode) 
     417        throws EmdrosException 
    419418        { 
    420419            String raw = m_Word.getEMdFValue(surface).getString(); 
     
    425424 
    426425    public static String wordToHtml(MatchedObject word, EmdrosDatabase emdros) 
    427     throws IOException, DatabaseException, SAXException 
    428     { 
    429         return wordTranslitToHtml(word, new HebrewMorphemeGenerator(emdros)); 
     426    throws EmdrosException 
     427    { 
     428        return wordTranslitToHtml(word, new HebrewMorphemeGenerator()); 
    430429    } 
    431430 
    432431    public static String wordTranslitToHtml(MatchedObject word,  
    433432        HebrewMorphemeGenerator generator) 
     433    throws EmdrosException 
    434434    { 
    435435        StringBuffer out = new StringBuffer(); 
    436436        Transliterator xlit = new Transliterator(word, out); 
    437         generator.parse(word, xlit, false); 
     437        generator.parse(word, xlit, false, (String)null); 
    438438        return toHtml(out.toString()); 
    439439    } 
     
    441441    public static String wordHebrewToHtml(MatchedObject word,  
    442442        HebrewMorphemeGenerator generator) 
     443    throws EmdrosException 
    443444    { 
    444445        StringBuffer out = new StringBuffer(); 
    445446        Hebrewator xlit = new Hebrewator(word, out); 
    446         generator.parse(word, xlit, false); 
     447        generator.parse(word, xlit, false, (String)null); 
    447448        return toHtml(out.toString()); 
    448449    } 
  • lex/trunk/src/com/qwirx/lex/hebrew/HebrewEnglishDatabase.java

    r189 r259  
    159159        return m_Instance; 
    160160    } 
     161     
     162    public synchronized static void delete() 
     163    { 
     164        m_Instance = null; 
     165    } 
    161166} 
  • lex/trunk/src/com/qwirx/lex/Lex.java

    r250 r259  
    1010import java.net.URL; 
    1111import java.sql.Connection; 
    12 import java.sql.DriverManager; 
    1312import java.sql.SQLException; 
    1413import java.util.Hashtable; 
     14import java.util.Iterator; 
    1515import java.util.Map; 
     16import java.util.Properties; 
    1617import java.util.Stack; 
    1718 
     
    2021import org.xml.sax.SAXException; 
    2122 
     23import com.mysql.jdbc.Driver; 
    2224import com.qwirx.db.DatabaseException; 
    2325import com.qwirx.db.sql.DbColumn; 
     
    117119            return emdrosDb; 
    118120        } 
     121         
     122        public void clear() 
     123        { 
     124            for (Iterator<EmdrosDatabase> i = m_Pool.iterator(); i.hasNext();) 
     125            { 
     126                EmdrosDatabase db = i.next(); 
     127                db.delete(); 
     128                i.remove(); 
     129            } 
     130        } 
    119131    } 
    120132