1 18 19 package org.apache.struts.config; 20 21 import org.apache.struts.util.RequestUtils; 22 import org.apache.commons.logging.Log; 23 import org.apache.commons.logging.LogFactory; 24 25 32 public abstract class ModuleConfigFactory { 33 34 40 public abstract ModuleConfig createModuleConfig(String prefix); 41 42 43 50 public static String getFactoryClass() { 51 return (ModuleConfigFactory.factoryClass); 52 } 53 54 60 public static void setFactoryClass(String factoryClass) { 61 ModuleConfigFactory.factoryClass = factoryClass; 62 ModuleConfigFactory.clazz = null; 63 } 64 65 67 68 74 public static ModuleConfigFactory createFactory() { 75 76 ModuleConfigFactory factory = null; 77 78 try { 79 if (clazz == null) { 80 clazz = RequestUtils.applicationClass(factoryClass); 81 } 82 83 factory = (ModuleConfigFactory) clazz.newInstance(); 84 85 } catch (ClassNotFoundException e) { 86 LOG.error("ModuleConfigFactory.createFactory()", e); 87 } catch (InstantiationException e) { 88 LOG.error("ModuleConfigFactory.createFactory()", e); 89 } catch (IllegalAccessException e) { 90 LOG.error("ModuleConfigFactory.createFactory()", e); 91 } 92 93 return factory; 94 95 } 96 97 98 102 protected static Class clazz = null; 103 104 107 private static final Log LOG = LogFactory.getLog(ModuleConfigFactory.class); 108 109 110 114 protected static String factoryClass = 115 "org.apache.struts.config.impl.DefaultModuleConfigFactory"; 116 117 118 } 119 | Popular Tags |