1 14 15 package org.quickserver.util.xmlreader; 16 17 import org.apache.commons.digester.*; 18 import java.io.*; 19 import org.quickserver.util.*; 20 import java.util.logging.*; 21 22 23 29 public class PluginConfigReader { 30 private static Logger logger = Logger.getLogger(PluginConfigReader.class.getName()); 31 32 public static QSAdminPluginConfig read(String fileName) throws Exception { 33 File input = new File(fileName); 34 return read(input); 35 } 36 37 40 public static QSAdminPluginConfig read(File input) throws Exception { 41 Digester digester = new Digester(); 42 digester.setValidating(false); 43 44 String mainTag = "qsadmin-plugin"; 45 46 digester.addObjectCreate(mainTag, QSAdminPluginConfig.class); 47 digester.addBeanPropertySetter(mainTag+"/name", "name"); 48 digester.addBeanPropertySetter(mainTag+"/desc", "desc"); 49 digester.addBeanPropertySetter(mainTag+"/type", "type"); 50 digester.addBeanPropertySetter(mainTag+"/main-class", "mainClass"); 51 digester.addBeanPropertySetter(mainTag+"/active", "active"); 52 53 54 logger.fine("Loading Plugin config from xml file : " + input.getAbsolutePath()); 55 QSAdminPluginConfig psc = (QSAdminPluginConfig) digester.parse(input); 56 return psc; 57 } 58 } 59 | Popular Tags |