Supporting CRUDPage edited by Carsten ZiegelerChanges (14)
Full ContentThe current Sling resource API only allows reading of resources - with the PersistableValueMap we have a simple mechanism to support updates, however this approach comes with some problems (see below). This is a concept how to fully implement CRUD via the resource API. As a first step we angle the problem from the users via: the API to be used by Sling applications. (SLING-2530) Client APIReadThe support for read is sufficient, we don't need to change that much. DeleteWe add a delete method to the Resource interface, so deleting a resource is a two way step: first getting the resource from the resource resolver and then deleting it. CreateWe add a new method create(String absolutePath, ValueMap properties) to the resource resolver, where the value map is optional. This will create the resource at the given path and add the provided properties. UpdateWe currently have the PersistableValueMap which is an easy way of modifying a resource. As we have modifications now as a first class feature, we should add an update(ValueMap props) method to the Resource interface. We should deprecate the PersistableValueMap as a save() call saves the whole session and this might include changes made through any other means to the session.(see SLING-1391 for some discussion about this) Persisting ChangesThere are two possibilities to handle changes:
The second approach is more like people are used to when they are familiar with JCR and it allows to do bulk changes to the persistence. The first approach without using a transaction is easier to implement inside the resource providers and for many use cases sufficient as usually just a single resource is affected by REST calls. Resource ProvidersA resource provider is mounted into the resource tree. In general, the providers are processed ordered by service ranking, highest first. A service provider gets a service property specifying the sub tree it is claiming to use. For example, a service provider might be mounted at /a/some/path. Everything below this path is processed by this resource resolver. However another resource provider might claim /a/some/path/and/down. So the longest matching path wins. We need to add a new interface which can be implemented by a ResourceProvider. It gets a create method. Update and delete are directly handled by the resource. Access ControlIt's the task of a resource resolver to check if the current user is able/allowed to access a resource. If this is not possible, the corresponding action is denied.
Change Notification Preferences
View Online
|
View Changes
|
Add Comment
|
- [CONF] Apache Sling > Supporting CRUD confluence
- [CONF] Apache Sling > Supporting CRUD confluence
- [CONF] Apache Sling > Supporting CRUD confluence
- [CONF] Apache Sling > Supporting CRUD confluence
- [CONF] Apache Sling > Supporting CRUD confluence
- [CONF] Apache Sling > Supporting CRUD confluence
- [CONF] Apache Sling > Supporting CRUD confluence
- [CONF] Apache Sling > Supporting CRUD Anonymous (Confluence)
- [CONF] Apache Sling > Supporting CRUD Daniel Klco (Confluence)
