2005/6/30, Trustin Lee <[EMAIL PROTECTED]>:
-- Another question, I want to retrieve the whole attributes of all decendant entries under a base name (it would be nice if the result includes the base entry itself, too). How can I do that?
I found the solution after some trials and errors:
SearchControls ctrl = new SearchControls();
ctrl.setSearchScope( SearchControls.SUBTREE_SCOPE );
NamingEnumeration e = nexus.search( new LdapName( "uid=admin,ou=system"), factoryCfg.getEnvironment (), new PresenceNode( "objectClass" ), ctrl );
while( e.hasMore() )
{
SearchResult sr = ( SearchResult ) e.next();
System.out.println( "Name: " + sr.getName () + ", Attrs: " + sr.getAttributes() );
}
ctrl.setSearchScope( SearchControls.SUBTREE_SCOPE );
NamingEnumeration e = nexus.search( new LdapName( "uid=admin,ou=system"), factoryCfg.getEnvironment (), new PresenceNode( "objectClass" ), ctrl );
while( e.hasMore() )
{
SearchResult sr = ( SearchResult ) e.next();
System.out.println( "Name: " + sr.getName () + ", Attrs: " + sr.getAttributes() );
}
Trustin
what we call human nature is actually human habit
--
http://gleamynode.net/
