Saturday, April 10, 2010

Embed OpenDS in your application

I just created a github project that shows what one has to do to configure and start OpenDS LDAP directory from a Java application, for example to run unit tests.

Most of the code is a direct transcription of information found on OpenDS wiki[1].

Along the commits, I tried to remove most of the unused configuration for the proposed goal, and I ended to replace the Berkeley DB backend by a memory one.

The source code is here: http://github.com/fanf/opends-simple-config

Feel free to remove even more unused configuration, or propose things to make OpenDS start time even faster.

Enjoy !


[1] https://www.opends.org/wiki/page/CreatingAnOpenDSInstanceForEmbeddedUse
https://www.opends.org/wiki/page/ControllingOpenDSFromAnotherApplication

3 comments:

Mathieu

HAd a look at your README and your Main.scala, I believe you do not need to have quicksetup.jar nor je.jar in your maven repository

Fanf

Thanks for your comment.

I don't know exactly what is the purpose of Quicksetup, perhaps I could try to remove it.

For BerkeleyDB, it depends of the backend you want to use. The idea of the main is only to show how to set-up openDS directory tree, but of course, after that you should use it - and so, add some data to the directory. So, if you want to go with BDB back-end, you will need je.jar. If you go for the memory one, perhaps you will be able to remove it ("perhaps", because it seems that some code in openDS relies on utilities provided by je.jar, so even with a memory back-end, the dependency may be needed).

Thanks,

ehsavoie

je.jar can't just be removed :( which issad for an in-memory LDAP server which doesn't rely on it for its backend.

To answer your comments on our blog : using OpenDJ for our tests is more like using the Glassfish embedded container to test your EJBs : use embedded production containers for testing.
It may cost a little more time to start but it is a 'full' container and not a stub one which makes me feel more secure in my production code.

  © Blogger template 'Minimalist G' by Ourblogtemplates.com 2008

Back to TOP