1 import java.io.*; 2 3 import com.teamkonzept.lib.*; 4 import com.teamkonzept.webman.db.TKWebmanDBManager; 5 import de.webman.generator.*; 6 import org.apache.log4j.Category; 7 8 21 public class WebManValidator 22 { 23 private Writer out; 24 private SiteTreeValidator validator; 25 26 31 public WebManValidator(String docRootPath, Writer out, boolean genHTMLOutput) 32 { 33 String templatePath = docRootPath + File.separator + TemplateUtils.getGenerationDirectory(); 34 validator = new SiteTreeValidator(docRootPath, templatePath); 35 36 if (genHTMLOutput) { 37 makeHTMLValidator(out); 38 } 39 else { 40 makeStdValidator(out); 41 } 42 this.out = out; 43 } 44 45 50 public boolean validate() 51 { 52 boolean retval = true; 53 54 try { 55 validator.initDB(); 56 validator.validate(); 57 } 58 catch (Throwable e) 59 { 60 PrintWriter pout = new PrintWriter(out); 61 e.printStackTrace(pout); 62 pout.flush(); 63 retval = false; 64 } 65 finally { 66 try { 67 validator.deinitDB(!retval); 68 } 69 catch (TKException e) { 70 e.printStackTrace(new PrintWriter(out)); 71 } 72 } 73 74 return retval; 75 } 76 77 80 private void makeHTMLValidator(Writer out) 81 { 82 87 } 88 89 92 private void makeStdValidator(Writer out) 93 { 94 99 } 100 101 public static void main(String [] args) 102 { 103 if (args.length < 1) { 104 printUsage(); 105 return; 106 } 107 108 boolean genHTMLOutput = false; 109 if (args.length == 2 && args[1].equalsIgnoreCase("htmlOut")) { 110 genHTMLOutput = true; 111 } 112 113 PrintWriter pw = new PrintWriter(System.out); 114 WebManValidator vd = new WebManValidator(args[0], pw, genHTMLOutput); 115 vd.validate(); 116 } 117 118 private static void printUsage() 119 { 120 int i = 0; 121 i++; 122 134 } 135 } 136 137 | Popular Tags |