/**
 * JOnAS: Java(TM) Open Application Server
 * Copyright (C) 2008 Bull S.A.S.
 * Copyright (C) 2008 France Telecom R&D
 * Contact: jonas-team@ow2.org
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or 1any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
 * USA
 *
 * --------------------------------------------------------------------------
 * $Id$
 * --------------------------------------------------------------------------
 */

package org.ow2.jonas.web.tomcat6.versioning;

import org.ow2.jonas.asm.ClassAdapter;
import org.ow2.jonas.asm.ClassVisitor;
import org.ow2.jonas.asm.MethodVisitor;
import org.ow2.util.log.Log;
import org.ow2.util.log.LogFactory;

/**
 * ASM transformation for the Tomcat Coyote Adapter.
 *
 * @author Frederic Germaneau
 * @author S. Ali Tokmen
 */
public class ConnectorTransformer extends ClassAdapter {
    /**
     * Calls parent.
     *
     * @param cv  ClassVisitor to use.
     */
    public ConnectorTransformer(final ClassVisitor cv) {
        super(cv);
    }

    /**
     * Logger.
     */
    private static Log logger = LogFactory.getLog(ConnectorTransformer.class);

    /**
     * Visits a method and creates a @link{ReplaceNewCoyoteAdapter} instance.
     *
     * @param access      Access type.
     * @param name        Name.
     * @param desc        Description.
     * @param signature   Signature.
     * @param exceptions  Exceptions thrown when called.
     *
     * @return @link{ReplaceNewCoyoteAdapter}.
     */
    @Override
    public MethodVisitor visitMethod(final int access, final String name, final String desc, final String signature, final String[] exceptions) {
        logger.debug("inside visitMethod for method: " + name);
        return new ReplaceNewCoyoteAdapter(cv.visitMethod(access, name, desc, signature, exceptions));
    }
}
