Hi Dominik and others,
now as some time passed I can tell about results and more concrete
things. Please see my comments inline:
Am 01.10.14 15:17, schrieb Dominik Süß:
Hi everyone,
here my 2 cents about changes that I would like to see (had a short chat
with Sandro at adaptTo() about that):
* rename it and get rid of JCR in the name since it effectively is a
resourceTreeBrowser
The JCRBrowser is renamed to Apache Sling Resource Editor. See the
contribution ticket [1] and the latest source code at GitHub [2]
* make sure to be compatible with all ResourceProviders through CRUD API
(and blend out operations not available for ResourceProviders not
supporting it)
From reading the docs I think the Sling POST servlet that I use for
nodes is operating on the Resource of the request.
For reading the nodes I use the Resource API as well.
But for reading properties I check if the resource is adaptable to a
node. If it is, I use the JCR API for reading. If it isn't I adapt to a
ValueMap and show its keys and values.
For changing properties I plan to use the Sling POST servlet as well.
I guess this is the best possible compatibility right?
* get rid of the Selectorbased ResourceDecorator pattern for the browser
but implement a ResourceProvider which does the decorationion to make sure
code can be properly secured for production instances and does not impact
rendering of 3rd code at all.
The code is changed now at GitHub [3] to use the ResourceProvider. This
way the Sling Resource Editor does not depend on a selector and instead
uses the root path element of the ResourceProvider. A URL looks like
this now:
http://localhost:8080/reseditor/libs/sling/servlet/default.html
To secure it I guess one use the 'ResourceAccessSecurity'. Even though I
still have to use a resource decorator.
I didn't overwrite the resource type in the resource wrapper that I use
in the resource provider. Because then for example after every node in
the tree the same type would show up and I couldn't distinguish between
them anymore.
This is why I just added a marker [4] to the resources that went through
my resource provider and I still use a resource decorator [5] to set the
resource type depending if this marker is found. By doing it in the
resource decorator the original resource types are preserved when
accessing them in the JSP.
If all of those points are met I guess this could really be something
useful (especially when not basing on commercial varations that provide a
browser) which can be included without having to worry that it actually
interfers with the application.
I guess this way it doesn't interfere with an other application in the
same Sling instance.
[1] - https://issues.apache.org/jira/browse/SLING-4001
[2] - https://github.com/sandroboehme/resourceeditor
[3] -
https://github.com/sandroboehme/resourceeditor/tree/master/src/main/java/org/apache/sling/reseditor/resource
[4] - line 23 in
https://github.com/sandroboehme/resourceeditor/blob/master/src/main/java/org/apache/sling/reseditor/resource/ResourceTypeResourceWrapper.java
[5] - line 73 in
https://github.com/sandroboehme/resourceeditor/blob/master/src/main/java/org/apache/sling/reseditor/resource/ResourceProviderBasedResourceDecorator.java
Best,
Sandro