Re: Resource.getParent() on NonExistingResource

2016-06-27 Thread Konrad Windszus
> On 20 Jun 2016, at 15:12, Julian Sedding wrote: > > IMHO your NonExistingResource or SynthetricResource should already > have the correct absolute path. This is not possible, as resource resolving on SyntheticResources is not unambiguous. So basically the

Re: Resource.getParent() on NonExistingResource

2016-06-20 Thread Julian Sedding
IMHO your NonExistingResource or SynthetricResource should already have the correct absolute path. As Rob noted, RR.resolve() is about resolving URIs to Resources. Once you are navigating Resources (e.g. getParent()), no more resolve() calls should happen. >From my point of view the problem is

Re: Resource.getParent() on NonExistingResource

2016-06-10 Thread Konrad Windszus
I am talking about https://github.com/apache/sling/blob/c9e59667d8f9cd698bc33a51f3e6a22e85d4a952/bundles/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/extension/ResourceRuntimeExtension.java#L254

Re: Resource.getParent() on NonExistingResource

2016-06-10 Thread Konrad Windszus
I only propose to change getParent() on NonExistingResource. Right now we have the situation that getParent() would just return the wrong NonExistingResource! So what we could do is to rely on resolve() as a fallback in case the regular way does not succeed. That would not make things any worse

Re: Resource.getParent() on NonExistingResource

2016-06-10 Thread Rob Ryan
Regardless of what other problem may exist; involving resolve() in getParent() isn't a solution. Resolve() operates on _URI_ paths. Not on resource paths. So proposing to involve resolve() in an implementation of getParent() doesn't make sense. Resolve() makes special considerations of some

Re: Resource.getParent() on NonExistingResource

2016-06-10 Thread Carsten Ziegeler
Konrad Windszus wrote > My use case is AEM: > I have an existing page containing some components (each one encapsulated in > dedicated child resources). > Now the underlying template in AEM is extended (i.e. new fixed components > have been added). For each of those a child resource is

Re: Resource.getParent() on NonExistingResource

2016-06-10 Thread Konrad Windszus
My use case is AEM: I have an existing page containing some components (each one encapsulated in dedicated child resources). Now the underlying template in AEM is extended (i.e. new fixed components have been added). For each of those a child resource is necessary, which does not exist yet on

Re: Resource.getParent() on NonExistingResource

2016-06-10 Thread Michael Dürig
On 10.6.16 9:26 , Carsten Ziegeler wrote: I think calling resolve() for traversal is totally unexpected. Now looking at this, I'm really wondering if it was a good idea to implement getParent on NonExistingResource. Let the client deal with it instead of adding complex special cases. FWIW:

Re: Resource.getParent() on NonExistingResource

2016-06-10 Thread Carsten Ziegeler
Konrad Windszus wrote > This is complex to solve for the client (and kind of unexpected that this is > not working). > So what speaks against supporting this use case properly in Sling. > Maybe you can elaborate a bit on >> I think calling resolve() for traversal is totally unexpected. > > IMHO

Re: Resource.getParent() on NonExistingResource

2016-06-10 Thread Konrad Windszus
This is complex to solve for the client (and kind of unexpected that this is not working). So what speaks against supporting this use case properly in Sling. Maybe you can elaborate a bit on > I think calling resolve() for traversal is totally unexpected. IMHO the complex cases should be nicely

Re: Resource.getParent() on NonExistingResource

2016-06-10 Thread Carsten Ziegeler
I think calling resolve() for traversal is totally unexpected. Now looking at this, I'm really wondering if it was a good idea to implement getParent on NonExistingResource. Let the client deal with it instead of adding complex special cases. Carsten Konrad Windszus wrote > There is one related

Re: Resource.getParent() on NonExistingResource

2016-06-10 Thread Konrad Windszus
There is one related problem with mapping: Consider the case you have a resource resolver mapping from "/content/" to "/". In the underlying repository you have a resource in "/content/existingParent". Now it might happen that a NonExistingResource is resolved for path

Re: Resource.getParent() on NonExistingResource

2016-06-02 Thread Konrad Windszus
Thanks for the input. I created https://issues.apache.org/jira/browse/SLING-5757 for tracking that and I am going to propose a patch in there. What about SyntheticResources which are not NonExistingResources? If we would follow the same approach as for NonExistingResources the question is, with

Re: Resource.getParent() on NonExistingResource

2016-06-02 Thread Daniel Klco
I would imagine that the only thing this would change is to make a small number of null checks irrelevant. +1 for making the behavior more consistent, however, the JavaDocs and release notes should be explicit about this change. On Thu, Jun 2, 2016 at 4:45 AM, Georg Henzler

Re: Resource.getParent() on NonExistingResource

2016-06-02 Thread Georg Henzler
Hi Konrad, +1 for making the behaviour of NonExistingResource more consistent - I personally can't think of any places this would break existing code. Regards Georg On 2016-06-01 15:09, Konrad Windszus wrote: Hi Robert, thanks for your input. I am not sure whether this would confuse

Re: Resource.getParent() on NonExistingResource

2016-06-01 Thread Konrad Windszus
Hi Robert, thanks for your input. > > I am not sure whether this would confuse existing clients though... I am also a bit worried about that but the only example I could think of is a code trying to create the parent nodes or collecting the non-existing ones by checking getParent() for null.

Re: Resource.getParent() on NonExistingResource

2016-06-01 Thread Robert Munteanu
Hi, On Wed, 2016-06-01 at 13:29 +0200, Konrad Windszus wrote: > Hi, > I have a question around the getParent() method on a > NonExistingResource. > Currently it returns null in case the parent is also a non existing > resource. > > According to the javadoc of Resource.getParent() this is kind of

Resource.getParent() on NonExistingResource

2016-06-01 Thread Konrad Windszus
Hi, I have a question around the getParent() method on a NonExistingResource. Currently it returns null in case the parent is also a non existing resource. According to the javadoc of Resource.getParent() this is kind of unexpected, because it states