directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Zoerner <ste...@labeo.de>
Subject Using DirectoryServiceFactory correcty
Date Thu, 25 Mar 2010 22:12:35 GMT
Hi all,

I try to update the documentation examples in order to reflect changes 
in 1.5.6. And I have a question regarding DirectoryServiceFactory. I 
have started with the custom partition example.

Currently, I do the following in order to start an embedded server, 
which seems to work:


         DirectoryServiceFactory factory = 
DefaultDirectoryServiceFactory.DEFAULT;
         factory.init("default");
         DirectoryService directoryService = factory.getDirectoryService();

         directoryService.setShutdownHookEnabled(true);

         HelloWorldPartition helloPartition = new HelloWorldPartition();
         helloPartition.setSuffix("ou=helloWorld");
 
helloPartition.setSchemaManager(directoryService.getSchemaManager());
         helloPartition.initialize();

         directoryService.addPartition(helloPartition);
         directoryService.startup();

         LdapServer ldapServer = new LdapServer();
         ldapServer.setDirectoryService(directoryService);
         ldapServer.setAllowAnonymousAccess(true);

         TcpTransport ldapTransport = new TcpTransport(10389);
         ldapServer.setTransports(ldapTransport);

         ldapServer.start();


HelloWorldPartition is my custom partition. The use of the factory class 
seems a little bit complicated to me. Is there an easier way? Is the 
order of the calls correct? Furthermore I do not know which argument to 
pass in the init-Method. without this call, I get an NPE later on (no 
schema manager). But the name seems not be used ...

Thanks in advance,
     StefanZ



Mime
View raw message