| java.lang.Object ch.ethz.inf.iks.jvmai.jvmdi.AspectInterfaceImpl
All known Subclasses: ch.ethz.inf.iks.jvmai.jvmdi.HotSwapAspectInterfaceImpl,
AspectInterfaceImpl | public class AspectInterfaceImpl implements JVMAspectInterface,SunBCELRepositoryInterface(Code) | | Interface AspectInterfaceImpl represents the aspect-interface to the jvmai-system.
It's needed for initialization of the jvmai-system, management of joinpoint-watches and
for enable or disable event-notification.
An instance of this interface can be obtained by calling the method
getAspectInterface() of a jvmai-provider (class DebuggerProvider ).
Implementation
The implementation of this aspect interface is based on the debugger interface of the JVM.
To receive notifications from the JVM, it uses the native code available in this class.
Bugs
The JVMDI is not consistent over serveral J2SDK versions.
- Startup ignores the openword/closed world assumption and the list of prefixes.
- Under JDK 1.4.*, when throwing an exception within the notificaion, exception
events are wrongly sent to the debugger
- Under JDK 1.4.*, the 'GetThreadDepth' JVMDI function (name may be wrong),
does not always work correclty. Consequently, the current implementation (as of prose 0.18.0)
relies on the height of a frame relative to the frame which received
the debugger notifcation.
- Under JDK 1.4.*, the 'getBytecode' method exported by JVMDI works non-deterministically.
(first time it works, subsequent times it generates illegal opcodes). The workaround
uses BCEL and the class loader. However, this may incurr performance penalties.
version: $Revision: 1.3 $ author: Andrei Popovici author: Angela Nicoara |
Inner Class :static class CompoundAopTag | |
Method Summary | |
public void | addBCELClassDefiniton(InputStream definition, String name) Adds a class file to BCELs repository. | public void | clearConstructorWatch(Constructor m) Clears a watch on a constructor joinpoint. | public void | clearExceptionCatchWatch(Class cls) Clears a watch on a exception catch joinpoint.
Parameters: cls - Exception Class that should be watched. exception: NotInitializedException - Aspect-interface has not been initialized yet. | public void | clearExceptionThrowWatch(Class cls) Clears a watch on a exception throw joinpoint.
Parameters: cls - Exception Class that should be watched. exception: NotInitializedException - Aspect-interface has not been initialized yet. | public void | clearFieldAccessWatch(Field field) Clears a watch on a field access joinpoint.
Parameters: field - the field beeing watched. exception: NotInitializedException - Aspect-interface has not been intialized yet. | public void | clearFieldModificationWatch(Field field) Clears a watch on a field modification joinpoint.
Parameters: field - the field beeing watched. exception: NotInitializedException - Aspect-interface has not been initialized yet. | public synchronized void | clearMethodEntryWatch(Method m) Clears a watch on a method entry joinpoint.
Parameters: m - the method beeing watched. exception: NotInitializedException - Aspect-interface has not been initialized yet. | public synchronized void | clearMethodExitWatch(Method m) Clears a watch on a method exit joinpoint.
Parameters: m - the method beeing watched. exception: NotInitializedException - Aspect-interface has not been initialized yet. | public List | getLoadedClasses() | public boolean | isClassLoaded(String name) Checks if the class is already into the PROSE BCEL repository. | public void | resumeNotification(Thread thread) Resumes notification regarding the specified thread.
Successive calls to resumeNotification
without preceding calls to suspendNotification
will be ignored by the jvmai-system.
Parameters: thread - Thread for which to reenable notification. exception: NotInitializedException - Aspect-interface has not been initialized yet. | public void | setConstructorWatch(Constructor m, Object aopTag) Sets a watch on a constructor joinpoint.
Parameters: m - the constructor to be watched. | public void | setExceptionCatchWatch(Class cls, Object aopTag) Sets a watch on a exception catch joinpoint.
Parameters: cls - Exception Class that should be watched. Parameters: aopTag - A user-defined object saved with this watch.When the joinpoint is reached, this object ispassed to the JoinPointHook as part of theJoinPoint-instance. | public void | setExceptionThrowWatch(Class cls, Object aopTag) Sets a watch on a exception throw joinpoint.
Parameters: cls - Exception Class that should be watched. Parameters: aopTag - A user-defined object saved with this watch.When the joinpoint is reached, this object ispassed to the JoinPointHook as part of theJoinPoint-instance. | public void | setFieldAccessWatch(Field f, Object aopTag) Sets a watch on a field access joinpoint.
Parameters: f - the field to be watched. | public void | setFieldModificationWatch(Field field, Object aopTag) Sets a watch on a field modification joinpoint.
Parameters: field - the field to be watched. Parameters: aopTag - A user-defined object saved with this watch.When the joinpoint is reached, this object ispassed to the JoinPointHook as part of theJoinPoint-instance. | public void | setJoinPointHook(JoinPointHook jpHook) Sets a JoinPointHook as listener for jvmai-events.
Whenever a watched joinpoint is reached or a class
is loaded into the virtual machine, this JoinPointHook
is notified by the aspect-interface. | public synchronized void | setMethodEntryWatch(Method m, Object aopTag) Sets a watch on a method entry joinpoint.
Parameters: m - the method to be watched. Parameters: aopTag - A user-defined object saved with this watch.When the joinpoint is reached, this object ispassed to the JoinPointHook as part of theJoinPoint-instance. | public synchronized void | setMethodExitWatch(Method m, Object aopTag) Sets a watch on a method exit joinpoint.
Parameters: m - the method beeing watched. Parameters: aopTag - A user-defined object saved with this watch.When the joinpoint is reached, this object ispassed to the JoinPointHook as part of theJoinPoint-instance. | public synchronized void | startup(String[] packagePrefixes, boolean openWorldAssumption) Initializes the underlying jvmai system.
In addition, this method takes a list of java package-names and a
boolean indicating how to interpret this prefixes. | public void | suspendNotification(Thread thread) Suspend notification regarding the specified thread.
Successive calls to suspendNotification
have to be balanced by (at least) the same number of calls to
resumeNotification , or the jvmai-system
will not resume notification.
Parameters: thread - Thread for which to disable notification. exception: NotInitializedException - Aspect-interface has not been initialized yet. | public void | teardown() |
classRepository | protected static Repository classRepository(Code) | | Caches BCEL class definitions, which where fetched to analyze or
redefine java classes.
|
exceptionCatchMap | Map exceptionCatchMap(Code) | | |
exceptionThrowMap | Map exceptionThrowMap(Code) | | |
fieldModificationMap | Map fieldModificationMap(Code) | | |
isInitialized | public boolean isInitialized(Code) | | |
methodExecutionMap | Map methodExecutionMap(Code) | | |
addBCELClassDefiniton | public void addBCELClassDefiniton(InputStream definition, String name)(Code) | | Adds a class file to BCELs repository. This is only required for remote class files,
which may not be found in the local class path.
Used by
ch.ethz.prose.tools.RemoteAspectManagerImpl to add
RedefineCut s to a remote aspect interface.
If the class file can not be readed or added to the repository an error message
will be written to stdout, but no exception will be thrown to notify the caller.
Parameters: definition - the raw class file bytes wrapped in an InputStream Parameters: name - (full qualified) class name in binary notation (p.a. ch.ethz.prose.LocalAspectManager ) |
clearConstructorWatch | public void clearConstructorWatch(Constructor m)(Code) | | Clears a watch on a constructor joinpoint.
Parameters: m - the constructor beeing watched. |
clearExceptionCatchWatch | public void clearExceptionCatchWatch(Class cls)(Code) | | Clears a watch on a exception catch joinpoint.
Parameters: cls - Exception Class that should be watched. exception: NotInitializedException - Aspect-interface has not been initialized yet. Call setup first. exception: NullPointerException - cls is null . exception: WatchNotSetException - There exists no exceptionCatch-watch at this point. |
clearExceptionThrowWatch | public void clearExceptionThrowWatch(Class cls)(Code) | | Clears a watch on a exception throw joinpoint.
Parameters: cls - Exception Class that should be watched. exception: NotInitializedException - Aspect-interface has not been initialized yet. Call setup first. exception: NullPointerException - cls is null . exception: WatchNotSetException - There exists no exceptionThrow-watch at this point. |
clearFieldAccessWatch | public void clearFieldAccessWatch(Field field)(Code) | | Clears a watch on a field access joinpoint.
Parameters: field - the field beeing watched. exception: NotInitializedException - Aspect-interface has not been intialized yet. Call setup first. exception: NullPointerException - cls is null . exception: InvalidIdException - There exists no field with id fieldId in class cls . exception: WatchNotSetException - There exists no access-watch on the field. |
clearFieldModificationWatch | public void clearFieldModificationWatch(Field field)(Code) | | Clears a watch on a field modification joinpoint.
Parameters: field - the field beeing watched. exception: NotInitializedException - Aspect-interface has not been initialized yet. Call setup first. exception: NullPointerException - cls is null . exception: InvalidIdException - There exists no field with id fieldId in class cls . exception: WatchNotSetException - There exists no modification-watch on the field. |
clearMethodEntryWatch | public synchronized void clearMethodEntryWatch(Method m)(Code) | | Clears a watch on a method entry joinpoint.
Parameters: m - the method beeing watched. exception: NotInitializedException - Aspect-interface has not been initialized yet. Call setup first. exception: NullPointerException - cls is null . exception: InvalidIdException - There exists no method with id methodId in class cls . exception: WatchNotSetException - There exists no entry-watch on the method. |
clearMethodExitWatch | public synchronized void clearMethodExitWatch(Method m)(Code) | | Clears a watch on a method exit joinpoint.
Parameters: m - the method beeing watched. exception: NotInitializedException - Aspect-interface has not been initialized yet. Call setup first. exception: NullPointerException - cls is null . exception: InvalidIdException - There exists no method with id methodId in class cls . exception: WatchNotSetException - There exists no exit-watch on the method. |
getLoadedClasses | public List getLoadedClasses()(Code) | | |
isClassLoaded | public boolean isClassLoaded(String name)(Code) | | Checks if the class is already into the PROSE BCEL repository.
|
resumeNotification | public void resumeNotification(Thread thread)(Code) | | Resumes notification regarding the specified thread.
Successive calls to resumeNotification
without preceding calls to suspendNotification
will be ignored by the jvmai-system.
Parameters: thread - Thread for which to reenable notification. exception: NotInitializedException - Aspect-interface has not been initialized yet. Call setup first. exception: NullPointerException - thread is null . |
setConstructorWatch | public void setConstructorWatch(Constructor m, Object aopTag)(Code) | | Sets a watch on a constructor joinpoint.
Parameters: m - the constructor to be watched. Parameters: aopTag - A user-defined object saved with this watch.When the joinpoint is reached, this object ispassed to the JoinPointHook as part of theJoinPoint-instance. This object may be null . |
setExceptionCatchWatch | public void setExceptionCatchWatch(Class cls, Object aopTag)(Code) | | Sets a watch on a exception catch joinpoint.
Parameters: cls - Exception Class that should be watched. Parameters: aopTag - A user-defined object saved with this watch.When the joinpoint is reached, this object ispassed to the JoinPointHook as part of theJoinPoint-instance. This object may be null . exception: NotInitializedException - Aspect-interface has not been initialized yet. Call setup first. exception: NullPointerException - cls is null . exception: WatchAlreadySetException - There already exists a exceptionCatch-watch at this point. |
setExceptionThrowWatch | public void setExceptionThrowWatch(Class cls, Object aopTag)(Code) | | Sets a watch on a exception throw joinpoint.
Parameters: cls - Exception Class that should be watched. Parameters: aopTag - A user-defined object saved with this watch.When the joinpoint is reached, this object ispassed to the JoinPointHook as part of theJoinPoint-instance. This object may be null . exception: NotInitializedException - Aspect-interface has not been initialized yet. Call setup first. exception: NullPointerException - cls is null . exception: WatchAlreadySetException - There already exists a exceptionThrow-watch at this point. |
setFieldAccessWatch | public void setFieldAccessWatch(Field f, Object aopTag)(Code) | | Sets a watch on a field access joinpoint.
Parameters: f - the field to be watched. Parameters: aopTag - A user-defined object saved with this watch.When the joinpoint is reached, this object ispassed to the JoinPointHook as part of theJoinPoint-instance. This object may be null . exception: NotInitializedException - Aspect-interface has not been initialized yet. Call setup first. exception: NullPointerException - cls is null . exception: InvalidIdException - There exists no field with id fieldId in class cls . exception: CannotSetWatchException - ? exception: WatchAlreadySetException - There already exists a access-watch on the field. |
setFieldModificationWatch | public void setFieldModificationWatch(Field field, Object aopTag)(Code) | | Sets a watch on a field modification joinpoint.
Parameters: field - the field to be watched. Parameters: aopTag - A user-defined object saved with this watch.When the joinpoint is reached, this object ispassed to the JoinPointHook as part of theJoinPoint-instance. This object may be null . exception: NotInitializedException - Aspect-interface has not been initialized yet. Call setup first. exception: NullPointerException - cls is null . exception: InvalidIdException - There exist no field with id fieldId in class cls . exception: CannotSetWatchException - ? exception: WatchAlreadySetException - There already exists a modification-watch on the field. |
setJoinPointHook | public void setJoinPointHook(JoinPointHook jpHook)(Code) | | Sets a JoinPointHook as listener for jvmai-events.
Whenever a watched joinpoint is reached or a class
is loaded into the virtual machine, this JoinPointHook
is notified by the aspect-interface. As long as no
JoinPointHook is set (or after setting null ),
processing of joinpoint- and classload-events is disabled
in the jvmai-system.
Parameters: jpHook - JoinPointHook to set as listener. exception: NotInitializedException - Aspect-interface has not been initialized yet. Call setup first. |
setMethodEntryWatch | public synchronized void setMethodEntryWatch(Method m, Object aopTag)(Code) | | Sets a watch on a method entry joinpoint.
Parameters: m - the method to be watched. Parameters: aopTag - A user-defined object saved with this watch.When the joinpoint is reached, this object ispassed to the JoinPointHook as part of theJoinPoint-instance. This object may be null . exception: NotInitializedException - Aspect-interface has not been initialized yet. Call setup first. exception: NullPointerException - cls is null . exception: InvalidIdException - There exists no method with id methodId in class cls . exception: CannotSetWatchException - The method must not be abstract or native. exception: WatchAlreadySetException - There already exists a entry-watch on the method. |
setMethodExitWatch | public synchronized void setMethodExitWatch(Method m, Object aopTag)(Code) | | Sets a watch on a method exit joinpoint.
Parameters: m - the method beeing watched. Parameters: aopTag - A user-defined object saved with this watch.When the joinpoint is reached, this object ispassed to the JoinPointHook as part of theJoinPoint-instance. This object may be null . exception: NotInitializedException - Aspect-interface has not been initialized yet. Call setup first. exception: NullPointerException - cls is null . exception: InvalidIdException - There exists no method with id methodId in class cls . exception: CannotSetWatchException - The method must not be abstract or native. exception: WatchAlreadySetException - There already exists a exit-watch on the method. |
startup | public synchronized void startup(String[] packagePrefixes, boolean openWorldAssumption)(Code) | | Initializes the underlying jvmai system.
In addition, this method takes a list of java package-names and a
boolean indicating how to interpret this prefixes. The prefixes are
used by the jvmai system to determine the set of classes beeing
relevant to the system at all.
Depeding on the value of openWorldAssumption , prefixes
are interpreted as followed:
openWorldAssumption == true
The jvmai-system is instructed to treat ALL classes as relevant,
EXCEPT the ones contained in a packages starting with one of the
supplied prefixes in packagePrefixes
openWorldAssumption == false
The jvmai-system is instructed to treat as relevant ONLY the classes
contained in a packages starting with one of the supplied prefixes
in packagePrefixes
Parameters: packagePrefixes - List of prefixes for java package-names. Parameters: openWorldAssumption - Specifies how the prefixes are interpreted. exception: StartupException - Use StartupException.getMessage() to get a detailed description |
suspendNotification | public void suspendNotification(Thread thread)(Code) | | Suspend notification regarding the specified thread.
Successive calls to suspendNotification
have to be balanced by (at least) the same number of calls to
resumeNotification , or the jvmai-system
will not resume notification.
Parameters: thread - Thread for which to disable notification. exception: NotInitializedException - Aspect-interface has not been initialized yet. Call setup first. exception: NullPointerException - thread is null . |
teardown | public void teardown()(Code) | | |
|
|