|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jasen.core.engine.Jasen
The core scanning class of the jASEN framework.
Jasen scans a MimeMessage using the internal logic and any registered plugins and returns a scan result object indicating the results of the scan
NOTE: You should not call this class directly. Use the JasenScanner singleton as it provides thread safety during updates
JasenScanner
Field Summary | |
static float |
NO_THRESHOLD
|
static int |
RESULT_INDEX_DISPLAY
The index into the test results array for the plugin display name |
static int |
RESULT_INDEX_NAME
The index into the test results array for the plugin name |
static int |
RESULT_INDEX_PROBABILITY
The index into the test results array for the probability |
static int |
RESULT_INDEX_TIME
The index into the test results array for the plugin execution time |
Constructor Summary | |
Jasen()
|
Method Summary | |
void |
destroy()
Calls destroy on any registered plugins. |
ProbabilityCalculator |
getCalculator()
Gets the calculator used to calculate the combined probabilities of all the tests |
JasenConfiguration |
getConfig()
Gets the configuration object defined for the engine |
ClassLoader |
getContextClassLoader()
Gets the context classloader to use when loading plugins etc. |
DNSResolver |
getDnsResolver()
Gets the resolver used to resolve DNS records |
JasenErrorHandler |
getErrorHandler()
Gets the error handler used by the scanner |
Class |
getHeaderParserClass()
Gets the mimeParser used to parse the "received" headers in the message |
InetAddressResolver |
getInetAddressResolver()
Gets the resolver used to resolve InetAddresses |
MimeMessageParser |
getMimeParser()
Gets the mimeParser used to parse the MimeMessage |
List |
getPlugins()
Gets the list of plugins to be used when scanning a message |
Class |
getScanResultClass()
Gets the class used to hold the results of a scan |
MimeMessageTokenizer |
getTokenizer()
Gets the tokenizer used to extract meaningful text from the message |
void |
init()
Initialises the engine with the default configuration |
void |
init(InputStream in)
Deprecated. Use init(JasenConfigurationLoader loader) |
void |
init(JasenConfigurationLoader loader)
Initialises the engine with the configuration loader provided |
void |
init(String config)
Deprecated. Use init(JasenConfigurationLoader loader) |
void |
restart()
Restarts the engine. |
JasenScanResult |
scan(javax.mail.internet.MimeMessage mm,
float threshold,
String[] ignored)
Scans the given message. |
JasenScanResult |
scan(javax.mail.internet.MimeMessage mm,
JasenMessage message,
float threshold,
String[] ignored)
Scans the given mime message using the already mime-parsed JasenMessage. |
JasenScanResult |
scan(javax.mail.internet.MimeMessage mm,
JasenMessage message,
String[] ignored)
Scans the message without a threshold specified |
JasenScanResult |
scan(javax.mail.internet.MimeMessage mm,
String[] ignored)
Scans the given message. |
void |
setCalculator(ProbabilityCalculator calculator)
Sets the calculator used to calculate the combined probabilities of all the tests |
void |
setContextClassLoader(ClassLoader pluginClassLoader)
Sets the class loader to use when loading plugins etc. |
void |
setDnsResolver(DNSResolver dnsResolver)
Sets the resolver used to resolve DNS records |
void |
setErrorHandler(JasenErrorHandler errorHandler)
Sets the error handler used by the scanner |
void |
setHeaderParserClass(Class headerParser)
Sets the mimeParser used to parse the "received" headers in the message |
void |
setInetAddressResolver(InetAddressResolver inetAddressResolver)
Sets the resolver used to resolve InetAddresses |
void |
setMimeParser(MimeMessageParser parser)
Sets the mimeParser used to parse the MimeMessage |
void |
setPlugins(Vector plugins)
Sets the list of plugins to be used when scanning a message |
void |
setScanResultClass(Class resultClass)
Sets the class used to hold the results of a scan |
void |
setTokenizer(MimeMessageTokenizer tokenizer)
Sets the tokenizer used to extract meaningful text from the message |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final float NO_THRESHOLD
public static final int RESULT_INDEX_PROBABILITY
public static final int RESULT_INDEX_TIME
public static final int RESULT_INDEX_NAME
public static final int RESULT_INDEX_DISPLAY
Constructor Detail |
public Jasen()
Method Detail |
public void init() throws JasenException
JasenException
public void init(String config) throws JasenException
config
- The absolute path to the configuration file
JasenException
public void init(InputStream in) throws JasenException
in
- The input stream from which the configuration may be read
JasenException
public void init(JasenConfigurationLoader loader) throws JasenException
loader
-
JasenException
public void destroy()
public void restart() throws JasenException
JasenException
public JasenScanResult scan(javax.mail.internet.MimeMessage mm, String[] ignored) throws JasenException
All plugins will execute regardless of the probability (or computed total probability) discovered from any single plugin or combination thereof
mm
- The MimeMessage to be scannedignored
- A list of plugin names which will be ignored during the scan. May be null
JasenException
public JasenScanResult scan(javax.mail.internet.MimeMessage mm, JasenMessage message, String[] ignored) throws JasenException
mm
- The MimeMessage to be scannedmessage
- A pre-parsed JasenMessageignored
- A list of plugin names which will be ignored during the scan. May be null
JasenException
public JasenScanResult scan(javax.mail.internet.MimeMessage mm, JasenMessage message, float threshold, String[] ignored) throws JasenException
This implementation allows calling applications to implement their own JasenMessage by passing it to the scan engine.
mm
- The MimeMessage to be scannedmessage
- A pre-parsed JasenMessagethreshold
- The thresholds. If any one plugin yields a result >= threshold, scanning is ceased and the result returned immediatelyignored
- A list of plugin names which will be ignored during the scan. May be null
JasenException
public JasenScanResult scan(javax.mail.internet.MimeMessage mm, float threshold, String[] ignored) throws JasenException
The threshold value indicates the value at which we know the message is spam without continuing
If the engine computes this threshold prior to all plugins executing, tests are stopped and the result is returned immediately
mm
- The MimeMessage to be scannedthreshold
- The marker above which scanning ceasesignored
- A list of plugin names which will be ignored during the scan. May be null
JasenException
public ProbabilityCalculator getCalculator()
JasenConfiguration.getCalculator()
public void setCalculator(ProbabilityCalculator calculator)
calculator
- JasenConfiguration.setCalculator(String)
public Class getHeaderParserClass()
JasenConfiguration.getHeaderParser()
public void setHeaderParserClass(Class headerParser)
headerParser
- JasenConfiguration.setHeaderParser(String)
public MimeMessageParser getMimeParser()
JasenConfiguration.getMimeParser()
public void setMimeParser(MimeMessageParser parser)
parser
- The mime parse to be usedpublic List getPlugins()
PluginContainer
public void setPlugins(Vector plugins)
plugins
- A List of PluginContainer objectsPluginContainer
public JasenConfiguration getConfig()
public MimeMessageTokenizer getTokenizer()
JasenConfiguration.getTokenizer()
public void setTokenizer(MimeMessageTokenizer tokenizer)
tokenizer
- The tokenizer to useJasenConfiguration.setTokenizer(String)
public Class getScanResultClass()
JasenConfiguration.getResult()
public void setScanResultClass(Class resultClass)
resultClass
- JasenConfiguration.setResult(String)
public InetAddressResolver getInetAddressResolver()
JasenConfiguration.getInetResolver()
public void setInetAddressResolver(InetAddressResolver inetAddressResolver)
inetAddressResolver
- JasenConfiguration.setInetResolver(String)
public DNSResolver getDnsResolver()
JasenConfiguration.getDnsResolver()
public void setDnsResolver(DNSResolver dnsResolver)
dnsResolver
- JasenConfiguration.setDnsResolver(String)
public JasenErrorHandler getErrorHandler()
JasenConfiguration.getErrorHandler()
public void setErrorHandler(JasenErrorHandler errorHandler)
errorHandler
- The error handler to beusedJasenConfiguration.setErrorHandler(String)
public ClassLoader getContextClassLoader()
This should only EVERY be set by the auto update engine
public void setContextClassLoader(ClassLoader pluginClassLoader)
This should only EVERY be set by the auto update engine
pluginClassLoader
- The class loader to use to load plugins for this session
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |