Hi,
I don't like this, and here is why: By adding this method, you add
functionality to a single location creating the impression, that this is
core functionality. That is you create a JavaScript-only
Resource.listChildren() method. The problem with this is, that migrating
such code to e.g. Java or trying to create similar code in other
languages will create tons of issues.
In addition, this implementation does not actually work, because it only
considers children of the current resource's ResourceProvider neglecting
any other ResourceProviders which might have "children" to the resource.
I understand, that it is cumbersome to revert to the ResourceResolver to
list the children of a resource - not just in JavaScript. So I would
like to propose these changes to the Resource interface:
Add Methods:
Iterator<Resource> listChildren(); // equivalent to
getResourceResolver().listChildren()
ResourceResolver getResourceResolver();
Remove Method:
ResourceProvider getResourceProvider(); // replaced by
getResourceResolver()
WDYT ?
Regards
Felix
Am Freitag, den 08.02.2008, 09:35 -0800 schrieb Bertrand Delacretaz
(JIRA):
> Improve iteration of child Resources in ScriptableResource
> ----------------------------------------------------------
>
> Key: SLING-240
> URL: https://issues.apache.org/jira/browse/SLING-240
> Project: Sling
> Issue Type: Improvement
> Reporter: Bertrand Delacretaz
> Priority: Minor
>
>
> The ScriptableResource should allow convenient access in javascript to the
> ResourceProvider.listChildren() method, to render hierarchies easily.
>