[jboss-user] [Microcontainer] - Re: JMX Decorator for POJOs - suggestion

adrian@jboss.org do-not-reply at jboss.com
Wed Dec 6 06:12:38 EST 2006


No because this breaks the whole idea of "do one thing well".
The microcontainer is a dependency state machine.

Besides, despite your assertion only a small percentage of POJOs end up in JNDI
and then not always trivially, e.g. they need to wrapped in object factories.

There already is a mechansim to add adhoc metadata to beans that can
be processed by pluggable interceptors so you can do


  | <bean ...>
  |    <annotation>org.jboss.jndi.JNDIBinding("blah")</annotation>
  | 
  | or
  | 
  | <bean annotation org.jboss.jndi.JNDIBinding(value="blah" objectFactory=com.acme.SomeObjectFactory)
  | 

Which makes this much more extenisbe in terms of matching the
metadata (the annotation) to the implementation (the aspect).

Additionally, you can meta-annotate the metadata to say it requires another service,
e.g.

  | @Depends("jboss:service=Naming")
  | public @interface JNDIBinding
  | ...
  | 

So you know beans annotated with JNDIBinding must wait for the Naming Service
to start.

This is a much more generic mechanism than the "hacky" approach you describe.
1) It requires not extra handling in the microcontainer
2) You can use AOP to map the metadata to any aspect implementation you like
3) The metadata is extensible as new requirements are understood.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3991598#3991598

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3991598



More information about the jboss-user mailing list