001    /*
002      Copyright (C) 2001 Renaud Pawlak
003    
004      This program is free software; you can redistribute it and/or modify
005      it under the terms of the GNU Lesser General Public License as
006      published by the Free Software Foundation; either version 2 of the
007      License, or (at your option) any later version.
008    
009      This program is distributed in the hope that it will be useful,
010      but WITHOUT ANY WARRANTY; without even the implied warranty of
011      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
012      GNU Lesser General Public License for more details.
013    
014      You should have received a copy of the GNU Lesser General Public License
015      along with this program; if not, write to the Free Software
016      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
017    
018    package org.objectweb.jac.aspects.tracing;
019    
020    import org.objectweb.jac.core.*;
021    
022    /**
023     * Implements a simple debugging aspect for JAC applications. The
024     * actual functionalities of the debugging are externalized within the
025     * <code>Debugger</code> class.
026     *
027     * <p>Here is a sample configuration file that steps all the methods
028     * that modify the instances of class <code>A</code> and
029     * <code>B</code>, excepted the setter for the field called f.
030     *
031     * <pre class=code>
032     * step ".*" "A || B" "MODIFIERS && !SETTER(f)"
033     * </pre>
034     *
035     * @see DebuggingWrapper
036     * @see Debugger */
037    
038    public class DebuggingAC extends AspectComponent {
039    
040       /** 
041        * This configuration method allows the programmer to define the
042        * set of objects, classes, and methods that must be stepped when a
043        * method is invoked.
044        *
045        * @param objects a pointcut expression on the name of the debugged
046        * objects
047        * @param classes a pointcut expression on the name of the debugged
048        * classes
049        * @param methods a pointcut expression on the name of the debugged
050        * methods */
051    
052       public void step(String objects, String classes, String methods) { 
053          pointcut( objects, classes+" && !org.objectweb.jac.aspects.tracing.Debugger", methods,
054                    DebuggingWrapper.class.getName(), "step", null, false );
055       }
056    
057       /**
058        * This configuration method must be used if the programmer wants
059        * to step ALL the methods of all the applications objects.  */
060    
061       public void stepAll() { 
062          pointcut( ".*", 
063                    ".* && !org.objectweb.jac.aspects.tracing.Debugger", 
064                    ".*",
065                    DebuggingWrapper.class.getName(), "step", null, false );
066       }
067    
068    }