in resolver/src/main/java/org/apache/james/jspf/impl/SPFQuery.java [82:133]
public static void main(String[] args) {
String ip = null;
String sender = null;
String helo = null;
String defaultExplanation = null;
boolean useBestGuess = false;
boolean useTrustedForwarder = false;
Options options = generateOptions();
CommandLineParser parser = new PosixParser();
try {
CommandLine line = parser.parse(options, args);
ip = line.getOptionValue(CHAR_IP);
sender = line.getOptionValue(CHAR_SENDER);
helo = line.getOptionValue(CHAR_HELO);
defaultExplanation = line.getOptionValue(CHAR_DEFAULT_EXP);
useBestGuess = line.hasOption(CHAR_BEST_GUESS);
useTrustedForwarder = line.hasOption(CHAR_TRUSTED_FORWARDER);
// check if all needed values was set
if (ip != null && sender != null && helo != null) {
SPF spf = new DefaultSPF();
// Check if we should set a costum default explanation
if (defaultExplanation != null) {
spf.setDefaultExplanation(defaultExplanation);
}
// Check if we should use best guess
if (useBestGuess == true) {
spf.setUseBestGuess(true);
}
if (useTrustedForwarder == true) {
spf.setUseTrustedForwarder(true);
}
SPFResult result = spf.checkSPF(ip, sender, helo);
System.out.println(result.getResult());
System.out.println(result.getHeader());
System.exit(getReturnCode(result.getResult()));
} else {
usage();
}
} catch (ParseException e) {
usage();
}
}