Package org.apache.excalibur.instrument.manager.http

Source Code of org.apache.excalibur.instrument.manager.http.XMLInstrumentableHandler

/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements.  See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed  under the  License is distributed on an "AS IS" BASIS,
* WITHOUT  WARRANTIES OR CONDITIONS  OF ANY KIND, either  express  or
* implied.
*
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.excalibur.instrument.manager.http;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Map;

import org.apache.excalibur.instrument.manager.DefaultInstrumentManager;
import org.apache.excalibur.instrument.manager.InstrumentableDescriptor;
import org.apache.excalibur.instrument.manager.NoSuchInstrumentableException;

/**
*
* @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
* @version CVS $Revision: 1.5 $ $Date: 2004/03/06 14:01:28 $
* @since 4.1
*/
public class XMLInstrumentableHandler
    extends AbstractXMLHandler
{
    /*---------------------------------------------------------------
     * Constructors
     *-------------------------------------------------------------*/
    /**
     * Creates a new XMLInstrumentableHandler.
     *
     * @param manager Reference to the DefaultInstrumentManager.
     * @param connector The InstrumentManagerHTTPConnector.
     */
    public XMLInstrumentableHandler( DefaultInstrumentManager manager,
                                     InstrumentManagerHTTPConnector connector )
    {
        super( "/instrumentable.xml", manager, connector );
    }
   
    /*---------------------------------------------------------------
     * AbstractHTTPURLHandler Methods
     *-------------------------------------------------------------*/
    /**
     * Handles the specified request.
     *
     * @param The full path being handled.
     * @param parameters A Map of the parameters in the request.
     * @param os The PrintWriter to write the result to.
     */
    public void doGet( String path, Map parameters, PrintWriter out )
        throws IOException
    {
        String name = getParameter( parameters, "name" );
        boolean packed = getBooleanParameter( parameters, "packed", false );
        boolean recurse = getBooleanParameter( parameters, "recurse", false );
       
        InstrumentableDescriptor desc;
        try
        {
            desc = getInstrumentManager().locateInstrumentableDescriptor( name );
        }
        catch ( NoSuchInstrumentableException e )
        {
            throw new FileNotFoundException(
                "The specified instrumentable does not exist: " + name );
        }
       
        out.println( InstrumentManagerHTTPConnector.XML_BANNER );
        outputInstrumentable( out, desc, "", recurse, packed );
    }
           
    /*---------------------------------------------------------------
     * Methods
     *-------------------------------------------------------------*/
}
 
TOP

Related Classes of org.apache.excalibur.instrument.manager.http.XMLInstrumentableHandler

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.