protected ContentProcessor initContentProcessor(SiteMeshWebAppContext webAppContext) { // TODO: Remove heavy coupling on horrible SM2 Factory Factory factory = Factory.getInstance(new Config(filterConfig)); factory.refresh(); return new PageParser2ContentProcessor(factory); }
/** * Entry-point for obtaining singleton instance of Factory. The default factory class * that will be instantiated can be overridden with the environment * entry <code>sitemesh.factory</code>. */ public static Factory getInstance(Config config) { Factory instance = (Factory)config.getServletContext().getAttribute(SITEMESH_FACTORY); if (instance == null) { String factoryClass = getEnvEntry("sitemesh.factory", "com.opensymphony.module.sitemesh.factory.DefaultFactory"); try { Class cls = ClassLoaderUtil.loadClass(factoryClass, config.getClass()); Constructor con = cls.getConstructor(new Class[] { Config.class }); instance = (Factory)con.newInstance(new Config[] { config }); config.getServletContext().setAttribute(SITEMESH_FACTORY, instance); } catch (InvocationTargetException e) { throw new FactoryException("Cannot construct Factory : " + factoryClass, e.getTargetException()); } catch (Exception e) { throw new FactoryException("Cannot construct Factory : " + factoryClass, e); } } instance.refresh(); return instance; }
protected DecoratorSelector initDecoratorSelector(SiteMeshWebAppContext webAppContext) { Factory factory = Factory.getInstance(new Config(filterConfig)); factory.refresh(); return new FreemarkerMapper2DecoratorSelector(factory.getDecoratorMapper()); } }
protected DecoratorSelector initDecoratorSelector(SiteMeshWebAppContext webAppContext) { // TODO: Remove heavy coupling on horrible SM2 Factory Factory factory = Factory.getInstance(new Config(filterConfig)); factory.refresh(); return new DecoratorMapper2DecoratorSelector(factory.getDecoratorMapper()); }
protected DecoratorSelector initDecoratorSelector(SiteMeshWebAppContext webAppContext) { // TODO: Remove heavy coupling on horrible SM2 Factory Factory factory = Factory.getInstance(new Config(filterConfig)); factory.refresh(); return new FreemarkerMapper2DecoratorSelector(factory.getDecoratorMapper()); }