In fact it doesn't look too bad, from our three main resources (bundle
resource, servlet resource and jcr resource) only bundle resource seems
to be doing it wrong (which I believe is the original problem of
SLING-7833).

Regards

Carsten


Carsten Ziegeler wrote
> Hi,
> 
> we've currently two APIs for resource traversal, the Resource interface
> allows to get the parent, list children etc., and the same methods are
> part of the resource resolver interface. In fact we have a third variant
> using ResourceUtil.
> 
> Now actually, all of these should return the same results. As the
> resource resolver implementation is the source of truth, the resource
> implementations should delegate to the resource resolver for all these
> methods.
> 
> Unfortunately, not all of them do. Will the AbstractResource class does
> so, sub classes sometimes override the traversal methods and take
> shortcuts. However by taking these shortcuts, the result might differ
> from the resource resolver equivalents. For example resource decorators
> might not be called, children from different providers might not be
> merged etc.
> 
> To fix this problem we should probably declare those methods in
> AbstractResource as final. This forces all implementations to use those
> implementations. We would also need to fix the NonExistingResource
> implementation in the API package, but that's easy to do.
> 
> However, this most likely will break some of the existing
> implementations. So we would need to update all resource provider
> implementations as well. It's not a big deal as we only have a couple of
> them, but still it's not nice.
> 
> On the other hand, simply trusting that every implementation does it
> right, does not work as we see now here and there.
> 
> Thoughts?
> 
> Regards
> Carsten
> 
-- 
Carsten Ziegeler
Adobe Research Switzerland
[email protected]

Reply via email to