root/trunk/src/java/org/jcoderz/commons/tracing/Tracer.java

Revision 1628, 3.4 kB (checked in by amandel, 2 years ago)

Add work in progress tracing components.
- Extended TracingProxy? that allows different Traces to be used
- TracingInjector? that allows aspect like injection of the tracing aspect.

Please note that this is still work in progress.

  • Property svn:mime-type set to text/plain
Line 
1/*
2 * $Id: ArraysUtil.java 1011 2008-06-16 17:57:36Z amandel $
3 *
4 * Copyright 2006, The jCoderZ.org Project. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met:
9 *
10 *    * Redistributions of source code must retain the above copyright
11 *      notice, this list of conditions and the following disclaimer.
12 *    * Redistributions in binary form must reproduce the above
13 *      copyright notice, this list of conditions and the following
14 *      disclaimer in the documentation and/or other materials
15 *      provided with the distribution.
16 *    * Neither the name of the jCoderZ.org Project nor the names of
17 *      its contributors may be used to endorse or promote products
18 *      derived from this software without specific prior written
19 *      permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS" AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS
25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
28 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
30 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
31 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 */
33package org.jcoderz.commons.tracing;
34
35
36/**
37 * Interface for classes that collect tracing information about a certain
38 * class.
39 *
40 * Instances must also hold a static factory method that returns a
41 * specific tracer, with a given name
42 * <pre>
43 *   public static Tracer getTracer(String className);
44 * </pre>
45 * the returned tracer must be multi-thread-save.
46 *
47 * @author Andreas Mandel
48 *
49 */
50public interface Tracer
51{
52    public boolean isTracing();
53
54    /**
55     * Indicates if the tracer is evaluating the contents of the arguments.
56     * Otherwise the entering/exiting method without the arguments / result
57     * can be called by the traced code.
58     * This value can change during runtime, but it is only needed to
59     * check this once, before the entering call. 
60     * @return true, if the tracer is evaluating the contents of the arguments.
61     */
62    public boolean isTracingArguments();
63   
64    /**
65     * <p>A null return value is a indication that tracing is
66     * currently not enabled.</b>
67     * @param className name of the class
68     * @param methodName name of the method entered.
69     * @return a token, holding the context for the followup
70     *  exiting / throwing call.
71     */
72    public TracingToken entering(String className, String methodName);
73    public TracingToken entering(String className, String methodName, Object argument);
74    public TracingToken entering(String className, String methodName, Object[] arguments);
75    public void exiting(TracingToken token);
76    public void exiting(TracingToken token, Object result);
77    public void throwing(TracingToken token, Throwable thrown);
78
79
80    public interface TracingToken
81    {
82    }
83}
Note: See TracBrowser for help on using the browser.