Supporting CRUDPage edited by Carsten ZiegelerChanges (7)
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. DeleteThere are basically two options for a delete:
While the first option seems to be more logical, it has the disadvantage that we have to enhance the Resource interface. Therefore I opt for the second option. CreateWe add a new method addChild(Resource parent, String name, ValueMap properties) to the resource resolver, where the value map is optional. This will create the resource at the given parent with the given name and add the provided properties. UpdateWe currently have the PersistableValueMap which is an easy way of modifying a resource. Like with delete, we have different options:
The first option would require a new method on the Resource interface and has usability options, like how to get a changeable value map, how to ensure that a value map get from resource A might not be used to update resource B etc. 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)
