org.apache.hivemind.service.impl
Class LoggingInterceptorFactory

java.lang.Object
  extended by org.apache.hivemind.service.impl.LoggingInterceptorFactory
All Implemented Interfaces:
ServiceInterceptorFactory

public class LoggingInterceptorFactory
extends java.lang.Object
implements ServiceInterceptorFactory

An interceptor factory that adds logging capability to a service. The logging is based upon the Jakarta commons-logging toolkit, which makes it very transportable.

The interceptor will log entry to each method and exit from the method (with return value), plus log any exceptions thrown by the method. The logger used is the id of the service, which is not necessarily the name of the implementing class. Logging occurs at the debug level.

Author:
Howard Lewis Ship

Constructor Summary
LoggingInterceptorFactory()
           
 
Method Summary
protected  void addServiceMethodImplementation(ClassFab classFab, MethodSignature sig)
           
protected  void addServiceMethods(InterceptorStack stack, ClassFab fab, java.util.List parameters)
           
protected  void addToStringMethod(InterceptorStack stack, ClassFab fab)
          Creates a toString() method that identify the interceptor service id, the intercepted service id, and the service interface class name).
 void createInterceptor(InterceptorStack stack, Module contributingModule, java.util.List parameters)
          Creates the interceptor.
 void setFactory(ClassFactory factory)
           
 void setServiceId(java.lang.String string)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LoggingInterceptorFactory

public LoggingInterceptorFactory()
Method Detail

addServiceMethodImplementation

protected void addServiceMethodImplementation(ClassFab classFab,
                                              MethodSignature sig)

addServiceMethods

protected void addServiceMethods(InterceptorStack stack,
                                 ClassFab fab,
                                 java.util.List parameters)

addToStringMethod

protected void addToStringMethod(InterceptorStack stack,
                                 ClassFab fab)
Creates a toString() method that identify the interceptor service id, the intercepted service id, and the service interface class name).


createInterceptor

public void createInterceptor(InterceptorStack stack,
                              Module contributingModule,
                              java.util.List parameters)
Creates the interceptor. The class that is created is cached; if an interceptor is requested for the same extension point, then the previously constructed class is reused (this can happen with the threaded service model, for example, when a thread-local service implementation is created for different threads).

Specified by:
createInterceptor in interface ServiceInterceptorFactory

setFactory

public void setFactory(ClassFactory factory)

setServiceId

public void setServiceId(java.lang.String string)