jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Padraic Hannon <...@wasabicowboy.com>
Subject Re: [OCM] Dynamic Mixin Support
Date Fri, 02 Nov 2007 16:02:09 GMT

On Nov 2, 2007, at 6:53 AM, Christophe Lombart wrote:

> On 11/1/07, Padraic Hannon <pih@wasabicowboy.com> wrote:
>>
>>
>> I have been reviewing the implementation I submitted for mixin  
>> support
>> in JCR-1100 and am struggling with how to proceed. On the one hand I
>> think the implementation that was submitted is nice since it has some
>> amount of type safety and gives the developer the ability to cast
>> objects. On the other hand, how is a developer to know what to cast
>> the objects to?
>
>
> What do you mean ? For example, I don't see some problems when  you  
> search
> on java class that match to mixin type.

That is true, however, for the application developer who may not have  
as much idea as to the underlying datastore perhaps there is a  
problem? At the same time this model is fairly different so it could  
be ok to expect the developer to have a certain amount of knowledge as  
to the underlying mechanism.

>
>
>
> I am starting to experiment with using the bean
>> generator cglib code which will allow me to use regular javabeans. My
>> idea is that the mapped node type would be used to instantiate the
>> object and then for mixin properties I would create a new class
>> dynamically which contains all the mixin's properties.
>
> ok. I expect "mapped node type" is the primary node type - right ?
>

yes

> I would modify
>> the object converter to first create the object with its nodes mapped
>> properties then I would take each mixin for its node and grab the
>> attributes for the mixin based on the mixin definition mapped in xml
>> (not sure how to handle this in JDK 1.5 where the mappings are done
>> with annotations)
>
>
> It is done in the same way. This is the same ObjectConverter impl  
> used in
> both cases (annotation & xml).
>
>
> and add these attributes to a new class which is a
>> subclass of the node's defined class.
>
>
> I don't understand why it is a sublcass of the node's defined class.
>

For example if I have a primary node type of Cat and I load two  
objects: Tiger and Lilly I could apply a mixin of type Cougar to  
Lilly. When doing so I would need to create an object with a new  
dynamically generated class. I would not want to change the current  
Cat class since there are other objects using it that have not had the  
Cougar mixin applied.

>
> This new class would have
>> properties defined for each property in the mixin.
>>
>> Has anyone else thought about how to handle this?
>
>
>
> No yet I'm sorry. I will to review your proposal max for monday.
>
> Christophe



Mime
View raw message