public abstract class JDBCBayesianAnalyzer extends BayesianAnalyzer
This class is abstract to allow implementations to take advantage of different logging capabilities/interfaces in different parts of the code.
Modifier and Type | Field and Description |
---|---|
static String |
DATABASE_LOCK
Public object representing a lock on database activity.
|
Constructor and Description |
---|
JDBCBayesianAnalyzer()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
protected abstract void |
delegatedLog(String errorString)
An abstract method which child classes override to handle logging of
errors in their particular environments.
|
static long |
getLastDatabaseUpdateTime()
Getter for static lastDatabaseUpdateTime.
|
String |
getSqlFileName()
Getter for property sqlFileName.
|
Map<String,String> |
getSqlParameters()
Getter for property sqlParameters.
|
void |
initSqlQueries(Connection conn,
File sqlFile)
Initializes the sql query environment from the SqlResources file.
|
void |
loadHamNSpam(Connection conn)
Loads the token frequencies from the database.
|
void |
resetData(Connection conn)
Reset all trained data
|
void |
setSqlFileName(String sqlFileName)
Setter for property sqlFileName.
|
void |
setSqlParameters(Map<String,String> sqlParameters)
Setter for property sqlParameters.
|
static void |
touchLastDatabaseUpdateTime()
Sets static lastDatabaseUpdateTime to System.currentTimeMillis().
|
void |
updateHamTokens(Connection conn)
Updates the database with new "ham" token frequencies.
|
void |
updateSpamTokens(Connection conn)
Updates the database with new "spam" token frequencies.
|
addHam, addSpam, buildCorpus, clear, computeSpamProbability, getCorpus, getHamMessageCount, getHamTokenCounts, getSpamMessageCount, getSpamTokenCounts, setCorpus, setHamMessageCount, setHamTokenCounts, setSpamMessageCount, setSpamTokenCounts, tokenCountsClear
public static final String DATABASE_LOCK
protected abstract void delegatedLog(String errorString)
errorString
- the error message generatedpublic String getSqlFileName()
public void setSqlFileName(String sqlFileName)
sqlFileName
- New value of property sqlFileName.public Map<String,String> getSqlParameters()
public void setSqlParameters(Map<String,String> sqlParameters)
sqlParameters
- New value of property sqlParameters.public static long getLastDatabaseUpdateTime()
public static void touchLastDatabaseUpdateTime()
public void loadHamNSpam(Connection conn) throws SQLException
conn
- The connection for accessing the databaseSQLException
- If a database error occurspublic void updateHamTokens(Connection conn) throws SQLException
conn
- The connection for accessing the databaseSQLException
- If a database error occurspublic void updateSpamTokens(Connection conn) throws SQLException
conn
- The connection for accessing the databaseSQLException
- If a database error occurspublic void resetData(Connection conn) throws SQLException
conn
- The connection for accessing the databaseSQLException
- If a database error occourspublic void initSqlQueries(Connection conn, File sqlFile) throws Exception
conn
- The connection for accessing the databasesqlFile
- The sqlResources.xml fileException
- If any error occursCopyright © 2002-2012 The Apache Software Foundation. All Rights Reserved.