private void initSchemaPartition ( ) throws Exception { final InstanceLayout instanceLayout = this . service . getInstanceLayout ( ) ; final File schemaPartitionDirectory = new File ( instanceLayout . getPartitionsDirectory ( ) , "schema" ) ; /* * Extract the schema on disk (a brand new one) and load the registries */ if ( schemaPartitionDirectory . exists ( ) ) { System . out . println ( "schema partition already exists, skipping schema extraction" ) ; } else { final SchemaLdifExtractor extractor = new DefaultSchemaLdifExtractor ( instanceLayout . getPartitionsDirectory ( ) ) ; extractor . extractOrCopy ( ) ; } final SchemaLoader loader = new LdifSchemaLoader ( schemaPartitionDirectory ) ; final SchemaManager schemaManager = new DefaultSchemaManager ( loader ) ; /* * 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 ( ) ; final List < Throwable > errors = schemaManager . getErrors ( ) ; if ( errors . size ( ) != 0 ) { throw new Exception ( I18n . err ( I18n . ERR_317 , Exceptions . printErrors ( errors ) ) ) ; } this . service . setSchemaManager ( schemaManager ) ; /* * Init the LdifPartition with schema */ final LdifPartition schemaLdifPartition = new LdifPartition ( schemaManager ) ; schemaLdifPartition . setPartitionPath ( schemaPartitionDirectory . toURI ( ) ) ; /* * The schema partition */ final SchemaPartition schemaPartition = new SchemaPartition ( schemaManager ) ; schemaPartition . setWrappedPartition ( schemaLdifPartition ) ; this . service . setSchemaPartition ( schemaPartition ) ; }
initialize the schema manager and add the schema partition to diectory service