james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefano Bagnara <apa...@bago.org>
Subject Re: Accessing BayesianAnalysisFeeder through Java
Date Tue, 01 May 2007 12:19:14 GMT
You have to use the JDBCBayesianAnalyzer class.
It is abstract because you have to implement the logging method.

This is done usually via anonymous classes:

/**
 * The JDBCBayesianAnalyzer class that does all the work.
 */
private JDBCBayesianAnalyzer analyzer = new JDBCBayesianAnalyzer() {
    protected void delegatedLog(String logString) {
        log("BayesianAnalysisFeeder: " + logString);
    }
};

If you look at BayesianAnalysisFeeder mailet sources you will see
exactly how it instantiate the analyzer and how it calls it.

You have to init the sql queries (there is an xml file declaring how the
needed sql queries look like), then you can call
                 analyzer.addSpam()+analyzer.updateSpamTokens() or
analyzer.addHam()+analyzer.updateHamTokens();

Stefano

Kevin Jackson ha scritto:
> Hi all,
> 
> We are using James (svn trunk), and we have a tomcat server with a web
> UI to our mail stored in postgres.  I'd like to be able to add a
> "report spam" button to our web UI that will use the James Bayesian
> Analysis Feeder to analyse the mail message.
> 
> We have a JSF front end, so adding a button is ok, but I want to know
> how to access the feeder directly via Java instead of resending the
> message to the server with a X-isSpam = 1.00 type header attached.
> 
> If anyone has an idea about how to do this with the James Mailet API
> I'd greatly appreciate your input.
> 
> Thanks,
> Kev



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message