On Fri, Feb 12, 2010 at 10:32 PM, Felix Meschberger <fmesc...@gmail.com> wrote:
> Sorry to chime in late...
>
> I see the issues of Vidar and these are caused by the
> PersistableValueMap introducing its own transient space ontop of the JCR
> transient space.
>
> When the PersistableValueMap transient space is saved (save() call), the
> data is written to the JCR transient space and then directly to the JCR
> persistent space by calling the JCR save method.
>
> I see the problem. In fact, even if the Sling API would allow for full
> CRUD, particularly creating resources, Vidar's use case cannot be
> implemented using the PersistableValueMap.
>
> How about this:
>
>  * Enable the PersistableValueMap to write through to the JCR
>    transient space on put().
>
>  * Write-through is configurable on a global level (in the
>    JcrResourceResolver providing the PersistableValueMap
>    instances upon adapt()). By default it is switched off
>    (backwards compatiblity).
>
>  * Write-through can also be switched on/off on a per-instance
>    level of the PersistableValueMap object (setWriteThrough(boolean))
>
>  * PersistableValueMap.save() first writes back local changes
>    not already stored using write-through and then calls node.save()
>
>  * PersistableValueMap.reset() drops local changes not already stored
>    using write-through and then calls node.refresh(false)
>
>  * When we finally do full CRUD in the ResourceResolver, we should
>    add save/reset methods, which would call Session.save() or
>    refresh(false), resp. For now the Session methods must be called
>    directly.
>
> WDYT ?

Makes a lot of sense. I suppose the JCR write-through does not affect
performance too much.

I really like the configurable setting on JcrResourceResolver. As
Carsten says, Node.save() is deprecated by JCR 2.0, so we should
probably start avoiding it already.

If we all agree that this is a viable path forward, I'll file a JIRA for it.

-- 
Vidar S. Ramdal <vi...@idium.no> - http://www.idium.no
Sommerrogata 13-15, N-0255 Oslo, Norway
+ 47 22 00 84 00 / +47 21 531941, ext 2070

Reply via email to