1 package org.apache.ecs; 2 3 60 61 import java.util.ResourceBundle ; 62 63 76 public final class ECSDefaults 77 { 78 82 private static ECSDefaults defaults = new ECSDefaults(); 83 84 private ResourceBundle resource; 86 87 private boolean filter_state =false; 89 private boolean filter_attribute_state = false; 90 private char attribute_equality_sign = '='; 91 private char begin_start_modifier = ' '; 92 private char end_start_modifier = ' '; 93 private char begin_end_modifier = ' '; 94 private char end_end_modifier = ' '; 95 private char attribute_quote_char = '\"'; 96 private boolean attribute_quote = true; 97 private boolean end_element = true; 98 private String codeset = "UTF-8"; 99 private int position = 4; 100 private int case_type = 3; 101 private char start_tag = '<'; 102 private char end_tag = '>'; 103 private boolean pretty_print = false; 104 105 108 public static boolean getDefaultFilterState() 109 { 110 return defaults.filter_state; 111 } 112 113 116 public static boolean getDefaultFilterAttributeState() 117 { 118 return defaults.filter_attribute_state; 119 } 120 121 124 public static char getDefaultAttributeEqualitySign() 125 { 126 return defaults.attribute_equality_sign; 127 } 128 129 132 public static char getDefaultBeginStartModifier() 133 { 134 return defaults.begin_start_modifier; 135 } 136 137 140 public static char getDefaultEndStartModifier() 141 { 142 return defaults.end_start_modifier; 143 } 144 145 148 public static char getDefaultBeginEndModifier() 149 { 150 return defaults.begin_end_modifier; 151 } 152 153 156 public static char getDefaultEndEndModifier() 157 { 158 return defaults.end_end_modifier; 159 } 160 161 164 public static char getDefaultAttributeQuoteChar() 165 { 166 return defaults.attribute_quote_char; 167 } 168 169 172 public static boolean getDefaultAttributeQuote() 173 { 174 return defaults.attribute_quote; 175 } 176 177 180 public static boolean getDefaultEndElement() 181 { 182 return defaults.end_element; 183 } 184 185 188 public static String getDefaultCodeset() 189 { 190 return defaults.codeset; 191 } 192 193 196 public static int getDefaultPosition() 197 { 198 return defaults.position; 199 } 200 201 204 public static int getDefaultCaseType() 205 { 206 return defaults.case_type; 207 } 208 209 212 public static char getDefaultStartTag() 213 { 214 return defaults.start_tag; 215 } 216 217 220 public static char getDefaultEndTag() 221 { 222 return defaults.end_tag; 223 } 224 225 228 public static boolean getDefaultPrettyPrint() 229 { 230 return defaults.pretty_print; 231 } 232 233 236 private ECSDefaults () 237 { 238 try 239 { 240 String props=System.getProperty("ecs.properties"); 242 if (props==null) 243 { 244 resource = ResourceBundle.getBundle("org.apache.ecs.ecs"); 245 } else { 246 resource = new java.util.PropertyResourceBundle (new java.io.FileInputStream (props)); 247 } 248 249 filter_state = new Boolean (resource.getString("filter_state")).booleanValue(); 251 filter_attribute_state = new Boolean (resource.getString("filter_attribute_state")).booleanValue(); 252 attribute_equality_sign = resource.getString("attribute_equality_sign").charAt(1); 253 begin_start_modifier = resource.getString("begin_start_modifier").charAt(1); 254 end_start_modifier = resource.getString("end_start_modifier").charAt(1); 255 begin_end_modifier = resource.getString("begin_end_modifier").charAt(1); 256 end_end_modifier = resource.getString("end_end_modifier").charAt(1); 257 attribute_quote_char = resource.getString("attribute_quote_char").charAt(0); 258 attribute_quote = new Boolean (resource.getString("attribute_quote")).booleanValue(); 259 end_element = new Boolean (resource.getString("end_element")).booleanValue(); 260 codeset = resource.getString("codeset"); 261 position = Integer.parseInt(resource.getString("position")); 262 case_type = Integer.parseInt(resource.getString("case_type")); 263 start_tag = resource.getString("start_tag").charAt(0); 264 end_tag = resource.getString("end_tag").charAt(0); 265 pretty_print = new Boolean (resource.getString("pretty_print")).booleanValue(); 266 267 } 268 catch(Exception e) 269 { 270 System.err.println("The following error preventing " + 271 "ecs.properties being loaded:"); 272 System.err.println(e.toString()); 273 } 274 } 275 276 279 public static String debugString() 280 { 281 return 282 "ECSDefaults:" + '\n' 283 + '\t' + "DefaultFilterState=" + getDefaultFilterState() +'\n' 284 + '\t' + "DefaultFilterAttributeState=" + getDefaultFilterAttributeState() +'\n' 285 + '\t' + "DefaultAttributeEqualitySign='" + getDefaultAttributeEqualitySign() +"'\n" 286 + '\t' + "DefaultBeginStartModifier='" + getDefaultBeginStartModifier() + "'\n" 287 + '\t' + "DefaultEndStartModifier='" + getDefaultEndStartModifier() + "'\n" 288 + '\t' + "DefaultBeginEndModifier='" + getDefaultBeginEndModifier() + "'\n" 289 + '\t' + "DefaultEndEndModifier='" + getDefaultEndEndModifier() + "'\n" 290 + '\t' + "DefaultAttributeQuoteChar=" + getDefaultAttributeQuoteChar() + '\n' 291 + '\t' + "DefaultAttributeQuote=" + getDefaultAttributeQuote() +'\n' 292 + '\t' + "DefaultEndElement=" + getDefaultEndElement() +'\n' 293 + '\t' + "DefaultCodeset='" + getDefaultCodeset() + "'\n" 294 + '\t' + "DefaultPosition=" + getDefaultPosition() +'\n' 295 + '\t' + "DefaultCaseType=" + getDefaultCaseType() +'\n' 296 + '\t' + "DefaultStartTag='" + getDefaultStartTag() + "'\n" 297 + '\t' + "DefaultEndTag='" + getDefaultEndTag() + "'\n" 298 + '\t' + "DefaultPrettyPrint=" + getDefaultPrettyPrint(); 299 } 300 } 301 | Popular Tags |