Ersin, Emmanuel,

Thanks - I'll give that a shot.

All I really want to do is start with a context like:
cn=users, cn=example, ou=com

and then jump to a subcontext,
like:

cn=Accounts, cn=users, cn=example, ou=com

Which may or may not exist.

If it does exist, I'll get an exception when first
trying to create it.  I catch the exception, and then I
try to jump to the subcontext like this inside the catch block:

Name name = ctx.createName("Accounts", "cn");

ctx = (DirContext) ctx.lookup(name);

Since ctx.lookup returns an Object instance, I'm assuming
I have to cast like that.

Anyways - I'll give it a shot.

Thanks,
- Ole











Emmanuel Lecharny wrote:
I think there is some misconception here - if I'm not wrong - : there is no such operation like 'navigating' a DIT. It's not like a Unix directory, you don't have such objects like dirs and files. An entry is just an entry : it has no knowledge about any potential children whatsoever. What you can do is to search for every elements one level higher, and you will get all the 'children', then you can 'create a subcontext and go for it, or just do a lookup on it, as suggested by Ersin, with the entries DNs.

Emmanuel.

On 4/11/07, *Ersin Er* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:

    Hi,

    
http://java.sun.com/javase/6/docs/api/javax/naming/Context.html#lookup(javax.naming.Name)
    should work.

    HTH,

    --
    Ersin

    On 4/11/07, Ole Ersoy <[EMAIL PROTECTED]
    <mailto:[EMAIL PROTECTED]>> wrote:
     > Hey Guys,
     >
     > Does anyone know if there's a utility or something
     > for navigating a DIT...like
     >
     > ctx = ctx.getChild(rdn)?
     >
     > Which would return a new DirContext
     > bound to the child rdn?
     >
     > Thanks,
     > - Ole
     >
     >
     >


    --
    Ersin




--
Cordialement,
Emmanuel Lécharny
www.iktek.com <http://www.iktek.com>

Reply via email to