null
- * @param partitionFactory must be not-null
- */
- public InMemoryDirectoryServiceFactory(DirectoryService directoryService, PartitionFactory partitionFactory) {
- this.directoryService = directoryService;
- this.partitionFactory = partitionFactory;
- }
-
- /**
- * {@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-inmemory-" + 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();
- ehCacheConfig.setName(name);
- CacheConfiguration defaultCache = new CacheConfiguration(name + "-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);
- ListRanged interceptor to emulate the behavior of AD. AD has a limit in - * the number of attributes that return (15000 by default in MaxValRange). + * the number of attributes that return (15000 by default in MaxValRange). * See this MS link for AD limits:
* * https://support.microsoft.com/en-us/help/315071/how-to-view-and-set-ldap-policy-in-active-directory-by-using-ntdsutil @@ -73,16 +73,16 @@ public class RangedAttributeInterceptor extends BaseInterceptor { int end = (max != null && max < attr.size() - 1)? max : attr.size() - 1; if (start != 0 || end != attr.size() - 1) { // some values should be stripped out - Iterator