ClonedServerEntry dsEntry = configPartition.lookup( forwardEntry.getId() );
LOG.debug( "directory service entry {}", dsEntry );
DirectoryService dirService = new DefaultDirectoryService();
// MUST attributes
dirService.setInstanceId( getString( "ads-directoryServiceId", dsEntry ) );
dirService.setReplicaId( getInt( "ads-dsReplicaId", dsEntry ) );
DN interceptorsDN = new DN( dsEntry.get( "ads-dsInterceptors" ).getString() );
interceptorsDN.normalize( configPartition.getSchemaManager().getNormalizerMapping() );
List<Interceptor> interceptors = getInterceptors( interceptorsDN );
dirService.setInterceptors( interceptors );
DN partitionsDN = new DN( dsEntry.get( "ads-dsPartitions" ).getString() );
partitionsDN.normalize( configPartition.getSchemaManager().getNormalizerMapping() );
Map<String, Partition> partitions = getPartitions( partitionsDN );
Partition systemPartition = partitions.remove( "system" );
if ( systemPartition == null )
{
throw new Exception( I18n.err( I18n.ERR_505 ) );
}
dirService.setSystemPartition( systemPartition );
dirService.setPartitions( new HashSet<Partition>( partitions.values() ) );
// MAY attributes
EntryAttribute acEnabledAttr = dsEntry.get( "ads-dsAccessControlEnabled" );
if ( acEnabledAttr != null )
{
dirService.setAccessControlEnabled( Boolean.parseBoolean( acEnabledAttr.getString() ) );
}
EntryAttribute anonAccessAttr = dsEntry.get( "ads-dsAllowAnonymousAccess" );
if ( anonAccessAttr != null )
{
dirService.setAllowAnonymousAccess( Boolean.parseBoolean( anonAccessAttr.getString() ) );
}
EntryAttribute changeLogAttr = dsEntry.get( "ads-dsChangeLog" );
if ( changeLogAttr != null )
{
DN clDN = new DN( changeLogAttr.getString() );
clDN.normalize( schemaManager.getNormalizerMapping() );
ChangeLog cl = getChangeLog( clDN );
dirService.setChangeLog( cl );
}
EntryAttribute denormAttr = dsEntry.get( "ads-dsDenormalizeOpAttrsEnabled" );
if ( denormAttr != null )
{
dirService.setDenormalizeOpAttrsEnabled( Boolean.parseBoolean( denormAttr.getString() ) );
}
EntryAttribute journalAttr = dsEntry.get( "ads-dsJournal" );
if ( journalAttr != null )
{
DN journalDN = new DN( journalAttr.getString() );
journalDN.normalize( schemaManager.getNormalizerMapping() );
dirService.setJournal( getJournal( journalDN ) );
}
EntryAttribute maxPduAttr = dsEntry.get( "ads-dsMaxPDUSize" );
if ( maxPduAttr != null )
{
dirService.setMaxPDUSize( Integer.parseInt( maxPduAttr.getString() ) );
}
EntryAttribute passwordHidAttr = dsEntry.get( "ads-dsPasswordHidden" );
if ( passwordHidAttr != null )
{
dirService.setPasswordHidden( Boolean.parseBoolean( passwordHidAttr.getString() ) );
}
EntryAttribute replAttr = dsEntry.get( "ads-dsReplication" );
if ( replAttr != null )
{
// configure replication
}
EntryAttribute syncPeriodAttr = dsEntry.get( "ads-dsSyncPeriodMillis" );
if ( syncPeriodAttr != null )
{
// FIXME the DirectoryService interface doesn't have this setter
//dirService.setSyncPeriodMillis( Long.parseLong( syncPeriodAttr.getString() ) );
}
EntryAttribute testEntryAttr = dsEntry.get( "ads-dsTestEntries" );
if ( testEntryAttr != null )
{
String entryFilePath = testEntryAttr.getString();
dirService.setTestEntries( getTestEntries( entryFilePath ) );
}
if ( !isEnabled( dsEntry ) )
{
// will only be useful if we ever allow more than one DS to be configured and