alt.jiapi.event
Class MethodEventProducer

java.lang.Object
  extended by alt.jiapi.event.EventProducer
      extended by alt.jiapi.event.MethodEventProducer

public class MethodEventProducer
extends EventProducer

This class registers itself to Jiapi runtime and tracks method entries and exits. When either event happens it will notify each listeners that has been registered.

If an exception is thrown from a method, the exit event is not produced. That is, exit events are produced only for the normal exits from methods.

Version:
$Revision: 1.26 $ $Date: 2010/03/05 10:34:45 $
Author:
Mika Riekkinen, Joni Suominen

Constructor Summary
MethodEventProducer(InstrumentationDescriptor id)
          Constructor.
MethodEventProducer(InstrumentationDescriptor id, java.lang.String resolution)
          Creates new MethodEventProducer.
 
Method Summary
 void addMethodListener(MethodListener mel)
          Adds a MethodListener.
protected  void fireMethodEnterEvent(java.lang.Object sourceObject, java.lang.String methodName)
          Fires an event on method entry.
protected  void fireMethodExitEvent(java.lang.Object sourceObject, java.lang.String methodName)
          Fires an event on method exit.
 void methodEntered(java.lang.Object sourceObject, java.lang.String methodName)
          This method is called by the Jiapi runtime.
 void methodExited(java.lang.Object sourceObject, java.lang.String methodName)
          This method is called by the Jiapi runtime.
 void removeMethodListener(MethodListener mel)
          Removes a MethodListener.
 
Methods inherited from class alt.jiapi.event.EventProducer
getResolutions, isProtected, isProtected, match, protect, release
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MethodEventProducer

public MethodEventProducer(InstrumentationDescriptor id)
Constructor. Resolution is set to '*', which indicates all the MethodEvents are produced.

Parameters:
id - Instrumentation decsriptor, that this MethodEventProducer registers itself to.

MethodEventProducer

public MethodEventProducer(InstrumentationDescriptor id,
                           java.lang.String resolution)
Creates new MethodEventProducer. Only MethodEvents, that match with given resolution, are produced. Resolution is compared against the name of the method during instrumentation.

Parameters:
id - Instrumentation decsriptor, that this MethodEventProducer registers itself to.
resolution - Resolution, that is used further to select which methods will trigger events to be produced.
Method Detail

addMethodListener

public void addMethodListener(MethodListener mel)
Adds a MethodListener.

Parameters:
mel - a MethodListener

fireMethodEnterEvent

protected void fireMethodEnterEvent(java.lang.Object sourceObject,
                                    java.lang.String methodName)
Fires an event on method entry.

Parameters:
sourceObject - Source Object
methodName - Name of the method

fireMethodExitEvent

protected void fireMethodExitEvent(java.lang.Object sourceObject,
                                   java.lang.String methodName)
Fires an event on method exit.

Parameters:
sourceObject - Source Object
methodName - Name of the method

methodEntered

public void methodEntered(java.lang.Object sourceObject,
                          java.lang.String methodName)
This method is called by the Jiapi runtime. It should not be called by others.


methodExited

public void methodExited(java.lang.Object sourceObject,
                         java.lang.String methodName)
This method is called by the Jiapi runtime. It should not be called by others.


removeMethodListener

public void removeMethodListener(MethodListener mel)
Removes a MethodListener.

Parameters:
mel - a MethodListener


Copyright © 2001. Documenation generated August 26 2011.