Hi David,

Firstly, thanks for answering.

As you specified we currently boot OpenWebBeans as a servlet context
listener to get all OWB  classes and to create OWB specific beans. For each
class, we ask OpenEJB whether it is an EJB related class or not. If it is
not an EJB class, we define OWB "*Managed Bean*" instance, if it is we
create "*EJB Bean*" instance.

OWB beans are used for creating actual object instances whenever they are
injected into some other beans. OWB container finds which bean it injects
using type safe algorithm. (In below example, it tries to find OWB Managed
Bean with "*API Type*" PaymentProcessor and "*Binding Type*" is @Payment)

For Example;

class Person{
   @Payment PaymentProcessor processor;
}

After the "Managed Bean" creates an object instance , it handles post
construct operations like injection of instance's fields. My aim is to call
OpenEJB specific injections into newly created object instance here. If
created object instance is EJB instance, we are done because, OpenEJB
handles injections for us.

>>>On the OpenWebBeans side, what kind of code would be needed to get a list
of Managed bean classes?
As explained above. So we get all classes in booting.

>>>What do you guys have going on in that area now and could it be possible
to reuse that ClassFinder instance?
We also scans paths as explained above using servlet context listener.

>>>I guess on that same question, how is OpenWebBeans booted?
As explained above.

>>>We could probably boot you a lot sooner so you can participate more
closely in deployment.
Tomcat calls our context listener after deployment, so we are able to use
EJB integration. So there is no problem for deployment ordering

Thanks;

--Gurkan

2009/8/18 David Blevins <[email protected]>

> 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
>
>


-- 
Gurkan Erdogdu
http://gurkanerdogdu.blogspot.com

Reply via email to