Return-Path: Delivered-To: apmail-jackrabbit-dev-archive@www.apache.org Received: (qmail 41730 invoked from network); 26 Apr 2006 16:10:16 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 26 Apr 2006 16:10:16 -0000 Received: (qmail 99511 invoked by uid 500); 26 Apr 2006 16:10:03 -0000 Delivered-To: apmail-jackrabbit-dev-archive@jackrabbit.apache.org Received: (qmail 99476 invoked by uid 500); 26 Apr 2006 16:10:02 -0000 Mailing-List: contact dev-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jackrabbit.apache.org Delivered-To: mailing list dev@jackrabbit.apache.org Received: (qmail 99462 invoked by uid 99); 26 Apr 2006 16:10:01 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Apr 2006 09:10:01 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [132.203.250.27] (HELO hermes.ulaval.ca) (132.203.250.27) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Apr 2006 09:10:00 -0700 Received: from hermes.ulaval.ca(132.203.250.27) by clouso.ulaval.ca via smtp id 1054_11510a98_d53f_11da_8445_00304811f440; Wed, 26 Apr 2006 12:09:41 -0400 Received: from NIBEL69.bibl.ulaval.ca (poste015-130.bibl.ulaval.ca [132.203.130.15]) by hermes.ulaval.ca (8.13.1/8.12.9) with ESMTP id k3QG9dYg027371 for ; Wed, 26 Apr 2006 12:09:39 -0400 Received: from poste015-130.bibl.ulaval.ca(132.203.130.15) by clouso.ulaval.ca via smtp id 104e_10fd2194_d53f_11da_8c4b_00304811f440; Wed, 26 Apr 2006 12:09:40 -0400 Message-Id: <6.1.1.1.2.20060426115631.04642d70@hermes.ulaval.ca> X-Sender: biblnbe@hermes.ulaval.ca (Unverified) X-Mailer: QUALCOMM Windows Eudora Version 6.1.1.1 Date: Wed, 26 Apr 2006 12:09:38 -0400 To: dev@jackrabbit.apache.org From: Nicolas Belisle Subject: Re: jcr:sucessors property not persisted immediatly within a transaction In-Reply-To: <8be731880604252254n73c979b6mf1216d73a9c1cd6f@mail.gmail.co m> References: <6.1.1.1.2.20060425110104.0463ee60@hermes.ulaval.ca> <6.1.1.1.2.20060425160101.046449c0@hermes.ulaval.ca> <8be731880604252254n73c979b6mf1216d73a9c1cd6f@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1"; format=flowed Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Hi Tobias, Done : http://issues.apache.org/jira/browse/JCR-414 The issue mentions the two problems : jcr:succesors not updated and=20 inconsistent read of version history. Thanks for your comments, Nick Le 01:54 2006-04-26, vous avez =E9crit: >hi nicolas, >thank you for looking into this. having a corresponding jira bug would >be great :-). the way of how the version storage (the stuff below >/jcr:system/jcr:versionStorage) exposed to the workspace is done by >'virtual itemstates'. the version storage needs to be 'mounted' to all >workspaces. so it could be, that the version manager does not >invalidate the above caches properly. > >regards, toby > >On 4/25/06, Nicolas Belisle wrote: > > Hi again, > > > > A get another strange behavior running a similar chunk of code (see= below). > > From repeated execution the output changes! Sometimes the first and= second > > versionHistory print displays 2 versions, sometimes only the= rootVersion... > > Commenting the transaction context seem to solve the problem. > > > > Maybe it's my coffee ... @_@ > > > > > > Regards, > > Nicolas > > > > > > package net.sf.archimede; > > > > import javax.jcr.Node; > > import javax.jcr.NodeIterator; > > import javax.jcr.Property; > > import javax.jcr.PropertyIterator; > > import javax.jcr.Repository; > > import javax.jcr.RepositoryException; > > import javax.jcr.Session; > > import javax.jcr.SimpleCredentials; > > import javax.jcr.Value; > > import javax.jcr.version.Version; > > import javax.jcr.version.VersionIterator; > > import javax.transaction.UserTransaction; > > > > import net.sf.archimede.model.UserTransactionImpl; > > > > import org.apache.jackrabbit.core.TransientRepository; > > > > public class VersioningTest { > > > > public static void main(String[] args) throws Exception { > > //RepositoryConfig config =3D RepositoryConfig.create(new > > FileInputStream(new File("C:/tmp/repository.xml")),= "C:/tmp/repository"); > > Repository repository =3D new > > TransientRepository();//RepositoryImpl.create(config); > > Session session =3D repository.login( new > > SimpleCredentials("username", "password".toCharArray()) ); > > try { > > > > String nodeName =3D "" + System.currentTimeMillis(); > > > > Node rootNode =3D session.getRootNode(); > > Node test =3D rootNode.addNode(nodeName); > > test.addMixin("mix:versionable"); > > session.save(); > > > > UserTransaction tx =3D new UserTransactionImpl(session); > > tx.begin(); > > > > //Create a version > > test.checkin(); > > test.checkout(); > > > > //Create another > > test.checkin(); > > test.checkout(); > > > > for (VersionIterator vi =3D > > test.getVersionHistory().getAllVersions(); vi.hasNext(); ) { > > Version version =3D vi.nextVersion(); > > System.out.println(); > > print(version); > > } > > > > for (VersionIterator vi =3D > > test.getVersionHistory().getAllVersions(); vi.hasNext(); ) { > > Version version =3D vi.nextVersion(); > > System.out.println(); > > print(version); > > } > > > > // Commit transaction > > tx.commit(); > > > > for (VersionIterator vi =3D > > test.getVersionHistory().getAllVersions(); vi.hasNext(); ) { > > Version version =3D vi.nextVersion(); > > System.out.println(); > > print(version); > > } > > > > > > } finally { > > session.logout(); > > } > > } > > > > public static void print(Node node) throws RepositoryException { > > System.out.println("Printing content of node: " += node.getName()); > > System.out.println(" Properties:"); > > for (PropertyIterator pi =3D node.getProperties();= pi.hasNext();) { > > Property p =3D pi.nextProperty(); > > if (p.getDefinition().isMultiple()) { > > Value[] values =3D p.getValues(); > > for (int i =3D 0; i < values.length; i++) { > > System.out.println(" - " + p.getName() + ": " + > > values[i].getString()); > > } > > } else { > > System.out.println(" - " + p.getName() + ": " + > > p.getValue().getString()); > > } > > } > > System.out.println(" Child nodes:"); > > for (NodeIterator ni =3D node.getNodes(); ni.hasNext();) { > > Node n =3D ni.nextNode(); > > System.out.println(" - " + n.getName()); > > } > > } > > > > } > > > > > > > > > > Le 14:16 2006-04-25, vous avez =E9crit: > > >Hi, > > > > > >*Is this a desired behavior ? If not, I will file an issue. > > > > > >During a transaction, if you create a new version (checkin + checkout) > > >then read the version history the "jcr:sucessors" property is not= updated. > > >Note that "jcr:predecessors" is updated properly. > > > > > > From what I understand, since the changes are commited immedialy for > > > checkin (8.2.5), the read should reflect the current status. > > > > > >Here's an example to show the situation: > > > > > > > > >package net.sf.archimede; > > > > > >import javax.jcr.Node; > > >import javax.jcr.NodeIterator; > > >import javax.jcr.Property; > > >import javax.jcr.PropertyIterator; > > >import javax.jcr.Repository; > > >import javax.jcr.RepositoryException; > > >import javax.jcr.Session; > > >import javax.jcr.SimpleCredentials; > > >import javax.jcr.Value; > > >import javax.jcr.version.Version; > > >import javax.jcr.version.VersionIterator; > > >import javax.transaction.UserTransaction; > > > > > >//Found in /src/test/ > > >import org.apache.jackrabbit.core.UserTransactionImpl; > > > > > >import org.apache.jackrabbit.core.TransientRepository; > > > > > >public class VersioningTest { > > > > > > public static void main(String[] args) throws Exception { > > > //RepositoryConfig config =3D RepositoryConfig.create(new > > > FileInputStream(new File("C:/tmp/repository.xml")),= "C:/tmp/repository"); > > > Repository repository =3D new > > > TransientRepository();//RepositoryImpl.create(config); > > > Session session =3D repository.login( > > > new SimpleCredentials("username",=20 > "password".toCharArray())); > > > try { > > > > > > UserTransaction tx =3D new UserTransactionImpl(session); > > > tx.begin(); > > > Node rootNode =3D session.getRootNode(); > > > Node test =3D rootNode.addNode("test"); > > > test.addMixin("mix:versionable"); > > > session.save(); > > > > > > //Create a version > > > test.checkin(); > > > test.checkout(); > > > > > > test.checkin(); > > > test.checkout(); > > > > > > //Create another > > > test.checkin(); > > > test.checkout(); > > > > > > //Read versions > > > for (VersionIterator vi =3D > > > test.getVersionHistory().getAllVersions(); vi.hasNext(); ) { > > > Version version =3D vi.nextVersion(); > > > System.out.println(); > > > print(version); > > > } > > > > > > //Read versions from another session > > > Session session2 =3D repository.login(); > > > Node test2 =3D session2.getRootNode().getNode("test"); > > > for (VersionIterator vi =3D > > > test2.getVersionHistory().getAllVersions(); vi.hasNext(); ) { > > > Version version =3D vi.nextVersion(); > > > System.out.println(); > > > print(version); > > > } > > > > > > //Commit transaction > > > tx.commit(); > > > > > > //Read versions after transaction > > > for (VersionIterator vi =3D > > > test.getVersionHistory().getAllVersions(); vi.hasNext(); ) { > > > Version version =3D vi.nextVersion(); > > > System.out.println(); > > > print(version); > > > } > > > > > > } finally { > > > session.logout(); > > > } > > > } > > > > > > public static void print(Node node) throws RepositoryException { > > > System.out.println("Printing content of node: " +=20 > node.getName()); > > > System.out.println(" Properties:"); > > > for (PropertyIterator pi =3D node.getProperties();= pi.hasNext();) { > > > Property p =3D pi.nextProperty(); > > > if (p.getDefinition().isMultiple()) { > > > Value[] values =3D p.getValues(); > > > for (int i =3D 0; i < values.length; i++) { > > > System.out.println(" - " + p.getName() + ": " + > > > values[i].getString()); > > > } > > > } else { > > > System.out.println(" - " + p.getName() + ": " + > > > p.getValue().getString()); > > > } > > > } > > > System.out.println(" Child nodes:"); > > > for (NodeIterator ni =3D node.getNodes(); ni.hasNext();) { > > > Node n =3D ni.nextNode(); > > > System.out.println(" - " + n.getName()); > > > } > > > } > > > > > >} > > > > > >Regards, > > > > > >Nicolas > > > > > > >-- >-----------------------------------------< tobias.bocanegra@day.com >--- >Tobias Bocanegra, Day Management AG, Barfuesserplatz 6, CH - 4001 Basel >T +41 61 226 98 98, F +41 61 226 98 97 >-----------------------------------------------< http://www.day.com >---