*
* @throws Exception in case of any problems while extracting and writing the schema files
*/
private void initSchema() throws Exception
{
SchemaPartition schemaPartition = directoryService.getSchemaService().getSchemaPartition();
// Init the LdifPartition
LdifPartition ldifPartition = new LdifPartition();
String workingDirectory = directoryService.getInstanceLayout().getPartitionsDirectory().getPath();
ldifPartition.setPartitionPath( new File( workingDirectory, "schema" ).toURI() );
// Extract the schema on disk (a brand new one) and load the registries
File schemaRepository = new File( workingDirectory, "schema" );
if( schemaRepository.exists() )
{
LOG.info( "schema partition already exists, skipping schema extraction" );
}
else
{
SchemaLdifExtractor extractor = new DefaultSchemaLdifExtractor( new File( workingDirectory ) );
extractor.extractOrCopy();
}
schemaPartition.setWrappedPartition( ldifPartition );
SchemaLoader loader = new LdifSchemaLoader( schemaRepository );
SchemaManager schemaManager = new DefaultSchemaManager( loader );
directoryService.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 )
{