001: //
002: // This file is part of the prose package.
003: //
004: // The contents of this file are subject to the Mozilla Public License
005: // Version 1.1 (the "License"); you may not use this file except in
006: // compliance with the License. You may obtain a copy of the License at
007: // http://www.mozilla.org/MPL/
008: //
009: // Software distributed under the License is distributed on an "AS IS" basis,
010: // WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
011: // for the specific language governing rights and limitations under the
012: // License.
013: //
014: // The Original Code is prose.
015: //
016: // The Initial Developer of the Original Code is Andrei Popovici. Portions
017: // created by Andrei Popovici are Copyright (C) 2002 Andrei Popovici.
018: // All Rights Reserved.
019: //
020: // Contributor(s):
021: // $Id: JoinPointHook.java,v 1.2 2004/05/12 09:41:54 anicoara Exp $
022: // =====================================================================
023: //
024: // (history at end)
025: //
026:
027: package ch.ethz.jvmai;
028:
029: // used packages/classes
030: import ch.ethz.jvmai.FieldAccessJoinPoint;
031: import ch.ethz.jvmai.FieldModificationJoinPoint;
032: import ch.ethz.jvmai.MethodEntryJoinPoint;
033: import ch.ethz.jvmai.MethodExitJoinPoint;
034: import ch.ethz.jvmai.ExceptionJoinPoint;
035: import ch.ethz.jvmai.ExceptionCatchJoinPoint;
036:
037: /**
038: * Interface JoinPointHook represents a listener for
039: * jvmai-events. An aspect-interface is needed to register
040: * an instance of JoinPointHook and to set (and clear)
041: * watches on joinpoints.
042: * <p>
043: * Methods of this interface are called by the
044: * aspect-interface whenever a joinpoint with a registered
045: * watch is reached or a class has been loaded into the
046: * virtual machine. Execution of the thread releasing this
047: * events is stopped until this methods have been processed.
048: * <p>
049: * Joinpoint related methods receive an instance of a
050: * subclass of JoinPoint containing information about the
051: * joinpoint itself. This instance can then be used to query
052: * the info-interface for additional information. Usually
053: * this instances are valid only until the method exits.
054: * <p>
055: * @version $Revision: 1.2 $
056: * @author Stephan Markwalder
057: * @author Angela Nicoara
058: */
059: public abstract class JoinPointHook {
060:
061: /**
062: * Called whenever a registered field access joinpoint
063: * is reached. This method is called BEFORE1 accessing
064: * the field's value.
065: *
066: * @param joinPoint Contains information about the
067: * joinpoint beeing reached.
068: */
069: public abstract void onFieldAccess(FieldAccessJoinPoint joinPoint);
070:
071: /**
072: * Called whenever a registered field modification
073: * joinpoint is reached. This method is called BEFORE1
074: * modifying the field's value.
075: *
076: * @param joinPoint Contains information about the
077: * joinpoint beeing reached.
078: */
079: public abstract void onFieldModification(
080: FieldModificationJoinPoint joinPoint);
081:
082: /**
083: * Called whenever a registered method entry joinpoint
084: * is reached. This method is called AFTER1 entering the
085: * method but BEFORE1 executing the first statement.
086: *
087: * @param joinPoint Contains information about the
088: * joinpoint beeing reached.
089: */
090: public abstract void onMethodEntry(MethodEntryJoinPoint joinPoint);
091:
092: /**
093: * Called whenever a registered method exit joinpoint is
094: * reached. This method is called right BEFORE1 leaving
095: * the method (before executing <code>retrun</code>, but
096: * after calculating the return-value). Abrupt
097: * completion of the method (because of an unhandled
098: * exception) does NOT trigger this method.
099: *
100: * @param joinPoint Contains information about the
101: * joinpoint beeing reached.
102: */
103: public abstract void onMethodExit(MethodExitJoinPoint joinPoint);
104:
105: /**
106: * Called whenever a registered constructor joinpoint
107: * is reached. This method is called AFTER1 entering the
108: * constructor but BEFORE1 executing the first statement.
109: *
110: * @param joinPoint Contains information about the
111: * joinpoint beeing reached.
112: */
113: public abstract void onConstructor(ConstructorJoinPoint joinPoint);
114:
115: /**
116: * Called whenever a registered exception throw joinpoint is
117: * reached. This method is called BEFORE1 leaving the class
118: * but AFTER1 creating the exception object.
119: *
120: * @param joinPoint Contains information about the
121: * joinpoint beeing reached.
122: */
123: public abstract void onExceptionThrow(ExceptionJoinPoint joinPoint);
124:
125: /**
126: * Called whenever a registered exception catch joinpoint is
127: * reached. This method is called BEFORE leaving the class
128: * but AFTER creating the exception object.
129: *
130: * @param joinPoint Contains information about the
131: * joinpoint beeing reached.
132: */
133: public abstract void onExceptionCatch(
134: ExceptionCatchJoinPoint joinPoint);
135:
136: /**
137: * Called whenever a class has been loaded into the
138: * virtual machine. This method is called AFTER1 the
139: * class has been loaded.
140: *
141: * @param cls Instance of the Class-object representing
142: * the loaded class.
143: */
144: public abstract void onClassLoad(Class cls);
145:
146: }
147:
148: //======================================================================
149: //
150: // $Log: JoinPointHook.java,v $
151: // Revision 1.2 2004/05/12 09:41:54 anicoara
152: // Remove the README.RVM file
153: //
154: // Revision 1.1.1.1 2003/07/02 15:30:50 apopovic
155: // Imported from ETH Zurich
156: //
157: // Revision 1.2 2003/07/02 12:42:49 anicoara
158: // Added CatchJoinPoint Functionality (Requests, Join-Points, Filters, CatchCuts, Tests)
159: //
160: // Revision 1.1 2003/05/05 14:02:18 popovici
161: // renaming from runes to prose
162: //
163: // Revision 1.9 2002/10/31 18:26:49 pschoch
164: // Capability of crosscutting Exceptions added to prose.
165: //
166: // Revision 1.8 2002/10/25 07:42:31 popovici
167: // Undo Chnages Phillippe
168: //
169: // Revision 1.6 2002/10/17 12:23:43 pschoch
170: // Added throw capabability to JVMAI
171: //
172: // Revision 1.5 2002/03/28 13:48:29 popovici
173: // Mozilla-ified
174: //
175: // Revision 1.4 2002/03/11 11:01:13 smarkwal
176: // JVMInfoInterface and JoinPointHook changed to abstract classes
177: //
178: // Revision 1.3 2002/02/13 12:24:57 smarkwal
179: // spaces/tabs alignment corrected
180: //
181: // Revision 1.2 2002/01/24 12:49:04 smarkwal
182: // comments added.
183: //
184: // Revision 1.1 2001/12/14 15:01:15 smarkwal
185: // Initial Revision
186: //
|