+++ /dev/null
-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.storage.*;
-import mircoders.entity.*;
-
-
-public class ProducerWap extends Producer {
-
- static String wapTemplate;
- static int itemsPerPage;
- static int newsPerPage;
-
- // Initialierung
- static {
- wapTemplate = MirConfig.getProp("Producer.Wap.Template");
- itemsPerPage = Integer.parseInt(MirConfig.getProp("Producer.Wap.Items"));
- }
-
- public static void main(String argv[]){
- try {
- // do we need the following? -mh <heckmann@hbe.ca>
- //Configuration.initConfig(argv[0]);
- new ProducerWap().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
- {
- printHTML(htmlout, "Producer.StartPage: started");
-
- long sessionConnectTime = 0;
- long startTime = (new java.util.Date()).getTime();
- String nowWebdbDate = StringUtil.date2webdbDate(new GregorianCalendar());
- String whereClause;
- String orderBy;
- FileWriter outputFile;
- String xmlFileName;
- String wmlFileName;
- EntityContent currentContent;
- EntityList entityList;
- SimpleHash wapPageModel;
- SimpleList contentList;
- String currentMediaId;
- SimpleHash imageHash = new SimpleHash();
-
-
- // get the breaking news
- // only the first 5
- ModuleBreaking breakingModule = new ModuleBreaking(DatabaseBreaking.getInstance());
- entityList = breakingModule.getByWhereClause(null,"webdb_create desc",0,itemsPerPage);
- SimpleList breakingList = HTMLTemplateProcessor.makeSimpleList(entityList);
-
-
-
- // Zusaetzlich Informationen
- wapPageModel = new SimpleHash();
- wapPageModel.put("breaking", breakingList);
-
- xmlFileName = producerDocRoot + "/wap/index.xml";
- wmlFileName = producerDocRoot + "/wap/index.wml";
-
- produce(wapTemplate, xmlFileName, wapPageModel, new LineFilterWriter(htmlout));
-
- XmlSaxonStyler styler = XmlSaxonStyler.getInstance();
- // clear XSL-Cache
- // XslStyleCache.clear();
-
- try {
- InputStream is = new FileInputStream(producerStorageRoot+xmlFileName);
- OutputStream os = new FileOutputStream(producerStorageRoot+wmlFileName);
- String contentXsl = MirConfig.getProp("Home") + "templates/" + MirConfig.getProp("Xsl.Wap");
- logHTML(htmlout,"using style " + contentXsl);
- styler.style(contentXsl,is,os);
- is.close();
- os.close();
- logHTML(htmlout,"styling done.");
- logHTML(htmlout, "html erstellt: <a href=\"" + producerProductionHost+ wmlFileName + "\">" + wmlFileName + "</a>");
- } catch (FileNotFoundException e) {
- System.err.println(e.toString());
- } catch (IOException e) {
- System.err.println(e.toString());
- } catch (org.xml.sax.SAXException e) {
- logHTML(htmlout,e.toString());
- System.err.println(e.toString());
- }
-
- // Finish
- sessionConnectTime = new java.util.Date().getTime() - startTime;
- logHTML(htmlout, "Producer.Startseite finished: " + sessionConnectTime + " ms.");
- }
-}
-