On Aug 17, 2009, at 1:06 PM, Gurkan Erdogdu wrote:

Hi;

I would like to inject @EJB,@WebServiceRef, @Resource, @PersistenceUnit, @PersistenceContext into the OpenWebbeans Managed Bean instance in the
Tomcat Environment. For example, in managed bean instance Person

@RequestScoped
@Named
public class Person
{
   @EJB, @WebServiceRef, bla... bla...
}

I tried to understand the "assembler tomcat" but no success. There are no comments for understanding code. So, my question is how to inject those type
of instances into the Managed Bean instance ? Is there any API to use?

I will give Managed Bean instance to the OpenEJB and it injects above types
of instances.

We'd have to do something custom for this to get the bean classes scanned at deploy time. After that you can inject on an existing instance with code like so:

    Object instance = ...//
    List<Injection> metadata = ...// can worry about this one later
Context javaCompEnv = ..// the result of new InitialContext().lookup("java:comp/env")

InjectionProcessor processor = new InjectionProcessor(instance, metadata, javaCompEnv);

    processor.createInstance();

On the OpenWebBeans side, what kind of code would be needed to get a list of Managed bean classes?

On that same topic, we will have already scanned the webapp classpath for all annotations using the ClassFinder from xbean-finder. Ideally you wouldn't need to scan the classpath again and could just reuse that cached data. What do you guys have going on in that area now and could it be possible to reuse that ClassFinder instance? Geronimo does the same thing with a cached ClassFinder.

I guess on that same question, how is OpenWebBeans booted? I have to imagine you're using a servlet that loads on startup. We could probably boot you a lot sooner so you can participate more closely in deployment.


-David

Reply via email to