org.apache.directory.shared.ldap.schema.ldif.extractor.impl.DefaultSchemaLdifExtractor Java Examples
The following examples show how to use
org.apache.directory.shared.ldap.schema.ldif.extractor.impl.DefaultSchemaLdifExtractor.
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: LdapTestServer.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
/** * initialize schema manager and add the schema partition to directory service * * @throws Exception * if the schema LDIF files are not found on the classpath */ private void initSchemaPartition() throws Exception { SchemaPartition schemaPartition = service.getSchemaService() .getSchemaPartition(); // Init the LdifPartition LdifPartition ldifPartition = new LdifPartition(); String workingDirectory = service.getWorkingDirectory().getPath(); ldifPartition.setWorkingDirectory(workingDirectory + "/schema"); // Extract the schema on disk (a brand new one) and load the registries File schemaRepository = new File(workingDirectory, "schema"); DefaultSchemaLdifExtractor extractor = new DefaultSchemaLdifExtractor( new File(workingDirectory)); extractor.extractOrCopy(true); schemaPartition.setWrappedPartition(ldifPartition); LdifSchemaLoader loader = new LdifSchemaLoader(schemaRepository); DefaultSchemaManager schemaManager = new DefaultSchemaManager(loader); service.setSchemaManager(schemaManager); // We have to load the schema now, otherwise we won't be able // to initialize the Partitions, as we won't be able to parse // and normalize their suffix DN schemaManager.loadAllEnabled(); schemaPartition.setSchemaManager(schemaManager); List<Throwable> errors = schemaManager.getErrors(); if (errors.size() != 0) { throw new Exception("Schema load failed : " + errors); } }
Example #2
Source File: LdapTestServer.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
/** * initialize schema manager and add the schema partition to directory service * * @throws Exception * if the schema LDIF files are not found on the classpath */ private void initSchemaPartition() throws Exception { SchemaPartition schemaPartition = service.getSchemaService() .getSchemaPartition(); // Init the LdifPartition LdifPartition ldifPartition = new LdifPartition(); String workingDirectory = service.getWorkingDirectory().getPath(); ldifPartition.setWorkingDirectory(workingDirectory + "/schema"); // Extract the schema on disk (a brand new one) and load the registries File schemaRepository = new File(workingDirectory, "schema"); DefaultSchemaLdifExtractor extractor = new DefaultSchemaLdifExtractor( new File(workingDirectory)); extractor.extractOrCopy(true); schemaPartition.setWrappedPartition(ldifPartition); LdifSchemaLoader loader = new LdifSchemaLoader(schemaRepository); DefaultSchemaManager schemaManager = new DefaultSchemaManager(loader); service.setSchemaManager(schemaManager); // We have to load the schema now, otherwise we won't be able // to initialize the Partitions, as we won't be able to parse // and normalize their suffix DN schemaManager.loadAllEnabled(); schemaPartition.setSchemaManager(schemaManager); List<Throwable> errors = schemaManager.getErrors(); if (errors.size() != 0) { throw new Exception("Schema load failed : " + errors); } }
Example #3
Source File: EmbeddedADS.java From vertx-auth with Apache License 2.0 | 5 votes |
/** * initialize the schema manager and add the schema partition to diectory service * * @throws Exception if the schema LDIF files are not found on the classpath */ private void initSchemaPartition() throws Exception { SchemaPartition schemaPartition = service.getSchemaService().getSchemaPartition(); // Init the LdifPartition LdifPartition ldifPartition = new LdifPartition(); String workingDirectory = service.getWorkingDirectory().getPath(); ldifPartition.setWorkingDirectory(workingDirectory + "/schema"); // Extract the schema on disk (a brand new one) and load the registries File schemaRepository = new File(workingDirectory, "schema"); SchemaLdifExtractor extractor = new DefaultSchemaLdifExtractor(new File(workingDirectory)); extractor.extractOrCopy(true); schemaPartition.setWrappedPartition(ldifPartition); SchemaLoader loader = new LdifSchemaLoader(schemaRepository); SchemaManager schemaManager = new DefaultSchemaManager(loader); service.setSchemaManager(schemaManager); // We have to load the schema now, otherwise we won't be able // to initialize the Partitions, as we won't be able to parse // and normalize their suffix DN schemaManager.loadAllEnabled(); schemaPartition.setSchemaManager(schemaManager); List<Throwable> errors = schemaManager.getErrors(); if (errors.size() != 0) { throw new Exception("Schema load failed : " + errors); } }