KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > ch > ethz > jvmai > JoinPointHook


1 //
2
// This file is part of the prose package.
3
//
4
// The contents of this file are subject to the Mozilla Public License
5
// Version 1.1 (the "License"); you may not use this file except in
6
// compliance with the License. You may obtain a copy of the License at
7
// http://www.mozilla.org/MPL/
8
//
9
// Software distributed under the License is distributed on an "AS IS" basis,
10
// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11
// for the specific language governing rights and limitations under the
12
// License.
13
//
14
// The Original Code is prose.
15
//
16
// The Initial Developer of the Original Code is Andrei Popovici. Portions
17
// created by Andrei Popovici are Copyright (C) 2002 Andrei Popovici.
18
// All Rights Reserved.
19
//
20
// Contributor(s):
21
// $Id: JoinPointHook.java,v 1.2 2004/05/12 09:41:54 anicoara Exp $
22
// =====================================================================
23
//
24
// (history at end)
25
//
26

27 package ch.ethz.jvmai;
28
29 // used packages/classes
30
import ch.ethz.jvmai.FieldAccessJoinPoint;
31 import ch.ethz.jvmai.FieldModificationJoinPoint;
32 import ch.ethz.jvmai.MethodEntryJoinPoint;
33 import ch.ethz.jvmai.MethodExitJoinPoint;
34 import ch.ethz.jvmai.ExceptionJoinPoint;
35 import ch.ethz.jvmai.ExceptionCatchJoinPoint;
36
37 /**
38  * Interface JoinPointHook represents a listener for
39  * jvmai-events. An aspect-interface is needed to register
40  * an instance of JoinPointHook and to set (and clear)
41  * watches on joinpoints.
42  * <p>
43  * Methods of this interface are called by the
44  * aspect-interface whenever a joinpoint with a registered
45  * watch is reached or a class has been loaded into the
46  * virtual machine. Execution of the thread releasing this
47  * events is stopped until this methods have been processed.
48  * <p>
49  * Joinpoint related methods receive an instance of a
50  * subclass of JoinPoint containing information about the
51  * joinpoint itself. This instance can then be used to query
52  * the info-interface for additional information. Usually
53  * this instances are valid only until the method exits.
54  * <p>
55  * @version $Revision: 1.2 $
56  * @author Stephan Markwalder
57  * @author Angela Nicoara
58  */

59 public abstract class JoinPointHook {
60
61     /**
62      * Called whenever a registered field access joinpoint
63      * is reached. This method is called BEFORE1 accessing
64      * the field's value.
65      *
66      * @param joinPoint Contains information about the
67      * joinpoint beeing reached.
68      */

69     public abstract void onFieldAccess(FieldAccessJoinPoint joinPoint);
70
71     /**
72      * Called whenever a registered field modification
73      * joinpoint is reached. This method is called BEFORE1
74      * modifying the field's value.
75      *
76      * @param joinPoint Contains information about the
77      * joinpoint beeing reached.
78      */

79     public abstract void onFieldModification(FieldModificationJoinPoint joinPoint);
80
81     /**
82      * Called whenever a registered method entry joinpoint
83      * is reached. This method is called AFTER1 entering the
84      * method but BEFORE1 executing the first statement.
85      *
86      * @param joinPoint Contains information about the
87      * joinpoint beeing reached.
88      */

89     public abstract void onMethodEntry(MethodEntryJoinPoint joinPoint);
90
91     /**
92      * Called whenever a registered method exit joinpoint is
93      * reached. This method is called right BEFORE1 leaving
94      * the method (before executing <code>retrun</code>, but
95      * after calculating the return-value). Abrupt
96      * completion of the method (because of an unhandled
97      * exception) does NOT trigger this method.
98      *
99      * @param joinPoint Contains information about the
100      * joinpoint beeing reached.
101      */

102     public abstract void onMethodExit(MethodExitJoinPoint joinPoint);
103
104     /**
105      * Called whenever a registered exception throw joinpoint is
106      * reached. This method is called BEFORE1 leaving the class
107      * but AFTER1 creating the exception object.
108      *
109      * @param joinPoint Contains information about the
110      * joinpoint beeing reached.
111      */

112     public abstract void onExceptionThrow(ExceptionJoinPoint joinPoint);
113
114     /**
115      * Called whenever a registered exception catch joinpoint is
116      * reached. This method is called BEFORE leaving the class
117      * but AFTER creating the exception object.
118      *
119      * @param joinPoint Contains information about the
120      * joinpoint beeing reached.
121      */

122     public abstract void onExceptionCatch(ExceptionCatchJoinPoint joinPoint);
123
124     /**
125      * Called whenever a class has been loaded into the
126      * virtual machine. This method is called AFTER1 the
127      * class has been loaded.
128      *
129      * @param cls Instance of the Class-object representing
130      * the loaded class.
131      */

132     public abstract void onClassLoad(Class JavaDoc cls);
133
134 }
135
136 //======================================================================
137
//
138
// $Log: JoinPointHook.java,v $
139
// Revision 1.2 2004/05/12 09:41:54 anicoara
140
// Remove the README.RVM file
141
//
142
// Revision 1.1.1.1 2003/07/02 15:30:50 apopovic
143
// Imported from ETH Zurich
144
//
145
// Revision 1.2 2003/07/02 12:42:49 anicoara
146
// Added CatchJoinPoint Functionality (Requests, Join-Points, Filters, CatchCuts, Tests)
147
//
148
// Revision 1.1 2003/05/05 14:02:18 popovici
149
// renaming from runes to prose
150
//
151
// Revision 1.9 2002/10/31 18:26:49 pschoch
152
// Capability of crosscutting Exceptions added to prose.
153
//
154
// Revision 1.8 2002/10/25 07:42:31 popovici
155
// Undo Chnages Phillippe
156
//
157
// Revision 1.6 2002/10/17 12:23:43 pschoch
158
// Added throw capabability to JVMAI
159
//
160
// Revision 1.5 2002/03/28 13:48:29 popovici
161
// Mozilla-ified
162
//
163
// Revision 1.4 2002/03/11 11:01:13 smarkwal
164
// JVMInfoInterface and JoinPointHook changed to abstract classes
165
//
166
// Revision 1.3 2002/02/13 12:24:57 smarkwal
167
// spaces/tabs alignment corrected
168
//
169
// Revision 1.2 2002/01/24 12:49:04 smarkwal
170
// comments added.
171
//
172
// Revision 1.1 2001/12/14 15:01:15 smarkwal
173
// Initial Revision
174
//
175
Popular Tags