Boolean options: bindttl - Print TTLs in BIND format multiline - Print records in multiline format noprintin - Don't print the class of a record if it's IN verbose - Turn on general debugging statements verbosemsg - Print all messages sent or received by SimpleResolver verbos
| 23 | */ |
| 24 | |
| 25 | public final class Options { |
| 26 | |
| 27 | private static Map table; |
| 28 | |
| 29 | static { |
| 30 | try { |
| 31 | refresh(); |
| 32 | } |
| 33 | catch (SecurityException e) { |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | private |
| 38 | Options() {} |
| 39 | |
| 40 | public static void |
| 41 | refresh() { |
| 42 | String s = System.getProperty("dnsjava.options"); |
| 43 | if (s != null) { |
| 44 | StringTokenizer st = new StringTokenizer(s, ","); |
| 45 | while (st.hasMoreTokens()) { |
| 46 | String token = st.nextToken(); |
| 47 | int index = token.indexOf('='); |
| 48 | if (index == -1) |
| 49 | set(token); |
| 50 | else { |
| 51 | String option = token.substring(0, index); |
| 52 | String value = token.substring(index + 1); |
| 53 | set(option, value); |
| 54 | } |
| 55 | } |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | /** Clears all defined options */ |
| 60 | public static void |
| 61 | clear() { |
| 62 | table = null; |
| 63 | } |
| 64 | |
| 65 | /** Sets an option to "true" */ |
| 66 | public static void |
| 67 | set(String option) { |
| 68 | if (table == null) |
| 69 | table = new HashMap(); |
| 70 | table.put(option.toLowerCase(), "true"); |
| 71 | } |
| 72 | |
| 73 | /** Sets an option to the the supplied value */ |
| 74 | public static void |
| 75 | set(String option, String value) { |
| 76 | if (table == null) |
| 77 | table = new HashMap(); |
| 78 | table.put(option.toLowerCase(), value.toLowerCase()); |
| 79 | } |
| 80 | |
| 81 | /** Removes an option */ |
| 82 | public static void |