* @throws Exception
*/
public static DirectoryService createDirectoryService( DirectoryServiceBean directoryServiceBean,
InstanceLayout instanceLayout, SchemaManager schemaManager ) throws Exception
{
DirectoryService directoryService = new DefaultDirectoryService();
// The schemaManager
directoryService.setSchemaManager( schemaManager );
// MUST attributes
// DirectoryService ID
directoryService.setInstanceId( directoryServiceBean.getDirectoryServiceId() );
// Replica ID
directoryService.setReplicaId( directoryServiceBean.getDsReplicaId() );
// WorkingDirectory
directoryService.setInstanceLayout( instanceLayout );
// Interceptors
List<Interceptor> interceptors = createInterceptors( directoryServiceBean.getInterceptors() );
directoryService.setInterceptors( interceptors );
// Partitions
Map<String, Partition> partitions = createPartitions( directoryService, directoryServiceBean.getPartitions() );
Partition systemPartition = partitions.remove( "system" );
if ( systemPartition == null )
{
//throw new Exception( I18n.err( I18n.ERR_505 ) );
}
directoryService.setSystemPartition( systemPartition );
directoryService.setPartitions( new HashSet<Partition>( partitions.values() ) );
// MAY attributes
// AccessControlEnabled
directoryService.setAccessControlEnabled( directoryServiceBean.isDsAccessControlEnabled() );
// AllowAnonymousAccess
directoryService.setAllowAnonymousAccess( directoryServiceBean.isDsAllowAnonymousAccess() );
// ChangeLog
ChangeLog cl = createChangeLog( directoryServiceBean.getChangeLog() );
if ( cl != null )
{
directoryService.setChangeLog( cl );
}
// DenormalizedOpAttrsEnabled
directoryService.setDenormalizeOpAttrsEnabled( directoryServiceBean.isDsDenormalizeOpAttrsEnabled() );
// Journal
Journal journal = createJournal( directoryServiceBean.getJournal() );
if ( journal != null )
{
directoryService.setJournal( journal );
}
// MaxPDUSize
directoryService.setMaxPDUSize( directoryServiceBean.getDsMaxPDUSize() );
// PasswordHidden
directoryService.setPasswordHidden( directoryServiceBean.isDsPasswordHidden() );
// SyncPeriodMillis
directoryService.setSyncPeriodMillis( directoryServiceBean.getDsSyncPeriodMillis() );
// testEntries
String entryFilePath = directoryServiceBean.getDsTestEntries();
if ( entryFilePath != null )
{
directoryService.setTestEntries( readTestEntries( entryFilePath ) );
}
// Enabled
if ( !directoryServiceBean.isEnabled() )
{