[Design the new POJO MicroContainer] - Re: KernelRegistryPlugins and dependencies
by adrian@jboss.org
"adrian(a)jboss.org" wrote : "bill.burke(a)jboss.com" wrote :
| | If you saw my original post, this just isn't feasible as the EJB container (or any component that uses EE metadata references) might be referencing something that is MC-unaware. I.e. a third-party JMS implementation.
| |
|
| In that case you impose a weaker dependency, either no dependency at all
| or something like the JNDIDependencyItem.
| What you need is something that says this needs the weaker notion,
| I thought that already existed?
Also we've been talking about having the notion of "optional" dependency in the MC.
It sort of already exists with the install callbacks (with cardinality=0)
The idea being you don't wait for the dependency to start, but if it appears later
then it gets injected at that time.
Similarly if it disappears you don't get undeployed.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4082216#4082216
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4082216
18 years, 7 months
[Design the new POJO MicroContainer] - Re: KernelRegistryPlugins and dependencies
by bill.burke@jboss.com
"adrian(a)jboss.org" wrote : Then a JNDIDependencyItem does something like:
|
| | public boolean isResolved()
| | {
| | Object realName = jndiRegistry.getRealName(jndiBinding);
| | if (realName != null)
| | {
| | setIDependOn(realName);
| | setResolved(true);
| | }
| | return super.isResolved();
| | }
| |
|
| Now the iDependOn is set, we know when the providing service is removed
| so we need to be removed/recycled.
|
If you saw my original post, this just isn't feasible as the EJB container (or any component that uses EE metadata references) might be referencing something that is MC-unaware. I.e. a third-party JMS implementation.
"adrian(a)jboss.org" wrote :
| In practice, as I discussed with Carlo, it is more difficult for ejb(3)
| since you can actually depend on is the "ejb-link-ref-name",
| resource-ref-name, etc. not the jndi name.
|
Its actually more difficult than that. EJB-refs might only know the interface of the EJB they are refencing, no other information. They also have to look first within the EJB-jar, then EAR, then globally for beans of this type. PersistenceUnits have exact same scoping rules as well, except that units defined in EJB jars or Wars are private. Making it even more complicated. For @Resource entries we rely on the mapped-name() attribute which we assume is a JNDI name. There is no other way to do it generically.
"adrian(a)jboss.org" wrote :
| Only when the application providing the link is deployed do you know what the
| real jndi name is. This is something that could be resolved either by
|
| 1) a seperate registry/dependency item for links provided by the
| javaee deployers/containers
|
| or
|
| 2) a more complicated jndi registry that understands deployments/links and
| their contexts.
|
| I think (1) is easier and cleaner. But the devil is always in the details. :-)
We already do (1) (or did? not sure if carlo totally refactored this incorrectly) for @EJB, @PersistenceContext, and @PersistenceUnit. It is just not possible to do it for datasources, JMS objects, and other resources. That's why I think a service is needed.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4082209#4082209
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4082209
18 years, 7 months