- open posting localizer now in use for updating startpage / content after an
authorzapata <zapata>
Sun, 28 Apr 2002 15:56:58 +0000 (15:56 +0000)
committerzapata <zapata>
Sun, 28 Apr 2002 15:56:58 +0000 (15:56 +0000)
open posting.
- some small fixes here and there...

12 files changed:
source/mir/misc/HTMLTemplateProcessor.java
source/mir/misc/MirConfig.java
source/mir/producer/Producer.java
source/mir/producer/ProducerFactory.java
source/mircoders/localizer/basic/FreemarkerGeneratorLocalizer.java
source/mircoders/localizer/basic/MirBasicOpenPostingLocalizer.java
source/mircoders/localizer/basic/MirBasicProducerLocalizer.java
source/mircoders/producer/CompositeProducer.java [new file with mode: 0755]
source/mircoders/producer/CompositeProducerFactory.java [new file with mode: 0755]
source/mircoders/producer/ContentProducer.java
source/mircoders/producer/ProducerMedia.java
source/mircoders/servlet/ServletModuleOpenIndy.java

index c2f10f2..b30f4b7 100755 (executable)
@@ -62,8 +62,8 @@ public final class HTMLTemplateProcessor {
 
     openAction = MirConfig.getProp("Producer.OpenAction");
     productionHost = MirConfig.getProp("Producer.ProductionHost");
-    videoHost = MirConfig.getProp("Producer.VideoHost");
-    audioHost = MirConfig.getProp("Producer.AudioHost");
+    videoHost = MirConfig.getProp("Producer.Video.Host");
+    audioHost = MirConfig.getProp("Producer.Audio.Host");
     imageHost = MirConfig.getProp("Producer.Image.Host");
     imagePath = MirConfig.getProp("Producer.Image.Path");
     producerDocRoot = MirConfig.getProp("Producer.DocRoot");
index a64f4cf..a3e9199 100755 (executable)
@@ -73,7 +73,14 @@ public class MirConfig extends Configuration {
    * @return a String containing the prop. value
    */
   public static String getProp(String propName) {
-    return (String)configHash.get(propName);
+    String result = (String)configHash.get(propName);
+
+    if (result==null)
+      throw new ConfigException("config property '"+propName+"' not available!");
+
+
+
+    return result;
   }
 
   /**
@@ -83,12 +90,11 @@ public class MirConfig extends Configuration {
    * @return a String containing the prop.value
    */
   public static String getPropWithHome(String propName) {
-    return (String)configHash.get("Home") +
-           (String)configHash.get(propName);
+    return getProp("Home") + getProp(propName);
   }
 
   /**
-   * Returns the property asked for iin raw Object form by 
+   * Returns the property asked for iin raw Object form by
    * pulling it out a HashMap
    * @param a String containing the property name (key)
    * @return an Object containing the prop.value
index 2f550de..be9415a 100755 (executable)
@@ -1,7 +1,6 @@
 package mir.producer;
 
 import java.io.*;
-import mir.servlet.*;
 
 public interface Producer {
   public void produce( PrintWriter aLogger ) throws ProducerException;
index 38691a3..401c25e 100755 (executable)
@@ -4,6 +4,6 @@ import java.util.*;
 
 public interface ProducerFactory {
   public Producer makeProducer(String aVerb) throws ProducerException;
-  public Iterator verbs() throws ProducerException;
+  public Iterator verbs();
 }
 
index 0af3d6a..fa5d389 100755 (executable)
@@ -21,8 +21,6 @@ public class FreemarkerGeneratorLocalizer  implements MirGeneratorLocalizer {
 
     prepareTemplate(template);
 
-    // ML: check for null!
-
     return new FreemarkerGenerator(template);
   };
 
index 87219dd..1e566d1 100755 (executable)
@@ -1,12 +1,20 @@
 package mircoders.localizer.basic;
 
 import mircoders.localizer.*;
+import mircoders.global.*;
 
 public class MirBasicOpenPostingLocalizer implements MirOpenPostingLocalizer {
 
   public void afterContentPosting() {
+    MirGlobal.producerEngine().addTask("content", "new");
+    MirGlobal.producerEngine().addTask("openposting", "new");
+    MirGlobal.producerEngine().addTask("startpage", "all");
+
+    MirGlobal.producerEngine().addTask("synchronization", "run");
   }
 
   public void afterCommentPosting() {
+    MirGlobal.producerEngine().addTask("content", "new");
+    MirGlobal.producerEngine().addTask("synchronization", "run");
   }
 }
index 7089b0e..00c1f0e 100755 (executable)
@@ -19,32 +19,59 @@ public class MirBasicProducerLocalizer implements MirProducerLocalizer {
     return producerFactories;
   };
 
-  protected void setupFactories(Map aFactoriesMap ) {
-
-    aFactoriesMap.put(
-      "content",
+  protected void setupContentFactory(CompositeProducerFactory aContentFactory) {
+    aContentFactory.addFactory(
       new ContentProducerFactory(
       MirGlobal.getConfigProperty("Producer.Content.Template"),
       "bundles.admin",
       MirGlobal.getConfigProperty("Producer.StorageRoot"),
       ".shtml",
       Integer.parseInt(MirGlobal.getConfigProperty("Producer.Content.Batchsize"))));
+  }
 
-    aFactoriesMap.put("oldstartpage", new OldProducerAdapterFactory(new ProducerStartPage()));
-    aFactoriesMap.put("images", new OldProducerAdapterFactory(new ProducerImages()));
-    aFactoriesMap.put("navigation", new OldProducerAdapterFactory(new ProducerNavigation()));
-    aFactoriesMap.put("openposting", new OldProducerAdapterFactory(new ProducerOpenPosting()));
-    aFactoriesMap.put("topics", new OldProducerAdapterFactory(new ProducerTopics()));
-
-    aFactoriesMap.put("startpage", new StartPageProducerFactory(
+  protected void setupStartPageFactory(CompositeProducerFactory aStartPageFactory) {
+    aStartPageFactory.addFactory(
+      new StartPageProducerFactory(
       MirGlobal.getConfigProperty("Producer.StartPage.Template"),
       "bundles.admin",
       MirGlobal.getConfigProperty("Producer.StorageRoot") + "/index.shtml",
       MirGlobal.getConfigIntegerProperty("Producer.StartPage.Items"),
       MirGlobal.getConfigIntegerProperty("Producer.StartPage.Newswire")));
+  }
 
+  protected void setupSynchronizationFactory(CompositeProducerFactory aSynchronizationFactory) {
     if(MirGlobal.getConfigBooleanProperty("Rsync")){
-      aFactoriesMap.put("sync", new ScriptCallProducerFactory(MirGlobal.getConfigProperty("Rsync.Script.Path")));
+      aSynchronizationFactory.addFactory(
+        new ScriptCallProducerFactory(MirGlobal.getConfigProperty("Rsync.Script.Path")));
     }
+    else {
+      NullProducerFactory nullFactory = new NullProducerFactory();
+      nullFactory.addVerb("run");
+      aSynchronizationFactory.addFactory(nullFactory);
+    }
+  }
+
+  protected void setupFactories(Map aFactoriesMap ) {
+
+    CompositeProducerFactory factory;
+
+    factory=new CompositeProducerFactory();
+    setupContentFactory(factory);
+    aFactoriesMap.put("content", factory);
+
+    factory=new CompositeProducerFactory();
+    setupStartPageFactory(factory);
+    aFactoriesMap.put("startpage", factory);
+
+    factory=new CompositeProducerFactory();
+    setupSynchronizationFactory(factory);
+    aFactoriesMap.put("synchronization", factory);
+
+    aFactoriesMap.put("oldstartpage", new OldProducerAdapterFactory(new ProducerStartPage()));
+    aFactoriesMap.put("images", new OldProducerAdapterFactory(new ProducerImages()));
+    aFactoriesMap.put("navigation", new OldProducerAdapterFactory(new ProducerNavigation()));
+    aFactoriesMap.put("openposting", new OldProducerAdapterFactory(new ProducerOpenPosting()));
+    aFactoriesMap.put("topics", new OldProducerAdapterFactory(new ProducerTopics()));
+
   };
 }
diff --git a/source/mircoders/producer/CompositeProducer.java b/source/mircoders/producer/CompositeProducer.java
new file mode 100755 (executable)
index 0000000..d444d16
--- /dev/null
@@ -0,0 +1,27 @@
+package mircoders.producer;
+
+import java.util.*;
+import java.io.*;
+import mir.producer.*;
+
+public class CompositeProducer implements mir.producer.Producer {
+
+  List producers;
+
+  public CompositeProducer() {
+    producers = new Vector();
+  }
+
+  public void addProducer(mir.producer.Producer aProducer) {
+    producers.add(aProducer);
+  }
+
+  public void produce( PrintWriter aLogger ) throws ProducerException {
+    Iterator i;
+
+    i=producers.iterator();
+
+    while (i.hasNext())
+      ((mir.producer.Producer) i.next()).produce(aLogger);
+  }
+}
diff --git a/source/mircoders/producer/CompositeProducerFactory.java b/source/mircoders/producer/CompositeProducerFactory.java
new file mode 100755 (executable)
index 0000000..2ef4a27
--- /dev/null
@@ -0,0 +1,53 @@
+package mircoders.producer;
+
+import java.util.*;
+import mir.entity.*;
+import mir.producer.*;
+import mircoders.storage.*;
+
+public class CompositeProducerFactory implements ProducerFactory {
+  Map factories;          // verb -> Vector ( ProducerFactory )
+
+  public CompositeProducerFactory() {
+    factories = new HashMap();
+  }
+
+  private List factoriesForVerb(String aVerb) {
+    List result;
+
+    result=(List) factories.get(aVerb);
+
+    if (result==null) {
+      result=new Vector();
+
+      factories.put(aVerb, result);
+    }
+
+    return result;
+  }
+
+  public void addFactory(ProducerFactory aFactory) {
+    Iterator i;
+
+    i=aFactory.verbs();
+
+    while (i.hasNext()) {
+      factoriesForVerb((String) i.next()).add(aFactory);
+    }
+  }
+
+  public mir.producer.Producer makeProducer(String aVerb) throws ProducerException {
+    CompositeProducer result = new CompositeProducer();
+
+    Iterator i=factoriesForVerb(aVerb).iterator();
+
+    while (i.hasNext())
+      result.addProducer(((ProducerFactory) i.next()).makeProducer(aVerb));
+
+    return result;
+  }
+
+  public Iterator verbs() {
+    return factories.keySet().iterator();
+  }
+}
index df65c32..428331b 100755 (executable)
-package mircoders.producer;\r
-\r
-import java.io.*;\r
-import java.util.*;\r
-\r
-import mir.misc.*;\r
-import mir.entity.*;\r
-import mir.producer.*;\r
-import mir.generator.*;\r
-\r
-import mircoders.localizer.*;\r
-import mircoders.global.*;\r
-import mircoders.entity.*;\r
-\r
-import org.apache.struts.util.MessageResources;\r
-\r
-// @todo ML: the file that gets generated should be better configurable\r
-\r
-public class ContentProducer implements mir.producer.Producer {\r
-\r
-  private String generatorIdentifier;\r
-  private String resourceBundle;\r
-\r
-  private String outputFilePrefix;\r
-  private String outputFilePostfix;\r
-\r
-  EntityBrowser browser;\r
-\r
-  public ContentProducer(\r
-    EntityBrowser aBrowser,\r
-    String aGeneratorIdentifier,\r
-    String aResourceBundle,\r
-    String anOutputFilePrefix,\r
-    String anOutputFilePostfix) {\r
-\r
-    browser = aBrowser;\r
-    generatorIdentifier=aGeneratorIdentifier;\r
-    resourceBundle=aResourceBundle;\r
-    outputFilePrefix=anOutputFilePrefix;\r
-    outputFilePostfix=anOutputFilePostfix;\r
-  }\r
-\r
-  public void produce( PrintWriter aLogger ) throws ProducerException {\r
-    EntityContent content;\r
-\r
-    Map configMap = new HashMap();\r
-    Map generationValues = new HashMap();\r
-    Map dataMap = new HashMap();\r
-    String fileName;\r
-\r
-\r
-\r
-               configMap.put("producerDocRoot", MirGlobal.getConfigProperty("Producer.DocRoot"));\r
-               configMap.put("storageRoot", MirGlobal.getConfigProperty("Producer.StorageRoot"));\r
-    configMap.put("productionHost", MirGlobal.getConfigProperty("Producer.ProductionHost"));\r
-               configMap.put("openAction", MirGlobal.getConfigProperty("Producer.OpenAction"));\r
-               configMap.put("docRoot", MirGlobal.getConfigProperty("RootUri"));\r
-               configMap.put("now", StringUtil.date2readableDateTime(new GregorianCalendar()));\r
-               configMap.put("videoHost", MirGlobal.getConfigProperty("Producer.Video.Host"));\r
-               configMap.put("audioHost", MirGlobal.getConfigProperty("Producer.Audio.Host"));\r
-               configMap.put("imageHost", MirGlobal.getConfigProperty("Producer.Image.Host"));\r
-               configMap.put("imagePath", MirGlobal.getConfigProperty("Producer.Image.Path"));\r
-               configMap.put("mirVersion", MirGlobal.getConfigProperty("Mir.Version"));\r
-               configMap.put("compressWhitespace", new freemarker.template.utility.CompressWhitespace() );\r
-    generationValues.put("config", configMap);\r
-\r
-               MessageResources messages = MessageResources.getMessageResources(resourceBundle);\r
-               generationValues.put("lang", new MessageMethodModel(null, messages) );\r
-               generationValues.put("data", dataMap);\r
-\r
-\r
-\r
-    try {\r
-      Generator generator = MirGlobal.localizer().generators().makeGenerator(generatorIdentifier);\r
-\r
-      aLogger.println("ContentProducer.produce:<br>");\r
-      aLogger.println("generatorIdentifier = " + generatorIdentifier + "<br>");\r
-\r
-      while (browser.hasNext()) {\r
-        content = (EntityContent) browser.next();\r
-        dataMap.put("content", content);\r
-\r
-        String date = content.getValue("date");\r
-\r
-        fileName = outputFilePrefix + "/" +\r
-                date.substring(0,4) + "/" + date.substring(4,6) + "/" +\r
-                content.getValue("id") + outputFilePostfix;\r
-\r
-        aLogger.println("fileName = " + fileName + "<br>");\r
-\r
-        try {\r
-          File file = new File(fileName);\r
-\r
-          File dir = new File(file.getParent());\r
-          if (!dir.exists()){\r
-            dir.mkdirs();\r
-          }\r
-\r
-          FileWriter fileWriter = new FileWriter(file);\r
-          PrintWriter printWriter = new PrintWriter(fileWriter);\r
-\r
-          aLogger.println("generating: " + fileName + "<br/>");\r
-\r
-          generator.generate(printWriter, generationValues, aLogger);\r
-          printWriter.close();\r
-          fileWriter.close();\r
-          content.setProduced(true);\r
-\r
-          aLogger.println("done generating: " + fileName + "<br/>");\r
-        }\r
-        catch (Exception e) {\r
-          aLogger.println("exception while generating " + fileName + ":<br/>");\r
-          aLogger.println(e.getMessage() + "<br/>");\r
-          e.printStackTrace(aLogger);\r
-          aLogger.flush();\r
-        }\r
-      }\r
-    }\r
-    catch (Exception e) {\r
-      aLogger.println("exception while generating:<br/>");\r
-      aLogger.println(e.getMessage() + "<br/>");\r
-      e.printStackTrace(aLogger);\r
-      aLogger.flush();\r
-    }\r
-\r
-    aLogger.println("ContentProducer.produce: done<br>");\r
-\r
-  }\r
-\r
-}\r
+package mircoders.producer;
+
+import java.io.*;
+import java.util.*;
+
+import mir.misc.*;
+import mir.entity.*;
+import mir.producer.*;
+import mir.generator.*;
+
+import mircoders.localizer.*;
+import mircoders.global.*;
+import mircoders.entity.*;
+
+import org.apache.struts.util.MessageResources;
+
+// @todo ML: the file that gets generated should be better configurable
+
+public class ContentProducer implements mir.producer.Producer {
+
+  private String generatorIdentifier;
+  private String resourceBundle;
+
+  private String outputFilePrefix;
+  private String outputFilePostfix;
+
+  EntityBrowser browser;
+
+  public ContentProducer(
+    EntityBrowser aBrowser,
+    String aGeneratorIdentifier,
+    String aResourceBundle,
+    String anOutputFilePrefix,
+    String anOutputFilePostfix) {
+
+    browser = aBrowser;
+    generatorIdentifier=aGeneratorIdentifier;
+    resourceBundle=aResourceBundle;
+    outputFilePrefix=anOutputFilePrefix;
+    outputFilePostfix=anOutputFilePostfix;
+  }
+
+  public void produce( PrintWriter aLogger ) throws ProducerException {
+    EntityContent content;
+
+    Map configMap = new HashMap();
+    Map generationValues = new HashMap();
+    Map dataMap = new HashMap();
+    String fileName;
+
+
+
+               configMap.put("producerDocRoot", MirGlobal.getConfigProperty("Producer.DocRoot"));
+               configMap.put("storageRoot", MirGlobal.getConfigProperty("Producer.StorageRoot"));
+    configMap.put("productionHost", MirGlobal.getConfigProperty("Producer.ProductionHost"));
+               configMap.put("openAction", MirGlobal.getConfigProperty("Producer.OpenAction"));
+               configMap.put("docRoot", MirGlobal.getConfigProperty("RootUri"));
+               configMap.put("now", StringUtil.date2readableDateTime(new GregorianCalendar()));
+               configMap.put("videoHost", MirGlobal.getConfigProperty("Producer.Video.Host"));
+               configMap.put("audioHost", MirGlobal.getConfigProperty("Producer.Audio.Host"));
+               configMap.put("imageHost", MirGlobal.getConfigProperty("Producer.Image.Host"));
+               configMap.put("imagePath", MirGlobal.getConfigProperty("Producer.Image.Path"));
+               configMap.put("mirVersion", MirGlobal.getConfigProperty("Mir.Version"));
+               configMap.put("compressWhitespace", new freemarker.template.utility.CompressWhitespace() );
+    generationValues.put("config", configMap);
+
+               MessageResources messages = MessageResources.getMessageResources(resourceBundle);
+               generationValues.put("lang", new MessageMethodModel(null, messages) );
+               generationValues.put("data", dataMap);
+
+
+
+    try {
+      Generator generator = MirGlobal.localizer().generators().makeGenerator(generatorIdentifier);
+
+      aLogger.println("ContentProducer.produce:<br>");
+      aLogger.println("generatorIdentifier = " + generatorIdentifier + "<br>");
+
+      while (browser.hasNext()) {
+        content = (EntityContent) browser.next();
+        dataMap.put("content", content);
+
+        String date = content.getValue("date");
+
+        fileName = outputFilePrefix + "/" +
+                date.substring(0,4) + "/" + date.substring(4,6) + "/" +
+                content.getValue("id") + outputFilePostfix;
+
+        aLogger.println("fileName = " + fileName + "<br>");
+
+        try {
+          File file = new File(fileName);
+
+          File dir = new File(file.getParent());
+          if (!dir.exists()){
+            dir.mkdirs();
+          }
+
+          FileWriter fileWriter = new FileWriter(file);
+          PrintWriter printWriter = new PrintWriter(fileWriter);
+
+          aLogger.println("generating: " + fileName + "<br/>");
+
+          generator.generate(printWriter, generationValues, aLogger);
+          printWriter.close();
+          fileWriter.close();
+          content.setProduced(true);
+
+          aLogger.println("done generating: " + fileName + "<br/>");
+        }
+        catch (Exception e) {
+          aLogger.println("exception while generating " + fileName + ":<br/>");
+          aLogger.println(e.getMessage() + "<br/>");
+          e.printStackTrace(aLogger);
+          aLogger.flush();
+        }
+      }
+    }
+    catch (Exception e) {
+      aLogger.println("exception while generating:<br/>");
+      aLogger.println(e.getMessage() + "<br/>");
+      e.printStackTrace(aLogger);
+      aLogger.flush();
+    }
+
+    aLogger.println("ContentProducer.produce: done<br>");
+
+  }
+
+}
index a44dc43..efb0f76 100755 (executable)
@@ -76,6 +76,7 @@ abstract public class ProducerMedia extends Producer {
                             e.toString());
           logHTML(htmlout, "problem with media id: "+currentMedia.getId()+
                   " <font color=\"Red\"> failed!</font>: "+e.toString());
+          e.printStackTrace(htmlout);
         }
       }
 
index 4148b35..3cd43f6 100755 (executable)
@@ -24,6 +24,8 @@ import mircoders.entity.*;
 import mircoders.storage.*;
 import mircoders.module.*;
 import mircoders.producer.*;
+import mircoders.global.*;
+import mircoders.localizer.*;
 
 /*
  *  ServletModuleOpenIndy -
@@ -66,7 +68,7 @@ public class ServletModuleOpenIndy extends ServletModule
       themenModule = new ModuleTopics(DatabaseTopics.getInstance());
       imageModule = new ModuleImages(DatabaseImages.getInstance());
       defaultAction="addposting";
-                       
+
     }
     catch (StorageObjectException e) {
         theLog.printError("servletmoduleopenindy could not be initialized");
@@ -93,7 +95,7 @@ public class ServletModuleOpenIndy extends ServletModule
                                session.setAttribute("passwd",passwd);
                                mergeData.put("passwd", passwd);
                        }
-                       
+
       mergeData.put("aid", aid);
       deliver(req, res, mergeData, commentFormTemplate);
     }
@@ -114,16 +116,16 @@ public class ServletModuleOpenIndy extends ServletModule
       // ok, collecting data from form
       try {
         HashMap withValues = getIntersectingValues(req, DatabaseComment.getInstance());
-       
+
         //no html in comments(for now)
         for (Iterator i=withValues.keySet().iterator(); i.hasNext(); ){
             String k=(String)i.next();
             String v=(String)withValues.get(k);
-            
+
             withValues.put(k,StringUtil.removeHTMLTags(v));
         }
         withValues.put("is_published","1");
-                               
+
                                //checking the onetimepasswd
                                if(passwdProtection.equals("yes")){
                                        HttpSession session = req.getSession(false);
@@ -137,7 +139,7 @@ public class ServletModuleOpenIndy extends ServletModule
                                        }
                                        session.invalidate();
                                }
-                               
+
         // inserting into database
         String id = mainModule.add(withValues);
         theLog.printDebugInfo("id: "+id);
@@ -145,13 +147,8 @@ public class ServletModuleOpenIndy extends ServletModule
         if(id==null){
           deliver(req, res, new SimpleHash(), commentFormDupeTemplate);
         }
-        
-        // producing new page
-        new ProducerContent().handle(null, null, true, false, aid);
 
-        // sync the server
-        int exitValue = Helper.rsync();
-        theLog.printDebugInfo("rsync:"+exitValue);
+        MirGlobal.localizer().openPostings().afterCommentPosting();
 
         // redirecting to url
         // should implement back to article
@@ -173,7 +170,7 @@ public class ServletModuleOpenIndy extends ServletModule
   public void addposting(HttpServletRequest req, HttpServletResponse res)
     throws ServletModuleException {
     SimpleHash mergeData = new SimpleHash();
-               
+
                // onetimepasswd
                if(passwdProtection.equals("yes")){
                        String passwd = this.createOneTimePasswd();
@@ -182,7 +179,7 @@ public class ServletModuleOpenIndy extends ServletModule
                        session.setAttribute("passwd",passwd);
                        mergeData.put("passwd", passwd);
                }
-                       
+
     String maxMedia = MirConfig.getProp("ServletModule.OpenIndy.MaxMediaUploadItems");
     String numOfMedia = req.getParameter("medianum");
     if(numOfMedia==null||numOfMedia.equals("")){
@@ -190,7 +187,7 @@ public class ServletModuleOpenIndy extends ServletModule
     } else if(Integer.parseInt(numOfMedia) > Integer.parseInt(maxMedia)) {
       numOfMedia = maxMedia;
     }
-    
+
     int mediaNum = Integer.parseInt(numOfMedia);
     SimpleList mediaFields = new SimpleList();
     for(int i =0; i<mediaNum;i++){
@@ -199,8 +196,8 @@ public class ServletModuleOpenIndy extends ServletModule
     }
     mergeData.put("medianum",numOfMedia);
     mergeData.put("mediafields",mediaFields);
-    
-    
+
+
     SimpleHash extraInfo = new SimpleHash();
     try{
       SimpleList popUpData = DatabaseLanguage.getInstance().getPopupData();
@@ -211,7 +208,7 @@ public class ServletModuleOpenIndy extends ServletModule
                         +e.toString());
       throw new ServletModuleException("OpenIndy -- failed getting language or topics: "+e.toString());
     }
-      
+
     deliver(req, res, mergeData, extraInfo, postingFormTemplate);
   }
 
@@ -229,9 +226,9 @@ public class ServletModuleOpenIndy extends ServletModule
 
     try {
       WebdbMultipartRequest mp = new WebdbMultipartRequest(req);
-          
+
       HashMap withValues = mp.getParameters();
-                                                       
+
                        //checking the onetimepasswd
                        if(passwdProtection.equals("yes")){
                                HttpSession session = req.getSession(false);
@@ -250,13 +247,13 @@ public class ServletModuleOpenIndy extends ServletModule
           (((String)withValues.get("description")).length() == 0) ||
           (((String)withValues.get("content_data")).length() == 0))
             throw new ServletModuleUserException("Missing field");
-      
+
       // call the routines that escape html
 
       for (Iterator i=withValues.keySet().iterator(); i.hasNext(); ){
         String k=(String)i.next();
         String v=(String)withValues.get(k);
-        
+
         if (k.equals("content_data")){
           //this doesn't quite work yet, so for now, all html goes
           //withValues.put(k,StringUtil.approveHTMLTags(v));
@@ -264,7 +261,7 @@ public class ServletModuleOpenIndy extends ServletModule
         } else {
           withValues.put(k,StringUtil.removeHTMLTags(v));
         }
-        
+
       }
 
       withValues.put("date", StringUtil.date2webdbDate(new GregorianCalendar()));
@@ -275,7 +272,7 @@ public class ServletModuleOpenIndy extends ServletModule
       withValues.put("is_published","0");
       // if op direct article-type == newswire
       if (directOp.equals("yes")) withValues.put("to_article_type","1");
-      
+
       // owner is openposting user
       withValues.put("to_publisher","1");
       if (withValues.get("creator").toString().equals(""))
@@ -296,7 +293,7 @@ public class ServletModuleOpenIndy extends ServletModule
       }
 
       String[] to_topicsArr = mp.getParameterValues("to_topic");
-      
+
                        if (to_topicsArr != null && to_topicsArr.length > 0) {
         try{
           DatabaseContentToTopics.getInstance().setTopics(cid,to_topicsArr);
@@ -307,7 +304,7 @@ public class ServletModuleOpenIndy extends ServletModule
           throw new ServletModuleException("smod - openindy :: insposting: setting content_x_topic failed: "+e.toString());
         } //end try
       } //end if
-        
+
       // if op contains uploaddata
       String mediaId=null;
       int i=1;
@@ -360,7 +357,7 @@ public class ServletModuleOpenIndy extends ServletModule
         HashMap mediaValues = new HashMap();
 
         theLog.printInfo("CONTENT TYPE IS: "+contentType);
-        
+
         if (contentType.equals("text/plain") ||
             contentType.equals("application/octet-stream")) {
           contentModule.deleteById(cid);
@@ -391,7 +388,7 @@ public class ServletModuleOpenIndy extends ServletModule
         MirMedia mediaHandler;
         Database mediaStorage;
         ProducerMedia mediaProducer;
+
         //if we didn't find an entry matching the
         //content-type int the table.
         if (mediaTypesList.size() == 0) {
@@ -401,7 +398,7 @@ public class ServletModuleOpenIndy extends ServletModule
 
         Entity mediaType = null;
         Entity mediaType2 = null;
-        
+
         // find out if we an exact content-type match if so take it.
         // otherwise try to match majortype/*
         // @todo this should probably be moved to DatabaseMediaType -mh
@@ -458,7 +455,7 @@ public class ServletModuleOpenIndy extends ServletModule
           //were done with mpReq at this point, dereference it.
           //as it contains mucho mem. -mh 01.10.2001
           mpReq=null;
-          
+
           //we got this far, associate the media to the article
           mediaEnt.setValueForProperty("is_published","1");
           mediaEnt.update();
@@ -483,22 +480,8 @@ public class ServletModuleOpenIndy extends ServletModule
       //dereference mp. -mh
       mp=null;
 
-      // producing openpostinglist
-      new ProducerOpenPosting().handle(null,null,false,false);
-      // producing new page
-      new ProducerContent().handle(null, null, false, false,cid);
-      //if direct op producing startpage
-      if (directOp.equals("yes")) new ProducerStartPage().handle(null,null);
-      
-                       //produce the topicPages if set
-                       //should be more intelligent
-                       //if(setTopic==true) new ProducerTopics().handle(null,null);
-                       
-      // sync the server
-      //should be configureable
-      int exitValue = Helper.rsync();
-      theLog.printDebugInfo("rsync: "+exitValue);
 
+      MirGlobal.localizer().openPostings().afterContentPosting();
     }
     catch (IOException e) { throw new ServletModuleException("IOException: "+ e.toString());}
     catch (StorageObjectException e) { throw new ServletModuleException("StorageObjectException" + e.toString());}
@@ -517,7 +500,7 @@ public class ServletModuleOpenIndy extends ServletModule
         +", we do not support this mime-type. "
         +"Error One or more files of unrecognized type. Sorry");
   }
-       
+
        protected String createOneTimePasswd(){
                Random r = new Random();
                int random = r.nextInt();
@@ -527,7 +510,7 @@ public class ServletModuleOpenIndy extends ServletModule
                String returnString = ""+l;
                return returnString.substring(5);
        }
-      
+
 }