|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.hivemind.service.impl.AbstractServiceInterceptorFactory | +--org.apache.hivemind.service.impl.LoggingInterceptorFactory
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.
Constructor Summary | |
LoggingInterceptorFactory()
|
Method Summary | |
protected void |
addServiceMethodImplementation(ClassFab classFab,
MethodSignature sig)
Invoked by addServiceMethods(InterceptorStack, ClassFab, List)
for each method in the service interface to allow the factory to
construct the corresponding method in the interceptor. |
protected void |
addServiceMethods(InterceptorStack stack,
ClassFab fab,
java.util.List parameters)
Invoked from {@link #createInterceptor(InterceptorStack, Module, List) to add the service methods to the interceptor class. |
protected void |
createInfrastructure(InterceptorStack stack,
ClassFab classFab,
java.util.List parameters)
Invoked in subclasses to create any infrastructure. |
protected java.lang.Class |
getInterceptorSuperclass()
Overridden in subclasses to identify the super-class for the interceptor. |
protected java.lang.Object |
instantiateInterceptor(InterceptorStack stack,
java.lang.Class interceptorClass,
java.util.List parameters)
Used to instantiate the interceptor. |
Methods inherited from class org.apache.hivemind.service.impl.AbstractServiceInterceptorFactory |
addToStringMethod, createInterceptor, setFactory, setServiceId |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public LoggingInterceptorFactory()
Method Detail |
protected void createInfrastructure(InterceptorStack stack, ClassFab classFab, java.util.List parameters)
AbstractServiceInterceptorFactory
This implementation adds a field, _inner
whose
type is the actual type of the
top object on the stack
(which, of
course, implements the service interface). A constructor is created
to set the field.
createInfrastructure
in class AbstractServiceInterceptorFactory
stack
- the interceptor stack (used to obtain the service interface and extension point id)classFab
- the interceptor class being constructedparameters
- parameters provided to the interceptor factoryprotected java.lang.Object instantiateInterceptor(InterceptorStack stack, java.lang.Class interceptorClass, java.util.List parameters) throws java.lang.Exception
AbstractServiceInterceptorFactory
#createInfrastructure(InterceptorStack, ClassFab)
)
will need to override this method as well.
instantiateInterceptor
in class AbstractServiceInterceptorFactory
stack
- the interceptor stack on which the returned interceptor will be placed.interceptorClass
- the generated class for the interceptor.
java.lang.Exception
- if there is an error getting or invoking the constructor#createInfrastructure(InterceptorStack, ClassFab)
protected void addServiceMethodImplementation(ClassFab classFab, MethodSignature sig)
AbstractServiceInterceptorFactory
AbstractServiceInterceptorFactory.addServiceMethods(InterceptorStack, ClassFab, List)
for each method in the service interface to allow the factory to
construct the corresponding method in the interceptor. This implementation
does nothing, and must be overridden. More sophisticated
interceptors will override addServiceMethods()
and may by
implemented in such a way that this method is not invoked.
addServiceMethodImplementation
in class AbstractServiceInterceptorFactory
classFab
- the fabricator for the interceptor classsig
- the method signature for the methodprotected java.lang.Class getInterceptorSuperclass()
AbstractServiceInterceptorFactory
getInterceptorSuperclass
in class AbstractServiceInterceptorFactory
protected void addServiceMethods(InterceptorStack stack, ClassFab fab, java.util.List parameters)
AbstractServiceInterceptorFactory
addServiceMethods
in class AbstractServiceInterceptorFactory
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |