Package info.bliki.api.creator

Examples of info.bliki.api.creator.WikiDB


    // the following subdirectory should not exist if you would like to create a
    // new database
    String databaseSubdirectory = "WikiDB";
    // the following directory must exist for image downloads
    String imageDirectory = "c:/temp/WikiImages";
    WikiDB db = null;

    try {
      db = new WikiDB(mainDirectory, databaseSubdirectory);
      APIWikiModel wikiModel = new APIWikiModel(user, db, "${image}", "${title}", imageDirectory);
      DocumentCreator creator = new DocumentCreator(wikiModel, user, listOfTitleStrings);
//      creator.setHeader(HTMLConstants.HTML_HEADER1 + HTMLConstants.CSS_SCREEN_STYLE + HTMLConstants.HTML_HEADER2);
//      creator.setFooter(HTMLConstants.HTML_FOOTER);
      wikiModel.setUp();
      creator.renderToFile(new PlainTextConverter(), mainDirectory + titleURL + ".txt");

    } catch (IOException e) {
      e.printStackTrace();
    } catch (Exception e1) {
      e1.printStackTrace();
    } finally {
      if (db != null) {
        try {
          db.tearDown();
        } catch (Exception e) {
          e.printStackTrace();
        }
      }
    }
View Full Code Here


      title
    };
    String titleURL = Encoder.encodeTitleLocalUrl(title);
    User user = new User("", "", "http://en.wikipedia.org/w/api.php");
    user.login();
    WikiDB db = null;
    String mainDirectory = "c:/temp/";
    // the following subdirectory should not exist if you would like to create a
    // new database
    String databaseSubdirectory = "WikiDB";
    // the following directory must exist for image downloads
    String imageDirectory = "c:/temp/WikiImages";
    try {
      db = new WikiDB(mainDirectory, databaseSubdirectory);
      APIWikiModel myWikiModel = new APIWikiModel(user, db, "${image}", "file:///c:/temp/${title}", imageDirectory);
      DocumentCreator creator = new DocumentCreator(myWikiModel, user, listOfTitleStrings);

      creator.renderPDFToFile(mainDirectory, titleURL + ".pdf", HTMLConstants.CSS_PRINTER_STYLE);
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      if (db != null) {
        try {
          db.tearDown();
        } catch (Exception e) {
          e.printStackTrace();
        }
      }
    }
View Full Code Here

    // the following subdirectory should not exist if you would like to create a
    // new database
    String databaseSubdirectory = "WikiDB";
    // the following directory must exist for image downloads
    String imageDirectory = "c:/temp/WikiImages";
    WikiDB db = null;

    try {
      db = new WikiDB(mainDirectory, databaseSubdirectory);
      APIWikiModel wikiModel = new APIWikiModel(user, db, "${image}", "${title}", imageDirectory);
      DocumentCreator creator = new DocumentCreator(wikiModel, user, listOfTitleStrings);
      creator.setHeader(HTMLConstants.HTML_HEADER1 + HTMLConstants.CSS_SCREEN_STYLE + HTMLConstants.HTML_HEADER2);
      creator.setFooter(HTMLConstants.HTML_FOOTER);
      wikiModel.setUp();
      creator.renderToFile(mainDirectory + titleURL + ".html");

    } catch (IOException e) {
      e.printStackTrace();
    } catch (Exception e1) {
      e1.printStackTrace();
    } finally {
      if (db != null) {
        try {
          db.tearDown();
        } catch (Exception e) {
          e.printStackTrace();
        }
      }
    }
View Full Code Here

    // the following directory must exist for image downloads
    String imageDirectory = "c:/temp/WikiImages";
    // the generated HTML will be stored in this file name:
    String generatedHTMLFilename = mainDirectory + titleURL + ".html";

    WikiDB db = null;

    try {
      db = new WikiDB(mainDirectory, databaseSubdirectory);
      APIWikiModel wikiModel = new APIWikiModel(user, db, "${image}", "${title}", imageDirectory);
      DocumentCreator creator = new DocumentCreator(wikiModel, user, listOfTitleStrings);
      creator.setHeader(HTMLConstants.HTML_HEADER1 + HTMLConstants.CSS_SCREEN_STYLE + HTMLConstants.HTML_HEADER2);
      creator.setFooter(HTMLConstants.HTML_FOOTER);
      wikiModel.setUp();
      creator.renderToFile(generatedHTMLFilename);

    } catch (IOException e) {
      e.printStackTrace();
    } catch (Exception e1) {
      e1.printStackTrace();
    } finally {
      if (db != null) {
        try {
          db.tearDown();
        } catch (Exception e) {
          e.printStackTrace();
        }
      }
    }
View Full Code Here

      title
    };
    String titleURL = Encoder.encodeTitleLocalUrl(title);
    User user = new User("", "", "http://en.wikipedia.org/w/api.php");
    user.login();
    WikiDB db = null;
    String mainDirectory = "c:/temp/";
    // the following subdirectory should not exist if you would like to create a
    // new database
    String databaseSubdirectory = "WikiDB";
    // the following directory must exist for image downloads
    String imageDirectory = "c:/temp/WikiImages";
    try {
      db = new WikiDB(mainDirectory, databaseSubdirectory);
      APIWikiModel myWikiModel = new APIWikiModel(user, db, "${image}", "file:///c:/temp/${title}", imageDirectory);
      DocumentCreator creator = new DocumentCreator(myWikiModel, user, listOfTitleStrings);

      creator.renderPDFToFile(mainDirectory, titleURL + ".pdf", HTMLConstants.CSS_PRINTER_STYLE);
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      if (db != null) {
        try {
          db.tearDown();
        } catch (Exception e) {
          e.printStackTrace();
        }
      }
    }
View Full Code Here

    // the following subdirectory should not exist if you would like to create a
    // new database
    String databaseSubdirectory = "WikiDB";
    // the following directory must exist for image downloads
    String imageDirectory = "c:/temp/WikiImages";
    WikiDB db = null;

    try {
      db = new WikiDB(mainDirectory, databaseSubdirectory);
      APIWikiModel wikiModel = new APIWikiModel(user, db, "${image}", "${title}", imageDirectory);
      DocumentCreator creator = new DocumentCreator(wikiModel, user, listOfTitleStrings);
      creator.setHeader(HTMLConstants.HTML_HEADER1 + HTMLConstants.CSS_SCREEN_STYLE + HTMLConstants.HTML_HEADER2);
      creator.setFooter(HTMLConstants.HTML_FOOTER);
      wikiModel.setUp();
      creator.renderToFile(mainDirectory + titleURL + ".html");

    } catch (IOException e) {
      e.printStackTrace();
    } catch (Exception e1) {
      e1.printStackTrace();
    } finally {
      if (db != null) {
        try {
          db.tearDown();
        } catch (Exception e) {
          e.printStackTrace();
        }
      }
    }
View Full Code Here

TOP

Related Classes of info.bliki.api.creator.WikiDB

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.