private Partition createPartition(String id, String suffix) throws LdapInvalidDnException { Partition partition = new AvlPartition(service.getSchemaManager()); partition.setId(id); partition.setSuffixDn(new Dn(suffix)); return partition; }
/** * {@inheritDoc} */ @Override protected void doInit() throws LdapException { if ( !initialized ) { // ----------------------------------------------------------------------- // Load apachemeta schema from within the ldap-schema Jar with all the // schema it depends on. This is a minimal mandatory set of schemas. // ----------------------------------------------------------------------- wrapped.setId( SCHEMA_ID ); wrapped.setSuffixDn( schemaDN ); wrapped.setSchemaManager( schemaManager ); try { wrapped.initialize(); synchronizer = new RegistrySynchronizerAdaptor( schemaManager ); } catch ( Exception e ) { LOG.error( I18n.err( I18n.ERR_90 ), e ); throw new RuntimeException( e ); } schemaModificationDN = new Dn( schemaManager, SchemaConstants.SCHEMA_MODIFICATIONS_DN ); } }
File workingDirectory = ...; Partition partition = new JdbmPartition(); partition.setId(...); partition.setSuffix(...); DirectoryService directoryService = new DefaultDirectoryService(); directoryService.setWorkingDirectory(workingDirectory); directoryService.addPartition(partition); LdapService ldapService = new LdapService(); ldapService.setSocketAcceptor(new SocketAcceptor(null)); ldapService.setIpPort(...); ldapService.setDirectoryService(directoryService); directoryService.startup(); ldapService.start();
partition = ( Partition ) constructor.newInstance( new Object[] { schemaManager, service.getDnFactory() } ); partition.setId( createPartition.name() ); partition.setSuffixDn( new Dn( schemaManager, createPartition.suffix() ) );