Author: norman
Date: Thu Sep 28 05:23:29 2006
New Revision: 450834
URL: http://svn.apache.org/viewvc?view=rev&rev=450834
Log:
Fix format
Modified:
james/jspf/trunk/src/main/java/org/apache/james/jspf/SPFQuery.java
Modified: james/jspf/trunk/src/main/java/org/apache/james/jspf/SPFQuery.java
URL:
http://svn.apache.org/viewvc/james/jspf/trunk/src/main/java/org/apache/james/jspf/SPFQuery.java?view=diff&rev=450834&r1=450833&r2=450834
==============================================================================
--- james/jspf/trunk/src/main/java/org/apache/james/jspf/SPFQuery.java
(original)
+++ james/jspf/trunk/src/main/java/org/apache/james/jspf/SPFQuery.java Thu Sep
28 05:23:29 2006
@@ -16,64 +16,62 @@
* specific language governing permissions and limitations *
* under the License. *
****************************************************************/
-
-
-package org.apache.james.jspf;
-
+
+package org.apache.james.jspf;
+
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.OptionBuilder;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.apache.commons.cli.PosixParser;
-import org.apache.log4j.ConsoleAppender;
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-import org.apache.log4j.SimpleLayout;
-
-/**
- * This class is used for commandline usage of JSPF
- *
- */
-public class SPFQuery {
-
- private final static int PASS_RCODE = 0;
-
- private final static int FAIL_RCODE = 1;
-
- private final static int SOFTFAIL_RCODE = 2;
-
- private final static int NEUTRAL_RCODE = 3;
-
- private final static int TEMP_ERROR_RCODE = 4;
-
- private final static int PERM_ERROR_RCODE = 5;
-
- private final static int NONE_RCODE = 6;
-
+import org.apache.log4j.ConsoleAppender;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.apache.log4j.SimpleLayout;
+
+/**
+ * This class is used for commandline usage of JSPF
+ *
+ */
+public class SPFQuery {
+
+ private final static int PASS_RCODE = 0;
+
+ private final static int FAIL_RCODE = 1;
+
+ private final static int SOFTFAIL_RCODE = 2;
+
+ private final static int NEUTRAL_RCODE = 3;
+
+ private final static int TEMP_ERROR_RCODE = 4;
+
+ private final static int PERM_ERROR_RCODE = 5;
+
+ private final static int NONE_RCODE = 6;
+
private final static int UNKNOWN_RCODE = 255;
-
+
private final static String CMD_IP = "ip";
-
+
private final static String CMD_SENDER = "sender";
-
+
private final static String CMD_HELO = "helo";
-
+
private final static String CMD_DEBUG = "debug";
-
- private final static String CMD_VERBOSE = "verbose";
- private final static String CMD_DEFAULT_EXP = "defaultexplanation";
-
- private final static String CMD_BEST_GUESS = "usebestguess";
-
+ private final static String CMD_VERBOSE = "verbose";
+
+ private final static String CMD_DEFAULT_EXP = "defaultexplanation";
+
+ private final static String CMD_BEST_GUESS = "usebestguess";
+
private static Logger logger = Logger.getRootLogger();
-
-
- /**
- * @param args
- * The commandline arguments to parse
- */
+
+ /**
+ * @param args
+ * The commandline arguments to parse
+ */
public static void main(String[] args) {
String ip = null;
@@ -93,7 +91,7 @@
try {
CommandLine line = parser.parse(options, args);
-
+
ip = line.getOptionValue(CMD_IP);
sender = line.getOptionValue(CMD_SENDER);
helo = line.getOptionValue(CMD_HELO);
@@ -132,7 +130,7 @@
usage();
}
}
-
+
/**
* Return the generated Options
*
@@ -140,52 +138,59 @@
*/
private static Options generateOptions() {
Options options = new Options();
-
options.addOption(OptionBuilder.withLongOpt(CMD_IP).withValueSeparator('=').hasArg().create());
-
options.addOption(OptionBuilder.withLongOpt(CMD_SENDER).withValueSeparator('=').hasArg().create());
-
options.addOption(OptionBuilder.withLongOpt(CMD_HELO).withValueSeparator('=').hasArg().create());
-
options.addOption(OptionBuilder.withLongOpt(CMD_DEFAULT_EXP).withValueSeparator('=').hasArg().create());
+ options.addOption(OptionBuilder.withLongOpt(CMD_IP).withValueSeparator(
+ '=').hasArg().create());
+ options.addOption(OptionBuilder.withLongOpt(CMD_SENDER)
+ .withValueSeparator('=').hasArg().create());
+ options.addOption(OptionBuilder.withLongOpt(CMD_HELO)
+ .withValueSeparator('=').hasArg().create());
+ options.addOption(OptionBuilder.withLongOpt(CMD_DEFAULT_EXP)
+ .withValueSeparator('=').hasArg().create());
options.addOption(OptionBuilder.withLongOpt(CMD_BEST_GUESS).create());
options.addOption(OptionBuilder.withLongOpt(CMD_DEBUG).create());
options.addOption(OptionBuilder.withLongOpt(CMD_VERBOSE).create());
return options;
- }
-
- /**
- * Print out the usage
- */
- private static void usage() {
- //TODO: Use HelpFormatter for printing usage
- System.out.println("Usage: java -jar jspf-x.jar --" + CMD_IP +
"=192.168.100.1 --" + CMD_SENDER + "[EMAIL PROTECTED] --"
- + CMD_HELO + "=foo.bar [--" + CMD_DEFAULT_EXP+
"=\"explanation String\"] [--" +CMD_BEST_GUESS+ "] "+ CMD_DEBUG + "] [--" +
CMD_VERBOSE+ "]");
- System.exit(UNKNOWN_RCODE);
- }
-
-
- /**
- * Return the return code for the result
- *
- * @param result The result
- * @return returnCode
- */
+ }
+
+ /**
+ * Print out the usage
+ */
+ private static void usage() {
+ // TODO: Use HelpFormatter for printing usage
+ System.out.println("Usage: java -jar jspf-x.jar --" + CMD_IP
+ + "=192.168.100.1 --" + CMD_SENDER + "[EMAIL PROTECTED] --"
+ + CMD_HELO + "=foo.bar [--" + CMD_DEFAULT_EXP
+ + "=\"explanation String\"] [--" + CMD_BEST_GUESS + "] "
+ + CMD_DEBUG + "] [--" + CMD_VERBOSE + "]");
+ System.exit(UNKNOWN_RCODE);
+ }
+
+ /**
+ * Return the return code for the result
+ *
+ * @param result
+ * The result
+ * @return returnCode
+ */
private static int getReturnCode(String result) {
-
- if (result.equals(SPF1Utils.PASS_CONV)) {
- return PASS_RCODE;
- } else if (result.equals(SPF1Utils.FAIL_CONV)) {
- return FAIL_RCODE;
- } else if (result.equals(SPF1Utils.SOFTFAIL_CONV)) {
- return SOFTFAIL_RCODE;
- } else if (result.equals(SPF1Utils.NEUTRAL_CONV)) {
- return NEUTRAL_RCODE;
- } else if (result.equals(SPF1Utils.TEMP_ERROR_CONV)) {
- return TEMP_ERROR_RCODE;
- } else if (result.equals(SPF1Utils.PERM_ERROR_CONV)) {
- return PERM_ERROR_RCODE;
- } else if (result.equals(SPF1Utils.NONE_CONV)) {
- return NONE_RCODE;
- }
-
- return UNKNOWN_RCODE;
- }
-
-}
+
+ if (result.equals(SPF1Utils.PASS_CONV)) {
+ return PASS_RCODE;
+ } else if (result.equals(SPF1Utils.FAIL_CONV)) {
+ return FAIL_RCODE;
+ } else if (result.equals(SPF1Utils.SOFTFAIL_CONV)) {
+ return SOFTFAIL_RCODE;
+ } else if (result.equals(SPF1Utils.NEUTRAL_CONV)) {
+ return NEUTRAL_RCODE;
+ } else if (result.equals(SPF1Utils.TEMP_ERROR_CONV)) {
+ return TEMP_ERROR_RCODE;
+ } else if (result.equals(SPF1Utils.PERM_ERROR_CONV)) {
+ return PERM_ERROR_RCODE;
+ } else if (result.equals(SPF1Utils.NONE_CONV)) {
+ return NONE_RCODE;
+ }
+
+ return UNKNOWN_RCODE;
+ }
+
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]