[webbeans-dev] binding Manager to JNDI on Jetty

Dan Allen dan.j.allen at gmail.com
Thu Apr 23 14:03:35 EDT 2009


Aha! After some thinking, I realized that using a factory in Jetty is just a
matter of some extra object construction. Instead of passing the
ManagerObjectFactory directly, you simply pass a naming Reference that
refers to the factory.

   <New id="jdciManager" class="org.mortbay.jetty.plus.naming.Resource">
      <Arg><Ref id="webAppCtx"/></Arg>
      <Arg>jcdi/Manager</Arg>
      <Arg>
         <New class="javax.naming.Reference">
            <Arg>javax.inject.manager.Manager</Arg>
            <Arg>org.jboss.webbeans.resources.ManagerObjectFactory</Arg>
            <Arg/>
         </New>
      </Arg>
   </New>

That works out of the box now. So the question becomes, should we add the
class to simplify it to:

   <New id="jdci" class="org.mortbay.jetty.plus.naming.Resource">
      <Arg><Ref id="webAppCtx"/></Arg>
      <Arg>jcdi/Manager</Arg>
      <Arg>
         <New
class="org.jboss.webbeans.resources.ManagerObjectFactoryReference"/>
      </Arg>
   </New>

?

I guess it can't hurt to add the class, but with proper documentation we can
live without it. Pete, once you make the decision, I'll add it to the docs
(and commit if you decide to have the extra class).

Notice I went with the name ManagerObjectFactoryReference, which reads the
best to me.

-Dan

On Thu, Apr 23, 2009 at 3:37 AM, Pete Muir <pmuir at redhat.com> wrote:

> Yeah, looks like Jetty doesn't support ObjectFactory natively. Probably it
> is actually neater to keep these two concepts separate, and just add an
> ManagerObjectFactoryReference class.
>
>
> On 23 Apr 2009, at 00:53, Dan Allen wrote:
>
>  In the process of setting up the servlet-booking example for Seam, I
>> tackled the problem of binding the JCDI Manager to JNDI on Jetty. It's just
>> a matter of extending the javax.naming.Reference class. I attached the
>> implementation to https://jira.jboss.org/jira/browse/WBX-31.
>>
>> Should I commit this Pete? I need a decison on whether we should change
>> the name of the class to reflect that it is an ObjectFactory and a
>> Reference. I think internally Tomcat must create the reference automatically
>> from the resource definition, which is why Jetty doesn't know what to do
>> with a plain ObjectFactory.
>>
>> ...I also noticed that injection is not supported in Jetty. I'm not sure
>> how to handle that problem, but it means no booking yet on Jetty.
>>
>> -Dan
>>
>> --
>> Dan Allen
>> Senior Software Engineer, Red Hat | Author of Seam in Action
>>
>> http://mojavelinux.com
>> http://mojavelinux.com/seaminaction
>> http://in.relation.to/Bloggers/Dan
>>
>> NOTE: While I make a strong effort to keep up with my email on a daily
>> basis, personal or other work matters can sometimes keep me away
>> from my email. If you contact me, but don't hear back for more than a
>> week,
>> it is very likely that I am excessively backlogged or the message was
>> caught in the spam filters.  Please don't hesitate to resend a message if
>> you feel that it did not reach my attention.
>> _______________________________________________
>> webbeans-dev mailing list
>> webbeans-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/webbeans-dev
>>
>
> --
> Pete Muir
> http://www.seamframework.org
> http://in.relation.to/Bloggers/Pete
>
>


-- 
Dan Allen
Senior Software Engineer, Red Hat | Author of Seam in Action

http://mojavelinux.com
http://mojavelinux.com/seaminaction
http://in.relation.to/Bloggers/Dan

NOTE: While I make a strong effort to keep up with my email on a daily
basis, personal or other work matters can sometimes keep me away
from my email. If you contact me, but don't hear back for more than a week,
it is very likely that I am excessively backlogged or the message was
caught in the spam filters.  Please don't hesitate to resend a message if
you feel that it did not reach my attention.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/weld-dev/attachments/20090423/d47677ae/attachment.html 


More information about the weld-dev mailing list