1 18 19 20 package org.apache.struts.util; 21 22 23 import java.io.Serializable ; 24 import org.apache.commons.logging.Log; 25 import org.apache.commons.logging.LogFactory; 26 27 28 44 45 public abstract class MessageResourcesFactory implements Serializable { 46 47 48 50 51 55 protected boolean returnNull = true; 56 57 63 public boolean getReturnNull() { 64 return (this.returnNull); 65 } 66 67 72 public void setReturnNull(boolean returnNull) { 73 this.returnNull = returnNull; 74 } 75 76 77 79 80 86 public abstract MessageResources createResources(String config); 87 88 89 91 92 96 protected static transient Class clazz = null; 97 98 99 102 private static Log LOG = LogFactory.getLog(MessageResourcesFactory.class); 103 104 105 109 protected static String factoryClass = 110 "org.apache.struts.util.PropertyMessageResourcesFactory"; 111 112 118 public static String getFactoryClass() { 119 return (MessageResourcesFactory.factoryClass); 120 } 121 122 128 public static void setFactoryClass(String factoryClass) { 129 MessageResourcesFactory.factoryClass = factoryClass; 130 MessageResourcesFactory.clazz = null; 131 } 132 133 134 136 137 143 public static MessageResourcesFactory createFactory() { 144 145 try { 147 if (clazz == null) 148 clazz = RequestUtils.applicationClass(factoryClass); 149 MessageResourcesFactory factory = 150 (MessageResourcesFactory) clazz.newInstance(); 151 return (factory); 152 } catch (Throwable t) { 153 LOG.error("MessageResourcesFactory.createFactory", t); 154 return (null); 155 } 156 157 } 158 159 160 } 161 | Popular Tags |