|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.james.ai.classic.BayesianAnalyzer
org.apache.james.ai.classic.JDBCBayesianAnalyzer
public class JDBCBayesianAnalyzer
Manages the persistence of the spam bayesian analysis corpus using a JDBC database.
This class is abstract to allow implementations to take advantage of different logging capabilities/interfaces in different parts of the code.
| Field Summary | |
|---|---|
static String |
DATABASE_LOCK
Public object representing a lock on database activity. |
| Constructor Summary | |
|---|---|
JDBCBayesianAnalyzer()
|
|
JDBCBayesianAnalyzer(Log log)
|
|
| Method Summary | |
|---|---|
static long |
getLastDatabaseUpdateTime()
Getter for static lastDatabaseUpdateTime. |
Log |
getLog()
Gets the current log. |
String |
getSqlFileName()
Getter for property sqlFileName. |
Map<String,String> |
getSqlParameters()
Getter for property sqlParameters. |
void |
initSqlQueries(Connection conn,
Document sqlConfiguration)
Initializes the sql query environment from the SqlResources file. |
void |
loadHamNSpam(Connection conn)
Loads the token frequencies from the database. |
void |
log(String errorString)
Logs errors. |
void |
log(String errorString,
Throwable t)
Logs errors. |
void |
resetData(Connection conn)
Reset all trained data |
void |
setLog(Log log)
Sets the current log. |
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. |
| Methods inherited from class org.apache.james.ai.classic.BayesianAnalyzer |
|---|
addHam, addSpam, buildCorpus, clear, computeSpamProbability, getCorpus, getHamMessageCount, getHamTokenCounts, getSpamMessageCount, getSpamTokenCounts, setCorpus, setHamMessageCount, setHamTokenCounts, setSpamMessageCount, setSpamTokenCounts, tokenCountsClear |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String DATABASE_LOCK
| Constructor Detail |
|---|
public JDBCBayesianAnalyzer()
public JDBCBayesianAnalyzer(Log log)
| Method Detail |
|---|
public static long getLastDatabaseUpdateTime()
public static void touchLastDatabaseUpdateTime()
public Log getLog()
public void setLog(Log log)
log - not nullpublic 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 void loadHamNSpam(Connection conn)
throws SQLException
conn - The connection for accessing the database
SQLException - If a database error occurs
public void updateHamTokens(Connection conn)
throws SQLException
conn - The connection for accessing the database
SQLException - If a database error occurs
public void updateSpamTokens(Connection conn)
throws SQLException
conn - The connection for accessing the database
SQLException - If a database error occurs
public void resetData(Connection conn)
throws SQLException
conn - The connection for accessing the database
SQLException - If a database error occours
public void initSqlQueries(Connection conn,
Document sqlConfiguration)
throws Exception
conn - The connection for accessing the databasesqlConfiguration - The sqlResources configuration document
Exception - If any error occurspublic void log(String errorString)
log in interface LogerrorString - the error message generated
public void log(String errorString,
Throwable t)
log in interface LogerrorString - the error message generatedt - exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||