1 6 7 package com.espada.bugtracker.util; 8 import java.util.*; 9 import java.io.*; 10 11 36 public class PropertyFactory extends java.lang.Object { 37 38 private static Properties _props; 39 40 public PropertyFactory() { 41 } 42 43 public static Properties getInstance() 44 throws PropertiesNotReadException 45 { 46 if (! isInitialized() ) 47 throw new PropertiesNotReadException("have you set the properties file using readProperties() at least once in the instance of this app?"); 48 return _props; 49 } 50 51 public static boolean isInitialized() 52 { 53 return (_props != null); 54 } 55 56 public static void readProperties( String fname ) 57 throws IOException 58 { 59 readProperties(new FileInputStream(fname)); 60 } 61 62 public static void readProperties( InputStream ips ) 63 throws IOException 64 { 65 _props = new Properties(); 66 _props.load(ips); 67 } 68 69 public static void readProperties( Properties p ) 70 { 71 _props = new Properties(p); 72 } 73 74 } 75 | Popular Tags |