jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Padraic I. Hannon" <...@wasabicowboy.com>
Subject Re: dynamic mixins and jcr mapping
Date Fri, 31 Aug 2007 19:02:31 GMT
For the loading part I ended up doing basically that. Basically I call 
addMixin() on the object (which extends a base class I created). The 
addMixin method keeps track of all objects added in as mixins to 
recreate the mixin each time rather than just nesting them..

public abstract class AbstractJcrModel implements JcrModel {
    private Collection mixins = new HashSet();
 
   <SNIP>

    public Object addMixin(JcrMixin mixin) {
        mixins.add(mixin);       
        Object[] delegates = mixins.toArray();
        delegates = ArrayUtils.add(delegates, 0, this);
        return Mixin.create(delegates);
   }
}

-paddy


Felix Meschberger wrote:
> Hi Paddy,
>
> Wow ! I was about to apologize to not answered to your mails earlier,
> now I have to admit, that I did not realize, what I missed !
>
> This definitely - from my point of view - like a very interesting path
> to go ! Very interested to see the future.
>
> As a side note on loading: You sketch, that you would load a node in the
> traditional way first and then for each mixin, you would create Mixin
> Object. How about first analyzing the node to get the "primary class"
> and all mixin classes to create the final mixin class upfront and then
> loading all the data into the generated class ? This way, you would not
> generate a cascade of mixin classes.... Just off the top of my head :-)
>
> Regards
> Felix
>
> Am Mittwoch, den 29.08.2007, 12:35 -0700 schrieb Padraic I. Hannon:
>   
>> For loading objects, since we now would be relying on interfaces and 
>> proxies the reflectionutils.setnestedproperties would no longer work as 
>> we would need to address methods instead of bean properties. I'll create 
>> a jira ticket if I haven't already to begin tracking code.
>>
>> -paddy
>>     


Mime
View raw message