}
else
{
// get base DNs from namingContexts attribute
Set<String> namingContextSet = new HashSet<String>();
IAttribute attribute = browserConnection.getRootDSE().getAttribute( SchemaConstants.NAMING_CONTEXTS_AT );
if ( attribute != null )
{
String[] values = attribute.getStringValues();
for ( int i = 0; i < values.length; i++ )
{
namingContextSet.add( values[i] );
}
}
if ( !namingContextSet.isEmpty() )
{
for ( String namingContext : namingContextSet )
{
if ( namingContext.length() > 0 && namingContext.charAt( namingContext.length() - 1 ) == '\u0000' )
{
namingContext = namingContext.substring( 0, namingContext.length() - 1 );
}
if ( !"".equals( namingContext ) ) //$NON-NLS-1$
{
try
{
LdapDN dn = new LdapDN( namingContext );
IEntry entry = browserConnection.getEntryFromCache( dn );
if ( entry == null )
{
entry = new BaseDNEntry( dn, browserConnection );
browserConnection.cacheEntry( entry );
}
rootDseEntries.put( dn, entry );
}
catch ( InvalidNameException e )
{
monitor.reportError( BrowserCoreMessages.model__error_setting_base_dn, e );
}
}
else
{
// special handling of empty namingContext (Novell eDirectory):
// perform a one-level search and add all result DNs to the set
searchRootDseEntries( browserConnection, rootDseEntries, monitor );
}
}
}
else
{
// special handling of non-existing namingContexts attribute (Oracle Internet Directory)
// perform a one-level search and add all result DNs to the set
searchRootDseEntries( browserConnection, rootDseEntries, monitor );
}
}
// 2nd: add schema sub-entry
IEntry[] schemaEntries = getDirectoryMetadataEntries( browserConnection, SchemaConstants.SUBSCHEMA_SUBENTRY_AT );
for ( IEntry entry : schemaEntries )
{
if ( entry instanceof DirectoryMetadataEntry )
{
( ( DirectoryMetadataEntry ) entry ).setSchemaEntry( true );
}
rootDseEntries.put( entry.getDn(), entry );
}
// get other meta data entries
IAttribute[] rootDseAttributes = browserConnection.getRootDSE().getAttributes();
if ( rootDseAttributes != null )
{
for ( IAttribute attribute : rootDseAttributes )
{
IEntry[] metadataEntries = getDirectoryMetadataEntries( browserConnection, attribute.getDescription() );
for ( IEntry entry : metadataEntries )
{
rootDseEntries.put( entry.getDn(), entry );
}
}