1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | package Torello.Java.Build; import static Torello.Java.C.*; import Torello.Java.*; import java.io.IOException; import java.io.File; public class Logs { // ******************************************************************************************** // ******************************************************************************************** // Fields // ******************************************************************************************** // ******************************************************************************************** // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** // The only non-static / instance field // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** final String LOG_DIR; // This is not private, because the actual file-writing is done inside JavaDoc-Upgrader itself static final String S03_UPGRADER = "Stage03-JavaDocUpgrader.log.html"; // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** // All of the Log File-Names // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** private static final String S01_SB = "Stage01-javac.sb.txt"; private static final String S01_STD_OUT = "Stage01-javac.stdOut.txt"; private static final String S01_STD_ERR = "Stage01-javac.stdErr.txt"; private static final String S02_SB = "Stage02-javadoc.sb.html"; //txt"; private static final String S02_STD_OUT = "Stage02-javadoc.stdOut.txt"; private static final String S02_STD_ERR = "Stage02-javadoc.stdErr.txt"; private static final String S03_SB = "Stage03-Other.log.html"; private static final String S04_TAR_SB = "Stage04-tar.sb.txt"; private static final String S04_JAR_SB = "Stage04-jar.sb.html"; // txt"; private static final String S05_SYNC_JD_SB = "Stage05-sync-JavaDoc.sb.txt"; private static final String S06_SYNC_TAR_JAR_SB = "Stage06-sync-TarJar.sb.txt"; private static final String S08_SMA_SB = "Stage08-SMA.sb.txt"; // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** // Short Printer Helpers // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** private static final String MESSAGE_FIRST_HALF = '\n' + Printing.LOG_LINE + '\n' + BCYAN_BKGND + " " + RESET + " Write Stage 0"; private static final String MESSAGE_SECOND_HALF = " Logs" + StringParse.nChars(' ', Printing.LEN - "* Write Stage 0x Logs".length() - 1) + BCYAN_BKGND + " " + RESET + '\n' + Printing.LOG_LINE; // ******************************************************************************************** // ******************************************************************************************** // Constructor // ******************************************************************************************** // ******************************************************************************************** Logs(final String LOG_DIR) { this.LOG_DIR = LOG_DIR; } // ******************************************************************************************** // ******************************************************************************************** // Helper Methods // ******************************************************************************************** // ******************************************************************************************** private String openStars(int stepNumber) { return MESSAGE_FIRST_HALF + stepNumber + MESSAGE_SECOND_HALF; } private void printFileName(String fileName) { fileName = LOG_DIR + fileName; System.out.println( BCYAN_BKGND + " " + RESET + " Writing File: " + BYELLOW + fileName + RESET + // "* Writing File: ".length() ==> 16 // NOTE: The extra '-1' is to put the closing '*' on the last character, not after it! StringParse.nChars(' ', Printing.LEN - 16 - 1 - fileName.length()) + BCYAN_BKGND + " " + RESET ); } // ******************************************************************************************** // ******************************************************************************************** // Primary Log Writing Methods // ******************************************************************************************** // ******************************************************************************************** void write_S01_LOGS(String sb, String stdOut, String stdErr) throws IOException { System.out.println(openStars(1)); printFileName(S01_SB); FileRW.writeFile(sb, LOG_DIR + S01_SB); printFileName(S01_STD_OUT); FileRW.writeFile(stdOut, LOG_DIR + S01_STD_OUT); printFileName(S01_STD_ERR); FileRW.writeFile(stdErr, LOG_DIR + S01_STD_ERR); System.out.println(Printing.LOG_LINE); System.out.println(); } void write_S02_LOGS(String sb, String stdOut, String stdErr) throws IOException { System.out.println(openStars(2)); printFileName(S02_SB); sb = C.toHTML(sb, true, true, "Stage 2: javadoc"); FileRW.writeFile(sb, LOG_DIR + S02_SB); printFileName(S02_STD_OUT); FileRW.writeFile(stdOut, LOG_DIR + S02_STD_OUT); printFileName(S02_STD_ERR); FileRW.writeFile(stdErr, LOG_DIR + S02_STD_ERR); System.out.println(Printing.LOG_LINE); System.out.println(); } void write_S03_LOGS(String sb) throws IOException { System.out.println(openStars(3)); printFileName(S03_SB); sb = C.toHTML(sb, true, true, "Misc JavaDoc Upgrader Extras"); FileRW.writeFile(sb, LOG_DIR + S03_SB); System.out.println(Printing.LOG_LINE); System.out.println(); } void write_S04_LOGS(String tarLog, String jarLog) throws IOException { System.out.println(openStars(4)); printFileName(S04_TAR_SB); FileRW.writeFile(tarLog, LOG_DIR + S04_TAR_SB); printFileName(S04_JAR_SB); jarLog = C.toHTML(jarLog, true, true, "Stage 4: jar "); FileRW.writeFile(jarLog, LOG_DIR + S04_JAR_SB); System.out.println(Printing.LOG_LINE); System.out.println(); } void write_S05_LOG(String sb) throws IOException { System.out.println(openStars(5)); printFileName(S05_SYNC_JD_SB); FileRW.writeFile(sb, LOG_DIR + S05_SYNC_JD_SB); System.out.println(Printing.LOG_LINE); System.out.println(); } void write_S06_LOG(String sb) throws IOException { System.out.println(openStars(6)); printFileName(S06_SYNC_TAR_JAR_SB); FileRW.writeFile(sb, LOG_DIR + S06_SYNC_TAR_JAR_SB); System.out.println(Printing.LOG_LINE); System.out.println(); } void write_S08_LOG(String sb) throws IOException { System.out.println(openStars(8)); printFileName(S08_SMA_SB); FileRW.writeFile(sb, LOG_DIR + S08_SMA_SB); System.out.println(Printing.LOG_LINE); System.out.println(); } } |