From: rk Date: Mon, 24 Sep 2001 23:05:04 +0000 (+0000) Subject: slight changes / translations X-Git-Tag: prexmlproducerconfig~438 X-Git-Url: http://erislabs.org.uk/gitweb/?a=commitdiff_plain;h=8b3a5af41547dd14645ef3af570f705d6972b63f;p=mir.git slight changes / translations --- diff --git a/source/mir/misc/HTMLTemplateProcessor.java b/source/mir/misc/HTMLTemplateProcessor.java index 06597da4..1b45367a 100755 --- a/source/mir/misc/HTMLTemplateProcessor.java +++ b/source/mir/misc/HTMLTemplateProcessor.java @@ -20,53 +20,53 @@ import javax.servlet.http.*; */ public final class HTMLTemplateProcessor { - public static String templateDir; - private static FileTemplateCache templateCache; - private static Logfile theLog; - private static String docRoot; - private static String actionRoot; - private static String productionHost; - private static String audioHost; - private static String videoHost; - private static String imageHost; - private static String openAction; - protected static String producerDocRoot = MirConfig.getProp("Producer.DocRoot"); - protected static String producerStorageRoot = MirConfig.getProp("Producer.StorageRoot"); - - - // - // Initialisierung - - static { - templateDir = MirConfig.getProp("Home") + MirConfig.getProp("HTMLTemplateProcessor.Dir"); - templateCache = new FileTemplateCache(templateDir); - templateCache.setLoadingPolicy(templateCache.LOAD_ON_DEMAND); - templateCache.startAutoUpdate(); - theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("HTMLTemplateProcessor.Logfile")); - docRoot = MirConfig.getProp("RootUri"); - //quickhack: action-root is only for Mir!!!!, idfx - //actionRoot = docRoot + "/servlet/" + MirConfig.getProp("ServletName"); - actionRoot = docRoot + "/servlet/Mir"; - openAction = MirConfig.getProp("Producer.OpenAction"); - productionHost = MirConfig.getProp("Producer.ProductionHost"); - videoHost = MirConfig.getProp("Producer.VideoHost"); - audioHost = MirConfig.getProp("Producer.AudioHost"); - imageHost = MirConfig.getProp("Producer.Image.Host"); - producerDocRoot = MirConfig.getProp("Producer.DocRoot"); - producerStorageRoot = MirConfig.getProp("Producer.StorageRoot"); + public static String templateDir; + private static FileTemplateCache templateCache; + private static Logfile theLog; + private static String docRoot; + private static String actionRoot; + private static String productionHost; + private static String audioHost; + private static String videoHost; + private static String imageHost; + private static String openAction; + protected static String producerDocRoot = MirConfig.getProp("Producer.DocRoot"); + protected static String producerStorageRoot = MirConfig.getProp("Producer.StorageRoot"); + + + // + // init + + static { + + templateDir = MirConfig.getPropWithHome("HTMLTemplateProcessor.Dir"); + templateCache = new FileTemplateCache(templateDir); + templateCache.setLoadingPolicy(templateCache.LOAD_ON_DEMAND); + templateCache.startAutoUpdate(); + theLog = Logfile.getInstance(MirConfig.getPropWithHome("HTMLTemplateProcessor.Logfile")); + docRoot = MirConfig.getProp("RootUri"); + /** @todo + quickhack: action-root is only for Mir!!!!, idfx + actionRoot = docRoot + "/servlet/" + MirConfig.getProp("ServletName");*/ + actionRoot = docRoot + "/servlet/Mir"; + openAction = MirConfig.getProp("Producer.OpenAction"); + productionHost = MirConfig.getProp("Producer.ProductionHost"); + videoHost = MirConfig.getProp("Producer.VideoHost"); + audioHost = MirConfig.getProp("Producer.AudioHost"); + imageHost = MirConfig.getProp("Producer.Image.Host"); + producerDocRoot = MirConfig.getProp("Producer.DocRoot"); + producerStorageRoot = MirConfig.getProp("Producer.StorageRoot"); - - } + } /** - * Privater Konstruktor, um versehentliche Instantiierung zu verhindern + * empty private constructor, to avoid instantiation */ - private HTMLTemplateProcessor () { - } + private HTMLTemplateProcessor () { } - // - // process-Methoden zum Mischen verschiedener Datenstrukturen mit HTML-Templates + // process-methods to merge different datastructures + // with freemarker templates /** @@ -82,12 +82,12 @@ public final class HTMLTemplateProcessor { public static void process(String templateFilename, Entity anEntity, PrintWriter out) throws HTMLParseException { - if (anEntity == null) throw new HTMLParseException("Entity leer!"); + if (anEntity == null) throw new HTMLParseException("entity is empty!"); else process(templateFilename, anEntity, out); } - /** + /** * Wandelt Liste mit Entities entList in freemarker-Struktur um, mischt die Daten mit * Template templateFilename und gibt das Ergebnis an den PrintWriter * out @@ -97,10 +97,10 @@ public final class HTMLTemplateProcessor { * @param out * @exception HTMLParseException */ - public static void process(HttpServletResponse res,String templateFilename, EntityList entList, PrintWriter out) + public static void process(HttpServletResponse res,String templateFilename, EntityList entList, PrintWriter out) throws HTMLParseException { - process(res, templateFilename, entList, (String)null, (TemplateModelRoot)null, out); - } + process(res, templateFilename, entList, (String)null, (TemplateModelRoot)null, out); + } /** * Wandelt Entitylist in freemarker-Struktur um, fügt additionalModel @@ -122,13 +122,12 @@ public final class HTMLTemplateProcessor { SimpleHash modelRoot = new SimpleHash(); if (entList == null) { - //theLog.printInfo("Keine Daten! Suche erfolglos."); process(null,templateFilename, modelRoot, out); } else { try { modelRoot = makeSimpleHashWithEntitylistInfos(entList); - // - // Hilfskruecke um mal ein Popup mit reinzunhemen .. + + // Quickhack um mal ein Popup mit reinzunhemen .. if (additionalModelName != null && additionalModel != null) modelRoot.put(additionalModelName, additionalModel); @@ -185,7 +184,7 @@ public final class HTMLTemplateProcessor { Template tmpl = getTemplateFor(templateFilename); if (tmpl == null) throw new HTMLParseException("KEIN TEMPLATE: " + templateFilename); if (tmr==null) tmr = new SimpleHash(); - + String session=null; if (res!=null) { session=res.encodeURL(""); @@ -325,23 +324,23 @@ public final class HTMLTemplateProcessor { } /** - * Private Methode, um für templateFilename das Template zu bekommen. + * Private methods to get template from a templateFilename * @param templateFilename * @return Template * @exception HTMLParseException */ private static Template getTemplateFor(String templateFilename) throws HTMLParseException - { - if (templateFilename!=null) return templateCache.getTemplate(templateFilename); - else { - theLog.printError("CACHE (ERR): Unknown template: " + templateFilename); - throw new HTMLParseException("Templatedatei: "+ templateFilename + " nicht gefunden!"); - } + { + if (templateFilename!=null) return templateCache.getTemplate(templateFilename); + else { + theLog.printError("CACHE (ERR): Unknown template: " + templateFilename); + throw new HTMLParseException("Templatefile: "+ templateFilename + " not found."); } + } + public static void stopAutoUpdate(){ + templateCache.stopAutoUpdate(); + templateCache=null; + } - public static void stopAutoUpdate(){ - templateCache.stopAutoUpdate(); - templateCache=null; - } } diff --git a/source/mir/misc/MirConfig.java b/source/mir/misc/MirConfig.java index 7a58c944..5f0f96bd 100755 --- a/source/mir/misc/MirConfig.java +++ b/source/mir/misc/MirConfig.java @@ -131,7 +131,7 @@ public class MirConfig extends Configuration { } /** - * Finalize Methode + * Finalize method */ public void finalize(){ instances --;