I have been looking at this area also and was hoping to see answers to
your questions.
Since none have been forthcoming yet here is my understanding how this
works (comments inline).
Somebody please correct me if I am mistaken!
Peter.
David Black wrote:
Hi,
I'm wondering about ServiceMix/JBI and JNDI. I see from the spec and APIs
that I can get a JNDI InitialContext via ComponentContext.getNamingContext()
... ok, so how do things get bound to that?
ComponentContextImpl.getNamingContext delegates to JBIContainer.
So I expect the container property "namingContext" can be set in the
servicemix.xml something like this:
<property name="namingContext">
<bean class="javax.naming.InitialContext"/>
</property>
I see there is a SpringInitialContextFactory which can bind the contents of
a jndi.xml file on the classpath (correct?) or a named file, or "the
spring.xml configuration file can be specified by the [EMAIL PROTECTED]
Context#PROVIDER_URL} property" ... I don't understand this bit, where is
that property set? Also, how does a JBI component cause
SpringInitialContextFactory to do its stuff if one wishes to use it?
InitialContext uses properties from the application resource file(s) -
eg conf/jndi.properties.
The property defined in that file
java.naming.factory.initial =
org.servicemix.jbi.jndi.SpringInitialContextFactory
is what "causes SpringInitialContextFactory to do its stuff"
If you felt the need to define java.naming.provider.url that's also
where you would do it.
See http://servicemix.org/JNDI+configuration?refresh=1
See http://java.sun.com/products/jndi/tutorial/beyond/env/source.html
Beyond that, suppose I'm deploying ServiceMix on a J2EE app server and I've
got stuff in its (the app servers) JNDI tree I want to be able to access
from my JBI component - make sense? possible? nonsense?? e.g. I want to look
up a data source.
any help much appreciated
thanks
David Black