You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by exabrial <ex...@gmail.com> on 2012/07/02 23:52:24 UTC

OpenEJB.xml and a custom javax.naming.spi.ObjectFactory

Hey guys,

One of the features I'm missing from GlassFish is the ability to bind an
ObjectFactory into JNDI. We have a few of these written and need to put them
into our instance. I'm also hoping to write a brand new one that could be
used to create JNDI links (see previous thread in mailing list).

Here's a simple example of a custom ObjectFactory: 
http://grepcode.com/file/repo1.maven.org/maven2/org.glassfish.connectors/connectors-internal-api/3.0/org/glassfish/resources/custom/factory/PrimitivesAndStringFactory.java

Is there a way to put an ObjectFactory like that into conf/openejb.xml? I've
read all the documentation on Resources and didn't find anything. I found
some old mails on the openejb.iusers that say if you're in Tomcat, you can
put it into context.xml, but I was curious if there was a way to do this on
OpenEJB standalone server.

Thanks guys,
-Jonathan

--
View this message in context: http://openejb.979440.n4.nabble.com/OpenEJB-xml-and-a-custom-javax-naming-spi-ObjectFactory-tp4655970.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: OpenEJB.xml and a custom javax.naming.spi.ObjectFactory

Posted by David Blevins <da...@gmail.com>.
On Jul 2, 2012, at 2:52 PM, exabrial wrote:

> Hey guys,
> 
> One of the features I'm missing from GlassFish is the ability to bind an
> ObjectFactory into JNDI. We have a few of these written and need to put them
> into our instance. I'm also hoping to write a brand new one that could be
> used to create JNDI links (see previous thread in mailing list).
> 
> Here's a simple example of a custom ObjectFactory: 
> http://grepcode.com/file/repo1.maven.org/maven2/org.glassfish.connectors/connectors-internal-api/3.0/org/glassfish/resources/custom/factory/PrimitivesAndStringFactory.java

Do you have an example of how that is configured?

I suspect that's not your only ObjectFactory, but note, you can put Primitives and Strings into <env-entry> elements and get them into JNDI in a standard way.  The standard technique also supports java.lang.Class and any Enum type.

As Romain notes, there might be something that can be done in the openejb/tomee.xml jar already using <Resource> to produce things which can then be consumed via @Resource.


-David


Re: OpenEJB.xml and a custom javax.naming.spi.ObjectFactory

Posted by Romain Manni-Bucau <rm...@gmail.com>.
you can write a custom service-jar.xml to be able to define default values
(normal usage).

On trunk i think you can skip this part and define all properties inline
(without default values) adding the property "IgnoreDefaultValues"

- Romain


2012/7/3 exabrial <ex...@gmail.com>

> Ok... that's fine. Would I need to write something like this?
>
> http://svn.apache.org/repos/asf/openejb/branches/old-website/src/doc/connector_service.xml
> (sorry for the XML link, but I can't find that page anywhere else)
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/OpenEJB-xml-and-a-custom-javax-naming-spi-ObjectFactory-tp4655970p4655974.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: OpenEJB.xml and a custom javax.naming.spi.ObjectFactory

Posted by exabrial <ex...@gmail.com>.
Ok... that's fine. Would I need to write something like this?
http://svn.apache.org/repos/asf/openejb/branches/old-website/src/doc/connector_service.xml
(sorry for the XML link, but I can't find that page anywhere else)

--
View this message in context: http://openejb.979440.n4.nabble.com/OpenEJB-xml-and-a-custom-javax-naming-spi-ObjectFactory-tp4655970p4655974.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: OpenEJB.xml and a custom javax.naming.spi.ObjectFactory

Posted by Romain Manni-Bucau <rm...@gmail.com>.
think not out of the box, currently providing a custom resource will
probably be the closer of the need.


- Romain


2012/7/2 exabrial <ex...@gmail.com>

> I've done this successfully with context.xml before, however, I was curious
> if this was available on the standalone OpenEjb 4.0.0 server
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/OpenEJB-xml-and-a-custom-javax-naming-spi-ObjectFactory-tp4655970p4655972.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: OpenEJB.xml and a custom javax.naming.spi.ObjectFactory

Posted by exabrial <ex...@gmail.com>.
I've done this successfully with context.xml before, however, I was curious
if this was available on the standalone OpenEjb 4.0.0 server

--
View this message in context: http://openejb.979440.n4.nabble.com/OpenEJB-xml-and-a-custom-javax-naming-spi-ObjectFactory-tp4655970p4655972.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: OpenEJB.xml and a custom javax.naming.spi.ObjectFactory

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi,

did you try using tomcat context.xml?

- Romain


2012/7/2 exabrial <ex...@gmail.com>

> Hey guys,
>
> One of the features I'm missing from GlassFish is the ability to bind an
> ObjectFactory into JNDI. We have a few of these written and need to put
> them
> into our instance. I'm also hoping to write a brand new one that could be
> used to create JNDI links (see previous thread in mailing list).
>
> Here's a simple example of a custom ObjectFactory:
>
> http://grepcode.com/file/repo1.maven.org/maven2/org.glassfish.connectors/connectors-internal-api/3.0/org/glassfish/resources/custom/factory/PrimitivesAndStringFactory.java
>
> Is there a way to put an ObjectFactory like that into conf/openejb.xml?
> I've
> read all the documentation on Resources and didn't find anything. I found
> some old mails on the openejb.iusers that say if you're in Tomcat, you can
> put it into context.xml, but I was curious if there was a way to do this on
> OpenEJB standalone server.
>
> Thanks guys,
> -Jonathan
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/OpenEJB-xml-and-a-custom-javax-naming-spi-ObjectFactory-tp4655970.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>