directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert r. Sanders" <>
Subject Configure (Eve) server from properties file.
Date Wed, 02 Mar 2005 02:54:09 GMT
I'd like to use the JNDI server so that I can create and run JUnit tests 
of JNDI/LDAP functionality.  To that end I'm trying to figure out the 
easiest way to configure a server instance; it looked like properties 
files would be a decent way (at least better than programmatically 
creating a bunch of JNDI Attribute objects); but I don' t know how to 
get the server to load a properties file - this is what I have so far 
(using properties file contents from documentation example):

Properties env = new Properties();
FileInputStream in = new 
env.put( Context.PROVIDER_URL, "ou=system" );
"org.apache.ldap.server.jndi.ServerContextFactory" );
env.put( Context.SECURITY_PRINCIPAL, "uid=admin,ou=system" );
env.put( Context.SECURITY_CREDENTIALS, "secret" );

DirContext ctx = new InitialDirContext( env );

Once I have the DirContext I have just been using code from the JNDI 
tutorial to see what's there:

NamingEnumeration list = ctx.list("");
while (list.hasMore()) {
    NameClassPair nc = (NameClassPair);
    System.out.println( nc );

Any help would be much appreciated.

    Robert r. Sanders
    Chief Technologist
    (334) 821-5412

View raw message