You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by Ryan Zoerner <ry...@gmail.com> on 2011/06/27 18:58:38 UTC

Bean Invoker, Proxy, EasyBeans EJB Remote Home proxy for remote calls

Sergey,

I have seen the Bean Invoker in cxf. I have just come across the class
EJBHomeCallFactory in EasyBeans.

I am wondering if it might suit our needs to use this, BeanInvoker, and make
BeanInvoker extend JAXRSInvoker.

What do you think?

If not, I am currently putting together a resourceProvider which selects
between the Stateless, Stateful, Singelton, EJB Factories in Easybeans, and
returns a resource from whichever state we have for this RP. I am passing in
the cri and will find out whether the bean is stateful, stateless, etc., and
then set an enum constant with that value, which value will determine which
factory is selected.

What do you think about the idea?

Thank you.

Ryan Zoerner

Re: Bean Invoker, Proxy, EasyBeans EJB Remote Home proxy for remote calls

Posted by Ryan Zoerner <ry...@gmail.com>.
Thank you.

Ryan Zoerner


On Mon, Jul 4, 2011 at 4:40 AM, Florent BENOIT <Fl...@ow2.org>wrote:

>   Hi,
>
> If you need details about EasyBeans/CXF integration, you may also ask on
> easybeans@ow2.org mailing list
> I can also answer on this ML ;-)
>
> Regards,
>
> Florent
>
>
> On 07/01/2011 04:40 PM, Sergey Beryozkin wrote:
>
>> Hi Ryan
>>
>> On Fri, Jul 1, 2011 at 2:36 PM, Ryan Zoerner<ry...@gmail.com>
>>  wrote:
>>
>>
>>> Hi Sergey,
>>>
>>> Yes, I've been looking at that package and exploring the same issues. I
>>> see
>>> that there is
>>> an EasyBeansCXFBootstrap. I am unsure whether the bootstrap is what is
>>> directly
>>> instantiated by a server such as Jetty or Tomcat. I found it, tracing
>>> constructor calls
>>> out from the CXFEJBWebserviceEndpoint.
>>>
>>> I will continue to look at Jonas-cxf and try to gain a more comprehensive
>>> understanding.
>>>
>>>
>>>
>> Sounds good. Having a better appreciation of how that works is a key IMHO.
>>
>> Cheers, Sergey
>>
>>
>>
>>> Thanks.
>>>
>>> Ryan
>>>
>>>
>>>
>>
>>
>>
>>
>
>

Re: Bean Invoker, Proxy, EasyBeans EJB Remote Home proxy for remote calls

Posted by Florent BENOIT <Fl...@ow2.org>.
    Hi,

If you need details about EasyBeans/CXF integration, you may also ask on 
easybeans@ow2.org mailing list
I can also answer on this ML ;-)

Regards,

Florent

On 07/01/2011 04:40 PM, Sergey Beryozkin wrote:
> Hi Ryan
>
> On Fri, Jul 1, 2011 at 2:36 PM, Ryan Zoerner<ry...@gmail.com>  wrote:
>    
>> Hi Sergey,
>>
>> Yes, I've been looking at that package and exploring the same issues. I see
>> that there is
>> an EasyBeansCXFBootstrap. I am unsure whether the bootstrap is what is
>> directly
>> instantiated by a server such as Jetty or Tomcat. I found it, tracing
>> constructor calls
>> out from the CXFEJBWebserviceEndpoint.
>>
>> I will continue to look at Jonas-cxf and try to gain a more comprehensive
>> understanding.
>>
>>      
> Sounds good. Having a better appreciation of how that works is a key IMHO.
>
> Cheers, Sergey
>
>    
>> Thanks.
>>
>> Ryan
>>
>>      
>
>
>    


Re: Bean Invoker, Proxy, EasyBeans EJB Remote Home proxy for remote calls

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi Ryan

On Fri, Jul 1, 2011 at 2:36 PM, Ryan Zoerner <ry...@gmail.com> wrote:
> Hi Sergey,
>
> Yes, I've been looking at that package and exploring the same issues. I see
> that there is
> an EasyBeansCXFBootstrap. I am unsure whether the bootstrap is what is
> directly
> instantiated by a server such as Jetty or Tomcat. I found it, tracing
> constructor calls
> out from the CXFEJBWebserviceEndpoint.
>
> I will continue to look at Jonas-cxf and try to gain a more comprehensive
> understanding.
>

Sounds good. Having a better appreciation of how that works is a key IMHO.

Cheers, Sergey

> Thanks.
>
> Ryan
>



-- 
Sergey Beryozkin

Application Integration Division of Talend
http://sberyozkin.blogspot.com

Re: Bean Invoker, Proxy, EasyBeans EJB Remote Home proxy for remote calls

Posted by Ryan Zoerner <ry...@gmail.com>.
Correction, I found it searching for which class instantiates
CXFEJBWebserviceEndpoint,
which class instantiates that, etc.

Ryan

Re: Bean Invoker, Proxy, EasyBeans EJB Remote Home proxy for remote calls

Posted by Ryan Zoerner <ry...@gmail.com>.
Hi Sergey,

Yes, I've been looking at that package and exploring the same issues. I see
that there is
an EasyBeansCXFBootstrap. I am unsure whether the bootstrap is what is
directly
instantiated by a server such as Jetty or Tomcat. I found it, tracing
constructor calls
out from the CXFEJBWebserviceEndpoint.

I will continue to look at Jonas-cxf and try to gain a more comprehensive
understanding.

Thanks.

Ryan

Re: Bean Invoker, Proxy, EasyBeans EJB Remote Home proxy for remote calls

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi Ryan

On Wed, Jun 29, 2011 at 9:19 PM, Ryan Zoerner <ry...@gmail.com> wrote:
> Hi Sergey,
>
>>>The fact you have seen EJB-related annotations being associated with a
>>>given CRI instance in debugger simply confirms the fact JVM retains
>>>them. But the sole responsibility of CRI is to model a JAX-RS root
>>>resource or subresource. It can not deal with with how a given
>>>resource is provided (via EJB, or something else)
>
> I converted this feature of the resourceProvider to annotation-based
> recognition, using methods of 'Class'.
>
> I think that this equates to the class-scanning feature that you had
> recommended.
>
> Because the EasyBeans StatelessSessionBean seems to be the only one produced
> by the invoker factory, it seemed good to decide between the four that are
> possible. At the same time, the presence of an EJB Lifecycle is also
> verified for the class's annotations.
>
> Because there are separate factories for each lifecycle, one of them has to
> be decided upon somehow and the jonas-easybeans-cxf code does not seem to do
> so.
>
> here are the links:
>
> http://pages.cs.wisc.edu/~zoerner/downloads/dev/samples/EJB/EJBResourceProvider.java
>

This actually looks right. It does. Some modifications may be needed -
but it appears it can be used right now
to get a basic jax-rs demo you were working with earlier on run in
Jonas/EasyBeans.

The main issue is how to do it. Which bring me back to the same idea
that you need to understand how CXF JAX-WS has been integrated there.
Having EJBResourceProvider is a big step forward, but the real issue
now is how to get EasyBeans/Jonas to start/create CXF JAX-RS EJB
endpoint - IMHO the answer is in the CXF JAX-WS integration package...

thanks, Sergey

> http://pages.cs.wisc.edu/~zoerner/downloads/dev/samples/EJB/EJBLifecycle.java
>
> Thanks,
>
> Ryan
>

Re: Bean Invoker, Proxy, EasyBeans EJB Remote Home proxy for remote calls

Posted by Ryan Zoerner <ry...@gmail.com>.
Also, for academic interest's sake, here is, to me, a novel idea for
restructuring a class, which implements one subclass for each refactored
method, each of which contains all submethods:

http://pages.cs.wisc.edu/~zoerner/downloads/dev/samples/EJB/idea_to_simplify_a_class_for_readability/

Re: Bean Invoker, Proxy, EasyBeans EJB Remote Home proxy for remote calls

Posted by Ryan Zoerner <ry...@gmail.com>.
Hi Sergey,

>>The fact you have seen EJB-related annotations being associated with a
>>given CRI instance in debugger simply confirms the fact JVM retains
>>them. But the sole responsibility of CRI is to model a JAX-RS root
>>resource or subresource. It can not deal with with how a given
>>resource is provided (via EJB, or something else)

I converted this feature of the resourceProvider to annotation-based
recognition, using methods of 'Class'.

I think that this equates to the class-scanning feature that you had
recommended.

Because the EasyBeans StatelessSessionBean seems to be the only one produced
by the invoker factory, it seemed good to decide between the four that are
possible. At the same time, the presence of an EJB Lifecycle is also
verified for the class's annotations.

Because there are separate factories for each lifecycle, one of them has to
be decided upon somehow and the jonas-easybeans-cxf code does not seem to do
so.

here are the links:

http://pages.cs.wisc.edu/~zoerner/downloads/dev/samples/EJB/EJBResourceProvider.java

http://pages.cs.wisc.edu/~zoerner/downloads/dev/samples/EJB/EJBLifecycle.java

Thanks,

Ryan

Re: Bean Invoker, Proxy, EasyBeans EJB Remote Home proxy for remote calls

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi Ryan

On Wed, Jun 29, 2011 at 6:25 AM, Ryan Zoerner <ry...@gmail.com> wrote:
> Sergey,
>
> I might be able to prove you wrong about which annotations are scanned from
> the class for the cri? I had evidence to the contrary.
>
The fact you have seen EJB-related annotations being associated with a
given CRI instance in debugger simply confirms the fact JVM retains
them. But the sole responsibility of CRI is to model a JAX-RS root
resource or subresource. It can not deal with with how a given
resource is provided (via EJB, or something else)

> Also, it might be just fine to return the factory, as in this
> resourceProvider here:
>
> http://pages.cs.wisc.edu/~zoerner/downloads/dev/samples/EJB/EJBResourceProvider.java
>
> because the factory seems to have a localMethodCall class, which gives the
> bean instance to the java.lang.reflect.Method.Invoke(..) method,
> along with method params. How it knows which method, I couldn't see just
> yet.
>
> If that is the case, then I know how to change the rough draft of the
> EJBInvoker to allow for this other method of invocation.
>

One thing I'd like to mention is that you are persevering and no doubt
you are very good
in trying to stick to fixing a difficult issue. This fact does deserve
the recognition. I'm sure Dan, others, do notice it. I do.

But I'm afraid we are just not understanding each other :-). It may
well point out to the fact I haven't been a good mentor for you. It's
a difficult task but I don't  know about much about EJB or all the
details of how CXF (JAX-WS) has been integrated with a given
container.  In cases like this, when I no idea of how to proceed :-),
I'd try to understand how a similar effort has been achieved/done and
then proceed from there. This has been my advice but you believe you
can avoid doing in and scrape some code there and here and build a
functional RP - but what is next ?

How are we going to confirm it's working in say EasyBeans ? As I said
if one is comfortable with the way a given container works, 'breathes'
EJB, then may be there's  no need to understand how CXF JAX-WS has
been integrated.  It definitely does not apply to me though and thus I
can't give you any useful advice on how to proceed...

Thanks, Sergey

> Thanks,
>
> Ryan
>



-- 
Sergey Beryozkin

Application Integration Division of Talend
http://sberyozkin.blogspot.com

Re: Bean Invoker, Proxy, EasyBeans EJB Remote Home proxy for remote calls

Posted by Ryan Zoerner <ry...@gmail.com>.
Sergey,

I might be able to prove you wrong about which annotations are scanned from
the class for the cri? I had evidence to the contrary.

Also, it might be just fine to return the factory, as in this
resourceProvider here:

http://pages.cs.wisc.edu/~zoerner/downloads/dev/samples/EJB/EJBResourceProvider.java

because the factory seems to have a localMethodCall class, which gives the
bean instance to the java.lang.reflect.Method.Invoke(..) method,
along with method params. How it knows which method, I couldn't see just
yet.

If that is the case, then I know how to change the rough draft of the
EJBInvoker to allow for this other method of invocation.

Thanks,

Ryan

Re: Bean Invoker, Proxy, EasyBeans EJB Remote Home proxy for remote calls

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi Ryan


On Tue, Jun 28, 2011 at 3:23 AM, Ryan Zoerner <ry...@gmail.com> wrote:
> When I was debugging the jax-rs example, I placed an @EJB annotation in my
> Customer class and it showed up in the annotations in cri. Hence, any
> lifecycle-defining annotations would show up also?
>


Yes, we discussed it earlier on. Those annotations are retained at
runtime but as far as ClassResourceInfo is concerned, it's only aware
of JAX-RS annotations.
Re you otherr email. I meant ResourceProvider should return an EJB
Bean instance and to do it the way CXF JAXWS Invoker factory EasyBeans
impl does

Cheers, Sergey

Re: Bean Invoker, Proxy, EasyBeans EJB Remote Home proxy for remote calls

Posted by Ryan Zoerner <ry...@gmail.com>.
When I was debugging the jax-rs example, I placed an @EJB annotation in my
Customer class and it showed up in the annotations in cri. Hence, any
lifecycle-defining annotations would show up also?

Re: Bean Invoker, Proxy, EasyBeans EJB Remote Home proxy for remote calls

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi Ryan

On Mon, Jun 27, 2011 at 5:58 PM, Ryan Zoerner <ry...@gmail.com> wrote:
> Sergey,
>
> I have seen the Bean Invoker in cxf. I have just come across the class
> EJBHomeCallFactory in EasyBeans.
>
> I am wondering if it might suit our needs to use this, BeanInvoker, and make
> BeanInvoker extend JAXRSInvoker.
>
> What do you think?
>
I think we should check how EasyBeans does integrate with CXF JAX-WS
and follow a similar approach.

> If not, I am currently putting together a resourceProvider which selects
> between the Stateless, Stateful, Singelton, EJB Factories in Easybeans, and
> returns a resource from whichever state we have for this RP. I am passing in
> the cri and will find out whether the bean is stateful, stateless, etc., and
> then set an enum constant with that value, which value will determine which
> factory is selected.
>
> What do you think about the idea?
>
ClassResourceInfo knows nothing about the lifecycle of the bean, it
only needs to get a reference to it from RP.
I believe in EasyBeans JAX-WS InvokerFactory (which is similar to RP)
is initialized and used by the invoker. As discussed earlier on, I
encourage you to understand how EasyBeans CXF JAX-WS integration is
done

thanks, Sergey

> Thank you.
>
> Ryan Zoerner
>