adding GenHTMLsingle; still problems with GenHTML.destination_
authorwneuper
Sun, 24 Aug 2008 20:19:56 +0200
changeset 3911dad646edb2a7
parent 3910 ff91732aed78
child 3912 29d5d67c74a1
adding GenHTMLsingle; still problems with GenHTML.destination_
src/java/isac/util/GenHTMLsinglePaths.java
src/java/isac/util/genhtml/GenHTML.java
src/java/isac/util/genhtml/GenHTMLsingle.java
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/java/isac/util/GenHTMLsinglePaths.java	Sun Aug 24 20:19:56 2008 +0200
     1.3 @@ -0,0 +1,29 @@
     1.4 +package isac.util;
     1.5 +
     1.6 +import java.io.InputStream;
     1.7 +import java.util.Properties;
     1.8 +
     1.9 +public class GenHTMLsinglePaths {
    1.10 +
    1.11 +    static {
    1.12 +        loadPropertyFile();
    1.13 +    }
    1.14 +
    1.15 +    public static void loadPropertyFile() {
    1.16 +        try {
    1.17 +            InputStream is = GenHTMLsinglePaths.class
    1.18 +                    .getResourceAsStream("/properties/GenHTMLsinglePaths.properties");
    1.19 +            if (is != null) {
    1.20 +                Properties p = new Properties();
    1.21 +                p.load(is);
    1.22 +                FILE_TO_CHECK = p.getProperty("FILE_TO_CHECK");
    1.23 +            }
    1.24 +        } catch (Exception e) {
    1.25 +            FILE_TO_CHECK = "";
    1.26 +            e.printStackTrace();
    1.27 +        }
    1.28 +    }
    1.29 +
    1.30 +    public static String FILE_TO_CHECK = "";
    1.31 +
    1.32 +}
    1.33 \ No newline at end of file
     2.1 --- a/src/java/isac/util/genhtml/GenHTML.java	Sun Aug 24 13:03:12 2008 +0200
     2.2 +++ b/src/java/isac/util/genhtml/GenHTML.java	Sun Aug 24 20:19:56 2008 +0200
     2.3 @@ -34,7 +34,7 @@
     2.4  
     2.5  /**
     2.6   * @author Andreas Griesmayer
     2.7 - *  
     2.8 + * 
     2.9   */
    2.10  public class GenHTML {
    2.11  
    2.12 @@ -44,30 +44,30 @@
    2.13  
    2.14      static final int EXPTREE_XSL = 3;
    2.15  
    2.16 +    // WN080824 why is there no THYTREE_XSL ???
    2.17 +
    2.18      static final int SIMPLE_HIERARCHY_XSL = 4;
    2.19  
    2.20      static final int SIMPLE_PBL_NODE = 5;
    2.21  
    2.22 -    //storage-destination for the generated html-files
    2.23 -    //fixed path /windows/E/xmldata_last/
    2.24 -   // static String destination_ = "/home/mLa/isac_html_files/";
    2.25 +    // storage-destination for the generated html-files
    2.26      static String destination_ = KEStorePaths.GENHTML_DESTINATON_PATH;
    2.27 +
    2.28      private static FileWriter error_log;
    2.29  
    2.30      public static void main(String[] args) {
    2.31 -        
    2.32 -		if (args.length != 1) {
    2.33 -			System.out
    2.34 -					.println("Only the path to the config file is allowed as one and only parameter");
    2.35 -			System.exit(1);
    2.36 -		}
    2.37 -		KEStorePaths.setConstants(args[0]);
    2.38 -        
    2.39 -    	//storage-destination of the problems occuring in the xml files
    2.40 +
    2.41 +        if (args.length != 1) {
    2.42 +            System.out
    2.43 +                    .println("Only the path to the config file is allowed as one and only parameter");
    2.44 +            System.exit(1);
    2.45 +        }
    2.46 +        KEStorePaths.setConstants(args[0]);
    2.47 +
    2.48 +        // storage-destination of the problems occuring in the xml files
    2.49          try {
    2.50 -            error_log = new FileWriter(
    2.51 -            //fixed path /windows/E/xmldata_last/GENHTML_error_log.txt
    2.52 -                    KEStorePaths.GENHTML_DESTINATON_PATH+"GENHTML_error_log.txt");
    2.53 +            error_log = new FileWriter(KEStorePaths.GENHTML_DESTINATON_PATH
    2.54 +                    + "GENHTML_error_log.txt");
    2.55          } catch (IOException e) {
    2.56              e.printStackTrace();
    2.57          }
    2.58 @@ -75,7 +75,7 @@
    2.59          if (args.length > 0)
    2.60              destination_ = KEStorePaths.GENHTML_DESTINATON_PATH;
    2.61          GenHTML genhtml = new GenHTML();
    2.62 -        
    2.63 +
    2.64          genhtml.buildHierarchy("met/code.html");
    2.65          genhtml.buildHierarchy("met/index.html");
    2.66          genhtml.buildHierarchy("met/heading.html");
    2.67 @@ -87,7 +87,7 @@
    2.68          genhtml.buildHierarchy("pbl/heading.html");
    2.69          genhtml.buildHierarchy("pbl/menu_empty.html");
    2.70          genhtml.buildHierarchy("pbl/main.html");
    2.71 -        
    2.72 +
    2.73          genhtml.buildHierarchy("thy/code.html");
    2.74          genhtml.buildHierarchy("thy/index.html");
    2.75          genhtml.buildHierarchy("thy/heading.html");
    2.76 @@ -108,7 +108,6 @@
    2.77              genhtml.loadContent("exp/" + exp_it.next());
    2.78          }
    2.79  
    2.80 -        //fixed path ???
    2.81          Set pbl_set = genhtml.loadFileList("pbl");
    2.82          index = pbl_set.size();
    2.83          Iterator pbl_it = pbl_set.iterator();
    2.84 @@ -116,8 +115,7 @@
    2.85              System.out.println("pbl to generate:" + (index--));
    2.86              genhtml.loadContent("pbl/" + pbl_it.next());
    2.87          }
    2.88 -        
    2.89 -        //fixed path ???
    2.90 +
    2.91          Set thy_set = genhtml.loadFileList("thy");
    2.92          index = thy_set.size();
    2.93          Iterator thy_it = thy_set.iterator();
    2.94 @@ -126,7 +124,6 @@
    2.95              genhtml.loadContent("thy/" + thy_it.next());
    2.96          }
    2.97  
    2.98 -        //fixed path ???
    2.99          Set met_set = genhtml.loadFileList("met");
   2.100          index = met_set.size();
   2.101          Iterator met_it = met_set.iterator();
   2.102 @@ -150,7 +147,7 @@
   2.103              DocumentBuilder db = dbf.newDocumentBuilder();
   2.104  
   2.105              InputSource inputsource = new InputSource(new StringReader(
   2.106 -                    //fixed path ???
   2.107 +            // fixed path ???
   2.108                      KEStoreCommunication.loadHierarchy("", type)));
   2.109              Document document = db.parse(inputsource);
   2.110  
   2.111 @@ -181,13 +178,10 @@
   2.112       */
   2.113      protected void buildHierarchy(String path) {
   2.114  
   2.115 -        String session = ""; ///FIXXXME why is here an empty
   2.116 +        String session = ""; // /FIXME why is here an empty
   2.117          // session ID??? -> Problem with
   2.118          // BrwoserDialog
   2.119          StringTokenizer tokens = new StringTokenizer(path, "/");
   2.120 -        //	(String)request.getSession().getAttribute("session_id");
   2.121 -        //	if(session==null)
   2.122 -        //	    session="";
   2.123          path = "";
   2.124          String type = tokens.nextToken();
   2.125  
   2.126 @@ -203,46 +197,53 @@
   2.127                  parameter.add(type);
   2.128                  Vector result;
   2.129                  Source xslSource = null;
   2.130 -                String hierarchy_string = KEStoreCommunication.loadHierarchy(session, type);
   2.131 -                hierarchy_string = hierarchy_string.replaceAll(".xml </CONTENTREF>"," </CONTENTREF>");
   2.132 -                Source xmlSource = new StreamSource(new StringReader(hierarchy_string));
   2.133 +                String hierarchy_string = KEStoreCommunication.loadHierarchy(
   2.134 +                        session, type);
   2.135 +                hierarchy_string = hierarchy_string.replaceAll(
   2.136 +                        ".xml </CONTENTREF>", " </CONTENTREF>");
   2.137 +                Source xmlSource = new StreamSource(new StringReader(
   2.138 +                        hierarchy_string));
   2.139  
   2.140                  if (type.equals("pbl"))
   2.141                      xslSource = new StreamSource(
   2.142 -                            //fixed path /isac/util/genhtml/templates/pbl_hierarchy_jmenu.xsl
   2.143 +                            // fixed path
   2.144 +                            // /isac/util/genhtml/templates/pbl_hierarchy_jmenu.xsl
   2.145                              getClass()
   2.146                                      .getResourceAsStream(
   2.147                                              "/isac/util/genhtml/templates/pbl_hierarchy_jmenu.xsl"));
   2.148                  else if (type.equals("met"))
   2.149                      xslSource = new StreamSource(
   2.150 -                            //fixed path /isac/util/genhtml/templates/met_hierarchy_jmenu.xsl
   2.151 +                            // fixed path
   2.152 +                            // /isac/util/genhtml/templates/met_hierarchy_jmenu.xsl
   2.153                              getClass()
   2.154                                      .getResourceAsStream(
   2.155                                              "/isac/util/genhtml/templates/met_hierarchy_jmenu.xsl"));
   2.156 -                
   2.157 +
   2.158                  else if (type.equals("thy"))
   2.159                      xslSource = new StreamSource(
   2.160 -                            //fixed path /isac/util/genhtml/templates/thy_hierarchy_jmenu.xsl
   2.161 +                            // fixed path
   2.162 +                            // /isac/util/genhtml/templates/thy_hierarchy_jmenu.xsl
   2.163                              getClass()
   2.164                                      .getResourceAsStream(
   2.165                                              "/isac/util/genhtml/templates/thy_hierarchy_jmenu.xsl"));
   2.166 -                
   2.167 +
   2.168                  else
   2.169                      xslSource = new StreamSource(
   2.170 -                            //fixed path /isac/util/genhtml/templates/exp_hierarchy_jmenu.xsl
   2.171 +                            // fixed path
   2.172 +                            // /isac/util/genhtml/templates/exp_hierarchy_jmenu.xsl
   2.173                              getClass()
   2.174                                      .getResourceAsStream(
   2.175                                              "/isac/util/genhtml/templates/exp_hierarchy_jmenu.xsl"));
   2.176 -                //fixed path /isac/util/genhtml/templates/codeheader.html
   2.177 +                // fixed path /isac/util/genhtml/templates/codeheader.html
   2.178                  String header = toString(getClass().getResourceAsStream(
   2.179                          "/isac/util/genhtml/templates/codeheader.html"));
   2.180 -                //fixed path /isac/util/genhtml/templates/codefooter.html
   2.181 +                // fixed path /isac/util/genhtml/templates/codefooter.html
   2.182                  String footer = toString(getClass().getResourceAsStream(
   2.183                          "/isac/util/genhtml/templates/codefooter.html"));
   2.184  
   2.185                  // Perform the transformation, sending the output to the
   2.186                  // response.
   2.187 -                //java.io.PrintWriter out = response.getWriter();
   2.188 +                // java.io.PrintWriter out = response.getWriter();
   2.189                  FileWriter out = new FileWriter(destination_ + type + "/"
   2.190                          + path);
   2.191                  out.write(header);
   2.192 @@ -261,7 +262,7 @@
   2.193                          path = "index_exp.html";
   2.194                  }
   2.195                  System.out.println(path);
   2.196 -                //fixed path /isac/util/genhtml/jscript/
   2.197 +                // fixed path /isac/util/genhtml/jscript/
   2.198                  InputStream istream = getClass().getResourceAsStream(
   2.199                          "/isac/util/genhtml/jscript/" + path);
   2.200                  FileWriter out = new FileWriter(destination_ + type + "/"
   2.201 @@ -299,9 +300,9 @@
   2.202  
   2.203      protected void loadFile(String path) {
   2.204          StringTokenizer tokens = new StringTokenizer(path, "/");
   2.205 -        //		(String)request.getSession().getAttribute("session_id");
   2.206 -        //		if(session==null)
   2.207 -        //			session="";
   2.208 +        // (String)request.getSession().getAttribute("session_id");
   2.209 +        // if(session==null)
   2.210 +        // session="";
   2.211          String session_id = "";
   2.212          path = "";
   2.213          String type = (String) tokens.nextToken();
   2.214 @@ -347,7 +348,7 @@
   2.215                  Encoder.encodeHContent(type, xmlSource, out);
   2.216                  return;
   2.217              }
   2.218 -            //TODO this type should not result in different files but in an
   2.219 +            // TODO this type should not result in different files but in an
   2.220              // autogeneration of a fitting file
   2.221              if (path.trim().endsWith("index.html")) {
   2.222                  if (type.equals("pbl")) {
   2.223 @@ -360,7 +361,7 @@
   2.224                      path = "index_exp.html";
   2.225              }
   2.226              InputStream istream = getClass().getResourceAsStream(
   2.227 -                    //fixed path /isac/BrowserServlet/jscript/ OUT OF DATE
   2.228 +            // fixed path /isac/BrowserServlet/jscript/ OUT OF DATE
   2.229                      "/isac/BrowserServlet/jscript/" + path);
   2.230              java.io.FileWriter out = new FileWriter(destination_ + type + "/"
   2.231                      + path);
   2.232 @@ -400,10 +401,10 @@
   2.233  
   2.234      protected void loadContent(String path) {
   2.235  
   2.236 -    	if(!path.endsWith(".xml"))
   2.237 -    		path += ".xml";
   2.238 -    	//if(!path.startsWith("thy_isac_RootEq-rls"))
   2.239 -    	//	return;
   2.240 +        if (!path.endsWith(".xml"))
   2.241 +            path += ".xml";
   2.242 +        // if(!path.startsWith("thy_isac_RootEq-rls"))
   2.243 +        // return;
   2.244          StringTokenizer tokens = new StringTokenizer(path, "/");
   2.245          String session = "";
   2.246  
   2.247 @@ -418,7 +419,7 @@
   2.248              Source xmlSource_nomodel = null;
   2.249  
   2.250              String command = tokens.nextToken();
   2.251 -         
   2.252 +
   2.253              String header = "<HTML xmlns=\"http://www.w3.org/1999/xhtml\"\n"
   2.254                      + "xmlns:math=\"http://www.w3.org/1998/Math/MathML\"\n"
   2.255                      + "xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n";
   2.256 @@ -427,7 +428,7 @@
   2.257              FileWriter out_author;
   2.258              FileWriter out_nomodel;
   2.259  
   2.260 -            //removing the ".xml" from the PathString
   2.261 +            // removing the ".xml" from the PathString
   2.262              String file_name = path.substring(0, path.length() - 4);
   2.263  
   2.264              parameter.add(command);
   2.265 @@ -444,16 +445,17 @@
   2.266                  return;
   2.267              }
   2.268  
   2.269 +            // System.out.println("destination_:" + destination_);
   2.270              out = new FileWriter(destination_ + file_name + ".html");
   2.271              out_author = new FileWriter(destination_ + file_name
   2.272                      + "_author.html");
   2.273              out_nomodel = new FileWriter(destination_ + file_name
   2.274                      + "_nomodel.html");
   2.275 -            
   2.276 -            //loading the content from the xml
   2.277 +
   2.278 +            // loading the content from the xml
   2.279              String result = KEStoreCommunication.loadContent(session, command,
   2.280                      contentfile);
   2.281 -              
   2.282 +
   2.283              if (result.startsWith("ERROR")) {
   2.284                  result = result.substring(5, result.length());
   2.285                  try {
   2.286 @@ -465,84 +467,93 @@
   2.287                      e1.printStackTrace();
   2.288                  }
   2.289              }
   2.290 -                        
   2.291 -            xmlSource = new StreamSource(new StringReader(result));            
   2.292 +
   2.293 +            xmlSource = new StreamSource(new StringReader(result));
   2.294              xmlSource_author = new StreamSource(new StringReader(result));
   2.295              xmlSource_nomodel = new StreamSource(new StringReader(result));
   2.296  
   2.297 -            //deciding which stylesheet to use
   2.298 +            // deciding which stylesheet to use
   2.299              if (contentfile.trim().startsWith("pbl")) {
   2.300                  xslSource = new StreamSource(getClass().getResourceAsStream(
   2.301 -                        //fixed path /isac/util/genhtml/templates/pbl_node_content.xsl
   2.302 +                // fixed path /isac/util/genhtml/templates/pbl_node_content.xsl
   2.303                          "/isac/util/genhtml/templates/pbl_node_content.xsl"));
   2.304                  xslSource_author = new StreamSource(
   2.305                          getClass()
   2.306                                  .getResourceAsStream(
   2.307 -                                        //fixed path /isac/util/genhtml/templates/pbl_node_content_author.xsl
   2.308 +                                // fixed path
   2.309 +                                        // /isac/util/genhtml/templates/pbl_node_content_author.xsl
   2.310                                          "/isac/util/genhtml/templates/pbl_node_content_author.xsl"));
   2.311                  xslSource_nomodel = new StreamSource(
   2.312                          getClass()
   2.313                                  .getResourceAsStream(
   2.314 -                                        //fixed path /isac/util/genhtml/templates/pbl_node_content_author.xsl
   2.315 +                                // fixed path
   2.316 +                                        // /isac/util/genhtml/templates/pbl_node_content_author.xsl
   2.317                                          "/isac/util/genhtml/templates/pbl_node_content_nomodel.xsl"));
   2.318 -                
   2.319 +
   2.320                  // generating the nomodel html from the pbl
   2.321                  out_nomodel.write(header);
   2.322 -                Encoder.encodeInformation(xslSource_nomodel, xmlSource_nomodel, out_nomodel);
   2.323 +                Encoder.encodeInformation(xslSource_nomodel, xmlSource_nomodel,
   2.324 +                        out_nomodel);
   2.325                  out_nomodel.close();
   2.326  
   2.327              }
   2.328  
   2.329              else if (contentfile.trim().startsWith("met")) {
   2.330                  xslSource = new StreamSource(getClass().getResourceAsStream(
   2.331 -                        //fixed path /isac/util/genhtml/templates/met_node_content.xsl
   2.332 +                // fixed path /isac/util/genhtml/templates/met_node_content.xsl
   2.333                          "/isac/util/genhtml/templates/met_node_content.xsl"));
   2.334                  xslSource_author = new StreamSource(
   2.335                          getClass()
   2.336                                  .getResourceAsStream(
   2.337 -                                        //fixed path /isac/util/genhtml/templates/met_node_content_author.xsl
   2.338 +                                // fixed path
   2.339 +                                        // /isac/util/genhtml/templates/met_node_content_author.xsl
   2.340                                          "/isac/util/genhtml/templates/met_node_content_author.xsl"));
   2.341                  xslSource_nomodel = new StreamSource(
   2.342                          getClass()
   2.343 -                        .getResourceAsStream(
   2.344 -                                //fixed path /isac/util/genhtml/templates/pbl_node_content_author.xsl
   2.345 -                        "/isac/util/genhtml/templates/met_node_content_nomodel.xsl"));
   2.346 -                	
   2.347 +                                .getResourceAsStream(
   2.348 +                                // fixed path
   2.349 +                                        // /isac/util/genhtml/templates/pbl_node_content_author.xsl
   2.350 +                                        "/isac/util/genhtml/templates/met_node_content_nomodel.xsl"));
   2.351 +
   2.352                  // generating the nomodel html from the met
   2.353                  out_nomodel.write(header);
   2.354 -                Encoder.encodeInformation(xslSource_nomodel, xmlSource_nomodel, out_nomodel);
   2.355 +                Encoder.encodeInformation(xslSource_nomodel, xmlSource_nomodel,
   2.356 +                        out_nomodel);
   2.357                  out_nomodel.close();
   2.358 -            }
   2.359 -            else if (contentfile.trim().startsWith("thy")) {
   2.360 +            } else if (contentfile.trim().startsWith("thy")) {
   2.361                  xslSource = new StreamSource(getClass().getResourceAsStream(
   2.362 -                        //fixed path /isac/util/genhtml/templates/thy_node_content.xsl
   2.363 +                // fixed path /isac/util/genhtml/templates/thy_node_content.xsl
   2.364                          "/isac/util/genhtml/templates/thy_node_content.xsl"));
   2.365                  xslSource_author = new StreamSource(
   2.366                          getClass()
   2.367                                  .getResourceAsStream(
   2.368 -                                        //fixed path /isac/util/genhtml/templates/thy_node_content_author.xsl
   2.369 +                                // fixed path
   2.370 +                                        // /isac/util/genhtml/templates/thy_node_content_author.xsl
   2.371                                          "/isac/util/genhtml/templates/thy_node_content_author.xsl"));
   2.372                  xslSource_nomodel = new StreamSource(
   2.373                          getClass()
   2.374 -                        .getResourceAsStream(
   2.375 -                                //fixed path /isac/util/genhtml/templates/thy_node_content_author.xsl
   2.376 -                        "/isac/util/genhtml/templates/thy_node_content_nomodel.xsl"));
   2.377 -                	
   2.378 +                                .getResourceAsStream(
   2.379 +                                // fixed path
   2.380 +                                        // /isac/util/genhtml/templates/thy_node_content_author.xsl
   2.381 +                                        "/isac/util/genhtml/templates/thy_node_content_nomodel.xsl"));
   2.382 +
   2.383                  // generating the nomodel html from the thy
   2.384                  out_nomodel.write(header);
   2.385 -                Encoder.encodeInformation(xslSource_nomodel, xmlSource_nomodel, out_nomodel);
   2.386 +                Encoder.encodeInformation(xslSource_nomodel, xmlSource_nomodel,
   2.387 +                        out_nomodel);
   2.388                  out_nomodel.close();
   2.389              }
   2.390  
   2.391              else if (contentfile.trim().startsWith("exp")) {
   2.392                  xslSource = new StreamSource(getClass().getResourceAsStream(
   2.393 -                        //fixed path /isac/util/genhtml/templates/exp_node_content.xsl
   2.394 +                // fixed path /isac/util/genhtml/templates/exp_node_content.xsl
   2.395                          "/isac/util/genhtml/templates/exp_node_content.xsl"));
   2.396                  xslSource_author = new StreamSource(
   2.397                          getClass()
   2.398                                  .getResourceAsStream(
   2.399 -                                        //fixed path /isac/util/genhtml/templates/exp_node_content_author.xsl
   2.400 -                                       "/isac/util/genhtml/templates/exp_node_content_author.xsl"));
   2.401 +                                // fixed path
   2.402 +                                        // /isac/util/genhtml/templates/exp_node_content_author.xsl
   2.403 +                                        "/isac/util/genhtml/templates/exp_node_content_author.xsl"));
   2.404              }
   2.405  
   2.406              // Perform the transformation, sending the output to the response.
   2.407 @@ -557,7 +568,7 @@
   2.408          } catch (IOException exc) {
   2.409              exc.printStackTrace();
   2.410          }
   2.411 -        //	arg1.getWriter().print("pathinfo: "+arg0.getPathInfo()+"\n
   2.412 +        // arg1.getWriter().print("pathinfo: "+arg0.getPathInfo()+"\n
   2.413          // transl:"+arg0.getPathTranslated());
   2.414      }
   2.415  
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/src/java/isac/util/genhtml/GenHTMLsingle.java	Sun Aug 24 20:19:56 2008 +0200
     3.3 @@ -0,0 +1,96 @@
     3.4 +/*
     3.5 + * @author Walther Neuper
     3.6 + * Created on Aug 24 2008
     3.7 + *  
     3.8 + */
     3.9 +package isac.util.genhtml;
    3.10 +
    3.11 +import isac.util.GenHTMLsinglePaths;
    3.12 +import isac.util.KEStorePaths;
    3.13 +
    3.14 +import java.io.FileInputStream;
    3.15 +import java.io.FileNotFoundException;
    3.16 +import java.io.FileWriter;
    3.17 +import java.io.IOException;
    3.18 +import java.io.InputStream;
    3.19 +import java.util.Properties;
    3.20 +
    3.21 +/**
    3.22 + * check one xml-file specified in the properties and, if ok, generate the
    3.23 + * respective html-files using the KEStore.properties.
    3.24 + * 
    3.25 + * !!!!! start KEStore before running GenHTML !!!!!
    3.26 + */
    3.27 +public class GenHTMLsingle {
    3.28 +
    3.29 +    private static FileWriter error_log;
    3.30 +
    3.31 +    public static void main(String[] args) {
    3.32 +
    3.33 +        // read arguments of main
    3.34 +        if (args.length != 1) {
    3.35 +            System.out.println("invalid arguments for GenHTMLsingle#main()"
    3.36 +                    + " - SYSTEM EXITING");
    3.37 +            System.exit(1);
    3.38 +        }
    3.39 +
    3.40 +        // read the one argument, which is the property-file
    3.41 +        Properties properties = new Properties();
    3.42 +        InputStream is = null;
    3.43 +
    3.44 +        try {
    3.45 +            is = new FileInputStream(args[0]);
    3.46 +        } catch (FileNotFoundException e1) {
    3.47 +            is = GenHTMLsingle.class.getResourceAsStream(args[0]);
    3.48 +        }
    3.49 +
    3.50 +        if (is == null) {
    3.51 +            System.err.println("No property file found! - SYSTEM EXITING");
    3.52 +            System.exit(-1);
    3.53 +        }
    3.54 +
    3.55 +        try {
    3.56 +            properties.load(is);
    3.57 +        } catch (IOException e) {
    3.58 +            e.printStackTrace();
    3.59 +        }
    3.60 +
    3.61 +        String filename = "";
    3.62 +        if ((GenHTMLsinglePaths.FILE_TO_CHECK = properties
    3.63 +                .getProperty("FILE_TO_CHECK")) == null) {
    3.64 +            System.err
    3.65 +                    .println("No value for FILE_TO_CHECK found in property-file"
    3.66 +                            + " - SYSTEM EXITING");
    3.67 +            System.exit(-1);
    3.68 +        } else {
    3.69 +            filename = GenHTMLsinglePaths.FILE_TO_CHECK;
    3.70 +            if (!filename.endsWith(".xml")) {
    3.71 +                System.err.println("No XML-file: " + filename
    3.72 +                        + " - SYSTEM EXITING");
    3.73 +                System.exit(-1);
    3.74 +                filename = filename.substring(0, filename.length() - 4);
    3.75 +            }
    3.76 +        }
    3.77 +
    3.78 +        // destination for reporting HTML-errors in the xml-file
    3.79 +        GenHTML genhtml = new GenHTML();
    3.80 +        try {
    3.81 +            error_log = new FileWriter(KEStorePaths.GENHTML_DESTINATON_PATH
    3.82 +                    + "GENHTML_error-" + filename.replaceAll(".xml", ".txt"));
    3.83 +        } catch (IOException e) {
    3.84 +            e.printStackTrace();
    3.85 +        }
    3.86 +
    3.87 +        // check the xml-file using all other properties from KEStore.properties
    3.88 +        String type = filename.substring(0, 3);// exp | met | pbl | thy
    3.89 +        System.out.println(type + " to generate:");
    3.90 +        genhtml.loadContent(type + "/" + filename);
    3.91 +
    3.92 +        try {
    3.93 +            error_log.close();
    3.94 +        } catch (IOException e1) {
    3.95 +            e1.printStackTrace();
    3.96 +        }
    3.97 +    }
    3.98 +
    3.99 +}
   3.100 \ No newline at end of file