You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by Ole Ersoy <ol...@gmail.com> on 2007/04/03 21:10:59 UTC

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

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);

Re: [Syntax] Does this code look ok for creating a Syntax entry?

Posted by Ole Ersoy <ol...@gmail.com>.
Cool - Thanks!

Ole

Alex Karasulu wrote:
> Sure give it a try :).
>  
> Alex
> 
>  
> On 4/3/07, *Ole Ersoy* <ole.ersoy@gmail.com 
> <ma...@gmail.com>> 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);
> 
> 

Re: [Syntax] Does this code look ok for creating a Syntax entry?

Posted by Ole Ersoy <ol...@gmail.com>.
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 :
> 
>>
>> 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
> 

Re: [Syntax] Does this code look ok for creating a Syntax entry?

Posted by Emmanuel Lecharny <el...@gmail.com>.
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

Re: [Syntax] Does this code look ok for creating a Syntax entry?

Posted by Ole Ersoy <ol...@gmail.com>.

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

Re: [Syntax] Does this code look ok for creating a Syntax entry?

Posted by Emmanuel Lecharny <el...@gmail.com>.
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

Re: [Syntax] Does this code look ok for creating a Syntax entry?

Posted by Ole Ersoy <ol...@gmail.com>.
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@gmail.com 
> <ma...@gmail.com>> 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);
> 
> 

Re: [Syntax] Does this code look ok for creating a Syntax entry?

Posted by Alex Karasulu <ak...@apache.org>.
Sure give it a try :).

Alex


On 4/3/07, Ole Ersoy <ol...@gmail.com> 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);
>