> > Hi,
> >
> > I'm currently working on CRUD support for Sling based on the resource
> > API. Current trunk contains already a version of it.
> > I'm wondering what the best api for modifying resources is.
> >
> > Right now, the idea is to adapt a resource to ModifiableValueMap which
> > is an extension of the ValueMap. Like the PersistableValueMap this map
> > collects all changes internally. It provides an update() method which
> > pushes the changes into the transient persistence layer (e.g. jcr
> > session). A call to the resource resolver finally persists all
> > transient changes (let's forget about different resource providers and
> > transactions for now)
> > This approach has the advantage to reuse the map interface to change
> > values, no exceptions are thrown on put and remove. - but it requires
> > to additional calls, update on the map and commit on the resource
> > resolver to get the changes persisted.
> 
> This "second level of indirection" -- calling update and then commit -- 
> sounds like
> overhead.

Actually that's what I meant in my post before, that update AND commit is 
a little complicated. On the other hand, if we want to introduce a transient 
space as Carsten proposes, there have to be two different methods.
My suggestion was to only introduce update directly on the ModifiableValueMap 
at the moment (and therefore no transient space or transactions).
In this case to update a Resource, only a Resource is needed, which would 
the handling make easier. Or we cancel the update Method and only introduce
the ResourceResolver#commit which would it make easier to add transactions
in the future. 
Or go with both as in the trunk by now...

best regards
mike

Reply via email to