Advertisement
Guest User

Untitled

a guest
Nov 25th, 2014
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. // Now we can create as many partitions as we need
  2. // Create some new partitions named 'foo', 'bar' and 'apache'.
  3. Partition mfPartition = addPartition( "mforg", "dc=mydomain,dc=org", service.getDnFactory() );
  4.  
  5. // Index some attributes on the apache partition
  6. addIndex( mfPartition, "objectClass", "ou", "uid" );
  7.  
  8. // And start the service
  9. service.startup();
  10.  
  11. // Inject the context entry for dc=Apache,dc=Org partition
  12. if ( !service.getAdminSession().exists( mfPartition.getSuffixDn() ) )
  13. {
  14. createDC(service, "dc=mydomain,dc=com");
  15.  
  16. createOU(service, "ou=User,dc=mydomain,dc=com");
  17. createOU(service, "ou=WebLDAP,dc=mydomain,dc=com");
  18. createOU(service, "ou=Account,ou=WebLDAP,dc=mydomain,dc=com");
  19. createOU(service, "ou=Stammdaten,ou=WebLDAP,dc=mydomain,dc=com");
  20.  
  21. }
  22.  
  23. createPerson(service);
  24.  
  25. // We are all done !
  26. }
  27.  
  28. private static void createDC(DirectoryService service, String dn) throws Exception{
  29. DefaultEntry entry = new DefaultEntry(dn,
  30. "objectClass: top",
  31. "objectClass: domain",
  32. "objectClass: extensibleObject",
  33. "dc: mydomain"
  34. );
  35.  
  36. service.getAdminSession().add(entry);
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement