From: zapata Date: Tue, 28 May 2002 00:34:43 +0000 (+0000) Subject: dead wood cleaned up X-Git-Tag: prexmlproducerconfig~70 X-Git-Url: http://erislabs.net/gitweb/?p=mir.git;a=commitdiff_plain;h=fc3eabf6da38c0549dcc6adbc1d3ca24a1d703c9 dead wood cleaned up --- diff --git a/source/mircoders/localizer/basic/MirBasicProducerLocalizer.java b/source/mircoders/localizer/basic/MirBasicProducerLocalizer.java index 97e80b29..c55b1558 100755 --- a/source/mircoders/localizer/basic/MirBasicProducerLocalizer.java +++ b/source/mircoders/localizer/basic/MirBasicProducerLocalizer.java @@ -20,42 +20,15 @@ public class MirBasicProducerLocalizer implements MirProducerLocalizer { }; protected void setupContentFactory(CompositeProducerFactory aContentFactory) { - aContentFactory.addFactory( - new ContentProducerFactory( - MirGlobal.getConfigProperty("Producer.Content.Template"), - "bundles.admin", - MirGlobal.getConfigProperty("Producer.StorageRoot") + "/${contentyear}/${contentmonth}/${contentid}.shtml", - Integer.parseInt(MirGlobal.getConfigProperty("Producer.Content.Batchsize")))); } 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")){ - aSynchronizationFactory.addFactory( - new ScriptCallProducerFactory(MirGlobal.getConfigProperty("Rsync.Script.Path"))); - } - else { - NullProducerFactory nullFactory = new NullProducerFactory(); - nullFactory.addVerb("run"); - aSynchronizationFactory.addFactory(nullFactory); - } } protected void setupStaticFactory(CompositeProducerFactory aStaticFactory) { - aStaticFactory.addFactory( - new StaticProducerFactory( - MirGlobal.getConfigProperty("Producer.Navigation.Template"), - "bundles.admin", - MirGlobal.getConfigProperty("Producer.StorageRoot") + "/navigation.inc")); } protected void setupFactories(Map aFactoriesMap ) { diff --git a/source/mircoders/producer/ContentProducer.java b/source/mircoders/producer/ContentProducer.java deleted file mode 100755 index 99902a53..00000000 --- a/source/mircoders/producer/ContentProducer.java +++ /dev/null @@ -1,109 +0,0 @@ -package mircoders.producer; - -import java.io.*; -import java.util.*; - -import mir.util.*; -import mir.misc.*; -import mir.entity.*; -import mir.producer.*; -import mir.generator.*; - -import mircoders.localizer.*; -import mircoders.global.*; -import mircoders.entity.*; -import mircoders.entity.adapter.*; - -import org.apache.struts.util.MessageResources; - -public class ContentProducer implements mir.producer.Producer { - - private String generatorIdentifier; - private String resourceBundle; - - private String outputFileExpression; - - - EntityBrowser browser; - - public ContentProducer( - EntityBrowser aBrowser, - String aGeneratorIdentifier, - String aResourceBundle, - String anOutputFileExpression) { - - browser = aBrowser; - generatorIdentifier = aGeneratorIdentifier; - resourceBundle = aResourceBundle; - outputFileExpression = anOutputFileExpression; - } - - public void produce( PrintWriter aLogger ) throws ProducerFailure { - EntityContent content; - - Map generationValues = new HashMap(); - Map dataMap = new HashMap(); - String fileName; - - MirGlobal.localizer().producerTool().initializeGenerationValueSet(generationValues); - - 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:"); - aLogger.println("generatorIdentifier = " + generatorIdentifier); - - while (browser.hasNext()) { - content = (EntityContent) browser.next(); - dataMap.put("content", ContentAdapterDefinition.getInstance().makeEntityAdapter(content)); - - String date = content.getValue("date"); - - // ML: this will be done more elegantly soon! - dataMap.put("contentmonth", date.substring(4,6)); - dataMap.put("contentyear", date.substring(0,4)); - dataMap.put("contentid", content.getValue("id")); - - aLogger.println("unparsed fileName = " + outputFileExpression); - - fileName = ParameterExpander.expandExpression(dataMap, outputFileExpression); - - aLogger.println("fileName = " + fileName); - - try { - aLogger.println("generating: " + fileName); - - PrintWriter printWriter = MirGlobal.localizer().producerTool().openWriter(fileName); - - generator.generate(printWriter, generationValues, aLogger); - - MirGlobal.localizer().producerTool().closeWriter(printWriter); - - content.setProduced(true); - - aLogger.println("done generating: " + fileName); - } - catch (Exception e) { - aLogger.println("exception while generating " + fileName + ":"); - aLogger.println(e.getMessage()); - e.printStackTrace(aLogger); - aLogger.flush(); - } - } - } - catch (Exception e) { - aLogger.println("exception while generating:"); - aLogger.println(e.getMessage()); - e.printStackTrace(aLogger); - aLogger.flush(); - } - - aLogger.println("ContentProducer.produce: done"); - - } - -} diff --git a/source/mircoders/producer/ContentProducerFactory.java b/source/mircoders/producer/ContentProducerFactory.java deleted file mode 100755 index a4554883..00000000 --- a/source/mircoders/producer/ContentProducerFactory.java +++ /dev/null @@ -1,60 +0,0 @@ -package mircoders.producer; - -import java.util.*; -import mir.entity.*; -import mir.producer.*; -import mircoders.storage.*; - -public class ContentProducerFactory implements ProducerFactory { - private String generatorIdentifier; - private String resourceBundle; - private String outputFileNameExpression; - private int batchSize; - - public ContentProducerFactory( - String aGeneratorIdentifier, - String aResourceBundle, - String anOutputFileNameExpression, - int aBatchSize) { - - generatorIdentifier = aGeneratorIdentifier; - resourceBundle = aResourceBundle; - outputFileNameExpression = anOutputFileNameExpression; - batchSize=aBatchSize; - } - - public mir.producer.Producer makeProducer(String aVerb) throws ProducerFailure { - try { - QueryBuilder queryBuilder = new QueryBuilder(); - - queryBuilder.appendAndCondition("is_published='1'"); - - if (!aVerb.equals("all")) { - queryBuilder.appendAndCondition("is_produced='0'"); - } - - return new ContentProducer( - new EntityBrowser( - DatabaseContent.getInstance(), - queryBuilder.getWhereClause(), - queryBuilder.getOrderByClause(), - batchSize), - generatorIdentifier, - resourceBundle, - outputFileNameExpression - ); - } catch (Exception e) { - throw new ProducerFailure("Creating Producer failed",e); - } - }; - - public Iterator verbs() { - Vector verbList = new Vector(); - - verbList.add("new"); - verbList.add("all"); - - return verbList.iterator(); - }; -} - diff --git a/source/mircoders/producer/ProducerAll.java b/source/mircoders/producer/ProducerAll.java deleted file mode 100755 index f98c0fa2..00000000 --- a/source/mircoders/producer/ProducerAll.java +++ /dev/null @@ -1,152 +0,0 @@ -package mircoders.producer; - -import java.io.*; -import java.lang.*; -import java.util.*; - -import freemarker.template.*; - -import mir.misc.*; -import mir.storage.*; -import mir.module.*; -import mir.entity.*; - -import mircoders.module.*; -import mircoders.entity.*; -import mircoders.storage.*; - - -public class ProducerAll extends Producer{ - - private boolean rsync; - - public static void main(String argv[]) - { - try { new ProducerAll().handle(new PrintWriter(System.out), null, false,false); } - catch(Exception e) { System.err.println(e.toString()); } - } - - // handle all - public void handle(PrintWriter htmlout, EntityUsers user, boolean force,boolean sync) - { - printHTML(htmlout, "Producer.All: started"); - - long sessionConnectTime = 0; - long startTime = (new java.util.Date()).getTime(); - - try { - new ProducerImages().handle(htmlout, user, force,sync); - } catch (Exception e) { - logHTML(htmlout, "Producer.All ERROR:" - +" in ProducerImages continuing "+ e.toString()); - } - try { - new ProducerAudio().handle(htmlout, user, force,sync); - } catch (Exception e) { - logHTML(htmlout, "Producer.All ERROR:" - +" in ProducerAudio continuing "+ e.toString()); - } - try { - new ProducerVideo().handle(htmlout, user, force,sync); - } catch (Exception e) { - logHTML(htmlout, "Producer.All ERROR:" - +" in ProducerVideo continuing "+ e.toString()); - } - try { - new ProducerOther().handle(htmlout, user, force,sync); - } catch (Exception e) { - logHTML(htmlout, "Producer.All ERROR:" - +" in ProducerOther continuing "+ e.toString()); - } - try { - new ProducerStartPage().handle(htmlout, user, force,sync); - } catch (Exception e) { - logHTML(htmlout, "Producer.All ERROR:" - +" in Producer.StartPage continuing "+ e.toString()); - } - try { - new ProducerContent().handle(htmlout, user, force,sync); - } catch (Exception e) { - logHTML(htmlout, "Producer.All ERROR:" - +" in Producer.Content continuing "+ e.toString()); - } - try { - new ProducerOpenPosting().handle(htmlout, user, force,sync); - } catch (Exception e) { - logHTML(htmlout, "Producer.All ERROR:" - +" in Producer.OpenPosting continuing "+ e.toString()); - } - try { - new ProducerTopics().handle(htmlout, user, force,sync); - } catch (Exception e) { - logHTML(htmlout, "Producer.All ERROR:" - +" in Producer.Topics continuing "+ e.toString()); - } - try { - new ProducerNavigation().handle(htmlout, user, force,sync); - } catch (Exception e) { - logHTML(htmlout, "Producer.All ERROR:" - +" in Producer.Navigation continuing "+ e.toString()); - } - - // Finish - sessionConnectTime = new java.util.Date().getTime() - startTime; - logHTML(htmlout, "Producer.All finished: " + sessionConnectTime + " ms."); - - // do we have to rsync the site - if (sync==true){ - sessionConnectTime = 0; - if (Helper.rsync()!=0){ - sessionConnectTime = new java.util.Date().getTime() - startTime; - logHTML(htmlout, "Rsync failed: " + sessionConnectTime + " ms."); - } else { - sessionConnectTime = new java.util.Date().getTime() - startTime; - logHTML(htmlout, "Rsync succeded: " + sessionConnectTime + " ms."); - } - } - } - - // handle all - public void handle2(PrintWriter htmlout, EntityUsers user, boolean force,boolean sync) - throws StorageObjectException, ModuleException { - printHTML(htmlout, "Producer.All: started"); - - long sessionConnectTime = 0; - long startTime = (new java.util.Date()).getTime(); - EntityContent currentContent; - - //get all new unproduced content-entities - String whereClause="is_produced='0' && to_article_type>0"; - String orderBy="date desc"; - EntityList entityList = contentModule.getContent(whereClause,orderBy,0,-1,null); - - //get their values - while (entityList != null) { - for(int i=0;i - * - * This is the entry point for standalone production. The code - * is then running in a new virtual machine, e.g. when called - * from cron-script. In that case the config has to be initliased. - * Don't know if is ok that way //rk - * - * ok, i figured that out a few months ago.. -mh - * - */ - //Configuration.initConfig("config"); - System.out.println(MirConfig.getProp("Producer.DocRoot")); - - try { - new ProducerContent().handle(new PrintWriter(System.out), null, - false,false); - } catch(Exception e) { - System.err.println(e.toString()); - } - } - - - - public void handle(PrintWriter htmlout, EntityUsers user, boolean force, - boolean sync) - throws StorageObjectException, ModuleException { - - handle(htmlout,user,force,sync,null); - } - - public void handle(PrintWriter htmlout, EntityUsers user, boolean force, - boolean sync, String id) throws StorageObjectException, - ModuleException - { - - long startTime = System.currentTimeMillis(); - int pageCount=0; - - String whereClause = " "; - String orderBy = " "; - String htmlFileName = null; - String foFileName = null; - String pdfFileName = null; - EntityContent currentContent; - EntityList batchEntityList; - EntityUsers userEntity=null; - - int contentBatchsize = - Integer.parseInt(MirConfig.getProp("Producer.Content.Batchsize")); - // production of the content-pages - - /** @todo this should be moved to ModuleContent */ - orderBy="date desc, webdb_lastchange desc"; - if(force==true){ - whereClause="is_published='1'"; - // if true: produces a single content item - if(id !=null){ - whereClause += " AND id="+id; - // I think this avoids a select count(*)... - contentBatchsize=-1; - } - batchEntityList = contentModule.getContent(whereClause, orderBy, 0, - contentBatchsize, userEntity); - } else { - whereClause="is_produced='0' AND is_published='1'"; - //if true produces a single contentitem - if(id !=null){ - whereClause += " AND id="+id; - // this avoids a select count(*)... - contentBatchsize=-1; - } - batchEntityList = contentModule.getContent(whereClause, orderBy, 0, - contentBatchsize, userEntity); - } - - while (batchEntityList!=null) { - for(int i=0;i 2){ - mergeData.put("previousPage",fileDesc + ".shtml"); - mergeData.put("nextPage",fileDesc + (numberOfPages-2) + ".shtml"); - } else { - if (i==(numberOfPages-1)){ - mergeData.put("previousPage",fileDesc + (numberOfPages-i+1) + ".shtml"); - mergeData.put("nextPage",""); - } else { - mergeData.put("previousPage",fileDesc + (numberOfPages-(i-1)) + ".shtml"); - mergeData.put("nextPage",fileDesc + (numberOfPages-(i+1)) + ".shtml"); - } - } - htmlFileName = producerDocRoot + "/" + fileDesc + (numberOfPages-i) + ".shtml"; - mergeData.put("filename",fileDesc + (numberOfPages-i) + ".shtml"); - } - - //producing the html-files - boolean retVal = produce(listTemplate, htmlFileName, mergeData, htmlout); - } //end if - }//end for - - sessionConnectTime = new java.util.Date().getTime() - startTime; - logHTML(htmlout, "Producer.List finished: " + sessionConnectTime + " ms."); - } //end handle - - public void setAdditional(String key, TemplateModel value) { - additional.put(key,value); - } - -} diff --git a/source/mircoders/producer/ProducerNavigation.java b/source/mircoders/producer/ProducerNavigation.java deleted file mode 100755 index ef5a3fc9..00000000 --- a/source/mircoders/producer/ProducerNavigation.java +++ /dev/null @@ -1,69 +0,0 @@ -package mircoders.producer; - -import java.io.*; -import java.lang.*; -import java.util.*; - -import freemarker.template.*; - -import mir.misc.*; -import mir.storage.*; -import mir.module.*; -import mir.entity.*; - -import mircoders.entity.*; - -/** - * Title: mir - another content management system - * Description: - * Copyright: Copyright (c) 2001 - * Company: indymedia - * @author idefix - * @version 1.0 - */ - -public class ProducerNavigation extends Producer { - - private static String naviPageTemplate = MirConfig.getProp("Producer.Navigation.Template"); - - public void handle(PrintWriter htmlout, EntityUsers user, boolean forced, boolean sync) - throws mir.module.ModuleException, mir.storage.StorageObjectException { - - printHTML(htmlout, "Producer.Navigation: started"); - - long sessionConnectTime = 0; - long startTime = (new java.util.Date()).getTime(); - String nowWebdbDate = StringUtil.date2webdbDate(new GregorianCalendar()); - String whereClause; - String orderBy; - FileWriter outputFile; - String htmlFileName; - EntityContent currentContent; - EntityList entityList; - SimpleHash naviPageModel; - - // get the imclinks - entityList = linksImcsModule.getByWhereClause("", "sortpriority, title", -1); - EntityList theParentList = linksImcsModule.getByWhereClause("to_parent_id=NULL", "sortpriority, title", -1); - - // put the informations into the navipagemodel - naviPageModel = new SimpleHash(); - naviPageModel.put("topics", topicsModule.getTopicsList()); - naviPageModel.put("imclist", entityList); - naviPageModel.put("parentlist", theParentList); - - htmlFileName = producerDocRoot + "/navigation.inc"; - - produce(naviPageTemplate, htmlFileName, naviPageModel, new LineFilterWriter(htmlout)); - - // Finish - sessionConnectTime = new java.util.Date().getTime() - startTime; - logHTML(htmlout, "Producer.Navigation finished: " + sessionConnectTime + " ms."); - - if(sync==true){ - Helper.rsync(); - logHTML(htmlout, "Producer.Startseite: rsync done"); - } - } - -} diff --git a/source/mircoders/producer/ProducerOpenPosting.java b/source/mircoders/producer/ProducerOpenPosting.java deleted file mode 100755 index 1278d63e..00000000 --- a/source/mircoders/producer/ProducerOpenPosting.java +++ /dev/null @@ -1,47 +0,0 @@ -package mircoders.producer; - -import java.io.*; -import java.lang.*; -import java.util.*; -import java.sql.*; - -import freemarker.template.*; - -import mir.misc.*; -import mir.storage.*; -import mir.module.*; -import mir.entity.*; - -import mir.module.*; -import mircoders.entity.*; -import mir.storage.*; - - - -public class ProducerOpenPosting extends ProducerList { - - - - 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"; - - setAdditional("topicslist",topicsModule.getTopicsList()); - setAdditional("title",new SimpleScalar("Open-Posting")); - 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()); - } - } - -} diff --git a/source/mircoders/producer/ProducerStartPage.java b/source/mircoders/producer/ProducerStartPage.java deleted file mode 100755 index 865c1009..00000000 --- a/source/mircoders/producer/ProducerStartPage.java +++ /dev/null @@ -1,69 +0,0 @@ -package mircoders.producer; - -import java.io.*; -import java.util.*; - -import freemarker.template.*; - -import mir.entity.*; -import mir.misc.*; -import mir.module.*; -import mir.storage.*; -import mircoders.module.*; -import mircoders.storage.*; -import mircoders.entity.*; - - -public class ProducerStartPage extends Producer { - - private static String startPageTemplate = MirConfig.getProp("Producer.StartPage.Template"); - private static String featuresRSSTemplate = MirConfig.getProp("Producer.FeaturesRSS.Template"); - private static int itemsPerPage = Integer.parseInt(MirConfig.getProp("Producer.StartPage.Items")); - private static int newsPerPage = Integer.parseInt(MirConfig.getProp("Producer.StartPage.Newswire")); - - public static void main(String argv[]){ - try { - // Why are we reloading the configuration here? - // is there something I'm missing? - // mh. - // Configuration.initConfig(argv[0]); - new ProducerStartPage().handle(new PrintWriter(System.out), null); - } catch(Exception e) { - System.err.println(e.toString()); - } - } - - public void handle(PrintWriter htmlout, EntityUsers user, boolean force,boolean sync) - throws StorageObjectException, ModuleException - { - long startTime = System.currentTimeMillis(); - printHTML(htmlout, "Producer.StartPage: started"); - SimpleHash startPageModel = new SimpleHash(); - - // breaking news - ModuleBreaking breakingModule = new ModuleBreaking(DatabaseBreaking.getInstance()); - startPageModel.put("breakingnews", breakingModule.getBreakingNews()); - startPageModel.put("topics", topicsModule.getTopicsList()); - startPageModel.put("newswire", contentModule.getNewsWire(0,newsPerPage)); - startPageModel.put("startspecial", contentModule.getStartArticle()); - startPageModel.put("features", contentModule.getFeatures(0,itemsPerPage)); - startPageModel.put("dc_now", new SimpleScalar(StringUtil.date2w3DateTime(new GregorianCalendar()))); - - - /** @todo switch to compressed */ - produce(startPageTemplate, producerDocRoot + "/index.shtml", startPageModel, htmlout); - - /** should be mandatory in light of new www.indy newswire */ - produce(featuresRSSTemplate, producerDocRoot + "/features.1-0.rdf", startPageModel, htmlout); - - // finished - logHTMLFinish(htmlout, "Startpage", 1, startTime, System.currentTimeMillis()); - - if(sync==true){ - logHTML(htmlout, "Producer.Startpage: rsyncing..."); - Helper.rsync(); - printHTML(htmlout, "Producer.Startpage: rsync done"); - } - } -} - diff --git a/source/mircoders/producer/ProducerTopics.java b/source/mircoders/producer/ProducerTopics.java deleted file mode 100755 index f26ab69e..00000000 --- a/source/mircoders/producer/ProducerTopics.java +++ /dev/null @@ -1,137 +0,0 @@ -package mircoders.producer; - -import java.io.*; -import java.lang.*; -import java.lang.reflect.*; -import java.util.*; -import java.sql.*; - -import freemarker.template.*; - -import mir.misc.*; -import mir.media.*; -import mir.storage.*; -import mir.module.*; -import mir.entity.*; - -import mircoders.entity.*; -import mircoders.storage.*; - - - -public class ProducerTopics extends ProducerList { - - public String where; - String currentMediaId; - EntityList upMediaEntityList; - EntityList imageEntityList; - EntityList currentMediaList; - Entity mediaType; - EntityMedia uploadedMedia; - Class mediaHandlerClass=null; - MirMedia mediaHandler=null; - String mediaHandlerName=null; - Database mediaStorage=null; - String tinyIcon; - String iconAlt; - - public void handle(PrintWriter htmlout, EntityUsers user, boolean force, boolean sync, String id) - throws StorageObjectException, ModuleException { - where=id; - handle(htmlout,user,force,sync); - } - - public void handle(PrintWriter htmlout, EntityUsers user, boolean force, boolean sync) - throws StorageObjectException, ModuleException - { - long startTime = System.currentTimeMillis(); - int pageCount =0; - logHTML(htmlout, "Producer.Topics: started"); - - /** @todo should be done in static */ - listTemplate = MirConfig.getProp("Producer.TopicList.Template"); - - orderBy="date desc, webdb_create desc"; - EntityList topicsEntityList; - if(where==null){ - topicsEntityList = topicsModule.getByWhereClause("","title", -1); - } else { - topicsEntityList = topicsModule.getByWhereClause(where,"title", -1); - } - - for(int i=0; i < topicsEntityList.size(); i++){ - - EntityTopics currentTopic = (EntityTopics)topicsEntityList.elementAt(i); - - try { - EntityList contentEntityList = DatabaseContentToTopics.getInstance().getContent(currentTopic); - String whereClauseSpecial=null; - - if (contentEntityList!=null || force==true) { - if (contentEntityList!=null){ - boolean first=true; - whereClause="is_published='1' AND to_article_type >= 1 AND to_article_type <=2 AND id IN ("; - whereClauseSpecial="is_published='1' AND to_article_type=3 AND id IN ("; - for(int j=0; j < contentEntityList.size(); j++){ - if(first==false) { - whereClause += ","; - whereClauseSpecial += ","; - } - EntityContent currentContent = (EntityContent)contentEntityList.elementAt(j); - whereClause += currentContent.getId(); - whereClauseSpecial += currentContent.getId(); - - setAdditional("topic",currentTopic); - - first = false; - } - whereClause += ")"; - whereClauseSpecial += ")"; - } - - if(contentEntityList==null && force==true){ - //hihi, das ist eigentlich boese - whereClause="is_published='1' AND to_article_type>=1 AND id IN (0)"; - } - - fileDesc = currentTopic.getValue("filename"); - - // get the startarticle - EntityList entityList = contentModule.getContent(whereClauseSpecial,"date desc, webdb_create desc",0,1); - String currentMediaId = null; - SimpleHash imageHash = new SimpleHash(); - EntityContent currentContent; - if(entityList != null && entityList.size()==1){ - currentContent = (EntityContent)entityList.elementAt(0); - try { - setAdditional("special",currentContent); - } catch (Exception e) { - theLog.printError("ProducerTopics: problem with start special media: "+currentContent.getId()+" "+e.toString()+" skipping"); - logHTML(htmlout,"ProducerTopics: problem with start special media: "+currentContent.getId()+" "+e.toString()); - } - } - - //set the list of topics - setAdditional("topicslist",topicsEntityList); - - handleIt(htmlout,user,force); - pageCount++; - } - } catch (Exception e) { - theLog.printError("ProducerTopics: problem with start special media: " - +e.toString()+" skipping"); - logHTML(htmlout,"ProducerTopics: problem with topic id: " - +currentTopic.getId()+ "skipping"); - } - } - logHTMLFinish(htmlout, "Topics", pageCount, startTime, System.currentTimeMillis()); - } - - 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/ScriptCallProducer.java b/source/mircoders/producer/ScriptCallProducer.java deleted file mode 100755 index 8497f438..00000000 --- a/source/mircoders/producer/ScriptCallProducer.java +++ /dev/null @@ -1,32 +0,0 @@ -package mircoders.producer; - -import mir.producer.*; -import java.io.*; - -// ML: needs to be tested! - -public class ScriptCallProducer implements mir.producer.Producer { - String script; - - public ScriptCallProducer(String aScript) { - script = aScript; - } - - public void produce( PrintWriter aLogger ) throws ProducerFailure { - Process process; - int returnValue; - - aLogger.println("Executing " + script + ":"); - - try { - process = Runtime.getRuntime().exec(script); - returnValue = process.waitFor(); - aLogger.println("Terminated successfully, return value = " + returnValue + "."); - } - catch (Throwable e) { - aLogger.println("Exception has occurred: " + e.getMessage() + ":"); - e.printStackTrace(aLogger); - throw new ProducerFailure("Executing script failed",e); - } - } -} diff --git a/source/mircoders/producer/ScriptCallProducerFactory.java b/source/mircoders/producer/ScriptCallProducerFactory.java deleted file mode 100755 index 9f96b7a4..00000000 --- a/source/mircoders/producer/ScriptCallProducerFactory.java +++ /dev/null @@ -1,30 +0,0 @@ -package mircoders.producer; - -import java.util.*; -import mir.entity.*; -import mir.producer.*; -import mircoders.storage.*; - -public class ScriptCallProducerFactory implements ProducerFactory { - private String script; - - - public ScriptCallProducerFactory(String aScript) { - script=aScript; - } - - public mir.producer.Producer makeProducer(String aVerb) throws ProducerFailure { - - - return new ScriptCallProducer(script); - }; - - public Iterator verbs() { - Vector verbList = new Vector(); - - verbList.add("run"); - - return verbList.iterator(); - }; -} - diff --git a/source/mircoders/producer/StartPageProducer.java b/source/mircoders/producer/StartPageProducer.java deleted file mode 100755 index 3af126f0..00000000 --- a/source/mircoders/producer/StartPageProducer.java +++ /dev/null @@ -1,85 +0,0 @@ -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 mircoders.module.*; - -import org.apache.struts.util.MessageResources; - -public class StartPageProducer implements mir.producer.Producer { - - private String generatorIdentifier; - private String resourceBundle; - private String outputFile; - private EntityList newswireItems; - private EntityList features; - private EntityList topics; - private EntityList breakingNews; - - EntityBrowser browser; - - public StartPageProducer( - String aGeneratorIdentifier, - String aResourceBundle, - String anOutputFile, - - EntityList aNewswireItems, - EntityList aFeatures, - EntityList aTopics, - EntityList aBreakingNews) { - - generatorIdentifier=aGeneratorIdentifier; - resourceBundle=aResourceBundle; - outputFile=anOutputFile; - newswireItems = aNewswireItems; - features = aFeatures; - topics = aTopics; - breakingNews = aBreakingNews; - } - - public void produce( PrintWriter aLogger ) throws ProducerFailure { - Map generationValues = new HashMap(); - Map dataMap = new HashMap(); - - try { - MirGlobal.localizer().producerTool().initializeGenerationValueSet(generationValues); - - MessageResources messages = MessageResources.getMessageResources(resourceBundle); - generationValues.put("lang", new MessageMethodModel(null, messages) ); - - generationValues.put("data", dataMap); - - dataMap.put("dc_now", StringUtil.date2w3DateTime(new GregorianCalendar())); - dataMap.put("newswire", newswireItems); - dataMap.put("features", features); - dataMap.put("breakingnews", breakingNews); - dataMap.put("topics", topics); - - aLogger.println("StartPageProducer.produce:"); - aLogger.println("generating: " + outputFile); - - Generator generator = MirGlobal.localizer().generators().makeGenerator(generatorIdentifier); - PrintWriter printWriter = MirGlobal.localizer().producerTool().openWriter(outputFile); - generator.generate(printWriter, generationValues, aLogger); - MirGlobal.localizer().producerTool().closeWriter(printWriter); - - aLogger.println("done"); - } - catch (Exception e) { - aLogger.println("exception while generating " + outputFile + ":"); - aLogger.println(e.getMessage()); - e.printStackTrace(aLogger); - aLogger.flush(); - } - } -} diff --git a/source/mircoders/producer/StartPageProducerFactory.java b/source/mircoders/producer/StartPageProducerFactory.java deleted file mode 100755 index 6bea900e..00000000 --- a/source/mircoders/producer/StartPageProducerFactory.java +++ /dev/null @@ -1,60 +0,0 @@ -package mircoders.producer; - -import java.util.*; -import mir.entity.*; -import mir.producer.*; -import mircoders.storage.*; -import mircoders.module.*; - -public class StartPageProducerFactory implements ProducerFactory { - private String generatorIdentifier; - private String resourceBundle; - private String outputFile; - private int nrNewswireItems; - private int nrFeatures; - - public StartPageProducerFactory( - String aGeneratorIdentifier, - String aResourceBundle, - String anOutputFile, - int aNrFeatures, - int aNrNewswireItems) { - - generatorIdentifier = aGeneratorIdentifier; - resourceBundle = aResourceBundle; - outputFile = anOutputFile; - nrFeatures = aNrFeatures; - nrNewswireItems = aNrNewswireItems; - } - - - public mir.producer.Producer makeProducer(String aVerb) throws ProducerFailure { - - try { - ModuleContent contentModule = new ModuleContent(DatabaseContent.getInstance()); - ModuleTopics topicsModule = new ModuleTopics(DatabaseTopics.getInstance()); - ModuleBreaking breakingModule = new ModuleBreaking(DatabaseBreaking.getInstance()); - - return new StartPageProducer( - generatorIdentifier, - resourceBundle, - outputFile, - contentModule.getNewsWire(0,nrNewswireItems), - contentModule.getFeatures(0,nrFeatures), - topicsModule .getTopicsList(), - breakingModule.getBreakingNews()); - } - catch (Throwable e) { - throw new ProducerFailure("Creating StartPageProducer failed",e); - } - }; - - public Iterator verbs() { - Vector verbList = new Vector(); - - verbList.add("all"); - - return verbList.iterator(); - }; -} - diff --git a/source/mircoders/producer/StaticProducer.java b/source/mircoders/producer/StaticProducer.java deleted file mode 100755 index afdb8363..00000000 --- a/source/mircoders/producer/StaticProducer.java +++ /dev/null @@ -1,66 +0,0 @@ -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 mircoders.module.*; - -import org.apache.struts.util.MessageResources; - -public class StaticProducer implements mir.producer.Producer { - - private String generatorIdentifier; - private String resourceBundle; - private String outputFile; - - public StaticProducer( - String aGeneratorIdentifier, - String aResourceBundle, - String anOutputFile) { - - generatorIdentifier=aGeneratorIdentifier; - resourceBundle=aResourceBundle; - outputFile=anOutputFile; - } - - public void produce( PrintWriter aLogger ) throws ProducerFailure { - Map generationValues = new HashMap(); - Map dataMap = new HashMap(); - - try { - MirGlobal.localizer().producerTool().initializeGenerationValueSet(generationValues); - - MessageResources messages = MessageResources.getMessageResources(resourceBundle); - generationValues.put("lang", new MessageMethodModel(null, messages) ); - - generationValues.put("data", dataMap); - - dataMap.put("dc_now", StringUtil.date2w3DateTime(new GregorianCalendar())); - - aLogger.println("StaticProducer.produce:"); - aLogger.println(" generating: " + outputFile + " from " + generatorIdentifier); - - Generator generator = MirGlobal.localizer().generators().makeGenerator(generatorIdentifier); - PrintWriter printWriter = MirGlobal.localizer().producerTool().openWriter(outputFile); - generator.generate(printWriter, generationValues, aLogger); - MirGlobal.localizer().producerTool().closeWriter(printWriter); - - aLogger.println("done"); - } - catch (Exception e) { - aLogger.println("exception while generating " + outputFile + ":"); - aLogger.println(e.getMessage()); - e.printStackTrace(aLogger); - aLogger.flush(); - } - } -} diff --git a/source/mircoders/producer/StaticProducerFactory.java b/source/mircoders/producer/StaticProducerFactory.java deleted file mode 100755 index 4413ff40..00000000 --- a/source/mircoders/producer/StaticProducerFactory.java +++ /dev/null @@ -1,38 +0,0 @@ -package mircoders.producer; - -import java.util.*; -import mir.producer.*; - -public class StaticProducerFactory implements ProducerFactory { - private String generatorIdentifier; - private String resourceBundle; - private String outputFile; - - public StaticProducerFactory( - String aGeneratorIdentifier, - String aResourceBundle, - String anOutputFile) { - - generatorIdentifier = aGeneratorIdentifier; - resourceBundle = aResourceBundle; - outputFile = anOutputFile; - } - - public mir.producer.Producer makeProducer(String aVerb) throws ProducerFailure { - try { - return new StaticProducer( generatorIdentifier, resourceBundle, outputFile ); - } - catch (Throwable e) { - throw new ProducerFailure("Creating StaticProducer failed",e); - } - }; - - public Iterator verbs() { - Vector verbList = new Vector(); - - verbList.add("all"); - - return verbList.iterator(); - }; -} - diff --git a/source/mircoders/producer/TopicStartPageProducerFactory.java b/source/mircoders/producer/TopicStartPageProducerFactory.java deleted file mode 100755 index 5b3f29ac..00000000 --- a/source/mircoders/producer/TopicStartPageProducerFactory.java +++ /dev/null @@ -1,99 +0,0 @@ -package mircoders.producer; - -import java.util.*; -import mir.entity.*; -import mir.producer.*; -import mir.util.*; -import mircoders.storage.*; -import mircoders.module.*; -import mircoders.entity.*; -import mircoders.global.*; -import mircoders.localizer.*; - - -public class TopicStartPageProducerFactory implements ProducerFactory { - private String generatorIdentifier; - private String resourceBundle; - private String outputFileNameExpression; - private int nrNewswireItems; - private int nrFeatures; - - public TopicStartPageProducerFactory( - String aGeneratorIdentifier, - String aResourceBundle, - String anOutputFileNameExpression, - int aNrFeatures, - int aNrNewswireItems) { - - generatorIdentifier = aGeneratorIdentifier; - resourceBundle = aResourceBundle; - outputFileNameExpression = anOutputFileNameExpression; - nrFeatures = aNrFeatures; - nrNewswireItems = aNrNewswireItems; - } - - - public mir.producer.Producer makeProducer(String aVerb) throws ProducerFailure { - CompositeProducer result = new CompositeProducer(); - Map values = new HashMap(); - - - try { - MirGlobal.localizer().producerTool().initializeGenerationValueSet(values); - - ModuleContent contentModule = new ModuleContent(DatabaseContent.getInstance()); - ModuleTopics topicsModule = new ModuleTopics(DatabaseTopics.getInstance()); - ModuleBreaking breakingModule = new ModuleBreaking(DatabaseBreaking.getInstance()); - - EntityBrowser topicBrowser = new EntityBrowser( - DatabaseTopics.getInstance(), - "", - "", - 100); - - while (topicBrowser.hasNext()) { - Entity topic = (Entity) topicBrowser.next(); - values.put("title", topic.getValue("title")); - values.put("filename", topic.getValue("filename")); - values.put("main_url", topic.getValue("main_url")); - values.put("archiv_url", topic.getValue("archiv_url")); - - - - // ML: ok, this is way too low-level for this place: - String orderBy = "webdb_create desc"; - String topicSelection = "exists (select * from content_x_topic where content_id=content.id and topic_id='"+topic.getValue("id")+"')"; - String featureWhereClause = "is_published='1' and to_article_type='2' and "+topicSelection; - String newsWireWhereClause = "is_published='1' and to_article_type='1' and "+topicSelection; - - result.addProducer( - - // "exists (select * from content_x_topic where content_id=content.id and topic_id="+topic.getValue("id") - new StartPageProducer( - generatorIdentifier, - resourceBundle, - ParameterExpander.expandExpression(values, outputFileNameExpression), - contentModule.getContent(newsWireWhereClause, orderBy, 0,nrNewswireItems), - contentModule.getContent(featureWhereClause, orderBy, 0,nrFeatures), - topicsModule .getTopicsList(), - breakingModule.getBreakingNews())); - } - - return result; - - - } - catch (Throwable e) { - throw new ProducerFailure("Creating TopicStartPageProducer failed",e); - } - }; - - public Iterator verbs() { - Vector verbList = new Vector(); - - verbList.add("all"); - - return verbList.iterator(); - }; -} - diff --git a/source/mirlocal/bolivia.indymedia.org/BoliviaProducerLocalizer.java b/source/mirlocal/bolivia.indymedia.org/BoliviaProducerLocalizer.java index 534d3d8c..057d4f80 100755 --- a/source/mirlocal/bolivia.indymedia.org/BoliviaProducerLocalizer.java +++ b/source/mirlocal/bolivia.indymedia.org/BoliviaProducerLocalizer.java @@ -13,7 +13,7 @@ public class BoliviaProducerLocalizer extends MirBasicProducerLocalizer { protected void setupContentFactory(CompositeProducerFactory aContentFactory) { - EntityEnumeratingProducerNode contentNode = null; +/* EntityEnumeratingProducerNode contentNode = null; try { contentNode = @@ -37,7 +37,7 @@ public class BoliviaProducerLocalizer extends MirBasicProducerLocalizer { contentNode.addVerb( "new", "is_published='1' and is_produced='f'", "" ); aContentFactory.addFactory( new NodedProducerFactory( contentNode ) ); - +*/ // public EntityEnumeratingProducerNode(String aKey, StorageObject aStorage, EntityAdapterDefinition aDefinition, ProducerNode aSubNode) { @@ -121,7 +121,7 @@ public class BoliviaProducerLocalizer extends MirBasicProducerLocalizer { } protected void setupStaticFactory(CompositeProducerFactory aStaticFactory) { - aStaticFactory.addFactory( +/* aStaticFactory.addFactory( new StaticProducerFactory( "producer/nav.template", "bundles.admin", @@ -156,6 +156,6 @@ public class BoliviaProducerLocalizer extends MirBasicProducerLocalizer { "producer/articlepost.template", "bundles.admin", MirGlobal.getConfigProperty("Producer.StorageRoot") + "/nl/articlepost.shtml")); - } +*/ } } diff --git a/source/mirlocal/euskalherria.indymedia.org/EHProducerLocalizer.java b/source/mirlocal/euskalherria.indymedia.org/EHProducerLocalizer.java index 0b513b02..3424e87d 100755 --- a/source/mirlocal/euskalherria.indymedia.org/EHProducerLocalizer.java +++ b/source/mirlocal/euskalherria.indymedia.org/EHProducerLocalizer.java @@ -82,15 +82,15 @@ public class EHProducerLocalizer extends MirBasicProducerLocalizer { } protected void setupSynchronizationFactory(CompositeProducerFactory aSynchronizationFactory) { - if(MirGlobal.getConfigBooleanProperty("Rsync")){ +/* if(MirGlobal.getConfigBooleanProperty("Rsync")){ aSynchronizationFactory.addFactory( new ScriptCallProducerFactory(MirGlobal.getConfigProperty("Rsync.Script.Path"))); } else { - NullProducerFactory nullFactory = new NullProducerFactory(); +*/ NullProducerFactory nullFactory = new NullProducerFactory(); nullFactory.addVerb("run"); aSynchronizationFactory.addFactory(nullFactory); - } +/* }*/ } protected void setupStaticFactory(CompositeProducerFactory aStaticFactory) { diff --git a/source/mirlocal/indymedia.nl/IndyNLProducerLocalizer.java b/source/mirlocal/indymedia.nl/IndyNLProducerLocalizer.java index 5ecb03ff..1cfe8091 100755 --- a/source/mirlocal/indymedia.nl/IndyNLProducerLocalizer.java +++ b/source/mirlocal/indymedia.nl/IndyNLProducerLocalizer.java @@ -131,15 +131,18 @@ public class IndyNLProducerLocalizer extends MirBasicProducerLocalizer { } protected void setupSynchronizationFactory(CompositeProducerFactory aSynchronizationFactory) { - if(MirGlobal.getConfigBooleanProperty("Rsync")){ +/* if(MirGlobal.getConfigBooleanProperty("Rsync")){ aSynchronizationFactory.addFactory( new ScriptCallProducerFactory(MirGlobal.getConfigProperty("Rsync.Script.Path"))); } else { +*/ NullProducerFactory nullFactory = new NullProducerFactory(); nullFactory.addVerb("run"); aSynchronizationFactory.addFactory(nullFactory); +/* } + */ } protected void setupStaticFactory(CompositeProducerFactory aStaticFactory) {