In EJB3 the lookup of java:comp/env should be used. I don't recall why I didn't do this in the first place.
I'm going to refactor injection. Now xml descriptors are interwoven into the framework, I want that out. Second thing is to make the separation between setup and injection more clearly.
On the client side this means that it will only use the injection phase with metadata provided via JNDI.
What I'm wondering is whether we can collapse the ee5-1.2 client containers into the same one where injection is simply a noop for the legacy container.
I think if you send a deployment descriptor to the EJB3 client container with metadata complete 'true' you're probably (almost) there.
Ok, then let's work toward replacing the old ClientDeployer with such a mechanism.
What if we bind a collection of injectors (org.jboss.injection.Injector) under java:comp/jboss/injectors?
Then you get something like this:
1. parse XML for injectors
2. if(!metadata complete) parse annotations for injectors
3. bind in JNDI
-- server is done
4. client (/ EJBContainer serverside) looks up injectors and fires them
All injectors should be JndiPropertyInjector with a mapped name somewhere in JNDI space.
During steps 1 & 2 parsing for env entries can also be done, but these should be treated separately.
This would simplify injection a lot, but would need a bit more functionality on the setup-env phase. It would also mean that the client uses only JavaEE API's and a simple injection framework, thus it can become a separate project / module.
Sounds good. Currently doesn't the ejb3 processing build the jndi env during the injection phase?
We would essentially need to take the existing j2ee1.4 client deployer jndi behavior and then add the javaee5 injectors for use by the client container?
Yup, except that the server environment should start at java:comp and not java:comp/env like now in the EJB3 client container. Then we can use java:comp/jboss for our own stuff.
I've committed a prototype of injection in https://svn.jboss.org/repos/jbossas/projects/ejb3/trunk/injection. It is a standalone project which should be usable in the 1.4 client launcher.
The client launcher will then work more or less like org.jboss.injection.test.annotated.unit.AnnotatedTestCase. With the injector setup coming from JNDI.
Note/ToDo: check getHandle in Java URL factory. I think there might be a conflict there.