rootDSE = new RootDSE( this );
cacheEntry( rootDSE );
}
// get well-known root DSE attributes, includes + and *
ISearch search = new Search( null, this, new DN(), ISearch.FILTER_TRUE, ROOT_DSE_ATTRIBUTES, ISearch.SCOPE_OBJECT, 0,
0, IConnection.DEREFERENCE_ALIASES_NEVER, IConnection.HANDLE_REFERRALS_IGNORE, false, false, null );
search( search, monitor );
// get base DNs
if( !isFetchBaseDNs() && getBaseDN() != null && !"".equals( getBaseDN().toString() ))
{
// only add the specified base DN
DN dn = getBaseDN();
IEntry entry = new BaseDNEntry( new DN( dn ), this );
cacheEntry( entry );
rootDSE.addChild( entry );
// check if entry exists
search = new Search( null, this, dn, ISearch.FILTER_TRUE, ISearch.NO_ATTRIBUTES, ISearch.SCOPE_OBJECT, 1, 0,
IConnection.DEREFERENCE_ALIASES_NEVER, IConnection.HANDLE_REFERRALS_IGNORE, true, true, null );
search( search, monitor );
}
else
{
// get naming contexts
Set<String> namingContextSet = new HashSet<String>();
IAttribute attribute = rootDSE.getAttribute( IRootDSE.ROOTDSE_ATTRIBUTE_NAMINGCONTEXTS );
if ( attribute != null )
{
String[] values = attribute.getStringValues();
for ( int i = 0; i < values.length; i++ )
{
namingContextSet.add( values[i] );
}
}
for ( String namingContext : namingContextSet )
{
if ( !"".equals( namingContext ) ) { //$NON-NLS-1$
try
{
IEntry entry = new BaseDNEntry( new DN( namingContext ), this );
rootDSE.addChild( entry );
cacheEntry( entry );
}
catch ( Exception e )
{
monitor.reportError( BrowserCoreMessages.model__error_setting_base_dn, e );
}
}
else
{
// special handling of empty namingContext: perform a one-level search and add all result DNs to the set
search = new Search( null, this, new DN(), ISearch.FILTER_TRUE, ISearch.NO_ATTRIBUTES, ISearch.SCOPE_ONELEVEL, 0,
0, IConnection.DEREFERENCE_ALIASES_NEVER, IConnection.HANDLE_REFERRALS_IGNORE, false, false, null );
search( search, monitor );
ISearchResult[] results = search.getSearchResults();
for ( int k = 0; results != null && k < results.length; k++ )
{