From e6d71f43e4eb375c6787149d90634dd8f537030e Mon Sep 17 00:00:00 2001 From: rk Date: Wed, 20 Feb 2002 10:23:05 +0000 Subject: [PATCH] producer debugging --- source/mircoders/producer/Producer.java | 4 +-- source/mircoders/producer/ProducerFeature.java | 23 +++++++---------- source/mircoders/producer/ProducerList.java | 5 +++- source/mircoders/producer/ProducerOpenPosting.java | 29 ++++++++++------------ source/mircoders/producer/ProducerStartPage.java | 9 ++++--- source/mircoders/producer/ProducerTopics.java | 6 ----- 6 files changed, 33 insertions(+), 43 deletions(-) diff --git a/source/mircoders/producer/Producer.java b/source/mircoders/producer/Producer.java index 1c0f4338..93eb37a1 100755 --- a/source/mircoders/producer/Producer.java +++ b/source/mircoders/producer/Producer.java @@ -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"); diff --git a/source/mircoders/producer/ProducerFeature.java b/source/mircoders/producer/ProducerFeature.java index 69adc509..09f83831 100755 --- a/source/mircoders/producer/ProducerFeature.java +++ b/source/mircoders/producer/ProducerFeature.java @@ -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()); + } + } } diff --git a/source/mircoders/producer/ProducerList.java b/source/mircoders/producer/ProducerList.java index e4abda93..5533a377 100755 --- a/source/mircoders/producer/ProducerList.java +++ b/source/mircoders/producer/ProducerList.java @@ -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); + } + } diff --git a/source/mircoders/producer/ProducerOpenPosting.java b/source/mircoders/producer/ProducerOpenPosting.java index 268a4dce..1278d63e 100755 --- a/source/mircoders/producer/ProducerOpenPosting.java +++ b/source/mircoders/producer/ProducerOpenPosting.java @@ -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()); - } - } } diff --git a/source/mircoders/producer/ProducerStartPage.java b/source/mircoders/producer/ProducerStartPage.java index 329b0ceb..8ae3e5b4 100755 --- a/source/mircoders/producer/ProducerStartPage.java +++ b/source/mircoders/producer/ProducerStartPage.java @@ -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 */ } } diff --git a/source/mircoders/producer/ProducerTopics.java b/source/mircoders/producer/ProducerTopics.java index 199ab769..f26ab69e 100755 --- a/source/mircoders/producer/ProducerTopics.java +++ b/source/mircoders/producer/ProducerTopics.java @@ -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; -- 2.11.0