jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Buchmann <david.buchm...@liip.ch>
Subject Re: Session.refresh(true) behaviour
Date Fri, 19 Aug 2011 08:39:48 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

> As far as the repository is concerned that node is gone.  If the
> .refresh(true) doesn't invalidate the cached n2/n3 right away, I
> would expect a repositoryexception when you try and save().

thanks for the reply. ok, put like this, deleting is the only way to
resolve the conflict.

> To prevent this type of issue
> you may want to look into locking[1].

i am implementing the refresh in the php implementation jackalope and
want it to behave according to the specification :-)

cheers,david

> 
> [1] http://www.day.com/specs/jcr/2.0/17_Locking.html
> 
> 
> -----Original Message-----
> From: David Buchmann [mailto:david.buchmann@liip.ch]
> Sent: Thu 8/18/2011 7:16 AM
> To: users@jackrabbit.apache.org
> Subject: Session.refresh(true) behaviour
>  
> hi,
> 
> the documentation [1] [2] is not very explicit how conflicts should be
> resolved. i wrote some simple test code, see below. is it correct that
> whenever i delete something on the server or move it somewhere else, the
> refresh(true) still changes the modified node to be deleted?
> 
> 
> Session s = repository.login(sc,workspace);
> Node n = s.getNode("/test");
> Node n2 = n.addNode("childname", "nt:folder");
> s.save();
> 
> // delete the node in a separate session
> Session s2 = repository.login(sc,workspace);
> s2.removeItem("/test/childname");
> // or just s2.move("/test/childname", "/xy");
> s2.save();
> 
> // add a child to the node in the first session
> Node n3 = n2.addNode("deepchild");
> 
> // keep local changes
> s.refresh(true);
> // but our local change "create a node" is lost
> System.out.println(n3.getPath());
> 
> 
> cheers,david
> 
> [1] http://www.day.com/specs/jcr/2.0/10_Writing.html#10.11.1%20Refresh
> [2]
> http://www.day.com/maven/javax.jcr/javadocs/jcr-2.0/javax/jcr/Session.html#re
> fresh(boolean)

- -- 
Liip AG // Agile Web Development // T +41 26 422 25 11
CH-1700 Fribourg // PGP 0xA581808B // www.liip.ch
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk5OIVAACgkQqBnXnqWBgItD/gCghqAvTqzhpJZRT+otvbZCch/B
faQAoM534RcF5la+Ud0yt13zai/Tvdhx
=7D3B
-----END PGP SIGNATURE-----

Mime
View raw message