You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@directory.apache.org by Christoph Czurda <ha...@gmail.com> on 2012/02/01 11:19:05 UTC

Re: Custom schema objects



On 01/10/2012 01:47 PM, Kiran Ayyagari wrote:
> to mention it quickly, new schema elements cannot be registered using
> connection.loadSchema()
> you need to upload the new schema elements to the server.
> 
> Please search the ML, this was already answered before.
> 
Hi,

I'm sorry but I can't get this to work. I will explain every step I
took. Please try to explain to me also step by step what I'm missing. If
you are unclear about what I did at some point, please ask. I really
want to get this working.

I used the schema editor from Directory Studio and created a new schema
project. In the project I included the already existing schemas 'java',
'core' and 'system'. Next I created a new schema called 'openengsb'. I
created my attributetypes and objectclasses. Then I clicked 'export
schema for Apacheds'. Then I connected to the server and imported the
ldif. The schema is now under cn=openengsb,ou=schema. I can also create
entries from my schema objects.

However, in my application I can use my own schema objects ONLY if I
don't use connection.loadSchema(). I know that loadSchema() only loads
the default schemas that are bundled with the api. But how can I make my
application aware of my schema / load my own schema?

Thank you,
kind regards,
Christoph
> 
> On Tue, Jan 10, 2012 at 5:50 PM, Christoph Czurda
> <ha...@gmail.com> wrote:
>> Hi,
>>
>> How can I use custom schema objects in my own application with ApacheDS
>> 2.0? In Studio I created some object classes and attribute types and
>> stored them in a subtree of ou=schema. So the ldif files are present in
>> their correct destinations. In Studio I can also build entries with
>> them. But in my application I get the following error: ERR_04269
>> ATTRIBUTE_TYPE for OID [any of my schema objects] does not exist!
>>
>> The problem must be with my own schema because when I move my schema
>> objects into any of the predefined schema, I can use them.
>>
>> Here's what I tried so far:
>>
>> connection.loadSchema();
>> schemaManager = connection.getSchemaManager();
>>
>> SchemaLoader loader = schemaManager.getLoader();
>> loader.addSchema(new DefaultSchema("mySchema")); //?
>>
>> schemaManager.enable("mySchema"); //?
>> schemaManager.load("mySchema"); //?
>>
>> Well, after this my schema is enabled and loaded but the elements are
>> still not registered. So how can I register them?
>>
>> Thank you,
>> kind regards,
>> Christoph
> 
> 
> 

Re: Custom schema objects

Posted by Christoph Czurda <ha...@gmail.com>.
I made a JIRA for it:

Directory Client API DIRAPI-73

Regards,
Christoph

On 02/01/2012 11:50 AM, Emmanuel Lecharny wrote:
> On 2/1/12 11:19 AM, Christoph Czurda wrote:
>>
>>
>> On 01/10/2012 01:47 PM, Kiran Ayyagari wrote:
>>> to mention it quickly, new schema elements cannot be registered using
>>> connection.loadSchema()
>>> you need to upload the new schema elements to the server.
>>>
>>> Please search the ML, this was already answered before.
>>>
>> Hi,
>>
>> I'm sorry but I can't get this to work. I will explain every step I
>> took. Please try to explain to me also step by step what I'm missing. If
>> you are unclear about what I did at some point, please ask. I really
>> want to get this working.
>>
>> I used the schema editor from Directory Studio and created a new schema
>> project. In the project I included the already existing schemas 'java',
>> 'core' and 'system'. Next I created a new schema called 'openengsb'. I
>> created my attributetypes and objectclasses. Then I clicked 'export
>> schema for Apacheds'. Then I connected to the server and imported the
>> ldif. The schema is now under cn=openengsb,ou=schema. I can also create
>> entries from my schema objects.
>>
>> However, in my application I can use my own schema objects ONLY if I
>> don't use connection.loadSchema(). I know that loadSchema() only loads
>> the default schemas that are bundled with the api. But how can I make my
>> application aware of my schema / load my own schema?
> 
> It's a bit complicated. Right now, there is no way in the API to inject
> your own schema into the connection. This was not clear when the method
> name was loadSchema, so it was renamed to loadDefaultSchema().
> 
> We are working to add such a feature to the api, so that you can inject
> your own schema elements locally.
> 
> Not that it's really complicated - all in all, we are using the exact
> same underlying code on the API and on the server to manage schema -
> it's just that we need to extend the API.
> 
> This is something we are working on this week.
> May I suggested that you create a JIRA requesting that we extend the API
> by adding a way to create a new schema, and to allow the injection of
> shcema elements into it (AT, OC, etc) ?
> 
> Thanks !
> 

Re: Custom schema objects

Posted by Emmanuel Lecharny <el...@gmail.com>.
On 2/1/12 11:19 AM, Christoph Czurda wrote:
>
>
> On 01/10/2012 01:47 PM, Kiran Ayyagari wrote:
>> to mention it quickly, new schema elements cannot be registered using
>> connection.loadSchema()
>> you need to upload the new schema elements to the server.
>>
>> Please search the ML, this was already answered before.
>>
> Hi,
>
> I'm sorry but I can't get this to work. I will explain every step I
> took. Please try to explain to me also step by step what I'm missing. If
> you are unclear about what I did at some point, please ask. I really
> want to get this working.
>
> I used the schema editor from Directory Studio and created a new schema
> project. In the project I included the already existing schemas 'java',
> 'core' and 'system'. Next I created a new schema called 'openengsb'. I
> created my attributetypes and objectclasses. Then I clicked 'export
> schema for Apacheds'. Then I connected to the server and imported the
> ldif. The schema is now under cn=openengsb,ou=schema. I can also create
> entries from my schema objects.
>
> However, in my application I can use my own schema objects ONLY if I
> don't use connection.loadSchema(). I know that loadSchema() only loads
> the default schemas that are bundled with the api. But how can I make my
> application aware of my schema / load my own schema?

It's a bit complicated. Right now, there is no way in the API to inject 
your own schema into the connection. This was not clear when the method 
name was loadSchema, so it was renamed to loadDefaultSchema().

We are working to add such a feature to the api, so that you can inject 
your own schema elements locally.

Not that it's really complicated - all in all, we are using the exact 
same underlying code on the API and on the server to manage schema - 
it's just that we need to extend the API.

This is something we are working on this week.
May I suggested that you create a JIRA requesting that we extend the API 
by adding a way to create a new schema, and to allow the injection of 
shcema elements into it (AT, OC, etc) ?

Thanks !

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


Re: Custom schema objects

Posted by Christoph Czurda <ha...@gmail.com>.

On 02/01/2012 11:30 AM, Pierre-Arnaud Marcelot wrote:
> On 1 févr. 2012, at 11:19, Christoph Czurda wrote:
> 
>> On 01/10/2012 01:47 PM, Kiran Ayyagari wrote:
>>> to mention it quickly, new schema elements cannot be registered using
>>> connection.loadSchema()
>>> you need to upload the new schema elements to the server.
>>>
>>> Please search the ML, this was already answered before.
>>>
>> Hi,
>>
>> I'm sorry but I can't get this to work. I will explain every step I
>> took. Please try to explain to me also step by step what I'm missing. If
>> you are unclear about what I did at some point, please ask. I really
>> want to get this working.
>>
>> I used the schema editor from Directory Studio and created a new schema
>> project. In the project I included the already existing schemas 'java',
>> 'core' and 'system'. Next I created a new schema called 'openengsb'. I
>> created my attributetypes and objectclasses. Then I clicked 'export
>> schema for Apacheds'. Then I connected to the server and imported the
>> ldif. The schema is now under cn=openengsb,ou=schema. I can also create
>> entries from my schema objects.
>>
>> However, in my application I can use my own schema objects ONLY if I
>> don't use connection.loadSchema(). I know that loadSchema() only loads
>> the default schemas that are bundled with the api. But how can I make my
>> application aware of my schema / load my own schema?
> 
> Unfortunately, at the moment, it is not possible to load any custom schema.
> 
> We currently have an opened JIRA issue about having a method to load the whole server schema exposed through the subSchemaSubEntry attribute in the RootDSE:
> DIRAPI-46 (Add a generic schema loader which looks for schema elements under the value of the 'subschemaSubentry' of the RootDSE) [1]
> 
oha. Well, this explains a lot :) Thank you for clarifying!

Regards,
Christoph

> Regards,
> Pierre-Arnaud
> 
> [1] - https://issues.apache.org/jira/browse/DIRAPI-46
> 
>> Thank you,
>> kind regards,
>> Christoph
>>>
>>> On Tue, Jan 10, 2012 at 5:50 PM, Christoph Czurda
>>> <ha...@gmail.com> wrote:
>>>> Hi,
>>>>
>>>> How can I use custom schema objects in my own application with ApacheDS
>>>> 2.0? In Studio I created some object classes and attribute types and
>>>> stored them in a subtree of ou=schema. So the ldif files are present in
>>>> their correct destinations. In Studio I can also build entries with
>>>> them. But in my application I get the following error: ERR_04269
>>>> ATTRIBUTE_TYPE for OID [any of my schema objects] does not exist!
>>>>
>>>> The problem must be with my own schema because when I move my schema
>>>> objects into any of the predefined schema, I can use them.
>>>>
>>>> Here's what I tried so far:
>>>>
>>>> connection.loadSchema();
>>>> schemaManager = connection.getSchemaManager();
>>>>
>>>> SchemaLoader loader = schemaManager.getLoader();
>>>> loader.addSchema(new DefaultSchema("mySchema")); //?
>>>>
>>>> schemaManager.enable("mySchema"); //?
>>>> schemaManager.load("mySchema"); //?
>>>>
>>>> Well, after this my schema is enabled and loaded but the elements are
>>>> still not registered. So how can I register them?
>>>>
>>>> Thank you,
>>>> kind regards,
>>>> Christoph
>>>
>>>
>>>
> 
> 

Re: Custom schema objects

Posted by Pierre-Arnaud Marcelot <pa...@marcelot.net>.
On 1 févr. 2012, at 11:19, Christoph Czurda wrote:

> On 01/10/2012 01:47 PM, Kiran Ayyagari wrote:
>> to mention it quickly, new schema elements cannot be registered using
>> connection.loadSchema()
>> you need to upload the new schema elements to the server.
>> 
>> Please search the ML, this was already answered before.
>> 
> Hi,
> 
> I'm sorry but I can't get this to work. I will explain every step I
> took. Please try to explain to me also step by step what I'm missing. If
> you are unclear about what I did at some point, please ask. I really
> want to get this working.
> 
> I used the schema editor from Directory Studio and created a new schema
> project. In the project I included the already existing schemas 'java',
> 'core' and 'system'. Next I created a new schema called 'openengsb'. I
> created my attributetypes and objectclasses. Then I clicked 'export
> schema for Apacheds'. Then I connected to the server and imported the
> ldif. The schema is now under cn=openengsb,ou=schema. I can also create
> entries from my schema objects.
> 
> However, in my application I can use my own schema objects ONLY if I
> don't use connection.loadSchema(). I know that loadSchema() only loads
> the default schemas that are bundled with the api. But how can I make my
> application aware of my schema / load my own schema?

Unfortunately, at the moment, it is not possible to load any custom schema.

We currently have an opened JIRA issue about having a method to load the whole server schema exposed through the subSchemaSubEntry attribute in the RootDSE:
DIRAPI-46 (Add a generic schema loader which looks for schema elements under the value of the 'subschemaSubentry' of the RootDSE) [1]

Regards,
Pierre-Arnaud

[1] - https://issues.apache.org/jira/browse/DIRAPI-46

> Thank you,
> kind regards,
> Christoph
>> 
>> On Tue, Jan 10, 2012 at 5:50 PM, Christoph Czurda
>> <ha...@gmail.com> wrote:
>>> Hi,
>>> 
>>> How can I use custom schema objects in my own application with ApacheDS
>>> 2.0? In Studio I created some object classes and attribute types and
>>> stored them in a subtree of ou=schema. So the ldif files are present in
>>> their correct destinations. In Studio I can also build entries with
>>> them. But in my application I get the following error: ERR_04269
>>> ATTRIBUTE_TYPE for OID [any of my schema objects] does not exist!
>>> 
>>> The problem must be with my own schema because when I move my schema
>>> objects into any of the predefined schema, I can use them.
>>> 
>>> Here's what I tried so far:
>>> 
>>> connection.loadSchema();
>>> schemaManager = connection.getSchemaManager();
>>> 
>>> SchemaLoader loader = schemaManager.getLoader();
>>> loader.addSchema(new DefaultSchema("mySchema")); //?
>>> 
>>> schemaManager.enable("mySchema"); //?
>>> schemaManager.load("mySchema"); //?
>>> 
>>> Well, after this my schema is enabled and loaded but the elements are
>>> still not registered. So how can I register them?
>>> 
>>> Thank you,
>>> kind regards,
>>> Christoph
>> 
>> 
>> 


Re: Custom schema objects

Posted by Emmanuel Lecharny <el...@gmail.com>.
On 2/1/12 11:36 AM, Kiran Ayyagari wrote:
> On Wed, Feb 1, 2012 at 3:49 PM, Christoph Czurda
> <ha...@gmail.com>  wrote:
>>
>>
>> On 01/10/2012 01:47 PM, Kiran Ayyagari wrote:
>>> to mention it quickly, new schema elements cannot be registered using
>>> connection.loadSchema()
>>> you need to upload the new schema elements to the server.
>>>
>>> Please search the ML, this was already answered before.
>>>
>> Hi,
>>
>> I'm sorry but I can't get this to work. I will explain every step I
>> took. Please try to explain to me also step by step what I'm missing. If
>> you are unclear about what I did at some point, please ask. I really
>> want to get this working.
>>
>> I used the schema editor from Directory Studio and created a new schema
>> project. In the project I included the already existing schemas 'java',
>> 'core' and 'system'. Next I created a new schema called 'openengsb'. I
>> created my attributetypes and objectclasses. Then I clicked 'export
>> schema for Apacheds'. Then I connected to the server and imported the
>> ldif. The schema is now under cn=openengsb,ou=schema. I can also create
>> entries from my schema objects.
>>
>> However, in my application I can use my own schema objects ONLY if I
>> don't use connection.loadSchema(). I know that loadSchema() only loads
>> the default schemas that are bundled with the api. But how can I make my
>> application aware of my schema / load my own schema?
>>
> you have to use the NetworkSchemaLoader to load the schema present on
> the server (this only works for ApacheDS)
>
> 1. create LdapNetworkConnection
> 2. bind to the server using the above connection
> 3. create an instance of NetworkSchemaLoader using the above connection
> 3. call connection.loadSchema() by passing the schema loader created in step 3

That's an option, but it's an heavy one. See my response in another thread.


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


Re: Custom schema objects

Posted by Christoph Czurda <ha...@gmail.com>.

On 02/01/2012 11:36 AM, Kiran Ayyagari wrote:
> On Wed, Feb 1, 2012 at 3:49 PM, Christoph Czurda
> <ha...@gmail.com> wrote:
>>
>>
>>
>> On 01/10/2012 01:47 PM, Kiran Ayyagari wrote:
>>> to mention it quickly, new schema elements cannot be registered using
>>> connection.loadSchema()
>>> you need to upload the new schema elements to the server.
>>>
>>> Please search the ML, this was already answered before.
>>>
>> Hi,
>>
>> I'm sorry but I can't get this to work. I will explain every step I
>> took. Please try to explain to me also step by step what I'm missing. If
>> you are unclear about what I did at some point, please ask. I really
>> want to get this working.
>>
>> I used the schema editor from Directory Studio and created a new schema
>> project. In the project I included the already existing schemas 'java',
>> 'core' and 'system'. Next I created a new schema called 'openengsb'. I
>> created my attributetypes and objectclasses. Then I clicked 'export
>> schema for Apacheds'. Then I connected to the server and imported the
>> ldif. The schema is now under cn=openengsb,ou=schema. I can also create
>> entries from my schema objects.
>>
>> However, in my application I can use my own schema objects ONLY if I
>> don't use connection.loadSchema(). I know that loadSchema() only loads
>> the default schemas that are bundled with the api. But how can I make my
>> application aware of my schema / load my own schema?
>>
> you have to use the NetworkSchemaLoader to load the schema present on
> the server (this only works for ApacheDS)
> 
> 1. create LdapNetworkConnection
> 2. bind to the server using the above connection
> 3. create an instance of NetworkSchemaLoader using the above connection
> 3. call connection.loadSchema() by passing the schema loader created in step 3
> 

Yes, that's it! Thank you very much. Really nice to see my schema there.

Kind regards,
Christoph

> HTH
>> Thank you,
>> kind regards,
>> Christoph
>>>
>>> On Tue, Jan 10, 2012 at 5:50 PM, Christoph Czurda
>>> <ha...@gmail.com> wrote:
>>>> Hi,
>>>>
>>>> How can I use custom schema objects in my own application with ApacheDS
>>>> 2.0? In Studio I created some object classes and attribute types and
>>>> stored them in a subtree of ou=schema. So the ldif files are present in
>>>> their correct destinations. In Studio I can also build entries with
>>>> them. But in my application I get the following error: ERR_04269
>>>> ATTRIBUTE_TYPE for OID [any of my schema objects] does not exist!
>>>>
>>>> The problem must be with my own schema because when I move my schema
>>>> objects into any of the predefined schema, I can use them.
>>>>
>>>> Here's what I tried so far:
>>>>
>>>> connection.loadSchema();
>>>> schemaManager = connection.getSchemaManager();
>>>>
>>>> SchemaLoader loader = schemaManager.getLoader();
>>>> loader.addSchema(new DefaultSchema("mySchema")); //?
>>>>
>>>> schemaManager.enable("mySchema"); //?
>>>> schemaManager.load("mySchema"); //?
>>>>
>>>> Well, after this my schema is enabled and loaded but the elements are
>>>> still not registered. So how can I register them?
>>>>
>>>> Thank you,
>>>> kind regards,
>>>> Christoph
>>>
>>>
>>>
> 
> 
> 

Re: Custom schema objects

Posted by Kiran Ayyagari <ka...@apache.org>.
On Wed, Feb 1, 2012 at 3:49 PM, Christoph Czurda
<ha...@gmail.com> wrote:
>
>
>
> On 01/10/2012 01:47 PM, Kiran Ayyagari wrote:
>> to mention it quickly, new schema elements cannot be registered using
>> connection.loadSchema()
>> you need to upload the new schema elements to the server.
>>
>> Please search the ML, this was already answered before.
>>
> Hi,
>
> I'm sorry but I can't get this to work. I will explain every step I
> took. Please try to explain to me also step by step what I'm missing. If
> you are unclear about what I did at some point, please ask. I really
> want to get this working.
>
> I used the schema editor from Directory Studio and created a new schema
> project. In the project I included the already existing schemas 'java',
> 'core' and 'system'. Next I created a new schema called 'openengsb'. I
> created my attributetypes and objectclasses. Then I clicked 'export
> schema for Apacheds'. Then I connected to the server and imported the
> ldif. The schema is now under cn=openengsb,ou=schema. I can also create
> entries from my schema objects.
>
> However, in my application I can use my own schema objects ONLY if I
> don't use connection.loadSchema(). I know that loadSchema() only loads
> the default schemas that are bundled with the api. But how can I make my
> application aware of my schema / load my own schema?
>
you have to use the NetworkSchemaLoader to load the schema present on
the server (this only works for ApacheDS)

1. create LdapNetworkConnection
2. bind to the server using the above connection
3. create an instance of NetworkSchemaLoader using the above connection
3. call connection.loadSchema() by passing the schema loader created in step 3

HTH
> Thank you,
> kind regards,
> Christoph
>>
>> On Tue, Jan 10, 2012 at 5:50 PM, Christoph Czurda
>> <ha...@gmail.com> wrote:
>>> Hi,
>>>
>>> How can I use custom schema objects in my own application with ApacheDS
>>> 2.0? In Studio I created some object classes and attribute types and
>>> stored them in a subtree of ou=schema. So the ldif files are present in
>>> their correct destinations. In Studio I can also build entries with
>>> them. But in my application I get the following error: ERR_04269
>>> ATTRIBUTE_TYPE for OID [any of my schema objects] does not exist!
>>>
>>> The problem must be with my own schema because when I move my schema
>>> objects into any of the predefined schema, I can use them.
>>>
>>> Here's what I tried so far:
>>>
>>> connection.loadSchema();
>>> schemaManager = connection.getSchemaManager();
>>>
>>> SchemaLoader loader = schemaManager.getLoader();
>>> loader.addSchema(new DefaultSchema("mySchema")); //?
>>>
>>> schemaManager.enable("mySchema"); //?
>>> schemaManager.load("mySchema"); //?
>>>
>>> Well, after this my schema is enabled and loaded but the elements are
>>> still not registered. So how can I register them?
>>>
>>> Thank you,
>>> kind regards,
>>> Christoph
>>
>>
>>



-- 
Kiran Ayyagari