1 19 20 package org.apache.excalibur.instrument.manager.http; 21 22 import java.io.FileNotFoundException ; 23 import java.io.IOException ; 24 import java.io.PrintWriter ; 25 import java.util.Map ; 26 27 import org.apache.excalibur.instrument.manager.DefaultInstrumentManager; 28 import org.apache.excalibur.instrument.manager.InstrumentSampleDescriptor; 29 import org.apache.excalibur.instrument.manager.NoSuchInstrumentSampleException; 30 31 37 public class XMLSnapshotHandler 38 extends AbstractXMLHandler 39 { 40 43 49 public XMLSnapshotHandler( DefaultInstrumentManager manager, 50 InstrumentManagerHTTPConnector connector ) 51 { 52 super( "/snapshot.xml", manager, connector ); 53 } 54 55 58 65 public void doGet( String path, Map parameters, PrintWriter out ) 66 throws IOException 67 { 68 String name = getParameter( parameters, "name" ); 69 long baseTime = getLongParameter( parameters, "base-time", 0 ); 70 boolean packed = getBooleanParameter( parameters, "packed", false ); 71 boolean compact = getBooleanParameter( parameters, "compact", false ); 72 73 InstrumentSampleDescriptor desc; 74 try 75 { 76 desc = getInstrumentManager().locateInstrumentSampleDescriptor( name ); 77 } 78 catch ( NoSuchInstrumentSampleException e ) 79 { 80 throw new FileNotFoundException ( 81 "The specified instrument sample does not exist: " + name ); 82 } 83 84 out.println( InstrumentManagerHTTPConnector.XML_BANNER ); 85 outputSampleHistory( out, desc, "", baseTime, packed, compact ); 86 } 87 88 91 } 92 93 | Popular Tags |