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


Java Partition.setSchemaManager方法代码示例

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


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

示例1: init

import org.apache.directory.server.core.api.partition.Partition; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
public void init(String name) throws Exception {
    if ((directoryService != null) && directoryService.isStarted()) {
        return;
    }

    directoryService.setInstanceId(name);

    // instance layout
    InstanceLayout instanceLayout = new InstanceLayout(System.getProperty("java.io.tmpdir") + "/server-work-" + name);
    if (instanceLayout.getInstanceDirectory().exists()) {
        try {
            FileUtils.deleteDirectory(instanceLayout.getInstanceDirectory());
        } catch (IOException e) {
            LOG.warn("couldn't delete the instance directory before initializing the DirectoryService", e);
        }
    }
    directoryService.setInstanceLayout(instanceLayout);

    // EhCache in disabled-like-mode
    Configuration ehCacheConfig = new Configuration();
    CacheConfiguration defaultCache = new CacheConfiguration("default", 1).eternal(false).timeToIdleSeconds(30)
            .timeToLiveSeconds(30).overflowToDisk(false);
    ehCacheConfig.addDefaultCache(defaultCache);
    CacheService cacheService = new CacheService(new CacheManager(ehCacheConfig));
    directoryService.setCacheService(cacheService);

    // Init the schema
    // SchemaLoader loader = new SingleLdifSchemaLoader();
    SchemaLoader loader = new JarLdifSchemaLoader();
    SchemaManager schemaManager = new DefaultSchemaManager(loader);
    schemaManager.loadAllEnabled();
    ComparatorRegistry comparatorRegistry = schemaManager.getComparatorRegistry();
    for (LdapComparator<?> comparator : comparatorRegistry) {
        if (comparator instanceof NormalizingComparator) {
            ((NormalizingComparator) comparator).setOnServer();
        }
    }
    directoryService.setSchemaManager(schemaManager);
    InMemorySchemaPartition inMemorySchemaPartition = new InMemorySchemaPartition(schemaManager);

    SchemaPartition schemaPartition = new SchemaPartition(schemaManager);
    schemaPartition.setWrappedPartition(inMemorySchemaPartition);
    directoryService.setSchemaPartition(schemaPartition);
    List<Throwable> errors = schemaManager.getErrors();
    if (errors.size() != 0) {
        throw new Exception(I18n.err(I18n.ERR_317, Exceptions.printErrors(errors)));
    }

    // Init system partition
    Partition systemPartition = partitionFactory.createPartition(directoryService.getSchemaManager(),
            directoryService.getDnFactory(), "system", ServerDNConstants.SYSTEM_DN, 500,
            new File(directoryService.getInstanceLayout().getPartitionsDirectory(), "system"));
    systemPartition.setSchemaManager(directoryService.getSchemaManager());
    partitionFactory.addIndex(systemPartition, SchemaConstants.OBJECT_CLASS_AT, 100);
    directoryService.setSystemPartition(systemPartition);

    directoryService.startup();
}
 
开发者ID:kawasima,项目名称:bouncr,代码行数:62,代码来源:InMemoryDirectoryServiceFactory.java

示例2: init

import org.apache.directory.server.core.api.partition.Partition; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void init(String name) throws Exception {
   if ((directoryService == null) || directoryService.isStarted()) {
      return;
   }

   directoryService.setInstanceId(name);

   // instance layout
   InstanceLayout instanceLayout = new InstanceLayout(System.getProperty("java.io.tmpdir") + "/server-work-" + name);
   if (instanceLayout.getInstanceDirectory().exists()) {
      try {
         FileUtils.deleteDirectory(instanceLayout.getInstanceDirectory());
      } catch (IOException e) {
         LOG.warn("couldn't delete the instance directory before initializing the DirectoryService", e);
      }
   }
   directoryService.setInstanceLayout(instanceLayout);

   // EhCache in disabled-like-mode
   Configuration ehCacheConfig = new Configuration();
   CacheConfiguration defaultCache = new CacheConfiguration("default", 1).eternal(false).timeToIdleSeconds(30).timeToLiveSeconds(30).overflowToDisk(false);
   ehCacheConfig.addDefaultCache(defaultCache);
   CacheService cacheService = new CacheService(new CacheManager(ehCacheConfig));
   directoryService.setCacheService(cacheService);

   // Init the schema
   // SchemaLoader loader = new SingleLdifSchemaLoader();
   SchemaLoader loader = new JarLdifSchemaLoader();
   SchemaManager schemaManager = new DefaultSchemaManager(loader);
   schemaManager.loadAllEnabled();
   ComparatorRegistry comparatorRegistry = schemaManager.getComparatorRegistry();
   for (LdapComparator<?> comparator : comparatorRegistry) {
      if (comparator instanceof NormalizingComparator) {
         ((NormalizingComparator) comparator).setOnServer();
      }
   }
   directoryService.setSchemaManager(schemaManager);
   InMemorySchemaPartition inMemorySchemaPartition = new InMemorySchemaPartition(schemaManager);

   SchemaPartition schemaPartition = new SchemaPartition(schemaManager);
   schemaPartition.setWrappedPartition(inMemorySchemaPartition);
   directoryService.setSchemaPartition(schemaPartition);
   List<Throwable> errors = schemaManager.getErrors();
   if (errors.size() != 0) {
      throw new Exception(I18n.err(I18n.ERR_317, Exceptions.printErrors(errors)));
   }

   // Init system partition
   Partition systemPartition = partitionFactory.createPartition(directoryService.getSchemaManager(), directoryService.getDnFactory(), "system", ServerDNConstants.SYSTEM_DN, 500, new File(directoryService.getInstanceLayout().getPartitionsDirectory(), "system"));
   systemPartition.setSchemaManager(directoryService.getSchemaManager());
   partitionFactory.addIndex(systemPartition, SchemaConstants.OBJECT_CLASS_AT, 100);
   directoryService.setSystemPartition(systemPartition);

   directoryService.startup();
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:60,代码来源:InMemoryDirectoryServiceFactory.java

示例3: init

import org.apache.directory.server.core.api.partition.Partition; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void init(String name) throws Exception {
    if ((directoryService != null) && directoryService.isStarted()) {
        return;
    }

    directoryService.setInstanceId(name);

    // instance layout
    InstanceLayout instanceLayout = new InstanceLayout(System.getProperty("java.io.tmpdir") + "/server-work-" + name);
    if (instanceLayout.getInstanceDirectory().exists()) {
        try {
            FileUtils.deleteDirectory(instanceLayout.getInstanceDirectory());
        } catch (IOException e) {
            LOG.warn("couldn't delete the instance directory before initializing the DirectoryService", e);
        }
    }
    directoryService.setInstanceLayout(instanceLayout);

    // EhCache in disabled-like-mode
    Configuration ehCacheConfig = new Configuration();
    CacheConfiguration defaultCache = new CacheConfiguration("ApacheDSTestCache", 1).eternal(false).timeToIdleSeconds(30)
            .timeToLiveSeconds(30).overflowToDisk(false);
    ehCacheConfig.addDefaultCache(defaultCache);
    cacheManager = new CacheManager(ehCacheConfig);
    CacheService cacheService = new CacheService(cacheManager);
    directoryService.setCacheService(cacheService);

    // Init the schema
    // SchemaLoader loader = new SingleLdifSchemaLoader();
    SchemaLoader loader = new JarLdifSchemaLoader();
    SchemaManager schemaManager = new DefaultSchemaManager(loader);
    schemaManager.loadAllEnabled();
    ComparatorRegistry comparatorRegistry = schemaManager.getComparatorRegistry();
    for (LdapComparator<?> comparator : comparatorRegistry) {
        if (comparator instanceof NormalizingComparator) {
            ((NormalizingComparator) comparator).setOnServer();
        }
    }
    directoryService.setSchemaManager(schemaManager);
    InMemorySchemaPartition inMemorySchemaPartition = new InMemorySchemaPartition(schemaManager);

    SchemaPartition schemaPartition = new SchemaPartition(schemaManager);
    schemaPartition.setWrappedPartition(inMemorySchemaPartition);
    directoryService.setSchemaPartition(schemaPartition);
    List<Throwable> errors = schemaManager.getErrors();
    if (errors.size() != 0) {
        throw new Exception(I18n.err(I18n.ERR_317, Exceptions.printErrors(errors)));
    }

    // Init system partition
    Partition systemPartition = partitionFactory.createPartition(directoryService.getSchemaManager(), "system",
            ServerDNConstants.SYSTEM_DN, 500, new File(directoryService.getInstanceLayout().getPartitionsDirectory(),
                    "system"));
    systemPartition.setSchemaManager(directoryService.getSchemaManager());
    partitionFactory.addIndex(systemPartition, SchemaConstants.OBJECT_CLASS_AT, 100);
    directoryService.setSystemPartition(systemPartition);

    directoryService.startup();
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:64,代码来源:InMemoryDirectoryServiceFactory.java


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