1 19 20 package org.apache.excalibur.instrument.manager.http; 21 22 import java.io.IOException ; 23 import java.io.PrintWriter ; 24 import java.util.Map ; 25 26 import org.apache.excalibur.instrument.manager.DefaultInstrumentManager; 27 import org.apache.excalibur.instrument.manager.InstrumentableDescriptor; 28 29 35 public class HTMLInstrumentManagerHandler 36 extends AbstractHTMLHandler 37 { 38 41 47 public HTMLInstrumentManagerHandler( DefaultInstrumentManager manager, 48 InstrumentManagerHTTPConnector connector ) 49 { 50 super( "/instrument-manager.html", manager, connector ); 51 } 52 53 56 63 public void doGet( String path, Map parameters, PrintWriter out ) 64 throws IOException 65 { 66 long oldMemory = getLongParameter( parameters, "oldMemory", 0 ); 67 long newMemory = getLongParameter( parameters, "newMemory", 0 ); 68 69 String gcLabel = "<a HREF='gc.html'>Perform Garbage Collection</a>"; 70 if ( ( oldMemory != 0 ) && ( newMemory != 0 ) ) 71 { 72 gcLabel = gcLabel + " (Freed: " + ( oldMemory - newMemory ) + "bytes. " 73 + "Now " + newMemory + " bytes."; 74 } 75 76 out.println( "<html>" ); 78 out.println( "<head><title>" + getInstrumentManager().getDescription() 79 + "</title></head>" ); 80 out.println( "<body>" ); 81 82 breadCrumbs( out, false ); 83 84 85 out.println( "<h2>Instrument Manager</h2>" ); 86 startTable( out ); 87 tableRow( out, 0, "Name", getInstrumentManager().getName() ); 88 tableRow( out, 0, "Description", getInstrumentManager().getDescription() ); 89 90 if ( !getConnector().isReadOnly() ) 91 { 92 tableRow( out, 0, "GC", gcLabel ); 93 } 94 95 endTable( out ); 96 97 InstrumentableDescriptor[] instrumentables = 98 getInstrumentManager().getInstrumentableDescriptors(); 99 if ( instrumentables.length > 0 ) 100 { 101 out.println( "<h2>Instrumentables</h2>" ); 102 outputInstrumentables( out, instrumentables ); 103 } 104 105 footer( out ); 106 107 out.println( "</body>" ); 108 out.println( "</html>" ); 109 } 110 111 114 } 115 116 | Popular Tags |