Hi Torgeir!

Torgeir Veimo wrote:
I'm looking at the example shown here; http://directory.apache.org/apacheds/1.5/embedding-apacheds-as-a-web-application.html I've sort of gettng it to work by tweaking a bit with jar files, but I'm also interested in packaging a server.xml file I've used with the standalone ApacheDS setup. I had a look at MutableServerStartupConfiguration to see if I could supply it with an InputSource/Stream to server.xml, but it seems to only accept a File for the working directory.

Any idea how to accomplish this? I'm planning to include an already configured DIT tree with data, and would require the webapp to run exploded, in order to allow it to use data from within the WEB-INF directory.

I have created the example basically for demonstration purposes. It is therefore as simple as possible. The server.xml file is a Spring bean definition file, hence Spring is necessary to start up the server. For embedded use, this is not necessary. The configuration is done programmatically then. This is exactly what I wanted to show.

Basically, it is possible to achieve all features available in the server.xml programatically as well. Spring is only used to wire the beans. The server.xml is a good option to configure the server without recompiling it. The example already takes advantage of the beans to some degree, like here:

...
// Set LDAP port to 10389
LdapConfiguration ldapCfg = cfg.getLdapConfiguration();
ldapCfg.setIpPort(10389);
...

You can do more (I assume: everything).

Another option would be to deploy Spring with the webapp and modify the startup class (StartStopListener) to use the same startup style which is used standalone to fire up the server. In this case you may user the server.xml as well. Obviously, you have to reworkthe example for this.

If you just want to deploy some data with ApacheDS. There are several options. One is to provide an LDIF file for startup, which may be included in the war-File (I have not tried this out, but it would be nice to extend the example this way ...).

I hope this already helps a bit.
Greetings from Hamburg,
    Stefan

Reply via email to