directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ole Ersoy <ole.er...@gmail.com>
Subject [JNDI] Navigating the DIT
Date Wed, 11 Apr 2007 03:15:08 GMT
Hey Guys,

Got a question.

Before writing a DataGraph we need to make sure the the 
InitialDirectoryContext exists.

Suppose the base DN is:

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

And previous another model had this as its base DN

DN: cn=Authorization, cn=users, cn=example, ou=com

However the DAS does not know that the context
DN: cn=users, cn=example, ou=com

exists.

So it wants to start with the initial context
DN: ou=com

Then it wants to check if the subcontext
cn=example exists, and jump to it if it does.  Otherwise
it will just create it, and the returned context will
be the right one.

So I have some code like this:

public static DirContext createSubcontext(DirContext dirContext, String 
subContext)
     {
         try
         {
             dirContext = dirContext.createSubcontext( subContext );
         }
         catch ( NamingException e )
         {
             //change to the subcontext?
         }
         return dirContext;
     }

So this tries to create the subcontext and if an
exception thrown it wants to change to the
subcontext that it tried to create.

I looked through the DirContext javadocs did not see
a way to do this.  Seems like it should be really easy
though.

Any ideas?

Thanks,
- Ole

Mime
View raw message