Add Jcr utilities.
authorMathieu Baudier <mbaudier@argeo.org>
Mon, 26 Oct 2020 09:41:51 +0000 (10:41 +0100)
committerMathieu Baudier <mbaudier@argeo.org>
Mon, 26 Oct 2020 09:41:51 +0000 (10:41 +0100)
org.argeo.jcr/src/org/argeo/jcr/Jcr.java

index 0f6059c7f36d09dee42d6c0f85feeb55d622512e..3ee235f62fd6c2afa02115d2545d7b86711b0a3e 100644 (file)
@@ -385,6 +385,15 @@ public class Jcr {
                }
        }
 
+       /** Retrieves the root node related to this session. */
+       public static Node getRootNode(Session session) {
+               try {
+                       return session.getRootNode();
+               } catch (RepositoryException e) {
+                       throw new IllegalStateException("Cannot get root node for " + session, e);
+               }
+       }
+
        /**
         * Saves the {@link Session} related to this node. Note that all other unrelated
         * modifications in this session will also be saved.