You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Justin Edelson (JIRA)" <ji...@apache.org> on 2010/09/01 17:44:06 UTC
[jira] Updated: (SLING-1391) Make JcrModifiablePropertyMap write
changes directly
[ https://issues.apache.org/jira/browse/SLING-1391?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Justin Edelson updated SLING-1391:
----------------------------------
Fix Version/s: (was: JCR Resource 2.0.8)
descheduling from current release
> Make JcrModifiablePropertyMap write changes directly
> ----------------------------------------------------
>
> Key: SLING-1391
> URL: https://issues.apache.org/jira/browse/SLING-1391
> Project: Sling
> Issue Type: Improvement
> Components: JCR
> Affects Versions: JCR Resource 2.0.6
> Reporter: Vidar S. Ramdal
>
> As discussed on http://markmail.org/thread/io2dnkykjnayydwz, the current JcrModifiablePropertyMap implementation of the PersistableValueMap interface uses a cached map to store changed values. The cached values are not written to the underlying node until a PVM.save() is called - at which point JMPM calles Node.save() to persist the changes. Thus, reverting changes made in a session is impossible.
> This makes atomic operations such as this difficult to implement:
> try {
> // Modify a property through PersistableValueMap
> PersistableValueMap props = resource.adaptTo(PersistableValueMap.class);
> props.put("prop", value);
> props.save();
> // Do some other, unrelated changes
> Node sibling = resource.adaptTo(Node.class).getParent().addNode("child");
> sibling.doSomeChange(); // This may throw an exception
> session.save();
> } catch(Exception e) {
> session.refresh(false); // Cancel the pending changes of this session
> }
> Felix suggests (http://markmail.org/message/5fae3cwsshbnemrf):
> * 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.
> This task is about implementing Felix' suggestions.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.