/** * To allow for custom configuration of freemarker, sublcass this class "ConfigManager" and * set the webwork configuration property * <b>webwork.freemarker.configmanager.classname</b> to the fully qualified classname. * <p/> * This allows you to override the protected methods in the ConfigMangaer * to programatically create your own Configuration instance */ public final static synchronized FreemarkerManager getInstance() { if (instance == null) { String classname = FreemarkerManager.class.getName(); if (Configuration.isSet(WebWorkConstants.WEBWORK_FREEMARKER_MANAGER_CLASSNAME)) { classname = Configuration.getString(WebWorkConstants.WEBWORK_FREEMARKER_MANAGER_CLASSNAME).trim(); } try { log.info("Instantiating Freemarker ConfigManager!, " + classname); // singleton instances shouldn't be built accessing request or session-specific context data instance = (FreemarkerManager) ObjectFactory.getObjectFactory().buildBean(classname, null); } catch (Exception e) { log.fatal("Fatal exception occurred while trying to instantiate a Freemarker ConfigManager instance, " + classname, e); } } // if the instance creation failed, make sure there is a default instance if (instance == null) { instance = new FreemarkerManager(); } return instance; }