1 22 package org.jboss.util.property; 23 24 import java.security.AccessController ; 25 import java.security.PrivilegedAction ; 26 27 34 public final class Property 35 { 36 37 public static String LINE_SEPARATOR; 38 39 40 public static String FILE_SEPARATOR; 41 42 43 public static String PATH_SEPARATOR; 44 45 static 46 { 47 PrivilegedAction action = new PrivilegedAction () 48 { 49 public Object run() 50 { 51 LINE_SEPARATOR = Property.get("line.separator"); 52 FILE_SEPARATOR = Property.get("file.separator"); 53 PATH_SEPARATOR = Property.get("path.separator"); 54 return null; 55 } 56 }; 57 AccessController.doPrivileged(action); 58 } 59 60 65 public static void addListener(PropertyListener listener) 66 { 67 PropertyManager.addPropertyListener(listener); 68 } 69 70 75 public static void addListeners(PropertyListener[] listeners) 76 { 77 PropertyManager.addPropertyListeners(listeners); 78 } 79 80 86 public static boolean removeListener(PropertyListener listener) 87 { 88 return PropertyManager.removePropertyListener(listener); 89 } 90 91 98 public static String set(String name, String value) 99 { 100 return PropertyManager.setProperty(name, value); 101 } 102 103 109 public static String remove(String name) 110 { 111 return PropertyManager.getProperty(name); 112 } 113 114 121 public static String get(String name, String defaultValue) 122 { 123 return PropertyManager.getProperty(name, defaultValue); 124 } 125 126 132 public static String get(String name) 133 { 134 return PropertyManager.getProperty(name); 135 } 136 137 144 public static String [] getArray(String base, String [] defaultValues) 145 { 146 return PropertyManager.getArrayProperty(base, defaultValues); 147 } 148 149 155 public static String [] getArray(String name) 156 { 157 return PropertyManager.getArrayProperty(name); 158 } 159 160 166 public static boolean exists(String name) 167 { 168 return PropertyManager.containsProperty(name); 169 } 170 171 177 public static PropertyGroup getGroup(String basename) 178 { 179 return PropertyManager.getPropertyGroup(basename); 180 } 181 182 189 public static PropertyGroup getGroup(String basename, int index) 190 { 191 return PropertyManager.getPropertyGroup(basename, index); 192 } 193 } 194 | Popular Tags |