Changeset 47
- Timestamp:
- 02/16/06 17:37:35 (3 years ago)
- Files:
-
- trunk/src/net/schst/XJConf/Examples/Example1.java (modified) (1 diff)
- trunk/src/net/schst/XJConf/XmlReader.java (modified) (5 diffs)
- trunk/version.properties (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/net/schst/XJConf/Examples/Example1.java
r34 r47 17 17 /** 18 18 * @author sschmidt 19 *20 * TODO To change the template for this generated type comment go to21 * Window - Preferences - Java - Code Style - Code Templates22 19 */ 23 20 public class Example1 { trunk/src/net/schst/XJConf/XmlReader.java
r41 r47 87 87 } 88 88 89 /**90 * Constructor91 *92 * You may pass a classloader to the constructor which will be93 * used to:94 * - load extension classes95 * - load dynamically created clases96 *97 * @param loader98 */99 public XmlReader(ClassLoader loader) {100 super();101 this.loader = loader;102 }103 104 89 /** 105 90 * Set the tag definitions … … 152 137 */ 153 138 public void addExtension(String name) throws UnknownExtensionException { 139 this.addExtension(name, this.getClass().getClassLoader()); 140 } 141 142 /** 143 * Add a new extension 144 * 145 * @param name full-qualified class name 146 * @param classLoader class loader that should be used 147 * @throws UnknownExtensionException 148 */ 149 public void addExtension(String name, ClassLoader classLoader) throws UnknownExtensionException { 154 150 Extension ext; 155 151 try { 156 Class c = Class.forName(name, true,this.loader);152 Class c = Class.forName(name, true, classLoader); 157 153 ext = (Extension)c.newInstance(); 158 154 } catch (Exception e) { … … 162 158 this.addExtension(ns, ext); 163 159 } 160 161 /** 162 * Parse a configuration file, that you already 163 * opened. 164 * 165 * @param file File object to parse 166 * @param classLoader 167 * @throws XJConfException 168 * @throws IOException 169 */ 170 public void parse(File file, ClassLoader classLoader) throws XJConfException, IOException { 171 this.loader = classLoader; 172 this.parse(file); 173 } 164 174 165 175 /** … … 193 203 } 194 204 195 /** 196 * Get the file that currently is being parsed 197 * 198 * @return 199 */ 200 public File getCurrentFile() { 201 return (File)this.openFiles.peek(); 202 } 203 204 /** 205 * Parse a configuration file. 205 /** 206 * Parse a configuration file. 206 207 * 207 208 * @param filename filename of the configuration file 208 209 * @throws IOException 209 210 * @throws XJConfException 210 */ 211 public void parse(String filename) throws XJConfException, IOException { 212 File file = new File(filename); 213 this.parse(file); 214 } 215 211 */ 212 public void parse(String filename, ClassLoader classLoader) throws XJConfException, IOException { 213 File file = new File(filename); 214 this.parse(file, classLoader); 215 } 216 217 /** 218 * Parse a configuration file. 219 * 220 * @param filename filename of the configuration file 221 * @throws IOException 222 * @throws XJConfException 223 */ 224 public void parse(String filename) throws XJConfException, IOException { 225 File file = new File(filename); 226 this.parse(file); 227 } 228 229 /** 230 * Get the file that currently is being parsed 231 * 232 * @return 233 */ 234 public File getCurrentFile() { 235 return (File)this.openFiles.peek(); 236 } 237 216 238 /** 217 239 * Start element … … 310 332 } 311 333 } 312 313 334 } 314 335 trunk/version.properties
r11 r47 1 version.number=0.9 1 version.number=0.9.1
