1 23 24 package com.sun.enterprise.cli.commands; 25 26 import java.util.Iterator ; 27 import java.util.Vector ; 28 import java.util.Hashtable ; 29 import java.util.Collections ; 30 import java.util.Enumeration ; 31 import java.lang.Character ; 32 33 import com.sun.enterprise.cli.framework.*; 34 35 36 42 public class CompileCLICommands 43 { 44 public static void main(String [] args) 45 { 46 try 47 { 48 CLIDescriptorsReader cdr = CLIDescriptorsReader.getInstance(); 49 ValidCommandsList vcl = cdr.getCommandsList(); 50 Iterator commands = vcl.getCommands(); 51 printHTMLHeader(); 52 53 Hashtable ht = new Hashtable (); 54 while (commands.hasNext()) 55 { 56 ValidCommand command = (ValidCommand)commands.next(); 57 ht.put(command.getName(), command.getUsageText()); 59 } 60 61 Vector v = new Vector (ht.keySet()); 62 Collections.sort(v); 64 65 printHTMLCommands(v); 66 printHTMLUsageText(v, ht); 67 68 74 75 printHTMLFooter(); 76 } 77 catch (Exception e) 78 { 79 e.printStackTrace(); 80 } 81 } 82 83 private static int printCommands(Vector commands, int ii, char ch) 84 { 85 System.out.println("<a name='" + ch + "'/>"); 86 System.out.println("<B>" + Character.toUpperCase(ch) + "</B><br>"); 87 while ( ii<commands.size() && 88 ((String )commands.get(ii)).charAt(0) == ch) 89 { 90 System.out.print("<a HREF='#"); 91 System.out.println((String )commands.get(ii) + "'>" + 92 (String )commands.get(ii++) + "</a> <br>"); 93 } 94 System.out.println("<a HREF='#top'>top</a> <br><br>"); 95 return ii; 96 } 97 98 99 public static void printHTMLCommands(Vector commands) 100 { 101 for (int ii=0; ii+1<commands.size();) 102 { 103 String commandName = (String )commands.get(ii); 104 105 if (commandName.charAt(0) == 'a') 106 ii = printCommands(commands, ii, 'a'); 107 else if (commandName.charAt(0) == 'b') 108 ii = printCommands(commands, ii, 'b'); 109 else if (commandName.charAt(0) == 'c') 110 ii = printCommands(commands, ii, 'c'); 111 else if (commandName.charAt(0) == 'd') 112 ii = printCommands(commands, ii, 'd'); 113 else if (commandName.charAt(0) == 'e') 114 ii = printCommands(commands, ii, 'e'); 115 else if (commandName.charAt(0) == 'f') 116 ii = printCommands(commands, ii, 'f'); 117 else if (commandName.charAt(0) == 'g') 118 ii = printCommands(commands, ii, 'g'); 119 else if (commandName.charAt(0) == 'h') 120 ii = printCommands(commands, ii, 'h'); 121 else if (commandName.charAt(0) == 'i') 122 ii = printCommands(commands, ii, 'i'); 123 else if (commandName.charAt(0) == 'j') 124 ii = printCommands(commands, ii, 'j'); 125 else if (commandName.charAt(0) == 'k') 126 ii = printCommands(commands, ii, 'k'); 127 else if (commandName.charAt(0) == 'l') 128 ii = printCommands(commands, ii, 'l'); 129 else if (commandName.charAt(0) == 'm') 130 ii = printCommands(commands, ii, 'm'); 131 else if (commandName.charAt(0) == 'n') 132 ii = printCommands(commands, ii, 'n'); 133 else if (commandName.charAt(0) == 'o') 134 ii = printCommands(commands, ii, 'o'); 135 else if (commandName.charAt(0) == 'p') 136 ii = printCommands(commands, ii, 'p'); 137 else if (commandName.charAt(0) == 'q') 138 ii = printCommands(commands, ii, 'q'); 139 else if (commandName.charAt(0) == 'r') 140 ii = printCommands(commands, ii, 'r'); 141 else if (commandName.charAt(0) == 's') 142 ii = printCommands(commands, ii, 's'); 143 else if (commandName.charAt(0) == 't') 144 ii = printCommands(commands, ii, 't'); 145 else if (commandName.charAt(0) == 'u') 146 ii = printCommands(commands, ii, 'u'); 147 else if (commandName.charAt(0) == 'v') 148 ii = printCommands(commands, ii, 'v'); 149 else if (commandName.charAt(0) == 'w') 150 ii = printCommands(commands, ii, 'w'); 151 else if (commandName.charAt(0) == 'x') 152 ii = printCommands(commands, ii, 'x'); 153 else if (commandName.charAt(0) == 'y') 154 ii = printCommands(commands, ii, 'y'); 155 else if (commandName.charAt(0) == 'z') 156 ii = printCommands(commands, ii, 'z'); 157 158 } 159 } 160 161 162 private static int printUsageText(Vector commands, Hashtable ht, 163 int ii, char ch) 164 { 165 while ( ii<commands.size() && 166 ((String )commands.get(ii)).charAt(0) == ch) 167 { 168 final String commandName = (String )commands.get(ii++); 169 System.out.println("<a name='"+commandName+"'/>"); 170 System.out.println((String )ht.get(commandName) + " <br><br>"); 171 } 172 return ii; 173 } 174 175 176 177 public static void printHTMLUsageText(Vector commands, Hashtable ht) 178 { 179 System.out.println("<a name='usagetext'/>"); 180 System.out.println("<br><B>Usage Text</B><br><br>"); 181 182 for (int ii=0; ii+1<commands.size();) 183 { 184 String commandName = (String )commands.get(ii); 185 if (commandName.charAt(0) == 'a') 186 ii= printUsageText(commands, ht, ii, 'a'); 187 else if (commandName.charAt(0) == 'b') 188 ii =printUsageText(commands, ht, ii, 'b'); 189 else if (commandName.charAt(0) == 'c') 190 ii =printUsageText(commands, ht, ii, 'c'); 191 else if (commandName.charAt(0) == 'd') 192 ii =printUsageText(commands, ht, ii, 'd'); 193 else if (commandName.charAt(0) == 'e') 194 ii =printUsageText(commands, ht, ii, 'e'); 195 else if (commandName.charAt(0) == 'f') 196 ii =printUsageText(commands, ht, ii, 'f'); 197 else if (commandName.charAt(0) == 'g') 198 ii =printUsageText(commands, ht, ii, 'g'); 199 else if (commandName.charAt(0) == 'h') 200 ii =printUsageText(commands, ht, ii, 'h'); 201 else if (commandName.charAt(0) == 'i') 202 ii =printUsageText(commands, ht, ii, 'i'); 203 else if (commandName.charAt(0) == 'j') 204 ii =printUsageText(commands, ht, ii, 'j'); 205 else if (commandName.charAt(0) == 'k') 206 ii =printUsageText(commands, ht, ii, 'k'); 207 else if (commandName.charAt(0) == 'l') 208 ii =printUsageText(commands, ht, ii, 'l'); 209 else if (commandName.charAt(0) == 'm') 210 ii =printUsageText(commands, ht, ii, 'm'); 211 else if (commandName.charAt(0) == 'n') 212 ii =printUsageText(commands, ht, ii, 'n'); 213 else if (commandName.charAt(0) == 'o') 214 ii =printUsageText(commands, ht, ii, 'o'); 215 else if (commandName.charAt(0) == 'p') 216 ii =printUsageText(commands, ht, ii, 'p'); 217 else if (commandName.charAt(0) == 'q') 218 ii =printUsageText(commands, ht, ii, 'q'); 219 else if (commandName.charAt(0) == 'r') 220 ii =printUsageText(commands, ht, ii, 'r'); 221 else if (commandName.charAt(0) == 's') 222 ii =printUsageText(commands, ht, ii, 's'); 223 else if (commandName.charAt(0) == 't') 224 ii =printUsageText(commands, ht, ii, 't'); 225 else if (commandName.charAt(0) == 'u') 226 ii =printUsageText(commands, ht, ii, 'u'); 227 else if (commandName.charAt(0) == 'v') 228 ii =printUsageText(commands, ht, ii, 'v'); 229 else if (commandName.charAt(0) == 'w') 230 ii =printUsageText(commands, ht, ii, 'w'); 231 else if (commandName.charAt(0) == 'x') 232 ii =printUsageText(commands, ht, ii, 'x'); 233 else if (commandName.charAt(0) == 'y') 234 ii =printUsageText(commands, ht, ii, 'y'); 235 else if (commandName.charAt(0) == 'z') 236 ii =printUsageText(commands, ht, ii, 'z'); 237 } 238 System.out.println("<a HREF='#top'>top</a> <br><br>"); 239 } 240 241 242 243 public static void printHTMLHeader() 244 { 245 System.out.println("<html>"); 246 System.out.println("<h2 align=center>asadmin commands list</h2>"); 247 System.out.println("<p align=center>"); 248 System.out.println("<a HREF='http://appserver.red.iplanet.com/apollo/cli/s1as8ee_cli_commands.html'>8.1 EE CLI Commands -- Dev Page</a> </p>"); 249 System.out.println("<a name='top'/>"); 250 System.out.println("[<a HREF='#a'>a</a>],"); 251 System.out.println("[<a HREF='#b'>b</a>],"); 252 System.out.println("[<a HREF='#c'>c</a>],"); 253 System.out.println("[<a HREF='#d'>d</a>],"); 254 System.out.println("[<a HREF='#e'>e</a>],"); 255 System.out.println("[<a HREF='#f'>f</a>],"); 256 System.out.println("[<a HREF='#g'>g</a>],"); 257 System.out.println("[<a HREF='#h'>h</a>],"); 258 System.out.println("[<a HREF='#i'>i</a>],"); 259 System.out.println("[<a HREF='#j'>j</a>],"); 260 System.out.println("[<a HREF='#k'>k</a>],"); 261 System.out.println("[<a HREF='#l'>l</a>],"); 262 System.out.println("[<a HREF='#m'>m</a>],"); 263 System.out.println("[<a HREF='#n'>n</a>],"); 264 System.out.println("[<a HREF='#o'>o</a>],"); 265 System.out.println("[<a HREF='#p'>p</a>],"); 266 System.out.println("[<a HREF='#q'>q</a>],"); 267 System.out.println("[<a HREF='#r'>r</a>],"); 268 System.out.println("[<a HREF='#s'>s</a>],"); 269 System.out.println("[<a HREF='#t'>t</a>],"); 270 System.out.println("[<a HREF='#u'>u</a>],"); 271 System.out.println("[<a HREF='#v'>v</a>],"); 272 System.out.println("[<a HREF='#w'>w</a>],"); 273 System.out.println("[<a HREF='#x'>x</a>],"); 274 System.out.println("[<a HREF='#y'>y</a>],"); 275 System.out.println("[<a HREF='#z'>z</a>],"); 276 System.out.println("[<a HREF='#usagetext'>Usage Text</a>] <br><br>"); 277 } 278 279 public static void printHTMLFooter() 280 { 281 System.out.println("</html>"); 282 } 283 284 285 286 } 287 | Popular Tags |