JNDI integration question

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

JNDI integration question

David Bosschaert
Hi all,

I'm looking at integrating the OSGi JNDI spec [1] with AS7.
Implementations of this spec (which exposes OSGi services via JNDI to
allow JavaEE integration) create a few javax.naming.spi.ObjectFactory
instances to handle some additional namespaces, e.g. osgi:service lookups.

To get this working with AS7 I can call
   org.jboss.as.naming.InitialContext.addUrlContextFactory(scheme,
myObjectFactory)
and that works fine.

However, I'm curious, is there a non-JBoss-specific way to do this too
(i.e. part of the JEE naming spec). If there is, I can make the Apache
Aries OSGi-JNDI implementation call this directly and it would avoid the
need for some AS7-specific glue code...

Thanks,

David

[1] Chapter 126 in the 4.2 Enterprise Spec
http://www.osgi.org/Download/Release4V42
_______________________________________________
jboss-as7-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
Reply | Threaded
Open this post in threaded view
|

Re: JNDI integration question

Carlo de Wolf
On 01/23/2012 12:58 PM, David Bosschaert wrote:

> Hi all,
>
> I'm looking at integrating the OSGi JNDI spec [1] with AS7.
> Implementations of this spec (which exposes OSGi services via JNDI to
> allow JavaEE integration) create a few javax.naming.spi.ObjectFactory
> instances to handle some additional namespaces, e.g. osgi:service lookups.
>
> To get this working with AS7 I can call
>     org.jboss.as.naming.InitialContext.addUrlContextFactory(scheme,
> myObjectFactory)
> and that works fine.
>
> However, I'm curious, is there a non-JBoss-specific way to do this too
> (i.e. part of the JEE naming spec). If there is, I can make the Apache
> Aries OSGi-JNDI implementation call this directly and it would avoid the
> need for some AS7-specific glue code...

http://docs.oracle.com/javase/jndi/tutorial/beyond/url/initctx.html

Carlo

>
> Thanks,
>
> David
>
> [1] Chapter 126 in the 4.2 Enterprise Spec
> http://www.osgi.org/Download/Release4V42
> _______________________________________________
> jboss-as7-dev mailing list
> [hidden email]
> https://lists.jboss.org/mailman/listinfo/jboss-as7-dev

_______________________________________________
jboss-as7-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
Reply | Threaded
Open this post in threaded view
|

Re: JNDI integration question

David Bosschaert
On 23/01/2012 12:02, Carlo de Wolf wrote:

> On 01/23/2012 12:58 PM, David Bosschaert wrote:
>> Hi all,
>>
>> I'm looking at integrating the OSGi JNDI spec [1] with AS7.
>> Implementations of this spec (which exposes OSGi services via JNDI to
>> allow JavaEE integration) create a few javax.naming.spi.ObjectFactory
>> instances to handle some additional namespaces, e.g. osgi:service lookups.
>>
>> To get this working with AS7 I can call
>>      org.jboss.as.naming.InitialContext.addUrlContextFactory(scheme,
>> myObjectFactory)
>> and that works fine.
>>
>> However, I'm curious, is there a non-JBoss-specific way to do this too
>> (i.e. part of the JEE naming spec). If there is, I can make the Apache
>> Aries OSGi-JNDI implementation call this directly and it would avoid the
>> need for some AS7-specific glue code...
> http://docs.oracle.com/javase/jndi/tutorial/beyond/url/initctx.html
>
Thanks Carlo.

 From that it seems that the only way to do this in a standard manner is
by putting the relevant packages on the java.naming.factory.url.pkgs
system property. The system attempts to instantiate a class in those
packages. This is not modular by design and will not work.

Seems like those 5 lines of glue code are inevitable. It's not a big
problem, thanks for pointing this out.

Cheers,

David
_______________________________________________
jboss-as7-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/jboss-as7-dev