alt.jiapi.interceptor
Class InvocationInterceptor

java.lang.Object
  extended by alt.jiapi.event.EventProducer
      extended by alt.jiapi.interceptor.InvocationInterceptor

public class InvocationInterceptor
extends EventProducer

InvocationInterceptor intercepts method invocations and delegates invocations to InvokeHandler.

Following code snippet is an example, how to initialize InvocationInterceptor:

      InstrumentationContext ctx = new InstrumentationContext();
      InstrumentationDescriptor id = new InstrumentationDescriptor();
      id.addInclusionRule("samples.*");
      ctx.addInstrumentationDescriptor(id);
       
      InvocationInterceptor ii = new InvocationInterceptor(id, "java*",this);
 

Version:
$Revision: 1.10 $ $Date: 2006/01/31 11:11:42 $
Author:
Mika Riekkinen

Constructor Summary
InvocationInterceptor(InstrumentationDescriptor id, java.lang.reflect.InvocationHandler handler)
          Constructor.
InvocationInterceptor(InstrumentationDescriptor id, java.lang.String[] resolutions, java.lang.reflect.InvocationHandler handler)
          Creates new InvocationInterceptor.
InvocationInterceptor(InstrumentationDescriptor id, java.lang.String resolution, java.lang.reflect.InvocationHandler handler)
          Creates new InvocationInterceptor.
 
Method Summary
 java.lang.Object invokeMethod(java.lang.Object o, java.lang.String name, java.lang.Object[] args, java.lang.String signature)
          Called by Jiapi runtime.
 
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

InvocationInterceptor

public InvocationInterceptor(InstrumentationDescriptor id,
                             java.lang.reflect.InvocationHandler handler)
Constructor. Resolution is set to '*'.

Parameters:
id - Instrumentation decsriptor, that this InvocationInterceptor registers itself to.
handler - InvocationHandler

InvocationInterceptor

public InvocationInterceptor(InstrumentationDescriptor id,
                             java.lang.String[] resolutions,
                             java.lang.reflect.InvocationHandler handler)
Creates new InvocationInterceptor.

Parameters:
id - Instrumentation decsriptor, that this InvocationInterceptor registers itself to.
resolutions - Resolutions, that is used further to select which methods will trigger events to be produced.
handler - InvocationHandler

InvocationInterceptor

public InvocationInterceptor(InstrumentationDescriptor id,
                             java.lang.String resolution,
                             java.lang.reflect.InvocationHandler handler)
Creates new InvocationInterceptor. Resolution tells, which methods are to be intercepted.

Parameters:
id - Instrumentation decsriptor, that this InvocationInterceptor registers itself to.
resolution - Resolution, that is used to select which methods will be intercepted.
handler - InvocationHandler
Method Detail

invokeMethod

public java.lang.Object invokeMethod(java.lang.Object o,
                                     java.lang.String name,
                                     java.lang.Object[] args,
                                     java.lang.String signature)
                              throws java.lang.Throwable
Called by Jiapi runtime.

Parameters:
o - if invocation is being made to an static method, this parameter holds a Class of the called method, otherwise this is the instance, that invocation should be acted on.
name - of the method to call
args - Arguments of the method
Throws:
java.lang.Throwable


Copyright © 2001. Documenation generated August 26 2011.