📄 jasenconfiguration.java
字号:
/*
* @(#)JasenConfiguration.java 30/10/2004
*
* Copyright (c) 2004, 2005 jASEN.org
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the distribution.
*
* 3. The names of the authors may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* 4. Any modification or additions to the software must be contributed back
* to the project.
*
* 5. Any investigation or reverse engineering of source code or binary to
* enable emails to bypass the filters, and hence inflict spam and or viruses
* onto users who use or do not use jASEN could subject the perpetrator to
* criminal and or civil liability.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JASEN.ORG,
* OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
package org.jasen.config;
import java.io.InputStream;
import java.io.Serializable;
import java.util.List;
import java.util.Vector;
import javax.mail.internet.MimeMessage;
/**
* <P>
* Holds the configuration for the engine.
* </P>
* <p>
* By default, the configuration file used is the internal configuration located in the jasen-config folder which MUST be in the classpath
* </p>
* <p>
* An alternate configuration can be loaded by specifying an alternal InputStream in the init method of the core Jasen class
* </p>
* @see org.jasen.core.engine.Jasen#init(InputStream)
* @see org.jasen.core.engine.Jasen#init(String)
* @author Jason Polites
*/
public class JasenConfiguration implements Serializable
{
//public static final String DEFAULT_CONFIG_PATH = "org/jasen/config/default-jasen-config.xml";
public static final String DEFAULT_CONFIG_PATH = "default-jasen-config.xml";
private String libPath;
private String calculator;
private String mimeParser;
private String headerParser;
private String tokenizer;
private String result;
private String boundary = "0";
private String errorHandler;
private String dnsResolver;
private String inetResolver;
private String tokenLimit;
private String confidence;
private String guess;
private String esf; // Effective Size Factor
private String ftt; // Few Token Threshold
private String autoUpdateUrl;
private String autoUpdateParcel;
private String autoUpdateFrequency;
private String autoUpdateEnabled = "true";
private String autoUpdateCheckOnStartup = "true";
private String autoUpdateReadBuffer = "1024";
private String autoUpdateReadTimout = "5000";
private String autoUpdateErrorHandler;
private List pluginConfigurations;
private JasenParserConfiguration parserConfiguration;
/**
* Constructs a new configuration instance
*/
public JasenConfiguration() {
super ();
}
/**
* Gets the FQCN of the parser used to parse received headers
* @return The class name of the header parser in use
*/
public String getHeaderParser() {
return headerParser;
}
/**
* Sets the FQCN of the parser used to parse received headers
* @param headerParserClass
*/
public void setHeaderParser(String headerParserClass) {
this.headerParser = headerParserClass;
}
/**
* Gets the FQCN of the parser used to parse MimeMessages
* @return The class name of the Mime Parser in use
*/
public String getMimeParser() {
return mimeParser;
}
/**
* Sets the FQCN of the parser used to parse MimeMessages
* @param mimeParserClass
*/
public void setMimeParser(String mimeParserClass) {
this.mimeParser = mimeParserClass;
}
/**
* Gets the list of configurations which pertain to the plugins used by the engine
* @return A List of JasenPluginConfiguration objects
* @see JasenPluginConfiguration
*/
public List getPluginConfigurations() {
return pluginConfigurations;
}
/**
* Sets the list of configurations which pertain to the plugins used by the engine
* @param pluginConfigurations
* @see JasenPluginConfiguration
*/
public void setPluginConfigurations(List pluginConfigurations) {
this.pluginConfigurations = pluginConfigurations;
}
/**
* Adds a plugin configuration
* @param config
* @see JasenPluginConfiguration
*/
public void addPluginConfiguration(JasenPluginConfiguration config) {
if(pluginConfigurations == null) {
pluginConfigurations = new Vector();
}
pluginConfigurations.add(config);
}
/**
* Gets the FQCN of the calculator used to compute the results of a scan
* @return The class name of the calculator in use
* @see org.jasen.interfaces.ProbabilityCalculator
*/
public String getCalculator() {
return calculator;
}
/**
* Sets the FQCN of the calculator used to compute the results of a scan
* @param probabilityCalculatorClass
* @see org.jasen.interfaces.ProbabilityCalculator
*/
public void setCalculator(String probabilityCalculatorClass) {
this.calculator = probabilityCalculatorClass;
}
/**
* Gets the FQCN of the tokenizer used to reduce the email to a set of tokens (words)
* @return
*/
public String getTokenizer() {
return tokenizer;
}
/**
* Sets the FQCN of the tokenizer used to reduce the email to a set of tokens (words)
* @param textTokenizerClass
*/
public void setTokenizer(String textTokenizerClass) {
this.tokenizer = textTokenizerClass;
}
/**
* Gets the FQCN of the result class returned by a call to scan
* @return
* @see org.jasen.core.engine.Jasen#scan(MimeMessage)
*/
public String getResult() {
return result;
}
/**
* Sets the FQCN of the result class returned by a call to scan
* @param result
* @see org.jasen.JasenScanner#scan(MimeMessage)
*/
public void setResult(String result) {
this.result = result;
}
/**
* Gets the "confidence" rating for the engine.
* <br/>
* Confidence refers to the degree to which we "trust" the results produced by the engine, specifically the RobinsonScanner
* @return String
* @see org.jasen.plugins.RobinsonScanner
*/
public String getConfidence() {
return confidence;
}
/**
* Gets the "confidence" rating for the engine.
* <br/>
* Confidence refers to the degree to which we "trust" the results produced by the engine, specifically the RobinsonScanner
* @param confidence A value between 0.0 and 1.0
* @see org.jasen.plugins.RobinsonScanner
*/
public void setConfidence(String confidence) {
this.confidence = confidence;
}
/**
* Returns the Effective Size Factor. This is an internal configuration used by the RobinsonScanner
* @return The Effective Size Factor
* @see org.jasen.plugins.RobinsonScanner
*/
public String getEsf() {
return esf;
}
/**
* Sets the Effective Size Factor. This is an internal configuration used by the RobinsonScanner
* @param esf A value between 0.0 and 1.0
* @see org.jasen.plugins.RobinsonScanner
*/
public void setEsf(String esf) {
this.esf = esf;
}
/**
* The guess is the value ascribed to result when no definative information about the nature of the email could be deduced
* @return The guess value
*/
public String getGuess() {
return guess;
}
/**
* The guess is the value ascribed to result when no definative information about the nature of the email could be deduced
* @param guess A value between 0.0 and 1.0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -