jsedding commented on code in PR #54:
URL: 
https://github.com/apache/sling-org-apache-sling-jcr-repoinit/pull/54#discussion_r1616872388


##########
src/main/java/org/apache/sling/jcr/repoinit/impl/JcrRepoInitOpsProcessorImpl.java:
##########
@@ -38,28 +44,70 @@
         })
 public class JcrRepoInitOpsProcessorImpl implements JcrRepoInitOpsProcessor {
 
+    private static final Logger log = 
LoggerFactory.getLogger(JcrRepoInitOpsProcessorImpl.class);
+
     /**
      * Apply the supplied operations: first the namespaces and nodetypes
      * registrations, then the service users, paths and ACLs.
      */
     @Override
     public void apply(Session session, List<Operation> ops) {
-        Stream.of(
-                // register namespaces first
-                singleton(new NamespacesVisitor(session)),
-                // then create node types and privileges, both use namespaces
-                asList(
+        AtomicReference<Operation> lastAttemptedOperation = new 
AtomicReference<>();
+        try {
+            Stream.of(
+                    // register namespaces first
+                    singleton(new NamespacesVisitor(session)),
+                    // then create node types and privileges, both use 
namespaces
+                    asList(
+                            new NodetypesVisitor(session),
+                            new PrivilegeVisitor(session)),
+                    // finally apply everything else
+                    asList(
+                            new UserVisitor(session),
+                            new NodeVisitor(session),
+                            new AclVisitor(session),
+                            new GroupMembershipVisitor(session),
+                            new NodePropertiesVisitor(session))
+            ).forEach(visitorGroup -> {
+                ops.forEach(op -> {
+                    lastAttemptedOperation.set(op);
+                    visitorGroup.forEach(op::accept);
+                });
+            });
+        } catch (RepoInitException originalFailure) {
+            // support legacy statement reordering for backwards compatibility
+            try {

Review Comment:
   Will do.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to