KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jac > aspects > tracing > DebuggingAC


1 /*
2   Copyright (C) 2001 Renaud Pawlak
3
4   This program is free software; you can redistribute it and/or modify
5   it under the terms of the GNU Lesser General Public License as
6   published by the Free Software Foundation; either version 2 of the
7   License, or (at your option) any later version.
8
9   This program is distributed in the hope that it will be useful,
10   but WITHOUT ANY WARRANTY; without even the implied warranty of
11   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12   GNU Lesser General Public License for more details.
13
14   You should have received a copy of the GNU Lesser General Public License
15   along with this program; if not, write to the Free Software
16   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */

17
18 package org.objectweb.jac.aspects.tracing;
19
20 import org.objectweb.jac.core.*;
21
22 /**
23  * Implements a simple debugging aspect for JAC applications. The
24  * actual functionalities of the debugging are externalized within the
25  * <code>Debugger</code> class.
26  *
27  * <p>Here is a sample configuration file that steps all the methods
28  * that modify the instances of class <code>A</code> and
29  * <code>B</code>, excepted the setter for the field called f.
30  *
31  * <pre class=code>
32  * step ".*" "A || B" "MODIFIERS && !SETTER(f)"
33  * </pre>
34  *
35  * @see DebuggingWrapper
36  * @see Debugger */

37
38 public class DebuggingAC extends AspectComponent {
39
40    /**
41     * This configuration method allows the programmer to define the
42     * set of objects, classes, and methods that must be stepped when a
43     * method is invoked.
44     *
45     * @param objects a pointcut expression on the name of the debugged
46     * objects
47     * @param classes a pointcut expression on the name of the debugged
48     * classes
49     * @param methods a pointcut expression on the name of the debugged
50     * methods */

51
52    public void step(String JavaDoc objects, String JavaDoc classes, String JavaDoc methods) {
53       pointcut( objects, classes+" && !org.objectweb.jac.aspects.tracing.Debugger", methods,
54                 DebuggingWrapper.class.getName(), "step", null, false );
55    }
56
57    /**
58     * This configuration method must be used if the programmer wants
59     * to step ALL the methods of all the applications objects. */

60
61    public void stepAll() {
62       pointcut( ".*",
63                 ".* && !org.objectweb.jac.aspects.tracing.Debugger",
64                 ".*",
65                 DebuggingWrapper.class.getName(), "step", null, false );
66    }
67
68 }
69
Popular Tags