Author: sascharodekamp
Date: Tue Jun 14 15:00:50 2011 New Revision: 1135628 URL: http://svn.apache.org/viewvc?rev=1135628&view=rev Log: Update - Improve versioning checkout, it fails when it try to checko ut the root node. Modified: ofbiz/branches/jackrabbit20100709/applications/content/src/org/ofbiz/content/jcr/JackrabbitWorker.java ofbiz/branches/jackrabbit20100709/applications/content/src/org/ofbiz/content/jcr/orm/OfbizRepositoryMappingJackrabbit.java ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/jackrabbit/JCRFactoryImpl.java Modified: ofbiz/branches/jackrabbit20100709/applications/content/src/org/ofbiz/content/jcr/JackrabbitWorker.java URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/applications/content/src/org/ofbiz/content/jcr/JackrabbitWorker.java?rev=1135628&r1=1135627&r2=1135628&view=diff ============================================================================== --- ofbiz/branches/jackrabbit20100709/applications/content/src/org/ofbiz/content/jcr/JackrabbitWorker.java (original) +++ ofbiz/branches/jackrabbit20100709/applications/content/src/org/ofbiz/content/jcr/JackrabbitWorker.java Tue Jun 14 15:00:50 2011 @@ -158,7 +158,9 @@ public class JackrabbitWorker { VersionManager vm = session.getWorkspace().getVersionManager(); for (Node node : nodesToCheckOut) { - vm.checkout(node.getPath()); + if (!"/".equals(node.getPath())) { + vm.checkout(node.getPath()); + } } } Modified: ofbiz/branches/jackrabbit20100709/applications/content/src/org/ofbiz/content/jcr/orm/OfbizRepositoryMappingJackrabbit.java URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/applications/content/src/org/ofbiz/content/jcr/orm/OfbizRepositoryMappingJackrabbit.java?rev=1135628&r1=1135627&r2=1135628&view=diff ============================================================================== --- ofbiz/branches/jackrabbit20100709/applications/content/src/org/ofbiz/content/jcr/orm/OfbizRepositoryMappingJackrabbit.java (original) +++ ofbiz/branches/jackrabbit20100709/applications/content/src/org/ofbiz/content/jcr/orm/OfbizRepositoryMappingJackrabbit.java Tue Jun 14 15:00:50 2011 @@ -65,6 +65,7 @@ public class OfbizRepositoryMappingJackr private Delegator delegator = null; private GenericValue content = null; + private String rootNodePath = "/"; // private GenericValue contentAssoc = null; private Session session = null; private Node node = null; @@ -692,7 +693,7 @@ public class OfbizRepositoryMappingJackr for (Node node : checkedOutNodeStore) { // add the new resource content to the version history - if (versionManager.isCheckedOut(node.getPath())) { + if (session.nodeExists(node.getPath()) && versionManager.isCheckedOut(node.getPath())) { versionManager.checkin(node.getPath()); } } @@ -706,8 +707,11 @@ public class OfbizRepositoryMappingJackr private void checkOutNode(Node node) { try { - versionManager.checkout(node.getPath()); - checkedOutNodeStore.add(node); + // make sure we don't checkout the root node, because it's not versionable + if (!rootNodePath.equals(node.getPath())) { + versionManager.checkout(node.getPath()); + checkedOutNodeStore.add(node); + } } catch (RepositoryException e) { Debug.logError(e, module); } Modified: ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/jackrabbit/JCRFactoryImpl.java URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/jackrabbit/JCRFactoryImpl.java?rev=1135628&r1=1135627&r2=1135628&view=diff ============================================================================== --- ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/jackrabbit/JCRFactoryImpl.java (original) +++ ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/jackrabbit/JCRFactoryImpl.java Tue Jun 14 15:00:50 2011 @@ -67,6 +67,7 @@ public class JCRFactoryImpl implements J */ @Override public void start() throws RepositoryException { + // Transient repositories closes automatically when the last session is closed repository = new TransientRepository(jackrabbitConfigFile, homeDir); createSession(); } |
Free forum by Nabble | Edit this page |