producer debugging
authorrk <rk>
Wed, 20 Feb 2002 10:23:05 +0000 (10:23 +0000)
committerrk <rk>
Wed, 20 Feb 2002 10:23:05 +0000 (10:23 +0000)
source/mircoders/producer/Producer.java
source/mircoders/producer/ProducerFeature.java
source/mircoders/producer/ProducerList.java
source/mircoders/producer/ProducerOpenPosting.java
source/mircoders/producer/ProducerStartPage.java
source/mircoders/producer/ProducerTopics.java

index 1c0f433..93eb37a 100755 (executable)
@@ -155,8 +155,8 @@ abstract public class Producer {
   public void logHTMLFinish(PrintWriter htmlout,String moduleName, int pageCount, long startTime, long endTime) {
     // timing and message to browser
     long overall = endTime - startTime;
-    long pagesPerMinute=0; float perMinute = overall/60000;
-    if (perMinute >0) pagesPerMinute = (long) (pageCount / perMinute);
+    int pagesPerMinute=0; float perMinute = (float)overall/(float)60000;
+    if (perMinute >0) pagesPerMinute = (int) ((float)pageCount / perMinute);
 
     logHTML(htmlout, "Producer."+moduleName+" finished producing: " +
             overall + " ms for "+ pageCount+" Pages = " +pagesPerMinute + " pages/min");
index 69adc50..09f8383 100755 (executable)
@@ -20,12 +20,7 @@ import mircoders.storage.*;
 
 public class ProducerFeature extends ProducerList {
 
-
-       public void setAdditional(String key, TemplateModel value) {
-               additional.put(key,value);
-       }
-
-       public void handle(PrintWriter htmlout, EntityUsers user, boolean force, boolean sync)
+  public void handle(PrintWriter htmlout, EntityUsers user, boolean force, boolean sync)
                throws StorageObjectException, ModuleException {
                orderBy="date desc";
                listTemplate = MirConfig.getProp("Producer.FeatureList.Template");
@@ -43,7 +38,7 @@ public class ProducerFeature extends ProducerList {
                 }
                 whereClause += currentTopic.getId();
                 fileDesc = currentTopic.getValue("filename").trim();
-                setAdditional("topic",HTMLTemplateProcessor.makeSimpleHash(currentTopic));
+                setAdditional("topic",currentTopic);
             } catch (Exception e) {
                 logHTML(htmlout, "problem with feature skipping");
             }
@@ -54,11 +49,11 @@ public class ProducerFeature extends ProducerList {
                handleIt(htmlout,user,force);
        }
 
-       public static void main(String argv[]){
-               try {
-                       new ProducerOpenPosting().handle(new PrintWriter(System.out), null,false, false);
-               } catch(Exception e) {
-                       System.err.println(e.toString());
-               }
-       }
+  public static void main(String argv[]){
+    try {
+      new ProducerOpenPosting().handle(new PrintWriter(System.out), null,false, false);
+    } catch(Exception e) {
+      System.err.println(e.toString());
+    }
+  }
 }
index e4abda9..5533a37 100755 (executable)
@@ -132,5 +132,8 @@ abstract public class ProducerList extends Producer {
     logHTML(htmlout, "Producer.List finished: " + sessionConnectTime + " ms.");
   } //end handle
 
-  abstract public void setAdditional(String key, TemplateModel value);
+  public void setAdditional(String key, TemplateModel value) {
+    additional.put(key,value);
+  }
+
 }
index 268a4dc..1278d63 100755 (executable)
@@ -20,31 +20,28 @@ import mir.storage.*;
 
 public class ProducerOpenPosting extends ProducerList {
 
-    public void setAdditional(String key, TemplateModel value) {
-        additional.put(key,value);
-    }
 
-       public void handle(PrintWriter htmlout, EntityUsers user, boolean force, boolean sync)
-               throws StorageObjectException, ModuleException {
 
+  public void handle(PrintWriter htmlout, EntityUsers user, boolean force, boolean sync)
+    throws StorageObjectException, ModuleException
+  {
     listTemplate = MirConfig.getProp("Producer.OpenPosting.Template");
     whereClause="is_published='1'";
     orderBy="date desc, webdb_create desc";
     fileDesc="open";
 
-    SimpleScalar title = new SimpleScalar();
-    title.setValue("Open-Posting");
     setAdditional("topicslist",topicsModule.getTopicsList());
-    setAdditional("title",title);
+    setAdditional("title",new SimpleScalar("Open-Posting"));
+    handleIt(htmlout,user,force);
+  }
+
 
-        handleIt(htmlout,user,force);
+  public static void main(String argv[]){
+    try {
+      new ProducerOpenPosting().handle(new PrintWriter(System.out), null,false, false);
+    } catch(Exception e) {
+      System.err.println(e.toString());
     }
+  }
 
-       public static void main(String argv[]){
-               try {
-                       new ProducerOpenPosting().handle(new PrintWriter(System.out), null,false, false);
-               } catch(Exception e) {
-                       System.err.println(e.toString());
-               }
-       }
 }
index 329b0ce..8ae3e5b 100755 (executable)
@@ -47,16 +47,17 @@ public class ProducerStartPage extends Producer {
     startPageModel.put("startspecial", contentModule.getStartArticle());
     startPageModel.put("features", contentModule.getFeatures(0,itemsPerPage));
 
+    /** @todo switch to compressed */
     produce(startPageTemplate, producerDocRoot + "/index.shtml", startPageModel, htmlout);
 
-    // Finish
-    logHTML(htmlout, "Producer.Startpage finished: " + (
-            System.currentTimeMillis() - startTime) + " ms.");
+    // finished
+    logHTMLFinish(htmlout, "Startpage", 1, startTime, System.currentTimeMillis());
+
     if(sync==true){
+      logHTML(htmlout, "Producer.Startpage: rsyncing...");
       Helper.rsync();
       logHTML(htmlout, "Producer.Startpage: rsync done");
     }
-    /** @todo we should have a link back to startpage here */
   }
 }
 
index 199ab76..f26ab69 100755 (executable)
@@ -35,12 +35,6 @@ public class ProducerTopics extends ProducerList {
   String              tinyIcon;
   String              iconAlt;
 
-  /** @todo couldn't this be in Producer.java and should be named addAdditional,
-   *  and should be thrown away afterwards? */
-  public void setAdditional(String key, TemplateModel value) {
-    additional.put(key,value);
-  }
-
   public void handle(PrintWriter htmlout, EntityUsers user, boolean force, boolean sync, String id)
     throws StorageObjectException, ModuleException {
     where=id;