You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@directory.apache.org by B G <fi...@gmail.com> on 2007/05/02 23:31:33 UTC

[ApcaheDS] How to import schema without using LDAP Studio

Sorry for the double post, but I realized I did not have a subject...doh!

Hi...

I recently upgraded from ApacheDS 1.0 to ApacheDS 1.5 and am embedding the
directory in an application.

Using 1.0 I was able to add custom schema using the maven plugin to compile
my schema classes from a .schema file and then using the bootstrap schema
mechanism to get it loaded into the directory. I came to realize that this
was not an option at all in 1.5 so I decided to use an ldif file to get my
schema loaded into the directory.

Unfortunately this does not work because there is a serious issue with
loading ldif files on a windows platform because the \ char (the file
seperator in windows) is interpreted as an escape for a hex sequence, so if
the following 2 bytes are possible hex then they are converted leaving the
path to the ldif file invalid. I have posted a thread on this issue as it
has made using ldif files with embedded directory on a windows platform
unusable if you cannot control the path to ensure there would be no hex
conversion.

My next step was to use JNDI to add the schema programatically which I have
found to also be impossible. I did search around and found a document about
adding schema to 1.5:
http://cwiki.apache.org/confluence/display/DIRxSBOX/Add+your+first+elements+to+the+schema
which had code like the following:
...
DirContext ctx = new InitalDirContext(env);
DirContext schema = ctx.getSchema ("");
...

I find that this code just throws an UnsupportedOperationException as it is
hard coded to do in the ServerDirContext class. This all leaves it
impossible for me to add custom schema to a 1.5 directory so I feel like I
must be missing something fundamental.

Also, for my application purposes I am not really able to use LDAP Studio to
import the ldif as the schema needs to be added upon my application first
starting which in turn will do a first start on the directory.

Is there a way to get my compiled schema classes into the directory now that
the bootstrap schema mechanism has been removed?

Any help would be greatly appreciated with regard to what I am missing here
or if there is a way to work around these issues without using LDAP Studio.

Thanks a lot!!!

Re: [ApcaheDS] How to import schema without using LDAP Studio

Posted by B G <fi...@gmail.com>.
Thanks for the reponse and I appreciate the help.

My application runs on multiple platforms, but windows is a limiting factor
with respect to the escaping issue.

I figured out what my issue was with trying to use JNDI. I was using the
InitialContext with PROVIDER_URL set to the dn "uid=admin,ou=system" to make
the getSchema call. This initial context was created to kick start the
directory in an embedded manner and when using this you get
UnsupportedOperationException when trying to get the schema context. I found
if I created a new InitialContext using a typical ldap url (ldap://...) I
could get the Schema context so I should be able to use JNDI to add my
custom schema. I would much rather use the ldif approach if that gets fixed.
:-)

I was also wondering if there is a maven repsoitory I could point to to get
the 1.5.1-SNAPSHOT artifacts as opposed to having to build it myself?

Thanks again for the help.

On 5/2/07, Emmanuel Lecharny <el...@gmail.com> wrote:
>
> Hi,
>
> first our apologizes for the problems you are facing. We have to fix this
> escaping problem, and we will try to fix it asap (it means tomorrow, I
> guess).
>
> I'm sorry that I can't give you a better answer right now, but I'm a
> little
> bit off base, being in Amsterdam for the Apache Conference, but we will
> find
> someone to update the site and give you a clear answer to all your
> questions.
>
> I assume you are on Windows.
>
> We will do our best  to help you!
>
> Emmanuel
>
> On 5/2/07, B G <fi...@gmail.com> wrote:
> >
> > Sorry for the double post, but I realized I did not have a
> subject...doh!
> >
> > Hi...
> >
> > I recently upgraded from ApacheDS 1.0 to ApacheDS 1.5 and am embedding
> the
> > directory in an application.
> >
> > Using 1.0 I was able to add custom schema using the maven plugin to
> > compile
> > my schema classes from a .schema file and then using the bootstrap
> schema
> > mechanism to get it loaded into the directory. I came to realize that
> this
> > was not an option at all in 1.5 so I decided to use an ldif file to get
> my
> > schema loaded into the directory.
> >
> > Unfortunately this does not work because there is a serious issue with
> > loading ldif files on a windows platform because the \ char (the file
> > seperator in windows) is interpreted as an escape for a hex sequence, so
> > if
> > the following 2 bytes are possible hex then they are converted leaving
> the
> > path to the ldif file invalid. I have posted a thread on this issue as
> it
> > has made using ldif files with embedded directory on a windows platform
> > unusable if you cannot control the path to ensure there would be no hex
> > conversion.
> >
> > My next step was to use JNDI to add the schema programatically which I
> > have
> > found to also be impossible. I did search around and found a document
> > about
> > adding schema to 1.5:
> >
> >
> http://cwiki.apache.org/confluence/display/DIRxSBOX/Add+your+first+elements+to+the+schema
> > which had code like the following:
> > ...
> > DirContext ctx = new InitalDirContext(env);
> > DirContext schema = ctx.getSchema ("");
> > ...
> >
> > I find that this code just throws an UnsupportedOperationException as it
> > is
> > hard coded to do in the ServerDirContext class. This all leaves it
> > impossible for me to add custom schema to a 1.5 directory so I feel like
> I
> > must be missing something fundamental.
> >
> > Also, for my application purposes I am not really able to use LDAP
> Studio
> > to
> > import the ldif as the schema needs to be added upon my application
> first
> > starting which in turn will do a first start on the directory.
> >
> > Is there a way to get my compiled schema classes into the directory now
> > that
> > the bootstrap schema mechanism has been removed?
> >
> > Any help would be greatly appreciated with regard to what I am missing
> > here
> > or if there is a way to work around these issues without using LDAP
> > Studio.
> >
> > Thanks a lot!!!
> >
>
>
>
> --
> Regards,
> Cordialement,
> Emmanuel Lécharny
> www.iktek.com
>

Re: [ApcaheDS] How to import schema without using LDAP Studio

Posted by Emmanuel Lecharny <el...@gmail.com>.
Hi,

first our apologizes for the problems you are facing. We have to fix this
escaping problem, and we will try to fix it asap (it means tomorrow, I
guess).

I'm sorry that I can't give you a better answer right now, but I'm a little
bit off base, being in Amsterdam for the Apache Conference, but we will find
someone to update the site and give you a clear answer to all your
questions.

I assume you are on Windows.

We will do our best  to help you!

Emmanuel

On 5/2/07, B G <fi...@gmail.com> wrote:
>
> Sorry for the double post, but I realized I did not have a subject...doh!
>
> Hi...
>
> I recently upgraded from ApacheDS 1.0 to ApacheDS 1.5 and am embedding the
> directory in an application.
>
> Using 1.0 I was able to add custom schema using the maven plugin to
> compile
> my schema classes from a .schema file and then using the bootstrap schema
> mechanism to get it loaded into the directory. I came to realize that this
> was not an option at all in 1.5 so I decided to use an ldif file to get my
> schema loaded into the directory.
>
> Unfortunately this does not work because there is a serious issue with
> loading ldif files on a windows platform because the \ char (the file
> seperator in windows) is interpreted as an escape for a hex sequence, so
> if
> the following 2 bytes are possible hex then they are converted leaving the
> path to the ldif file invalid. I have posted a thread on this issue as it
> has made using ldif files with embedded directory on a windows platform
> unusable if you cannot control the path to ensure there would be no hex
> conversion.
>
> My next step was to use JNDI to add the schema programatically which I
> have
> found to also be impossible. I did search around and found a document
> about
> adding schema to 1.5:
>
> http://cwiki.apache.org/confluence/display/DIRxSBOX/Add+your+first+elements+to+the+schema
> which had code like the following:
> ...
> DirContext ctx = new InitalDirContext(env);
> DirContext schema = ctx.getSchema ("");
> ...
>
> I find that this code just throws an UnsupportedOperationException as it
> is
> hard coded to do in the ServerDirContext class. This all leaves it
> impossible for me to add custom schema to a 1.5 directory so I feel like I
> must be missing something fundamental.
>
> Also, for my application purposes I am not really able to use LDAP Studio
> to
> import the ldif as the schema needs to be added upon my application first
> starting which in turn will do a first start on the directory.
>
> Is there a way to get my compiled schema classes into the directory now
> that
> the bootstrap schema mechanism has been removed?
>
> Any help would be greatly appreciated with regard to what I am missing
> here
> or if there is a way to work around these issues without using LDAP
> Studio.
>
> Thanks a lot!!!
>



-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com