if ( null == attrs )
{
return ( DirContext ) super.createSubcontext( name );
}
LdapName target = buildTarget( name );
String rdn = name.get( name.size() - 1 );
String rdnAttribute = NamespaceTools.getRdnAttribute( rdn );
String rdnValue = NamespaceTools.getRdnValue( rdn );
// Clone the attributes and add the Rdn attributes
Attributes attributes = ( Attributes ) attrs.clone();
boolean doRdnPut = attributes.get( rdnAttribute ) == null;
doRdnPut = doRdnPut || attributes.get( rdnAttribute ).size() == 0;
doRdnPut = doRdnPut || ! attributes.get( rdnAttribute ).contains( rdnValue );
if ( doRdnPut )
{
attributes.put( rdnAttribute, rdnValue );
}
// Add the new context to the server which as a side effect adds
getNexusProxy().add( target.toString(), target, attributes );
// Initialize the new context
ServerLdapContext ctx = new ServerLdapContext( getPrincipal(), getNexusProxy(), getEnvironment(), target );
Control [] controls = ( ( ServerLdapContext ) this ).getRequestControls();