Apache Directory Project - [Syntax] Does this code look ok for creating a Syntax entry?

This is Interesting: Free IT Magazines  
Home > Archive > Apache Directory Project > April 2007 > [Syntax] Does this code look ok for creating a Syntax entry?





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author [Syntax] Does this code look ok for creating a Syntax entry?
Ole Ersoy

2007-04-03, 7:11 pm

private static final String PEN = "35453";
private static final String ESTRING_SYNTAX_LOCAL_OID = "1";
private static final String ESTRING_SYNTAX_GLOBAL_OID = PEN +"." +
ESTRING_LOCAL_OID;
private static final String ESTRING_SYNTAX_DESCRIPTION = "Ecore String
DataType";
....
Attributes ldapAttributes = new AttributesImpl();
Attribute objectClass = new AttributeImpl(
SystemSchemaConstants.OBJECT_CLASS_AT,
"top" );
objectClass.add( MetaSchemaConstants.META_TOP_OC );
objectClass.add( MetaSchemaConstants.META_SYNTAX_OC );
ldapAttributes.put( objectClass );
ldapAttributes.put( MetaSchemaConstants.M_OID_AT,
ESTRING_SYNTAX_GLOBAL_OID );
ldapAttributes.put( MetaSchemaConstants.M_DESCRIPTION_AT,
ESTRING_SYNTAX_DESCRIPTION );

String eStringSyntaxRDN = "MetaSchemaConstants.M_OID_AT + "=" +
ESTRING_SYNTAX_GLOBAL_OID;

//With the current context being "ou=syntaxes,ou=schema"
ctx.createSubcontext(eStringSyntaxRDN, ldapAttributes);

Alex Karasulu

2007-04-03, 7:11 pm

Sure give it a try .

Alex


On 4/3/07, Ole Ersoy <ole.ersoy-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> private static final String PEN = "35453";
> private static final String ESTRING_SYNTAX_LOCAL_OID = "1";
> private static final String ESTRING_SYNTAX_GLOBAL_OID = PEN +"." +
> ESTRING_LOCAL_OID;
> private static final String ESTRING_SYNTAX_DESCRIPTION = "Ecore String
> DataType";
> ...
> Attributes ldapAttributes = new AttributesImpl();
> Attribute objectClass = new AttributeImpl(
> SystemSchemaConstants.OBJECT_CLASS_AT,
> "top" );
> objectClass.add( MetaSchemaConstants.META_TOP_OC );
> objectClass.add( MetaSchemaConstants.META_SYNTAX_OC );
> ldapAttributes.put( objectClass );
> ldapAttributes.put( MetaSchemaConstants.M_OID_AT,
> ESTRING_SYNTAX_GLOBAL_OID );
> ldapAttributes.put( MetaSchemaConstants.M_DESCRIPTION_AT,
> ESTRING_SYNTAX_DESCRIPTION );
>
> String eStringSyntaxRDN = "MetaSchemaConstants.M_OID_AT + "=" +
> ESTRING_SYNTAX_GLOBAL_OID;
>
> //With the current context being "ou=syntaxes,ou=schema"
> ctx.createSubcontext(eStringSyntaxRDN, ldapAttributes);
>


Ole Ersoy

2007-04-03, 7:11 pm

Cool - Thanks!

Ole

Alex Karasulu wrote:
> Sure give it a try .
>
> Alex
>
>
> On 4/3/07, *Ole Ersoy* <ole.ersoy-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
> <mailto:ole.ersoy-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>> wrote:
>
> private static final String PEN = "35453";
> private static final String ESTRING_SYNTAX_LOCAL_OID = "1";
> private static final String ESTRING_SYNTAX_GLOBAL_OID = PEN +"." +
> ESTRING_LOCAL_OID;
> private static final String ESTRING_SYNTAX_DESCRIPTION = "Ecore String
> DataType";
> ...
> Attributes ldapAttributes = new AttributesImpl();
> Attribute objectClass = new AttributeImpl(
> SystemSchemaConstants.OBJECT_CLASS_AT,
> "top" );
> objectClass.add( MetaSchemaConstants.META_TOP_OC );
> objectClass.add( MetaSchemaConstants.META_SYNTAX_OC );
> ldapAttributes.put( objectClass );
> ldapAttributes.put( MetaSchemaConstants.M_OID_AT,
> ESTRING_SYNTAX_GLOBAL_OID );
> ldapAttributes.put( MetaSchemaConstants.M_DESCRIPTION_AT,
> ESTRING_SYNTAX_DESCRIPTION );
>
> String eStringSyntaxRDN = "MetaSchemaConstants.M_OID_AT + "=" +
> ESTRING_SYNTAX_GLOBAL_OID;
>
> //With the current context being "ou=syntaxes,ou=schema"
> ctx.createSubcontext(eStringSyntaxRDN, ldapAttributes);
>
>


Ole Ersoy

2007-04-14, 7:11 pm

OK - I gave it a try, aaand (Drum Roll) I get this:

javax.naming.NameNotFoundException: [LDAP: error code 32 - failed to add
entry
m-oid=1.3.6.1.4.1.18060.0.4.0.0.100000.11123.11233,ou=syntaxes,ou=schema:
Parent ou=syntaxes,ou=schema not found];

DOH!

Is there a Java file somewhere that contains the DNs for
various schema entry parents (AttributeTypes, ObjectClasses, etc)?

Thanks,
- Ole




Alex Karasulu wrote:
> Sure give it a try .
>
> Alex
>
>
> On 4/3/07, *Ole Ersoy* <ole.ersoy-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
> <mailto:ole.ersoy-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>> wrote:
>
> private static final String PEN = "35453";
> private static final String ESTRING_SYNTAX_LOCAL_OID = "1";
> private static final String ESTRING_SYNTAX_GLOBAL_OID = PEN +"." +
> ESTRING_LOCAL_OID;
> private static final String ESTRING_SYNTAX_DESCRIPTION = "Ecore String
> DataType";
> ...
> Attributes ldapAttributes = new AttributesImpl();
> Attribute objectClass = new AttributeImpl(
> SystemSchemaConstants.OBJECT_CLASS_AT,
> "top" );
> objectClass.add( MetaSchemaConstants.META_TOP_OC );
> objectClass.add( MetaSchemaConstants.META_SYNTAX_OC );
> ldapAttributes.put( objectClass );
> ldapAttributes.put( MetaSchemaConstants.M_OID_AT,
> ESTRING_SYNTAX_GLOBAL_OID );
> ldapAttributes.put( MetaSchemaConstants.M_DESCRIPTION_AT,
> ESTRING_SYNTAX_DESCRIPTION );
>
> String eStringSyntaxRDN = "MetaSchemaConstants.M_OID_AT + "=" +
> ESTRING_SYNTAX_GLOBAL_OID;
>
> //With the current context being "ou=syntaxes,ou=schema"
> ctx.createSubcontext(eStringSyntaxRDN, ldapAttributes);
>
>


Emmanuel Lecharny

2007-04-14, 7:11 pm

Ole Ersoy a écrit :

> OK - I gave it a try, aaand (Drum Roll) I get this:
>
> javax.naming.NameNotFoundException: [LDAP: error code 32 - failed to
> add entry
> m-oid=1.3.6.1.4.1.18060.0.4.0.0.100000.11123.11233,ou=syntaxes,ou=schema:
> Parent ou=syntaxes,ou=schema not found];
>
> DOH!


This is simply because you don't have a ou=syntaxes, ou=schema entry.
Create it, it will work. But then, it's not at all a good idea. You
should instead create your own entry like cn=mySchema, ou=schema under
which you will add the ou=syntaxes entry, and then add your m-oid=blah.

> <snip/>


Emmanuel

Ole Ersoy

2007-04-15, 1:11 am



SNIP
> This is simply because you don't have a ou=syntaxes, ou=schema entry.
> Create it, it will work. But then, it's not at all a good idea. You
> should instead create your own entry like cn=mySchema, ou=schema under
> which you will add the ou=syntaxes entry, and then add your m-oid=blah.


Ooooh - I thought all the Syntax entries had to be stored under the same
entry. I like this. It's really elegant.

I'm going for a run and when I get back I'm gonna try it!

Thanks Emmanuel!

- Ole

Emmanuel Lecharny

2007-04-15, 1:11 am

Ole Ersoy a écrit :

>
> Ooooh - I thought all the Syntax entries had to be stored under the
> same entry. I like this. It's really elegant.


Just do me a favor : launch LdapStudio, create a connexion on rootDSE
and look at ou=schema partition. Then the structure will be clear like
crystal, I think (you will need to launch ADS before of course).

LdapStudio is your friend, "no ldapstudio left behind" ...
Emmanuel

Ole Ersoy

2007-04-15, 1:11 am

Emmanuel,

Let me tell something tto u. U DA MAN!!

That's a massive help. I was trying to figure
out how to see ou=schema...it's really obvious now
that I see it...creating such a connection just
had to occur to my squirrel nut, and sometimes there's just
not much happening in it.

Thanks. I think I'm going to be much more productive now :-)
- Ole



Emmanuel Lecharny wrote:
> Ole Ersoy a écrit :
>
>
> Just do me a favor : launch LdapStudio, create a connexion on rootDSE
> and look at ou=schema partition. Then the structure will be clear like
> crystal, I think (you will need to launch ADS before of course).
>
> LdapStudio is your friend, "no ldapstudio left behind" ...
> Emmanuel
>


Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com