|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.james.util.BayesianAnalyzer org.apache.james.util.JDBCBayesianAnalyzer
public abstract 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 java.lang.String |
DATABASE_LOCK
Public object representing a lock on database activity. |
Constructor Summary | |
---|---|
JDBCBayesianAnalyzer()
Default constructor. |
Method Summary | |
---|---|
protected abstract void |
delegatedLog(java.lang.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. |
java.lang.String |
getSqlFileName()
Getter for property sqlFileName. |
java.util.Map |
getSqlParameters()
Getter for property sqlParameters. |
void |
initSqlQueries(java.sql.Connection conn,
MailetContext mailetContext)
Initializes the sql query environment from the SqlResources file. |
void |
loadHamNSpam(java.sql.Connection conn)
Loads the token frequencies from the database. |
void |
setSqlFileName(java.lang.String sqlFileName)
Setter for property sqlFileName. |
void |
setSqlParameters(java.util.Map sqlParameters)
Setter for property sqlParameters. |
static void |
touchLastDatabaseUpdateTime()
Sets static lastDatabaseUpdateTime to System.currentTimeMillis(). |
void |
updateHamTokens(java.sql.Connection conn)
Updates the database with new "ham" token frequencies. |
void |
updateSpamTokens(java.sql.Connection conn)
Updates the database with new "spam" token frequencies. |
Methods inherited from class org.apache.james.util.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 java.lang.String DATABASE_LOCK
Constructor Detail |
---|
public JDBCBayesianAnalyzer()
Method Detail |
---|
protected abstract void delegatedLog(java.lang.String errorString)
errorString
- the error message generatedpublic java.lang.String getSqlFileName()
public void setSqlFileName(java.lang.String sqlFileName)
sqlFileName
- New value of property sqlFileName.public java.util.Map getSqlParameters()
public void setSqlParameters(java.util.Map sqlParameters)
sqlParameters
- New value of property sqlParameters.public static long getLastDatabaseUpdateTime()
public static void touchLastDatabaseUpdateTime()
public void loadHamNSpam(java.sql.Connection conn) throws java.sql.SQLException
conn
- The connection for accessing the database
java.sql.SQLException
- If a database error occurspublic void updateHamTokens(java.sql.Connection conn) throws java.sql.SQLException
conn
- The connection for accessing the database
java.sql.SQLException
- If a database error occurspublic void updateSpamTokens(java.sql.Connection conn) throws java.sql.SQLException
conn
- The connection for accessing the database
java.sql.SQLException
- If a database error occurspublic void initSqlQueries(java.sql.Connection conn, MailetContext mailetContext) throws java.lang.Exception
conn
- The connection for accessing the databasemailetContext
- The current mailet context,
for finding the conf/sqlResources.xml file
java.lang.Exception
- If any error occurs
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |