You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hivemind.apache.org by James Carman <ja...@carmanconsulting.com> on 2006/05/19 15:12:08 UTC
HiveMind 2.0: Interceptors
All,
I would also like to come up with a way to allow interceptors to be added to
service points based upon some criteria. Maybe we could have
InterceptorInjector or something. I don't know. But, in Spring, I can use
annotations (@Transactional for instance) to decide whether an interceptor
needs to be added to a "bean." I'd like to be able to do the same thing
with HiveMind. Thoughts/ideas?
James
---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-dev-help@jakarta.apache.org
Re: HiveMind 2.0: Interceptors
Posted by Achim Hügen <ac...@gmx.de>.
I'd prefer the plain java way for such things.
The refactoring I mentioned here
(http://article.gmane.org/gmane.comp.jakarta.hivemind.devel/2333)
allows such things quite easily:
You can register a new RegistryProvider, that is called by the
RegistryBuilder during registry construction:
class MyRegistryProvider {
public void postProcess(RegistryConstruction construction) {
// get all service points registered by all modules
List servicePoints = construction.getServicePointDefinitions();
for (.....) {
if (whateverIsTrue)
construction.addIntercepter(currentServicePointDef,
myInterceptor);
}
}
}
Or what about an interceptor factory in a annotated module that gets all
service implementations
when they are constructed, so it could decide what to do?
public class MyModule()
{
@interceptorFactory(id='myInterceptor')
public void addMyInterceptor(Object coreImplementation) {
if (coreImplementation.getClass().hasAnnotation("transactional")) {
addInterceptor(coreImpolementation, myInterceptor);
}
}
}
Achim
James Carman schrieb:
> All,
>
> I would also like to come up with a way to allow interceptors to be added to
> service points based upon some criteria. Maybe we could have
> InterceptorInjector or something. I don't know. But, in Spring, I can use
> annotations (@Transactional for instance) to decide whether an interceptor
> needs to be added to a "bean." I'd like to be able to do the same thing
> with HiveMind. Thoughts/ideas?
>
> James
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: hivemind-dev-help@jakarta.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-dev-help@jakarta.apache.org