1 package mircoders.localizer.basic;
5 import freemarker.template.utility.*;
8 import mircoders.module.*;
9 import mircoders.storage.*;
10 import mircoders.localizer.*;
11 import mircoders.global.*;
13 public class MirBasicProducerToolLocalizer implements MirProducerToolLocalizer {
15 public void initializeGenerationValueSet(Map aValueSet) {
16 // ML: these config settings will be included more beautifully as soon as the new config system is in place
18 Map configMap = new HashMap();
20 configMap.put("producerDocRoot", MirGlobal.getConfigProperty("Producer.DocRoot"));
21 configMap.put("storageRoot", MirGlobal.getConfigProperty("Producer.StorageRoot"));
22 configMap.put("productionHost", MirGlobal.getConfigProperty("Producer.ProductionHost"));
23 configMap.put("openAction", MirGlobal.getConfigProperty("Producer.OpenAction"));
24 configMap.put("docRoot", MirGlobal.getConfigProperty("RootUri"));
25 configMap.put("now", StringUtil.date2readableDateTime(new GregorianCalendar()));
26 configMap.put("videoHost", MirGlobal.getConfigProperty("Producer.Video.Host"));
27 configMap.put("audioHost", MirGlobal.getConfigProperty("Producer.Audio.Host"));
28 configMap.put("imageHost", MirGlobal.getConfigProperty("Producer.Image.Host"));
29 configMap.put("imagePath", MirGlobal.getConfigProperty("Producer.Image.Path"));
30 configMap.put("mirVersion", MirGlobal.getConfigProperty("Mir.Version"));
31 configMap.put("compressWhitespace", new freemarker.template.utility.CompressWhitespace() );
32 configMap.put("defEncoding", MirGlobal.getConfigProperty("Mir.DefaultEncoding"));
34 aValueSet.put("config", configMap);
36 EntityList topicList=null;
37 EntityList entityList=null;
38 EntityList parentList=null;
41 ModuleLinksImcs linksImcsModule = new ModuleLinksImcs(DatabaseLinksImcs.getInstance());
42 ModuleTopics topicsModule = new ModuleTopics(DatabaseTopics.getInstance());
44 topicList = topicsModule.getTopicsList();
45 entityList = linksImcsModule.getByWhereClause("", "sortpriority, title", -1);
46 parentList = linksImcsModule.getByWhereClause("to_parent_id=NULL", "sortpriority, title", -1);
50 System.out.println("initializeGenerationValueSet: Exception "+t.getMessage());
51 t.printStackTrace(System.out);
54 aValueSet.put("topics", topicList);
55 aValueSet.put("imclist", entityList);
56 aValueSet.put("parentlist", parentList);
59 public PrintWriter openWriter(String anIdentifier) throws MirLocalizerFailure {
64 file = new File( anIdentifier );
65 dir = new File(file.getParent());
66 if (dir!=null && !dir.exists()){
70 return new PrintWriter(
71 new OutputStreamWriter(
72 new FileOutputStream(file), MirGlobal.getConfigProperty("Mir.DefaultEncoding")
77 throw new MirLocalizerFailure("Failure while opening a PrintWriter",t);
81 public void closeWriter(PrintWriter aWriter) {