public ApacheDSContainer(String root, String ldifs) throws Exception { this.ldifResources = ldifs; service = new DefaultDirectoryService(); List<Interceptor> list = new ArrayList<>(); list.add(new NormalizationInterceptor()); list.add(new AuthenticationInterceptor()); list.add(new ReferralInterceptor()); // list.add( new AciAuthorizationInterceptor() ); // list.add( new DefaultAuthorizationInterceptor() ); list.add(new ExceptionInterceptor()); // list.add( new ChangeLogInterceptor() ); list.add(new OperationalAttributeInterceptor()); // list.add( new SchemaInterceptor() ); list.add(new SubentryInterceptor()); // list.add( new CollectiveAttributeInterceptor() ); // list.add( new EventInterceptor() ); // list.add( new TriggerInterceptor() ); // list.add( new JournalInterceptor() ); service.setInterceptors(list); partition = new JdbmPartition(); partition.setId("rootPartition"); partition.setSuffix(root); this.root = root; service.addPartition(partition); service.setExitVmOnShutdown(false); service.setShutdownHookEnabled(false); service.getChangeLog().setEnabled(false); service.setDenormalizeOpAttrsEnabled(true); }
protected Partition addPartition(String partitionId, String partitionDn) throws Exception { Partition partition = new JdbmPartition(); partition.setId(partitionId); partition.setSuffix(partitionDn); service.addPartition(partition); return partition; }
public ApacheDsSSLContainer(String root, Resource[] ldifs) throws Exception { this.ldifResources = ldifs; service = new DefaultDirectoryService(); List<Interceptor> list = new ArrayList<Interceptor>(); //list.add(new NormalizationInterceptor()); list.add(new AuthenticationInterceptor()); list.add(new ReferralInterceptor()); // list.add( new AciAuthorizationInterceptor() ); // list.add( new DefaultAuthorizationInterceptor() ); //list.add(new ExceptionInterceptor()); // list.add( new ChangeLogInterceptor() ); //list.add(new OperationalAttributeInterceptor()); // list.add( new SchemaInterceptor() ); //list.add(new SubentryInterceptor()); // list.add( new CollectiveAttributeInterceptor() ); // list.add( new EventInterceptor() ); // list.add( new TriggerInterceptor() ); // list.add( new JournalInterceptor() ); //service.setInterceptors(list); partition = new JdbmPartition(); partition.setId("rootPartition"); partition.setSuffix(root); this.root = root; service.addPartition(partition); service.setExitVmOnShutdown(false); service.setShutdownHookEnabled(false); service.getChangeLog().setEnabled(false); service.setDenormalizeOpAttrsEnabled(true); }
/** * {@inheritDoc} */ public JdbmPartition createPartition( SchemaManager schemaManager, DnFactory dnFactory, String id, String suffix, int cacheSize, File workingDirectory ) throws Exception { JdbmPartition partition = new JdbmPartition( schemaManager, dnFactory ); partition.setId( id ); partition.setSuffixDn( new Dn( schemaManager, suffix ) ); partition.setCacheSize( cacheSize ); partition.setPartitionPath( workingDirectory.toURI() ); return partition; }
/** * Add a new partition to the server * * @param partitionId The partition Id * @param partitionDn The partition DN * @return The newly added partition * @throws Exception If the partition can't be added */ private Partition addPartition(String partitionId, String partitionDn) throws Exception { JdbmPartition partition = new JdbmPartition(); partition.setId(partitionId); partition.setPartitionDir(new File(service.getWorkingDirectory(), partitionId)); partition.setSuffix(partitionDn); service.addPartition(partition); return partition; }
private JdbmPartition createNewPartition(String partitionId, String partitionSuffix) throws DirectoryServerException { try { JdbmPartition partition = new JdbmPartition(); String partitionDirectoryName = this.workingDirectory + File.separator + partitionId; File partitionDirectory = new File(partitionDirectoryName);
/** * Add a new partition to the server. * * @param partitionId The partition Id * @param partitionDn The partition DN * @return The newly added partition * @throws Exception If the partition can't be added */ private Partition addPartition(String partitionId, String partitionDn) throws Exception { // Create a new partition named 'foo'. JdbmPartition partition = new JdbmPartition(); partition.setId(partitionId); partition.setPartitionDir(new File(service.getWorkingDirectory(), partitionId)); partition.setSuffix(partitionDn); service.addPartition(partition); return partition; }//addPartition
partition = new JdbmPartition(); partition.setId("rootPartition"); partition.setSuffix(root);
public ApacheDSContainer(String root, String ldifs) throws Exception { this.ldifResources = ldifs; service = new DefaultDirectoryService(); List<Interceptor> list = new ArrayList<>(); list.add(new NormalizationInterceptor()); list.add(new AuthenticationInterceptor()); list.add(new ReferralInterceptor()); // list.add( new AciAuthorizationInterceptor() ); // list.add( new DefaultAuthorizationInterceptor() ); list.add(new ExceptionInterceptor()); // list.add( new ChangeLogInterceptor() ); list.add(new OperationalAttributeInterceptor()); // list.add( new SchemaInterceptor() ); list.add(new SubentryInterceptor()); // list.add( new CollectiveAttributeInterceptor() ); // list.add( new EventInterceptor() ); // list.add( new TriggerInterceptor() ); // list.add( new JournalInterceptor() ); service.setInterceptors(list); partition = new JdbmPartition(); partition.setId("rootPartition"); partition.setSuffix(root); this.root = root; service.addPartition(partition); service.setExitVmOnShutdown(false); service.setShutdownHookEnabled(false); service.getChangeLog().setEnabled(false); service.setDenormalizeOpAttrsEnabled(true); }
partition = new JdbmPartition(); partition.setId("apiman"); partition.setPartitionDir(partitionDirectory);
/** * Add a new partition to the server * * @param partitionId The partition Id * @param partitionDn The partition DN * @return The newly added partition * @throws Exception If the partition can't be added */ private Partition addPartition(String partitionId, String partitionDn) throws Exception { // Create a new partition named 'foo'. JdbmPartition partition = new JdbmPartition(); partition.setId(partitionId); partition.setPartitionDir(new File(service.getWorkingDirectory(), partitionId)); partition.setSuffix(partitionDn); service.addPartition(partition); return partition; }
/** * Add a new partition to the server * * @param partitionId The partition Id * @param partitionDn The partition DN * @return The newly added partition * @throws Exception If the partition can't be added */ private Partition addPartition(String partitionId, String partitionDn) throws Exception { // Create a new partition named 'foo'. JdbmPartition partition = new JdbmPartition(); partition.setId(partitionId); partition.setPartitionDir(new File(service.getWorkingDirectory(), partitionId)); partition.setSuffix(partitionDn); service.addPartition(partition); return partition; }
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();
/** * Creates a {@link JdbmPartition} with the given id and DN. * * @param id Id to create partition with. * @param dn Distinguished Name to use to create partition. * @return Created partition. */ private JdbmPartition createPartition(String id, Dn dn) throws LdapInvalidDnException { JdbmPartition partition = new JdbmPartition(service.getSchemaManager(), service.getDnFactory()); partition.setId(id); partition.setPartitionPath( new File(service.getInstanceLayout().getPartitionsDirectory(), id).toURI()); partition.setSuffixDn(dn); partition.setSchemaManager(service.getSchemaManager()); return partition; }
service.setWorkingDirectory(getWorkingDirectory()); final JdbmPartition partition = new JdbmPartition(); partition.setId("rootPartition"); partition.setSuffix(getRoot());
public static EmbeddedLdapServer newEmbeddedServer(String defaultPartitionName, String defaultPartitionSuffix, int port) throws Exception{ workingDirectory = new File(System.getProperty("java.io.tmpdir") + "/apacheds-test1"); FileUtils.deleteDirectory(workingDirectory); DefaultDirectoryService directoryService = new DefaultDirectoryService(); directoryService.setShutdownHookEnabled(true); directoryService.setAllowAnonymousAccess(true); directoryService.setWorkingDirectory(workingDirectory); directoryService.getChangeLog().setEnabled( false ); JdbmPartition partition = new JdbmPartition(); partition.setId(defaultPartitionName); partition.setSuffix(defaultPartitionSuffix); directoryService.addPartition(partition); directoryService.startup(); // Inject the apache root entry if it does not already exist if ( !directoryService.getAdminSession().exists( partition.getSuffixDn() ) ) { ServerEntry entry = directoryService.newEntry(new LdapDN(defaultPartitionSuffix)); entry.add("objectClass", "top", "domain", "extensibleObject"); entry.add("dc", defaultPartitionName); directoryService.getAdminSession().add( entry ); } LdapServer ldapServer = new LdapServer(); ldapServer.setDirectoryService(directoryService); TcpTransport ldapTransport = new TcpTransport(port); ldapServer.setTransports( ldapTransport ); ldapServer.start(); return new EmbeddedLdapServer(directoryService, ldapServer); }
JdbmPartition jdbmPartition = new JdbmPartition( directoryService.getSchemaManager(), directoryService.getDnFactory() );
public static EmbeddedLdapServer newEmbeddedServer(String defaultPartitionName, String defaultPartitionSuffix, int port) throws Exception{ workingDirectory = new File(System.getProperty("java.io.tmpdir") + "/apacheds-test1"); FileUtils.deleteDirectory(workingDirectory); DefaultDirectoryService directoryService = new DefaultDirectoryService(); directoryService.setShutdownHookEnabled(true); directoryService.setAllowAnonymousAccess(true); directoryService.setWorkingDirectory(workingDirectory); directoryService.getChangeLog().setEnabled( false ); JdbmPartition partition = new JdbmPartition(); partition.setId(defaultPartitionName); partition.setSuffix(defaultPartitionSuffix); directoryService.addPartition(partition); directoryService.startup(); // Inject the apache root entry if it does not already exist if ( !directoryService.getAdminSession().exists( partition.getSuffixDn() ) ) { ServerEntry entry = directoryService.newEntry(new LdapDN(defaultPartitionSuffix)); entry.add("objectClass", "top", "domain", "extensibleObject"); entry.add("dc", defaultPartitionName); directoryService.getAdminSession().add( entry ); } LdapServer ldapServer = new LdapServer(); ldapServer.setDirectoryService(directoryService); TcpTransport ldapTransport = new TcpTransport(port); ldapServer.setTransports( ldapTransport ); ldapServer.start(); return new EmbeddedLdapServer(directoryService, ldapServer); }
partition = new JdbmPartition(); partition.setId("apiman"); partition.setPartitionDir(partitionDirectory);
directoryService.getChangeLog().setEnabled(false); JdbmPartition partition = new JdbmPartition(); partition.setId(defaultPartitionName); partition.setSuffix(defaultPartitionSuffix);