import freemarker.template.*;\r
import mir.util.*;\r
import mir.generator.*;\r
+import mir.config.MirPropertiesConfiguration;\r
+import mir.config.MirPropertiesConfiguration.PropertiesConfigExc;\r
import mir.entity.Entity;\r
import mir.entity.EntityList;\r
-import mir.storage.StorageObjectException;\r
+import mir.storage.StorageObjectFailure;\r
import org.apache.struts.util.MessageResources;\r
\r
import javax.servlet.http.HttpServletResponse;\r
public final class HTMLTemplateProcessor {\r
\r
public static String templateDir;\r
+ private static MirPropertiesConfiguration configuration;\r
private static FileTemplateCache templateCache;\r
private static Logfile theLog;\r
private static String docRoot;\r
private static String actionRoot;\r
\r
static {\r
- templateDir = MirConfig.getPropWithHome("HTMLTemplateProcessor.Dir");\r
+ try {\r
+ configuration = MirPropertiesConfiguration.instance();\r
+ } catch (PropertiesConfigExc e) {\r
+ e.printStackTrace();\r
+ }\r
+ theLog = Logfile.getInstance(\r
+ configuration.getStringWithHome("HTMLTemplateProcessor.Logfile"));\r
+ templateDir = \r
+ configuration.getStringWithHome("HTMLTemplateProcessor.Dir");\r
+ theLog.printDebugInfo("templateDir: " + templateDir);\r
templateCache = new FileTemplateCache(templateDir);\r
- templateCache.setLoadingPolicy(templateCache.LOAD_ON_DEMAND);\r
+ templateCache.setLoadingPolicy(FileTemplateCache.LOAD_ON_DEMAND);\r
// gone in freemarker 1.7.1: templateCache.startAutoUpdate();\r
- theLog = Logfile.getInstance(MirConfig.getPropWithHome(\r
- "HTMLTemplateProcessor.Logfile"));\r
\r
- docRoot = MirConfig.getProp("RootUri");\r
+\r
+ docRoot = configuration.getString("RootUri");\r
try {\r
- actionRoot = docRoot + MirConfig.getProp("Producer.ActionServlet");\r
+ actionRoot = docRoot +configuration.getString("Producer.ActionServlet");\r
}\r
catch (ConfigException ce) {\r
// if Producer.ActionServlet is not set in the conf file\r
}\r
\r
/**\r
- * Wandelt Entitylist in freemarker-Struktur um, fΓΌgt <code>additionalModel</code>\r
+ * Wandelt Entitylist in freemarker-Struktur um, f?gt <code>additionalModel</code>\r
* unter dem Namen <code>additionalModelName</code> ein und mischt die Daten mit\r
* Template <code>templateFilename</code> und gibt das Ergebnis an den PrintWriter\r
* <code>out</code>\r
\r
process(res, templateFilename, modelRoot, out, locale);\r
}\r
- catch (StorageObjectException e) {\r
+ catch (StorageObjectFailure e) {\r
throw new HTMLParseException(e.toString());\r
}\r
}\r
SimpleHash configHash = new SimpleHash();\r
\r
// pass the whole config hash to the templates\r
- Enumeration en = MirConfig.getResourceKeys();\r
+ Iterator it = configuration.getKeys();\r
String key;\r
- while (en.hasMoreElements()) {\r
- key = (String) en.nextElement();\r
- configHash.put(key, new SimpleScalar(MirConfig.getProp(key)));\r
+ while (it.hasNext()) {\r
+ key = (String) it.next();\r
+ configHash.put(key, new SimpleScalar(\r
+ configuration.getString(key))\r
+ );\r
}\r
\r
// this does not come directly from the config file\r
* @deprecated EntityLists comply with TemplateListModel now.\r
*/\r
public static SimpleList makeSimpleList(EntityList aList) throws\r
- StorageObjectException {\r
+ StorageObjectFailure {\r
theLog.printWarning(\r
"## using deprecated makeSimpleList(entityList) - a waste of resources");\r
SimpleList simpleList = new SimpleList();\r
*\r
*/\r
public static SimpleHash makeSimpleHash(EntityList aList) throws\r
- StorageObjectException {\r
+ StorageObjectFailure {\r
SimpleHash simpleHash = new SimpleHash();\r
Entity currentEntity;\r
\r
*/\r
\r
public static SimpleHash makeSimpleHashWithEntitylistInfos(EntityList entList) throws\r
- StorageObjectException {\r
+ StorageObjectFailure {\r
SimpleHash modelRoot = new SimpleHash();\r
if (entList != null) {\r
modelRoot.put("contentlist", entList);\r