Class PropertiesToAsciidoc


  • public class PropertiesToAsciidoc
    extends java.lang.Object
    Iterates over all concrete Protocol classes and creates tables with Protocol's properties. These tables are in turn then merged into asciidoc. Iterates over unsupported and experimental classes and creates tables listing those classes. These tables are in turn then merged into asciidoc.
    Author:
    Vladimir Blagojevic, Bela Ban
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static java.lang.String ROOT_PACKAGE  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      protected static void convertUnsupportedToAsciidocTable​(java.util.Properties props, java.util.List<java.lang.Class<?>> clazzes, java.lang.String title)  
      static int copy​(java.io.Reader input, java.io.Writer output)  
      protected static java.lang.String createAsciidocTable​(java.util.List<java.lang.String[]> rows, java.lang.String title, java.lang.String header)
      Creates an AsciiDoc table of the elements in rows.
      protected static void getDescriptions​(java.lang.Class<?> clazz, java.util.Map<java.lang.String,​java.lang.String> m, java.lang.String prefix, boolean print_class)  
      static void main​(java.lang.String[] args)  
      protected static java.lang.String readUntilBracket​(java.io.InputStream in)
      Reads until the next bracket '}' and returns the string excluding the bracket, or throws an exception if no bracket has been found
      protected static void replaceVariables​(java.io.InputStream in, java.io.OutputStream out, java.util.Properties p)
      Reads from the input stream and replaces occurrences of ${PROT} with p.get("PROT") and writes this to the output stream.
      protected static void writeVarToStream​(java.lang.String var, java.util.Properties p, java.io.OutputStream out)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PropertiesToAsciidoc

        public PropertiesToAsciidoc()
    • Method Detail

      • main

        public static void main​(java.lang.String[] args)
      • convertUnsupportedToAsciidocTable

        protected static void convertUnsupportedToAsciidocTable​(java.util.Properties props,
                                                                java.util.List<java.lang.Class<?>> clazzes,
                                                                java.lang.String title)
                                                         throws javax.xml.parsers.ParserConfigurationException,
                                                                javax.xml.transform.TransformerException
        Throws:
        javax.xml.parsers.ParserConfigurationException
        javax.xml.transform.TransformerException
      • createAsciidocTable

        protected static java.lang.String createAsciidocTable​(java.util.List<java.lang.String[]> rows,
                                                              java.lang.String title,
                                                              java.lang.String header)
                                                       throws javax.xml.parsers.ParserConfigurationException,
                                                              javax.xml.transform.TransformerException
        Creates an AsciiDoc table of the elements in rows. The first tuple needs to be the column names, the rest the contents
        Throws:
        javax.xml.parsers.ParserConfigurationException
        javax.xml.transform.TransformerException
      • getDescriptions

        protected static void getDescriptions​(java.lang.Class<?> clazz,
                                              java.util.Map<java.lang.String,​java.lang.String> m,
                                              java.lang.String prefix,
                                              boolean print_class)
                                       throws java.io.IOException,
                                              java.lang.ClassNotFoundException
        Throws:
        java.io.IOException
        java.lang.ClassNotFoundException
      • replaceVariables

        protected static void replaceVariables​(java.io.InputStream in,
                                               java.io.OutputStream out,
                                               java.util.Properties p)
        Reads from the input stream and replaces occurrences of ${PROT} with p.get("PROT") and writes this to the output stream. If no value is found, then the ${PROT} will simple be omitted from the output. Escaped values of the form \${PROT} are not looked up and the value without the backslash will be written to the output stream.
      • writeVarToStream

        protected static void writeVarToStream​(java.lang.String var,
                                               java.util.Properties p,
                                               java.io.OutputStream out)
                                        throws java.io.IOException
        Throws:
        java.io.IOException
      • readUntilBracket

        protected static java.lang.String readUntilBracket​(java.io.InputStream in)
                                                    throws java.io.IOException
        Reads until the next bracket '}' and returns the string excluding the bracket, or throws an exception if no bracket has been found
        Throws:
        java.io.IOException
      • copy

        public static int copy​(java.io.Reader input,
                               java.io.Writer output)
                        throws java.io.IOException
        Throws:
        java.io.IOException