1
// Copyright (c) 1999-2004 Brian Wellington (bwelling@xbill.org)
9
* bindttl - Print TTLs in BIND format<BR>
10
* multiline - Print records in multiline format<BR>
11
* noprintin - Don't print the class of a record if it's IN<BR>
12
* verbose - Turn on general debugging statements<BR>
13
* verbosemsg - Print all messages sent or received by SimpleResolver<BR>
14
* verbosecompression - Print messages related to name compression<BR>
15
* verbosesec - Print messages related to signature verification<BR>
16
* verbosecache - Print messages related to cache lookups<BR>
19
* tsigfudge=n - Sets the default TSIG fudge value (in seconds)<BR>
20
* sig0validity=n - Sets the default SIG(0) validity period (in seconds)<BR>
22
* @author Brian Wellington
25
public final class Options {
27
private static Map table;
33
catch (SecurityException e) {
42
String s = System.getProperty("dnsjava.options");
44
StringTokenizer st = new StringTokenizer(s, ",");
45
while (st.hasMoreTokens()) {
46
String token = st.nextToken();
47
int index = token.indexOf('=');
51
String option = token.substring(0, index);
52
String value = token.substring(index + 1);
59
/** Clears all defined options */
65
/** Sets an option to "true" */
69
table = new HashMap();
70
table.put(option.toLowerCase(), "true");
73
/** Sets an option to the the supplied value */
75
set(String option, String value) {
77
table = new HashMap();
78
table.put(option.toLowerCase(), value.toLowerCase());
81
/** Removes an option */
83
unset(String option) {
86
table.remove(option.toLowerCase());
89
/** Checks if an option is defined */
91
check(String option) {
94
return (table.get(option.toLowerCase()) != null);
97
/** Returns the value of an option */
99
value(String option) {
102
return ((String)table.get(option.toLowerCase()));
106
* Returns the value of an option as an integer, or -1 if not defined.
109
intValue(String option) {
110
String s = value(option);
113
int val = Integer.parseInt(s);
117
catch (NumberFormatException e) {