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); }
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); }
/** * 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
/** * 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; }
partition.setSuffix(partitionSuffix); partition.setPartitionDir(partitionDirectory);
partition = new JdbmPartition(); partition.setId("rootPartition"); partition.setSuffix(root); this.root = root; service.addPartition(partition);
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.setPartitionDir(partitionDirectory); partition.setSchemaManager(service.getSchemaManager()); partition.setSuffix("o=apiman"); service.addPartition(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; }
/** * 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; }
jbdmPartition.setSuffix( partition.getSuffix() );
systemPartition.setPartitionDir(new File(directoryService .getWorkingDirectory(), "system")); systemPartition.setSuffix(ServerDNConstants.SYSTEM_DN); systemPartition.setSchemaManager(schemaManager); directoryService.setSystemPartition(systemPartition);
partition.setSuffix(getRoot()); service.addPartition(partition); service.setExitVmOnShutdown(false);
try { dnMicromata = new DN("dc=example,dc=org"); jdbmPartition.setSuffix(String.valueOf(dnMicromata)); } catch (LdapInvalidDnException e) { e.printStackTrace(); jdbmPartition.setSuffix(String.valueOf(dnUsers)); } catch (LdapInvalidDnException e) { e.printStackTrace(); dnDeactivated = new DN("ou=deactivated"); dnDeactivated.addAll(dnUsers); jdbmPartition.setSuffix(String.valueOf(dnDeactivated)); } catch (LdapInvalidDnException e) { e.printStackTrace(); dnRestricted = new DN("ou=restricted"); dnRestricted.addAll(dnUsers); jdbmPartition.setSuffix(String.valueOf(dnRestricted)); } catch (LdapInvalidDnException e) { e.printStackTrace();
partition.setPartitionDir(partitionDirectory); partition.setSchemaManager(service.getSchemaManager()); partition.setSuffix("o=apiman"); service.addPartition(partition);
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); }
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.setSuffix(defaultPartitionSuffix); directoryService.addPartition(partition);