Java Code Examples for org.apache.directory.server.core.DefaultDirectoryService#setShutdownHookEnabled()
The following examples show how to use
org.apache.directory.server.core.DefaultDirectoryService#setShutdownHookEnabled() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ApacheDSContainerWithSecurity.java From spring-cloud-dashboard with Apache License 2.0 | 5 votes |
public ApacheDSContainerWithSecurity(String root, String 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); }
Example 2
Source File: InMemoryDirectoryServiceFactory.java From bouncr with Eclipse Public License 1.0 | 5 votes |
/** * Default constructor which creates {@link DefaultDirectoryService} instance and configures {@link AvlPartitionFactory} as * the {@link PartitionFactory} implementation. */ public InMemoryDirectoryServiceFactory() { try { directoryService = new DefaultDirectoryService(); } catch (Exception e) { throw new RuntimeException(e); } directoryService.setShutdownHookEnabled(false); partitionFactory = new AvlPartitionFactory(); }
Example 3
Source File: InMemoryDirectoryServiceFactory.java From activemq-artemis with Apache License 2.0 | 5 votes |
/** * Default constructor which creates {@link DefaultDirectoryService} instance and configures {@link AvlPartitionFactory} as * the {@link PartitionFactory} implementation. */ public InMemoryDirectoryServiceFactory() { try { directoryService = new DefaultDirectoryService(); } catch (Exception e) { throw new RuntimeException(e); } directoryService.setShutdownHookEnabled(false); partitionFactory = new AvlPartitionFactory(); }
Example 4
Source File: InMemoryDirectoryServiceFactory.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
/** * Default constructor which creates {@link DefaultDirectoryService} instance and configures {@link AvlPartitionFactory} as * the {@link PartitionFactory} implementation. */ public InMemoryDirectoryServiceFactory() { try { directoryService = new DefaultDirectoryService(); } catch (Exception e) { throw new RuntimeException(e); } directoryService.setShutdownHookEnabled(false); partitionFactory = new AvlPartitionFactory(); }
Example 5
Source File: InMemoryDirectoryServiceFactory.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
/** * Default constructor which creates {@link DefaultDirectoryService} instance and configures {@link AvlPartitionFactory} as * the {@link PartitionFactory} implementation. */ public InMemoryDirectoryServiceFactory() { try { directoryService = new DefaultDirectoryService(); } catch (Exception e) { throw new RuntimeException(e); } directoryService.setShutdownHookEnabled(false); partitionFactory = new AvlPartitionFactory(); }
Example 6
Source File: InMemoryDirectoryServiceFactory.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
/** * Default constructor which creates {@link DefaultDirectoryService} instance and configures {@link AvlPartitionFactory} as * the {@link PartitionFactory} implementation. */ public InMemoryDirectoryServiceFactory() { try { directoryService = new DefaultDirectoryService(); } catch (Exception e) { throw new RuntimeException(e); } directoryService.setShutdownHookEnabled(false); partitionFactory = new AvlPartitionFactory(); }
Example 7
Source File: InMemoryDirectoryServiceFactory.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
/** * Default constructor which creates {@link DefaultDirectoryService} instance and configures {@link AvlPartitionFactory} as * the {@link PartitionFactory} implementation. */ public InMemoryDirectoryServiceFactory() { try { directoryService = new DefaultDirectoryService(); } catch (Exception e) { throw new RuntimeException(e); } directoryService.setShutdownHookEnabled(false); partitionFactory = new AvlPartitionFactory(); }
Example 8
Source File: EmbeddedLdapServer.java From spring-ldap with Apache License 2.0 | 5 votes |
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); }
Example 9
Source File: LdapTestServer.java From gemfirexd-oss with Apache License 2.0 | 4 votes |
/** * Initialize the server. It creates the partition, injects the context * entries for the created partitions, and loads an LDIF file ( * {@link #ldifLoadFile}) for initial entries. * * @param workDir * the directory to be used for storing the data * @throws Exception * if there were some problems while initializing the system */ private void initDirectoryService(File workDir) throws Exception { // Initialize the LDAP service service = new DefaultDirectoryService(); service.setWorkingDirectory(workDir); // first load the schema initSchemaPartition(); // then the system partition // this is a MANDATORY partition Partition systemPartition = addPartition("system", ServerDNConstants.SYSTEM_DN); service.setSystemPartition(systemPartition); // create the partition for testing Partition testingPartition = addPartition("ldapTesting", "ou=ldapTesting,dc=pune,dc=gemstone,dc=com"); // Disable the shutdown hook service.setShutdownHookEnabled(false); // Disable the ChangeLog system service.getChangeLog().setEnabled(false); service.setDenormalizeOpAttrsEnabled(true); // And start the service service.startup(); // inject the entry for testing if (!service.getAdminSession().exists(testingPartition.getSuffixDn())) { DN dnTesting = new DN("ou=ldapTesting,dc=pune,dc=gemstone,dc=com"); ServerEntry entryTesting = service.newEntry(dnTesting); entryTesting.add("objectClass", "top", "domain", "extensibleObject"); entryTesting.add("dc", "pune"); service.getAdminSession().add(entryTesting); } // load schema from LDIF if (ldifLoadFile != null) { LdifFileLoader ldifLoader = new LdifFileLoader( service.getAdminSession(), ldifLoadFile); int numLoaded = ldifLoader.execute(); if (numLoaded <= 0) { throw new Exception( "Failed to load any entries from " + ldifLoadFile); } else { System.out.println( "LDAP loaded " + numLoaded + " entries from " + ldifLoadFile); } } }
Example 10
Source File: LdapTestServer.java From gemfirexd-oss with Apache License 2.0 | 4 votes |
/** * Initialize the server. It creates the partition, injects the context * entries for the created partitions, and loads an LDIF file ( * {@link #ldifLoadFile}) for initial entries. * * @param workDir * the directory to be used for storing the data * @throws Exception * if there were some problems while initializing the system */ private void initDirectoryService(File workDir) throws Exception { // Initialize the LDAP service service = new DefaultDirectoryService(); service.setWorkingDirectory(workDir); // first load the schema initSchemaPartition(); // then the system partition // this is a MANDATORY partition Partition systemPartition = addPartition("system", ServerDNConstants.SYSTEM_DN); service.setSystemPartition(systemPartition); // create the partition for testing Partition testingPartition = addPartition("ldapTesting", "ou=ldapTesting,dc=pune,dc=gemstone,dc=com"); // Disable the shutdown hook service.setShutdownHookEnabled(false); // Disable the ChangeLog system service.getChangeLog().setEnabled(false); service.setDenormalizeOpAttrsEnabled(true); // And start the service service.startup(); // inject the entry for testing if (!service.getAdminSession().exists(testingPartition.getSuffixDn())) { DN dnTesting = new DN("ou=ldapTesting,dc=pune,dc=gemstone,dc=com"); ServerEntry entryTesting = service.newEntry(dnTesting); entryTesting.add("objectClass", "top", "domain", "extensibleObject"); entryTesting.add("dc", "pune"); service.getAdminSession().add(entryTesting); } // load schema from LDIF if (ldifLoadFile != null) { LdifFileLoader ldifLoader = new LdifFileLoader( service.getAdminSession(), ldifLoadFile); int numLoaded = ldifLoader.execute(); if (numLoaded <= 0) { throw new Exception( "Failed to load any entries from " + ldifLoadFile); } else { System.out.println( "LDAP loaded " + numLoaded + " entries from " + ldifLoadFile); } } }