当前位置: 首页>>代码示例>>Java>>正文


Java DefaultDirectoryService.setShutdownHookEnabled方法代码示例

本文整理汇总了Java中org.apache.directory.server.core.DefaultDirectoryService.setShutdownHookEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultDirectoryService.setShutdownHookEnabled方法的具体用法?Java DefaultDirectoryService.setShutdownHookEnabled怎么用?Java DefaultDirectoryService.setShutdownHookEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.directory.server.core.DefaultDirectoryService的用法示例。


在下文中一共展示了DefaultDirectoryService.setShutdownHookEnabled方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ApacheDSContainerWithSecurity

import org.apache.directory.server.core.DefaultDirectoryService; //导入方法依赖的package包/类
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);
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-dashboard,代码行数:32,代码来源:ApacheDSContainerWithSecurity.java

示例2: InMemoryDirectoryServiceFactory

import org.apache.directory.server.core.DefaultDirectoryService; //导入方法依赖的package包/类
/**
 * 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();
}
 
开发者ID:kawasima,项目名称:bouncr,代码行数:14,代码来源:InMemoryDirectoryServiceFactory.java

示例3: InMemoryDirectoryServiceFactory

import org.apache.directory.server.core.DefaultDirectoryService; //导入方法依赖的package包/类
/**
 * 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();
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:14,代码来源:InMemoryDirectoryServiceFactory.java

示例4: newEmbeddedServer

import org.apache.directory.server.core.DefaultDirectoryService; //导入方法依赖的package包/类
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);
}
 
开发者ID:spring-projects,项目名称:spring-ldap,代码行数:38,代码来源:EmbeddedLdapServer.java

示例5: initDirectoryService

import org.apache.directory.server.core.DefaultDirectoryService; //导入方法依赖的package包/类
/**
 * 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);
    }
  }
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:61,代码来源:LdapTestServer.java


注:本文中的org.apache.directory.server.core.DefaultDirectoryService.setShutdownHookEnabled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。