1 package com.opensymphony.webwork.dispatcher.mapper; 2 3 import com.opensymphony.webwork.config.Configuration; 4 import com.opensymphony.xwork.ObjectFactory; 5 import org.apache.commons.logging.Log; 6 import org.apache.commons.logging.LogFactory; 7 8 import java.util.HashMap ; 9 10 15 public class ActionMapperFactory { 16 protected static final Log LOG = LogFactory.getLog(ActionMapperFactory.class); 17 18 private static final HashMap classMap = new HashMap (); 19 20 public static ActionMapper getMapper() { 21 synchronized (classMap) { 22 String clazz = (String ) Configuration.get("webwork.mapper.class"); 23 try { 24 ActionMapper mapper = (ActionMapper) classMap.get(clazz); 25 if (mapper == null) { 26 mapper = (ActionMapper) ObjectFactory.getObjectFactory().buildBean(clazz); 27 classMap.put(clazz, mapper); 28 } 29 30 return mapper; 31 } catch (Exception e) { 32 String msg = "Could not creat ActionMapper: WebWork will *not* work!"; 33 LOG.fatal(msg, e); 34 throw new RuntimeException (msg, e); 35 } 36 } 37 } 38 } 39 | Popular Tags |