Coverage Report - org.paneris.bibliomania.RegenerateNavigation
 
Classes in this File Line Coverage Branch Coverage Complexity
RegenerateNavigation
0%
0/14
N/A
1.5
RegenerateNavigation$1
0%
0/6
N/A
1.5
 
 1  
 package org.paneris.bibliomania;
 2  
 
 3  
 import java.io.File;
 4  
 
 5  
 import org.melati.Melati;
 6  
 import org.melati.poem.AccessToken;
 7  
 import org.melati.poem.PoemTask;
 8  
 import org.melati.poem.UnexpectedExceptionPoemException;
 9  
 import org.webmacro.servlet.WebContext;
 10  
 
 11  0
 public class RegenerateNavigation extends BibliomaniaServlet {
 12  
 
 13  
   /**
 14  
    * 
 15  
    */
 16  
   private static final long serialVersionUID = 1L;
 17  
 
 18  
   private static void doRegen(BibliomaniaDatabase db) throws Exception {
 19  0
     db.interpolateTemplateToFile(Bib.bibliomaniaTemplate("bookToURL"),
 20  
         new File(db.getCachedContentRootDir(),
 21  
                  "bookToURL.html"),
 22  
         null);
 23  0
     db.interpolateTemplateToFile(Bib.bibliomaniaTemplate("createSymLinks.pl"),
 24  
         new File(db.getCachedContentRootDir(),
 25  
                  "createSymLinks.pl"),
 26  
         null);
 27  0
     db.interpolateTemplateToFile(Bib.bibliomaniaTemplate("google"),
 28  
                            new File(db.getCachedContentRootDir(),
 29  
                                     "google.html"),
 30  
                            null);
 31  0
     db.interpolateTemplateToFile(Bib.bibliomaniaTemplate("totalContents"),
 32  
                            new File(db.getCachedContentRootDir(),
 33  
                                     "contents.html"),
 34  
                            null);
 35  0
     db.interpolateTemplateToFile(Bib.bibliomaniaTemplate("totalnav"),
 36  
                            new File(db.getCachedContentRootDir(),
 37  
                                     "totalnav.html"),
 38  
                            null);
 39  0
     db.interpolateTemplateToFile(Bib.bibliomaniaTemplate("Faq"),
 40  
                            new File(db.getCachedContentRootDir(),
 41  
                                     "Faq.html"),
 42  
                            null);
 43  0
   }
 44  
 
 45  
   protected String bibliomaniaHandle(Melati melati, WebContext context)
 46  
       throws Exception {
 47  0
     doRegen((BibliomaniaDatabase)melati.getDatabase());
 48  0
     return bibliomaniaTemplate("admin/RegenerateNavigation");
 49  
   }
 50  
 
 51  
   public static void main(final String[] args) {
 52  0
     final BibliomaniaDatabase db = new BibliomaniaDatabase();
 53  0
     db.connect("bibliomania","org.melati.poem.dbms.Postgresql",
 54  
                 "jdbc:postgresql:bibliomania", "postgres", "*",8);
 55  
 
 56  0
     db.inSession(
 57  
         AccessToken.root,       // FIXME
 58  0
         new PoemTask() {
 59  
           public void run() {
 60  
             try {
 61  0
               doRegen(db);
 62  
             }
 63  0
             catch (Exception e) {
 64  0
               throw new UnexpectedExceptionPoemException(e);
 65  0
             }
 66  0
           }
 67  
         });
 68  0
   }
 69  
 }