geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ivan <xhh...@gmail.com>
Subject Legacy JNDI support ?
Date Thu, 27 Jun 2013 07:23:14 GMT
Hi,

One tradition usage for JNDI API is that, the users could configure a
factory class while creating the Context instance, and the jar file
contains the context factory is shipped in the user application.

Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.myContextFactory");
InitialContext ctx = new InitialContext(env);

While moving to OSGi, the typical scenario above will not work, as the
current JNDI lookup follows the JNDI OSGi spec, except that the configured
factory could be loaded from JRE, we will always return the default XBean
context.

I could saw two solutions for this,

a. Enable the leagacy JNDI support from Aries

http://svn.apache.org/repos/asf/aries/tags/jndi-0.3/jndi-legacy-support/src/main/java/org/apache/aries/jndi/legacy/support/LegacyInitialContextFinder.java

b. Add the similar logic in our DefaultInitialContextFactoryBuilder.

I would prefer the option b, considering the logic is so simple, and there
is no need to import another  jar file, also, we may not suffer the
potential ordering issue, since the current
DefaultInitialContextFactoryBuilder will always return one context instance.

Thoughts ?

-- 
Ivan

Mime
View raw message