ar.com.ktulu.dict
Class JDBCDatabase

java.lang.Object
  |
  +--ar.com.ktulu.dict.Database
        |
        +--ar.com.ktulu.dict.JDBCDatabase

public class JDBCDatabase
extends Database

Support for dictionaries stored in databases. To be able to change the jdbc driver without the need for recompiling, there is not explicit loading of the driver. So you must put in the system property jdbc.drivers the name of the class to load (i.e., the driver class). You also have to set the name of the user and the password to connecto to the dbms. The system properties to set are jdbc.user and jdbc.password, respectively.

It was only used with PostgreSQL.

Author:
Luis Parravicini

Field Summary
(package private)  java.sql.Connection con
           
(package private)  java.lang.String url
           
 
Constructor Summary
JDBCDatabase(java.lang.String name, java.lang.String url)
           
 
Method Summary
 Matches define(java.lang.String word)
          Used by the server to process a "DEFINE" command.
 void finalize()
           
protected  java.sql.Connection getConnection()
          Creates a connection to url using the user and password from the system properties jdbc.user and jdbc.password.
 Definition getWordDefinition(Key k)
          Returns the definition of the word stored in k.
 int keySize()
          Returns the number of headwords in the database.
 Matches match(java.lang.String word, Strategy strat)
          Used by the server to process a "MATCH" command.
 
Methods inherited from class ar.com.ktulu.dict.Database
getInfo, getName, getProperty, getProperty, getShortInfo, setInfo, setName, setShortInfo
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

url

java.lang.String url

con

java.sql.Connection con
Constructor Detail

JDBCDatabase

public JDBCDatabase(java.lang.String name,
                    java.lang.String url)
             throws DatabaseException
Method Detail

finalize

public void finalize()
Overrides:
finalize in class java.lang.Object

getConnection

protected java.sql.Connection getConnection()
                                     throws java.sql.SQLException
Creates a connection to url using the user and password from the system properties jdbc.user and jdbc.password.

java.sql.SQLException
See Also:
url

keySize

public int keySize()
            throws DatabaseException
Description copied from class: Database
Returns the number of headwords in the database.

Specified by:
keySize in class Database
DatabaseException

define

public Matches define(java.lang.String word)
               throws DatabaseException
Description copied from class: Database
Used by the server to process a "DEFINE" command.

Specified by:
define in class Database
DatabaseException

match

public Matches match(java.lang.String word,
                     Strategy strat)
              throws DatabaseException
Description copied from class: Database
Used by the server to process a "MATCH" command.

Specified by:
match in class Database
DatabaseException

getWordDefinition

public Definition getWordDefinition(Key k)
                             throws DatabaseException
Description copied from class: Database
Returns the definition of the word stored in k.

Specified by:
getWordDefinition in class Database
DatabaseException