// We let other mechanisms filter out operational attributes.
// -----------------------------------------------------------
if ( ( ids == null ) || ( ids.length == 0 ) )
{
ServerEntry rootDSE = (ServerEntry)getRootDSE( null ).clone();
return new BaseEntryFilteringCursor( new SingletonCursor<ServerEntry>( rootDSE ), opContext );
}
// -----------------------------------------------------------
// Collect all the real attributes besides 1.1, +, and * and
// note if we've seen these special attributes as well.
// -----------------------------------------------------------
Set<String> realIds = new HashSet<String>();
boolean containsAsterisk = false;
boolean containsPlus = false;
boolean containsOneDotOne = false;
for ( String id:ids )
{
String idTrimmed = id.trim();
if ( idTrimmed.equals( SchemaConstants.ALL_USER_ATTRIBUTES ) )
{
containsAsterisk = true;
}
else if ( idTrimmed.equals( SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES ) )
{
containsPlus = true;
}
else if ( idTrimmed.equals( SchemaConstants.NO_ATTRIBUTE ) )
{
containsOneDotOne = true;
}
else
{
try
{
realIds.add( oidRegistry.getOid( idTrimmed ) );
}
catch ( Exception e )
{
realIds.add( idTrimmed );
}
}
}
// return nothing
if ( containsOneDotOne )
{
ServerEntry serverEntry = new DefaultServerEntry( registries, base );
return new BaseEntryFilteringCursor( new SingletonCursor<ServerEntry>( serverEntry ), opContext );
}
// return everything
if ( containsAsterisk && containsPlus )
{
ServerEntry rootDSE = (ServerEntry)getRootDSE( null ).clone();
return new BaseEntryFilteringCursor( new SingletonCursor<ServerEntry>( rootDSE ), opContext );
}
ServerEntry serverEntry = new DefaultServerEntry( registries, opContext.getDn() );
ServerEntry rootDSE = getRootDSE( new GetRootDSEOperationContext( opContext.getSession() ) );
for ( EntryAttribute attribute:rootDSE )
{
AttributeType type = atRegistry.lookup( attribute.getUpId() );
if ( realIds.contains( type.getOid() ) )
{
serverEntry.put( attribute );
}
else if ( containsAsterisk && ( type.getUsage() == UsageEnum.USER_APPLICATIONS ) )
{
serverEntry.put( attribute );
}
else if ( containsPlus && ( type.getUsage() != UsageEnum.USER_APPLICATIONS ) )
{
serverEntry.put( attribute );
}
}
return new BaseEntryFilteringCursor( new SingletonCursor<ServerEntry>( serverEntry ), opContext );
}
// TODO : handle searches based on the RootDSE
throw new LdapNameNotFoundException();
}