Fixed up javadoc warnings and source paths.

Now using BaseLdapPathAware on all LdapServerManagers.
This commit is contained in:
Ulrik Sandberg
2008-01-13 23:07:41 +00:00
parent 0b2811bfee
commit cd96ed59e6
2 changed files with 22 additions and 15 deletions

View File

@@ -22,7 +22,8 @@
<dependency org="commons-logging" name="commons-logging" rev="1.0.4" />
<dependency org="commons-lang" name="commons-lang" rev="2.1" />
<dependency org="commons-collections" name="commons-collections" rev="3.1" />
<dependency org="org.springframework" name="spring-ldap" rev="latest.integration"/>
<dependency org="org.springframework" name="spring-ldap"
rev="latest.integration" conf="global->default;source->source" />
<dependency org="org.springframework" name="spring-beans" rev="2.0.8"/>
<dependency org="org.springframework" name="spring-core" rev="2.0.8"/>
<dependency org="org.springframework" name="spring-context" rev="2.0.8"/>

View File

@@ -16,15 +16,7 @@
package org.springframework.ldap;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.directory.server.core.configuration.ShutdownConfiguration;
import org.apache.directory.server.jndi.ServerContextFactory;
import org.apache.directory.server.protocol.shared.store.LdifFileLoader;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.ldap.core.ContextSource;
import org.springframework.ldap.core.DistinguishedName;
import org.springframework.ldap.core.support.DefaultDirObjectFactory;
import java.util.Properties;
import javax.naming.Binding;
import javax.naming.Context;
@@ -34,7 +26,16 @@ import javax.naming.Name;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
import javax.naming.directory.DirContext;
import java.util.Properties;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.directory.server.core.configuration.ShutdownConfiguration;
import org.apache.directory.server.jndi.ServerContextFactory;
import org.apache.directory.server.protocol.shared.store.LdifFileLoader;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.ldap.core.ContextSource;
import org.springframework.ldap.core.DistinguishedName;
import org.springframework.ldap.core.support.BaseLdapPathAware;
/**
* Utility class to initialize the apache directory server for use in the
@@ -42,17 +43,23 @@ import java.util.Properties;
*
* @author Mattias Arthursson
*/
public class LdapServerManager implements DisposableBean
public class LdapServerManager implements DisposableBean, BaseLdapPathAware
{
private static Log log = LogFactory.getLog(LdapServerManager.class);
private ContextSource contextSource;
private DistinguishedName baseLdapPath;
public void setContextSource(ContextSource contextSource)
{
this.contextSource = contextSource;
}
public void setBaseLdapPath(DistinguishedName baseLdapPath) {
this.baseLdapPath = baseLdapPath;
}
public void destroy() throws Exception
{
Properties env = new Properties();
@@ -77,14 +84,13 @@ public class LdapServerManager implements DisposableBean
// Different test cases have different base paths. This means that the
// starting point will be different.
if (ctx.getEnvironment().get(
DefaultDirObjectFactory.JNDI_ENV_BASE_PATH_KEY) != null)
if (baseLdapPath.size() != 0)
{
startingPoint = DistinguishedName.EMPTY_PATH;
}
else
{
startingPoint = new DistinguishedName("dc=jayway,dc=se");
startingPoint = new DistinguishedName(baseLdapPath);
}
try