John E. Conlon wrote:
...
Have updated it by encapsulating it within a M2 OSGi plugin and have
replaced the hard coding of the directory configuration with a
springframework based server.xml file.
OK, makes sense. You may have noticed I'm working to upgrade this stuff
to M2 at the moment, too, so it is subject to change. Unfortunately, a
lot has changed, in particular the MINA interfaces and everything moving
from Oscar to Felix and Maven to M2, so there is a bit of work.
The issue I am having problems with is the loading of ldif using the
ldifDirectory property in the server.xml file.
<property name="ldifDirectory">
<value>src/test/resources/nonspecific.ldif</value>
</property>
We could use some code samples, more server.xml, or even logging output
to try to help diagnose this.
...
Being a newbee on embedding the server any ideas or hints on how to
approach the problem would be very appreciated.
The way I would approach this is to get the "loader" OSGi bundle
working. You are combining starting the store as a service, adding
entries to it, and a bunch of Spring stuff not meant for OSGi-land,
which, IMO, should be separate. To this end I created the LdifLoader as
an Oscar console Command. Once the JNDI provider bundle is started then
the LdifLoader command can use the registered JNDI interface from the
OSGi backplane. This needs an update to Felix. Then, at the Felix
console you can call:
-> load <path/to/file> <context>
For example:
-> load /home/user/my.ldif dc=example,dc=com
One benefit here is that you can use 'load' more than just once at startup.
Enrique