|
|||||||||||
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
Base class for creating new service interceptors. Most implementations
merely have to implement
#addServiceMethodImplementation(ClassFab, String, Class, Class[], Class[])
.
This is only suitable for interceptors which do not use parameters.
Implementations of this service must be configured with:
serviceId
property
hivemind.ClassFactory
service assigned to the factory
property
Constructor Summary | |
AbstractServiceInterceptorFactory()
|
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 |
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). |
protected void |
createInfrastructure(InterceptorStack stack,
ClassFab classFab,
java.util.List parameters)
Invoked in subclasses to create any infrastructure. |
void |
createInterceptor(InterceptorStack stack,
Module contributingModule,
java.util.List parameters)
Creates the interceptor. |
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. |
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 |
public AbstractServiceInterceptorFactory()
Method Detail |
public void createInterceptor(InterceptorStack stack, Module contributingModule, java.util.List parameters)
createInterceptor
in interface ServiceInterceptorFactory
protected java.lang.Class getInterceptorSuperclass()
protected void createInfrastructure(InterceptorStack stack, ClassFab classFab, java.util.List parameters)
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.
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
#createInfrastructure(InterceptorStack, ClassFab)
)
will need to override this method as well.
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)
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.
classFab
- the fabricator for the interceptor classsig
- the method signature for the methodprotected void addServiceMethods(InterceptorStack stack, ClassFab fab, java.util.List parameters)
protected void addToStringMethod(InterceptorStack stack, ClassFab fab)
public void setServiceId(java.lang.String string)
public void setFactory(ClassFactory factory)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |