You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Alexander Klimetschek <ak...@adobe.com.INVALID> on 2017/06/01 00:34:49 UTC

[API] ResourceResolver.copy/move() transient or not?

Hi everyone,

the javadocs of ResourceResolver.copy/move() [1] aren't very clear whether these methods immediately persist the change, or if the change is transient and it's necessary to call commit().

The implementation of the JCR resource provider uses Session.move() which is transient.

When copy and move works across different providers, I wonder if transient is still supposed to work. It seems, but would be good to clarify this.

In fact, no other modifying method mentions commit(), nor does the class level javadoc.

[1] https://github.com/apache/sling/blob/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceResolver.java#L727-L781
[2] https://github.com/apache/sling/blob/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProvider.java#L554

Cheers,
Alex

Re: [API] ResourceResolver.copy/move() transient or not?

Posted by Alexander Klimetschek <ak...@adobe.com.INVALID>.
Thanks. I created https://issues.apache.org/jira/browse/SLING-6932 for the javadoc change.

Also noted that the multi-phase commit behaviour (across providers) should probably be documented as well.

Cheers,
Alex

> On 31.05.2017, at 22:27, Carsten Ziegeler <cz...@apache.org> wrote:
> 
> Hi,
> 
> all resource operations are transient, you always have to call commit.
> But I guess we need to work on the javadocs a little bit to make this clear.
> 
> Sling 9 is not released yet, but we're pretty close. Once it's there the
> javadoc will be there as well.
> 
> Carsten
> 
> Alexander Klimetschek wrote
>> BTW, there is no published javadoc for sling 9, the latest is sling 8 [3], which does not include the copy/move methods, albeit they are 2 years old [4].
>> 
>> [3] https://sling.apache.org/apidocs/sling8/org/apache/sling/api/resource/ResourceResolver.html
>> [4] https://github.com/apache/sling/commit/6653209154a464f45fa63634af869408d6b84619
>> 
>> Cheers,
>> Alex
>> 
>>> On 31.05.2017, at 17:34, Alexander Klimetschek <ak...@adobe.com.INVALID> wrote:
>>> 
>>> Hi everyone,
>>> 
>>> the javadocs of ResourceResolver.copy/move() [1] aren't very clear whether these methods immediately persist the change, or if the change is transient and it's necessary to call commit().
>>> 
>>> The implementation of the JCR resource provider uses Session.move() which is transient.
>>> 
>>> When copy and move works across different providers, I wonder if transient is still supposed to work. It seems, but would be good to clarify this.
>>> 
>>> In fact, no other modifying method mentions commit(), nor does the class level javadoc.
>>> 
>>> [1] https://github.com/apache/sling/blob/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceResolver.java#L727-L781
>>> [2] https://github.com/apache/sling/blob/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProvider.java#L554
>>> 
>>> Cheers,
>>> Alex
>> 
>> 
> 
> 
> 
> 
> -- 
> Carsten Ziegeler
> Adobe Research Switzerland
> cziegeler@apache.org


Re: [API] ResourceResolver.copy/move() transient or not?

Posted by Carsten Ziegeler <cz...@apache.org>.
Hi,

all resource operations are transient, you always have to call commit.
But I guess we need to work on the javadocs a little bit to make this clear.

Sling 9 is not released yet, but we're pretty close. Once it's there the
javadoc will be there as well.

Carsten

Alexander Klimetschek wrote
> BTW, there is no published javadoc for sling 9, the latest is sling 8 [3], which does not include the copy/move methods, albeit they are 2 years old [4].
> 
> [3] https://sling.apache.org/apidocs/sling8/org/apache/sling/api/resource/ResourceResolver.html
> [4] https://github.com/apache/sling/commit/6653209154a464f45fa63634af869408d6b84619
> 
> Cheers,
> Alex
> 
>> On 31.05.2017, at 17:34, Alexander Klimetschek <ak...@adobe.com.INVALID> wrote:
>>
>> Hi everyone,
>>
>> the javadocs of ResourceResolver.copy/move() [1] aren't very clear whether these methods immediately persist the change, or if the change is transient and it's necessary to call commit().
>>
>> The implementation of the JCR resource provider uses Session.move() which is transient.
>>
>> When copy and move works across different providers, I wonder if transient is still supposed to work. It seems, but would be good to clarify this.
>>
>> In fact, no other modifying method mentions commit(), nor does the class level javadoc.
>>
>> [1] https://github.com/apache/sling/blob/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceResolver.java#L727-L781
>> [2] https://github.com/apache/sling/blob/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProvider.java#L554
>>
>> Cheers,
>> Alex
> 
> 


 

-- 
Carsten Ziegeler
Adobe Research Switzerland
cziegeler@apache.org

Re: [API] ResourceResolver.copy/move() transient or not?

Posted by Alexander Klimetschek <ak...@adobe.com.INVALID>.
BTW, there is no published javadoc for sling 9, the latest is sling 8 [3], which does not include the copy/move methods, albeit they are 2 years old [4].

[3] https://sling.apache.org/apidocs/sling8/org/apache/sling/api/resource/ResourceResolver.html
[4] https://github.com/apache/sling/commit/6653209154a464f45fa63634af869408d6b84619

Cheers,
Alex

> On 31.05.2017, at 17:34, Alexander Klimetschek <ak...@adobe.com.INVALID> wrote:
> 
> Hi everyone,
> 
> the javadocs of ResourceResolver.copy/move() [1] aren't very clear whether these methods immediately persist the change, or if the change is transient and it's necessary to call commit().
> 
> The implementation of the JCR resource provider uses Session.move() which is transient.
> 
> When copy and move works across different providers, I wonder if transient is still supposed to work. It seems, but would be good to clarify this.
> 
> In fact, no other modifying method mentions commit(), nor does the class level javadoc.
> 
> [1] https://github.com/apache/sling/blob/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceResolver.java#L727-L781
> [2] https://github.com/apache/sling/blob/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProvider.java#L554
> 
> Cheers,
> Alex