jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1407069 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeInitializer.java
Date Thu, 08 Nov 2012 13:24:08 GMT
Author: angela
Date: Thu Nov  8 13:24:08 2012
New Revision: 1407069

URL: http://svn.apache.org/viewvc?rev=1407069&view=rev
Log:
OAK-432 	: Repository does not restart with PrivilegeInitializer

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeInitializer.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeInitializer.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeInitializer.java?rev=1407069&r1=1407068&r2=1407069&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeInitializer.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeInitializer.java
Thu Nov  8 13:24:08 2012
@@ -20,7 +20,6 @@ import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
-
 import javax.jcr.RepositoryException;
 
 import org.apache.jackrabbit.JcrConstants;
@@ -66,23 +65,25 @@ class PrivilegeInitializer implements Re
         NodeBuilder system = root.child(JcrConstants.JCR_SYSTEM);
         system.setProperty(JcrConstants.JCR_PRIMARYTYPE, NodeTypeConstants.NT_REP_SYSTEM,
Type.NAME);
 
-        NodeBuilder privileges = system.child(REP_PRIVILEGES);
-        privileges.setProperty(JcrConstants.JCR_PRIMARYTYPE, NT_REP_PRIVILEGES, Type.NAME);
-
-        try {
-            branch.setRoot(root.getNodeState());
-            branch.merge();
-        } catch (CommitFailedException e) {
-            log.error("Failed to initialize privilege content ", e);
-            throw new RuntimeException(e);
-        }
-
-        PrivilegeDefinitionWriter writer = new PrivilegeDefinitionWriter(new RootImpl(store));
-        try {
-            writer.writeDefinitions(getBuiltInDefinitions());
-        } catch (RepositoryException e) {
-            log.error("Failed to register built-in privileges", e);
-            throw new RuntimeException(e);
+        if (!system.hasChildNode(REP_PRIVILEGES)) {
+            NodeBuilder privileges = system.child(REP_PRIVILEGES);
+            privileges.setProperty(JcrConstants.JCR_PRIMARYTYPE, NT_REP_PRIVILEGES, Type.NAME);
+
+            try {
+                branch.setRoot(root.getNodeState());
+                branch.merge();
+            } catch (CommitFailedException e) {
+                log.error("Failed to initialize privilege content ", e);
+                throw new RuntimeException(e);
+            }
+
+            PrivilegeDefinitionWriter writer = new PrivilegeDefinitionWriter(new RootImpl(store));
+            try {
+                writer.writeDefinitions(getBuiltInDefinitions());
+            } catch (RepositoryException e) {
+                log.error("Failed to register built-in privileges", e);
+                throw new RuntimeException(e);
+            }
         }
     }
 



Mime
View raw message