* loaded into the registries on the next step. So here we must enable
* the schemas of those attributes so they are loaded into the global
* registries.
*/
SchemaPartitionDao dao = new SchemaPartitionDao( schemaPartition, registries );
Map<String,Schema> schemaMap = dao.getSchemas();
Set<Partition> partitions = new HashSet<Partition>();
partitions.add( systemPartition );
partitions.addAll( this.partitions );
for ( Partition partition : partitions )
{
if ( partition instanceof BTreePartition )
{
JdbmPartition btpconf = ( JdbmPartition ) partition;
for ( Index<?,ServerEntry> index : btpconf.getIndexedAttributes() )
{
String schemaName = null;
try
{
// Try to retrieve the AT in the registries
AttributeType at = registries.getAttributeTypeRegistry().lookup( index.getAttributeId() );
schemaName = dao.findSchema( at.getOid() );
}
catch ( Exception e )
{
// It does not exists: just use the attribute ID
schemaName = dao.findSchema( index.getAttributeId() );
}
if ( schemaName == null )
{
throw new NamingException( "Index on unidentified attribute: " + index.toString() );
}
Schema schema = schemaMap.get( schemaName );
if ( schema.isDisabled() )
{
dao.enableSchema( schemaName );
}
}
}
}
// --------------------------------------------------------------------
// Initialize schema subsystem and reset registries
// --------------------------------------------------------------------
PartitionSchemaLoader schemaLoader = new PartitionSchemaLoader( schemaPartition, registries );
Registries globalRegistries = new DefaultRegistries( "global", schemaLoader, registries.getOidRegistry() );
schemaLoader.loadEnabled( globalRegistries );
registries = globalRegistries;
SerializableComparator.setRegistry( globalRegistries.getComparatorRegistry() );
SchemaOperationControl schemaControl = new SchemaOperationControl( registries, schemaLoader,
new SchemaPartitionDao( schemaPartition, registries ) );
schemaService = new SchemaService( this, schemaPartition, schemaControl );
adminDn = new LdapDN( ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
adminDn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );