You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 09:48:43 UTC

[sling-org-apache-sling-jcr-repoinit] annotated tag org.apache.sling.jcr.repoinit-1.0.0 created (now 7287fc9)

This is an automated email from the ASF dual-hosted git repository.

rombert pushed a change to annotated tag org.apache.sling.jcr.repoinit-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git.


      at 7287fc9  (tag)
 tagging 2752ce1f055134973756c4ab4163a6410b7b715d (commit)
      by Bertrand Delacretaz
      on Wed Jul 6 09:09:32 2016 +0000

- Log -----------------------------------------------------------------
org.apache.sling.jcr.repoinit-1.0.0
-----------------------------------------------------------------------

This annotated tag includes the following new commits:

     new ae75f44  SLING-5355 - jcr module added, work in progress
     new eabeb26  SLING-5355 - rename jcr to oak-jcr
     new 4b89959  SLING-5355 - test with multiple users
     new d20da33  SLING-5355 - factor our TestUtil
     new d7a5f83  SLING-5355 - AclOperationVisitor partially implemented, and webconsole plugin added
     new a52d167  SLING-5355 - cleanup tests
     new 909608b  SLING-5355 - better error reporting
     new de7c980  SLING-5355 - parser service
     new 1d0ac30  SLING-5355 - it's ok for service user to already exist
     new 1bc8999  SLING-5355 - AclSetupComponent, work in progress
     new 8791efe  SLING-5355 - fail if Principal not found
     new 32f8cf8  SLING-5355 - test ACL definitions in provisioning model
     new 15ca220  Switch to parent pom 26
     new 77ca4b9  SLING-5449 - rename the modules to 'jcrinit'
     new 462ba19  SLING-5449 - the name is 'repoinit' instead as the parser is not JCR-specific
     new 6bc3f85  SLING-5449 - the name is 'repoinit' instead as the parser is not JCR-specific
     new 8296d7d  SLING-5449 - rename packages to repoinit
     new 22a05d6  SLING-5449 - remove AclSetup component and adapt integration tests
     new 7790424  SLING-5449 - rename the remaining things from ACL to 'repoinit'
     new 8a6aec6  SLING-5449 - rename one more thing from ACL to 'repoinit'
     new 9bd6e4b  SLING-5449 - remove console plugin, we don't want this module to be Sling specific
     new 2752857  SLING-5449 - move repoinit under commons
     new f8873b8  repoinit: fix SCM urls after move
     new 5e4f40b  repoinit/oak-jcr: second attempt to fix the scm urls
     new 70c5d7b  SLING-5449 - initial base tree creation language, see test-20.txt for examples
     new 7af1acb  SLING-5449 - Implement CreatePath in oak-jcr module
     new 5938771  SLING-5449 - move the repoinit modules under extensions, they do contain Sling-specific stuff
     new e5e302e  SLING-5449 - fix scm strings
     new e87acee  SLING-5355 - RepositoryInitializer created, reads from provisioning model, WIP:ProvisioningModelIT fails for now
     new 4fc1e21  SLING-5355 - ProvisioningModelIT passes
     new 029bbe3  SLING-5800 - remove unnecessary snapshots and use current jcr.api snapshot
     new 7b78070  SLING-5800 - depend on related releases while releasing this module
     new 3663d69  [maven-release-plugin] prepare release org.apache.sling.repoinit.oak-jcr-1.0.0
     new 60f5b7b  [maven-release-plugin] prepare for next development iteration
     new 7dff12f  SLING-5800 - back to current snapshots after releases
     new 713d36f  Rename o.a.s.repoinit.oak-jcr to o.a.s.jcr.repoinit
     new 1a15e86  SLING-5819 - jcr.repoinit bundle should only export what's strictly needed
     new 4273f56  Remove unused source files and folders
     new 92c4254  SLING-5819 - rename repoinit.jcr package to jcr.repoinit
     new 533713a  Remove unused source code folders
     new 014d655  Prepare for release
     new bb14f7d  [maven-release-plugin] prepare release org.apache.sling.jcr.repoinit-1.0.0
     new 2752ce1  [maven-release-plugin] copy for tag org.apache.sling.jcr.repoinit-1.0.0

The 43 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


-- 
To stop receiving notification emails like this one, please contact
['"commits@sling.apache.org" <co...@sling.apache.org>'].

[sling-org-apache-sling-jcr-repoinit] 13/43: Switch to parent pom 26

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.jcr.repoinit-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git

commit 15ca220e6e830ddcf6375531ad0a0f3c151ce227
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Sun Jan 3 14:07:46 2016 +0000

    Switch to parent pom 26
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/acldef/oak-jcr@1722720 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index 70a623c..b9267c7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
   <parent>
     <groupId>org.apache.sling</groupId>
     <artifactId>sling</artifactId>
-    <version>25</version>
+    <version>26</version>
     <relativePath/>
   </parent>
 

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-repoinit] 14/43: SLING-5449 - rename the modules to 'jcrinit'

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.jcr.repoinit-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git

commit 77ca4b9e002af9951c796b39248e0dda29cdc225
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Fri Jan 22 15:33:26 2016 +0000

    SLING-5449 - rename the modules to 'jcrinit'
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/jcrinit/oak-jcr@1726235 13f79535-47bb-0310-9956-ffa450edef68

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-repoinit] 24/43: repoinit/oak-jcr: second attempt to fix the scm urls

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.jcr.repoinit-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git

commit 5e4f40bc521586c294abfeb294a298173a0fa05d
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Tue Feb 2 08:04:20 2016 +0000

    repoinit/oak-jcr: second attempt to fix the scm urls
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/commons/repoinit/oak-jcr@1728049 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/pom.xml b/pom.xml
index d5aa694..e093443 100644
--- a/pom.xml
+++ b/pom.xml
@@ -41,9 +41,9 @@
   </properties>
 
   <scm>
-    <connection>scm:svn: https://svn.apache.org/repos/asf/sling/trunk/bundles/commons/repoinit/oak-jcr</connection>
-    <developerConnection>scm:svn: https://svn.apache.org/repos/asf/sling/trunk/bundles/commons/repoinit/oak-jcr</developerConnection>
-    <url> https://svn.apache.org/repos/asf/sling/trunk/bundles/commons/repoinit/oak-jcr</url>
+    <connection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/commons/repoinit/oak-jcr</connection>
+    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/commons/repoinit/oak-jcr</developerConnection>
+    <url>https://svn.apache.org/repos/asf/sling/trunk/bundles/commons/repoinit/oak-jcr</url>
   </scm>
   
   <build>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-repoinit] 35/43: SLING-5800 - back to current snapshots after releases

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.jcr.repoinit-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git

commit 7dff12f083058a48f9f2f211a298182e1c639c48
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Tue Jun 21 14:50:54 2016 +0000

    SLING-5800 - back to current snapshots after releases
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/repoinit/oak-jcr@1749545 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pom.xml b/pom.xml
index 8cc55a2..f9c1a74 100644
--- a/pom.xml
+++ b/pom.xml
@@ -103,13 +103,13 @@
      <dependency>
       <groupId>org.apache.sling</groupId>
       <artifactId>org.apache.sling.repoinit.parser</artifactId>
-      <version>1.0.0</version>
+      <version>1.0.1-SNAPSHOT</version>
       <scope>provided</scope>
     </dependency>
     <dependency>
       <groupId>org.apache.sling</groupId>
       <artifactId>org.apache.sling.jcr.api</artifactId>
-      <version>2.4.0</version>
+      <version>2.4.1-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.apache.sling</groupId>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-repoinit] 29/43: SLING-5355 - RepositoryInitializer created, reads from provisioning model, WIP:ProvisioningModelIT fails for now

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.jcr.repoinit-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git

commit e87acee7901b5ee807c54203a8830e7ebb9c0dfe
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Thu May 19 15:14:49 2016 +0000

    SLING-5355 - RepositoryInitializer created, reads from provisioning model, WIP:ProvisioningModelIT fails for now
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/repoinit/oak-jcr@1744594 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                            |  26 +++-
 .../sling/repoinit/jcr/RepositoryInitializer.java  | 161 +++++++++++++++++++++
 2 files changed, 186 insertions(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index a469558..dfc5d61 100644
--- a/pom.xml
+++ b/pom.xml
@@ -62,6 +62,14 @@
   
   <dependencies>
     <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>org.osgi.core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>org.osgi.compendium</artifactId>
+    </dependency>
+    <dependency>
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-api</artifactId>
     </dependency>
@@ -99,6 +107,23 @@
 	  <scope>provided</scope>
     </dependency>
     <dependency>
+      <groupId>org.apache.sling</groupId>
+      <artifactId>org.apache.sling.jcr.api</artifactId>
+      <version>2.3.1-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.sling</groupId>
+      <artifactId>org.apache.sling.provisioning.model</artifactId>
+      <version>1.4.2</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.sling</groupId>
+      <artifactId>org.apache.sling.commons.osgi</artifactId>
+      <version>2.2.0</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
     </dependency>
@@ -106,7 +131,6 @@
       <groupId>commons-io</groupId>
       <artifactId>commons-io</artifactId>
       <version>2.4</version>
-      <scope>test</scope>
     </dependency>
     <dependency>
       <groupId>org.apache.sling</groupId>
diff --git a/src/main/java/org/apache/sling/repoinit/jcr/RepositoryInitializer.java b/src/main/java/org/apache/sling/repoinit/jcr/RepositoryInitializer.java
new file mode 100644
index 0000000..3f4f288
--- /dev/null
+++ b/src/main/java/org/apache/sling/repoinit/jcr/RepositoryInitializer.java
@@ -0,0 +1,161 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sling.repoinit.jcr;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.Map;
+
+import javax.jcr.Session;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Properties;
+import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.Service;
+import org.apache.sling.commons.osgi.PropertiesUtil;
+import org.apache.sling.jcr.api.SlingRepository;
+import org.apache.sling.jcr.api.SlingRepositoryInitializer;
+import org.apache.sling.provisioning.model.Feature;
+import org.apache.sling.provisioning.model.Model;
+import org.apache.sling.provisioning.model.Section;
+import org.apache.sling.provisioning.model.io.ModelReader;
+import org.apache.sling.repoinit.parser.RepoInitParser;
+import org.apache.sling.repoinit.parser.operations.Operation;
+import org.osgi.framework.Constants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/** SlingRepositoryInitializer that executes repoinit statements read
+ *  from a configurable URL.
+ */
+@Component
+@Service(SlingRepositoryInitializer.class)
+@Properties({
+    // SlingRepositoryInitializers are executed in ascending
+    // order of their service ranking
+    @Property(name=Constants.SERVICE_RANKING, intValue=100)
+})
+public class RepositoryInitializer implements SlingRepositoryInitializer {
+    private final Logger log = LoggerFactory.getLogger(getClass());
+
+    public static final String DEFAULT_TEXT_URL = "context:/resources/provisioning/model.txt";
+    
+    @Property(
+            label="Text URL", 
+            description="URL of the source text that provides repoinit statements."
+                + " That text is processed according to the model section name parameter.", 
+            value=DEFAULT_TEXT_URL)
+    public static final String PROP_TEXT_URL = "text.url";
+    private String textURL;
+    
+    public static final String DEFAULT_MODEL_SECTION_NAME = ":repoinit";
+    
+    @Property(
+            label="Model section name", 
+            description=
+                "Optional provisioning model section name to used to extract repoinit statements"
+                + " from the raw text provided by our text URL. Leave empty to consider the content"
+                + " provided by that URL to already be in repoinit format", 
+            value=DEFAULT_MODEL_SECTION_NAME)
+    public static final String PROP_MODEL_SECTION_NAME = "model.section.name";
+    private String modelSectionName;
+    
+    @Reference
+    private RepoInitParser parser;
+    
+    @Activate
+    public void activate(Map<String, Object> config) {
+        textURL = PropertiesUtil.toString(config.get(PROP_TEXT_URL), DEFAULT_TEXT_URL);
+        modelSectionName = PropertiesUtil.toString(config.get(PROP_MODEL_SECTION_NAME), DEFAULT_MODEL_SECTION_NAME);
+    }
+    
+    @Override
+    public void processRepository(SlingRepository repo) throws Exception {
+        final String repoinit = getRepoInitText();
+        int count=0;
+        
+        // loginAdministrative is ok here, definitely an admin operation
+        final Session s = repo.loginAdministrative(null);
+        final JcrRepoInitOpVisitor v = new JcrRepoInitOpVisitor(s);
+        try {
+            for(Operation op : parser.parse(new StringReader(repoinit))) {
+                count++;
+                log.info("Executing {}", op);
+                op.accept(v);
+            }
+            log.info("{} repoinit operations executed", count);
+        } finally {
+            s.logout();
+        }
+    }
+    
+    /** Get the repoinit statements to execute */
+    private String getRawRepoInitText() {
+        String result = "";
+        try {
+            final URL url = new URL(textURL);
+            final URLConnection c = url.openConnection();
+            final InputStream is = c.getInputStream();
+            if(is == null) {
+                log.warn("Cannot get InputStream for {}", url);
+            } else {
+                final StringWriter w = new StringWriter();
+                IOUtils.copy(is, w, "UTF-8");
+            }
+        } catch(Exception e) {
+            log.warn("Error reading repoinit statements from " + textURL, e);
+        }
+        return result;
+    }
+    
+    private String getRepoInitText() {
+        final boolean parseRawText = modelSectionName.trim().length() > 0;
+        if(parseRawText) {
+            log.info("Reading repoinit statements from {}", textURL);
+        } else {
+            log.info("Extracting repoinit statements from section {} of provisioning model {}", modelSectionName, textURL);
+        }
+        String result = getRawRepoInitText();
+        log.debug("Raw text from {}: \n{}", textURL, result);
+        if(parseRawText) {
+            final StringReader r = new StringReader(result);
+            try {
+                final Model m = ModelReader.read(r, textURL);
+                final StringBuilder b = new StringBuilder();
+                for(Feature f : m.getFeatures()) {
+                    for(Section s : f.getAdditionalSections(modelSectionName)) {
+                        b.append("# ").append(modelSectionName).append(" from ").append(f.getName()).append("\n");
+                        b.append("# ").append(s.getComment()).append("\n");
+                        b.append(s.getContents()).append("\n");
+                    }
+                }
+                result = b.toString();
+            } catch (IOException e) {
+                result = "";
+                log.warn("Error parsing provisioning model from " + textURL, e);
+            }
+        }
+        return result;
+    }
+}
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-repoinit] 01/43: SLING-5355 - jcr module added, work in progress

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.jcr.repoinit-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git

commit ae75f44616810c7f99022b83fbf2962746ace708
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Mon Dec 21 09:49:23 2015 +0000

    SLING-5355 - jcr module added, work in progress
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/acldef/jcr@1721113 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                            | 128 +++++++++++++++++++++
 .../sling/acldef/jcr/AclOperationVisitor.java      |  82 +++++++++++++
 .../apache/sling/acldef/jcr/ServiceUserUtil.java   |  48 ++++++++
 .../sling/acldef/jcr/CreateServiceUsersTest.java   | 103 +++++++++++++++++
 4 files changed, 361 insertions(+)

diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..8845101
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.sling</groupId>
+    <artifactId>sling</artifactId>
+    <version>25</version>
+    <relativePath/>
+  </parent>
+
+  <artifactId>org.apache.sling.acldef.jcr</artifactId>
+  <packaging>bundle</packaging>
+  <version>0.0.1-SNAPSHOT</version>
+  <name>Apache Sling ACL Definitions JCR module</name>
+  <description>
+	  Applies ACLs to a JCR repository based on the output
+	  of the ACL Definition Language parser.
+  </description>
+
+  <scm>
+    <connection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/acldef-jcr</connection>
+    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/acldef-jcr</developerConnection>
+    <url>https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/acldef-jcr</url>
+  </scm>
+  
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-scr-plugin</artifactId>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <extensions>true</extensions>
+      </plugin>
+    </plugins>
+  </build>
+  
+  <dependencies>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-simple</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>javax.jcr</groupId>
+      <artifactId>jcr</artifactId>
+	  <version>2.0</version>
+	  <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.jackrabbit</groupId>
+      <artifactId>jackrabbit-api</artifactId>
+      <version>2.11.3</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.jackrabbit</groupId>
+      <artifactId>jackrabbit-jcr-commons</artifactId>
+      <version>2.2.9</version>
+      <scope>provided</scope>
+    </dependency>
+     <dependency>
+      <groupId>org.apache.sling</groupId>
+      <artifactId>org.apache.sling.acldef.parser</artifactId>
+	  <version>0.0.1-SNAPSHOT</version>
+	  <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>commons-io</groupId>
+      <artifactId>commons-io</artifactId>
+      <version>2.4</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.sling</groupId>
+      <artifactId>org.apache.sling.testing.osgi-mock</artifactId>
+      <version>1.6.0</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.sling</groupId>
+      <artifactId>org.apache.sling.testing.jcr-mock</artifactId>
+      <version>1.1.10</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.sling</groupId>
+      <artifactId>org.apache.sling.testing.sling-mock</artifactId>
+      <version>1.6.0</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.sling</groupId>
+      <artifactId>org.apache.sling.testing.sling-mock-oak</artifactId>
+      <version>1.0.1-SNAPSHOT</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+</project>
diff --git a/src/main/java/org/apache/sling/acldef/jcr/AclOperationVisitor.java b/src/main/java/org/apache/sling/acldef/jcr/AclOperationVisitor.java
new file mode 100644
index 0000000..48ff05e
--- /dev/null
+++ b/src/main/java/org/apache/sling/acldef/jcr/AclOperationVisitor.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sling.acldef.jcr;
+
+import javax.jcr.Session;
+
+import org.apache.sling.acldef.parser.operations.CreateServiceUser;
+import org.apache.sling.acldef.parser.operations.DeleteServiceUser;
+import org.apache.sling.acldef.parser.operations.OperationVisitor;
+import org.apache.sling.acldef.parser.operations.SetAclPaths;
+import org.apache.sling.acldef.parser.operations.SetAclPrincipals;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/** Processes the Operations produced by the ACL
+ *  definitions parser to create the users and
+ *  set the ACLs defined by the parser input.
+ */
+public class AclOperationVisitor implements OperationVisitor {
+
+    private final Logger log = LoggerFactory.getLogger(getClass());
+    
+    private Session session;
+    
+    /** Create a visitor using the supplied JCR Session.
+     * @param s must have sufficient rights to create users
+     *      and set ACLs.
+     */
+    public AclOperationVisitor(Session s) {
+        session = s;
+    }
+    
+    private void report(Exception e, String message) {
+        throw new RuntimeException(message, e);
+    }
+    
+    @Override
+    public void visitCreateServiceUser(CreateServiceUser s) {
+        final String id = s.getUsername();
+        log.info("Creating service user {}", id);
+        try {
+            ServiceUserUtil.createServiceUser(session, id);
+        } catch(Exception e) {
+            report(e, "Unable to create service user [" + id + "]:" + e);
+        }
+    }
+
+    @Override
+    public void visitDeleteServiceUser(DeleteServiceUser s) {
+        final String id = s.getUsername();
+        log.info("Deleting service user {}", id);
+        try {
+            ServiceUserUtil.deleteServiceUser(session, id);
+        } catch(Exception e) {
+            report(e, "Unable to delete service user [" + id + "]:" + e);
+        }
+    }
+
+    @Override
+    public void visitSetAclPrincipal(SetAclPrincipals s) {
+        log.warn("TODO - set ACL for Principals");
+    }
+
+    @Override
+    public void visitSetAclPaths(SetAclPaths s) {
+        log.warn("TODO - set ACL for Paths");
+    }
+}
diff --git a/src/main/java/org/apache/sling/acldef/jcr/ServiceUserUtil.java b/src/main/java/org/apache/sling/acldef/jcr/ServiceUserUtil.java
new file mode 100644
index 0000000..265c7df
--- /dev/null
+++ b/src/main/java/org/apache/sling/acldef/jcr/ServiceUserUtil.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sling.acldef.jcr;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+
+import org.apache.jackrabbit.api.JackrabbitSession;
+import org.apache.jackrabbit.api.security.user.Authorizable;
+import org.apache.jackrabbit.api.security.user.UserManager;
+
+/** Utilities for Service Users management */
+public class ServiceUserUtil {
+
+    public static UserManager getUserManager(Session session) throws RepositoryException {
+        if(!(session instanceof JackrabbitSession)) {
+            throw new IllegalArgumentException("Session is not a JackrabbitSession");
+        }
+        return ((JackrabbitSession)session).getUserManager();
+    }
+    
+    public static void createServiceUser(Session s, String username) throws RepositoryException {
+        getUserManager(s).createSystemUser(username, null);
+    }
+    
+    public static void deleteServiceUser(Session s, String username) throws RepositoryException {
+        final Authorizable a = getUserManager(s).getAuthorizable(username);
+        if(a == null) {
+            throw new IllegalStateException("Authorizable not found:" + username);
+        }
+        a.remove();
+    }
+    
+}
diff --git a/src/test/java/org/apache/sling/acldef/jcr/CreateServiceUsersTest.java b/src/test/java/org/apache/sling/acldef/jcr/CreateServiceUsersTest.java
new file mode 100644
index 0000000..46a7334
--- /dev/null
+++ b/src/test/java/org/apache/sling/acldef/jcr/CreateServiceUsersTest.java
@@ -0,0 +1,103 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sling.acldef.jcr;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+import java.io.Reader;
+import java.io.StringReader;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicLong;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.jackrabbit.api.security.user.Authorizable;
+import org.apache.jackrabbit.api.security.user.User;
+import org.apache.jackrabbit.api.security.user.UserManager;
+import org.apache.sling.acldef.parser.ACLDefinitions;
+import org.apache.sling.acldef.parser.ParseException;
+import org.apache.sling.acldef.parser.operations.Operation;
+import org.apache.sling.testing.mock.sling.ResourceResolverType;
+import org.apache.sling.testing.mock.sling.junit.SlingContext;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+/** Test the creation and delete of service users */
+public class CreateServiceUsersTest {
+    
+    @Rule
+    public final SlingContext context = new SlingContext(ResourceResolverType.JCR_OAK);
+    
+    private Session session;
+    private UserManager userManager;
+    private AtomicLong counter = new AtomicLong(System.currentTimeMillis());
+    private long id; 
+    
+    private List<Operation> parse(String input) throws ParseException {
+        final Reader r = new StringReader(input);
+        try {
+            return new ACLDefinitions(r).parse();
+        } finally {
+            IOUtils.closeQuietly(r);
+        }
+    }
+
+    @Before
+    public void setup() throws RepositoryException {
+        session = context.resourceResolver().adaptTo(Session.class);
+        userManager = ServiceUserUtil.getUserManager(session);
+        id = counter.incrementAndGet();
+    }
+
+    @After
+    public void cleanup() {
+        session.logout();
+    }
+    
+    private void assertServiceUser(String info, String id, boolean expectToExist) throws RepositoryException {
+        final Authorizable a = userManager.getAuthorizable(id);
+        if(!expectToExist) {
+            assertNull(info + ", expecting Principal to be absent:" + id, a);
+        } else {
+            assertNotNull(info + ", expecting Principal to exist:" + id, a);
+            final User u = (User)a;
+            assertNotNull(info + ", expecting Principal to be a System user:" + id, u.isSystemUser());
+        }
+    }
+    
+    private void exec(String input) throws ParseException {
+        final AclOperationVisitor v = new AclOperationVisitor(session);
+        for(Operation o : parse(input)) {
+            o.accept(v);
+        }
+    }
+
+    @Test
+    public void createDeleteTest() throws Exception {
+        final String userId = "bob_" + id;
+        assertServiceUser("at start of test", userId, false);
+        exec("create service user " + userId);
+        assertServiceUser("affter creating user", userId, true);
+        exec("delete service user " + userId);
+        assertServiceUser("after deleting user", userId, false);
+    }
+}

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-repoinit] 26/43: SLING-5449 - Implement CreatePath in oak-jcr module

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.jcr.repoinit-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git

commit 7af1acb9c89e2197abb7a146675663666945fc0c
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Tue May 17 15:35:15 2016 +0000

    SLING-5449 - Implement CreatePath in oak-jcr module
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/commons/repoinit/oak-jcr@1744286 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                            |  6 ++
 .../sling/repoinit/jcr/JcrRepoInitOpVisitor.java   | 23 ++++++-
 .../apache/sling/repoinit/jcr/CreatePathsTest.java | 77 ++++++++++++++++++++++
 .../org/apache/sling/repoinit/jcr/TestUtil.java    | 23 +++++++
 4 files changed, 128 insertions(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index e093443..90ce530 100644
--- a/pom.xml
+++ b/pom.xml
@@ -132,5 +132,11 @@
       <version>1.0.1-SNAPSHOT</version>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.sling</groupId>
+      <artifactId>org.apache.sling.commons.testing</artifactId>
+      <version>2.0.18</version>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 </project>
diff --git a/src/main/java/org/apache/sling/repoinit/jcr/JcrRepoInitOpVisitor.java b/src/main/java/org/apache/sling/repoinit/jcr/JcrRepoInitOpVisitor.java
index 1b991af..e3680bb 100644
--- a/src/main/java/org/apache/sling/repoinit/jcr/JcrRepoInitOpVisitor.java
+++ b/src/main/java/org/apache/sling/repoinit/jcr/JcrRepoInitOpVisitor.java
@@ -22,6 +22,7 @@ import static org.apache.sling.repoinit.parser.operations.AclLine.PROP_PRIVILEGE
 
 import java.util.List;
 
+import javax.jcr.Node;
 import javax.jcr.Session;
 
 import org.apache.sling.repoinit.jcr.impl.AclUtil;
@@ -31,6 +32,7 @@ import org.apache.sling.repoinit.parser.operations.CreatePath;
 import org.apache.sling.repoinit.parser.operations.CreateServiceUser;
 import org.apache.sling.repoinit.parser.operations.DeleteServiceUser;
 import org.apache.sling.repoinit.parser.operations.OperationVisitor;
+import org.apache.sling.repoinit.parser.operations.PathSegmentDefinition;
 import org.apache.sling.repoinit.parser.operations.SetAclPaths;
 import org.apache.sling.repoinit.parser.operations.SetAclPrincipals;
 import org.slf4j.Logger;
@@ -117,6 +119,25 @@ public class JcrRepoInitOpVisitor implements OperationVisitor {
 
     @Override
     public void visitCreatePath(CreatePath cp) {
-        throw new UnsupportedOperationException("visitCreatePath is not implemented yet");
+        String parentPath = "";
+            for(PathSegmentDefinition psd : cp.getDefinitions()) {
+                final String fullPath = parentPath + "/" + psd.getSegment();
+                try {
+                    if(session.itemExists(fullPath)) {
+                        // TODO warn if primary type is not correct 
+                    } else {
+                        final Node n = parentPath.equals("") ? session.getRootNode() : session.getNode(parentPath);
+                        n.addNode(psd.getSegment(), psd.getPrimaryType());
+                    }
+                } catch(Exception e) {
+                    throw new RuntimeException("CreatePath execution failed at " + psd + ": " + e, e);
+                }
+                parentPath += "/" + psd.getSegment();
+            }
+        try {
+            session.save();
+        } catch(Exception e) {
+            throw new RuntimeException("Session.save failed: "+ e, e);
+        }
     }
 }
diff --git a/src/test/java/org/apache/sling/repoinit/jcr/CreatePathsTest.java b/src/test/java/org/apache/sling/repoinit/jcr/CreatePathsTest.java
new file mode 100644
index 0000000..faf5cf2
--- /dev/null
+++ b/src/test/java/org/apache/sling/repoinit/jcr/CreatePathsTest.java
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sling.repoinit.jcr;
+
+import java.io.IOException;
+
+import javax.jcr.RepositoryException;
+
+import org.apache.sling.commons.testing.jcr.RepositoryUtil;
+import org.apache.sling.testing.mock.sling.ResourceResolverType;
+import org.apache.sling.testing.mock.sling.junit.SlingContext;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+/** Test the creation of paths with specific node types */
+public class CreatePathsTest {
+    
+    @Rule
+    public final SlingContext context = new SlingContext(ResourceResolverType.JCR_OAK);
+    
+    private TestUtil U;
+    
+    @Before
+    public void setup() throws RepositoryException, IOException {
+        U = new TestUtil(context);
+        RepositoryUtil.registerSlingNodeTypes(U.adminSession);
+    }
+
+    @Test
+    public void createSimplePath() throws Exception {
+        final String path = "/one/two/three";
+        U.parseAndExecute("create path " + path);
+        U.assertNodeExists(path);
+    }
+    
+    @Test
+    public void createPathWithTypes() throws Exception {
+        final String path = "/four/five(sling:Folder)/six(nt:folder)";
+        U.parseAndExecute("create path " + path);
+        U.assertNodeExists("/four", "nt:unstructured");
+        U.assertNodeExists("/four/five", "sling:Folder");
+        U.assertNodeExists("/four/five/six", "nt:folder");
+    }
+    
+    @Test
+    public void createPathWithSpecificDefaultType() throws Exception {
+        final String path = "/seven/eight(nt:unstructured)/nine";
+        U.parseAndExecute("create path (sling:Folder) " + path);
+        U.assertNodeExists("/seven", "sling:Folder");
+        U.assertNodeExists("/seven/eight", "nt:unstructured");
+        U.assertNodeExists("/seven/eight/nine", "sling:Folder");
+    }
+    
+    @Test
+    public void createPathWithJcrDefaultType() throws Exception {
+        final String path = "/ten/eleven(sling:Folder)/twelve";
+        U.parseAndExecute("create path " + path);
+        U.assertNodeExists("/ten", "nt:unstructured");
+        U.assertNodeExists("/ten/eleven", "sling:Folder");
+        U.assertNodeExists("/ten/eleven/twelve", "sling:Folder");
+    }
+}
diff --git a/src/test/java/org/apache/sling/repoinit/jcr/TestUtil.java b/src/test/java/org/apache/sling/repoinit/jcr/TestUtil.java
index e1d2383..7d72df8 100644
--- a/src/test/java/org/apache/sling/repoinit/jcr/TestUtil.java
+++ b/src/test/java/org/apache/sling/repoinit/jcr/TestUtil.java
@@ -18,12 +18,14 @@ package org.apache.sling.repoinit.jcr;
 
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
 
 import java.io.Reader;
 import java.io.StringReader;
 import java.util.List;
 import java.util.UUID;
 
+import javax.jcr.Node;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 import javax.jcr.SimpleCredentials;
@@ -40,6 +42,7 @@ import org.apache.sling.testing.mock.sling.junit.SlingContext;
 /** Test utilities */
 class TestUtil {
     
+    public static final String JCR_PRIMARY_TYPE = "jcr:primaryType";
     final Session adminSession;
     final String id;
     final String username;
@@ -70,6 +73,26 @@ class TestUtil {
         }
     }
     
+    void assertNodeExists(String path) throws RepositoryException {
+        assertNodeExists(path, null);
+    }
+    
+    void assertNodeExists(String path, String primaryType) throws RepositoryException {
+        if(!adminSession.nodeExists(path)) {
+            fail("Node does not exist:" + path);
+        }
+        if(primaryType != null) {
+            final Node n = adminSession.getNode(path);
+            if(!n.hasProperty(JCR_PRIMARY_TYPE)) {
+                fail("No " + JCR_PRIMARY_TYPE + " property at " + path);
+            }
+            final String actual = n.getProperty(JCR_PRIMARY_TYPE).getString();
+            if(!primaryType.equals(actual)) {
+                fail("Primary type mismatch for " + path + ", expected " + primaryType + " but got " + actual);
+            }
+        }
+    }
+    
     void parseAndExecute(String input) throws RepositoryException, RepoInitParsingException {
         final JcrRepoInitOpVisitor v = new JcrRepoInitOpVisitor(adminSession);
         for(Operation o : parse(input)) {

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-repoinit] 40/43: Remove unused source code folders

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.jcr.repoinit-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git

commit 533713a3ffe6d74f402c831e697d1883673a7aa2
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Wed Jul 6 09:02:17 2016 +0000

    Remove unused source code folders
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/repoinit/jcr@1751630 13f79535-47bb-0310-9956-ffa450edef68

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-repoinit] 18/43: SLING-5449 - remove AclSetup component and adapt integration tests

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.jcr.repoinit-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git

commit 22a05d6f8e408d0e85a3b7d28871a378a33811ff
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Fri Jan 22 18:18:22 2016 +0000

    SLING-5449 - remove AclSetup component and adapt integration tests
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/repoinit/oak-jcr@1726268 13f79535-47bb-0310-9956-ffa450edef68
---
 .../sling/repoinit/jcr/AclOperationVisitor.java    |   2 +
 .../apache/sling/repoinit/jcr/impl/AclSetup.java   | 154 ---------------------
 .../sling/repoinit/jcr/{ => impl}/AclUtil.java     |   2 +-
 .../repoinit/jcr/{ => impl}/ServiceUserUtil.java   |   2 +-
 .../apache/sling/repoinit/jcr/package-info.java    |  21 +++
 .../org/apache/sling/repoinit/jcr/TestUtil.java    |   1 +
 6 files changed, 26 insertions(+), 156 deletions(-)

diff --git a/src/main/java/org/apache/sling/repoinit/jcr/AclOperationVisitor.java b/src/main/java/org/apache/sling/repoinit/jcr/AclOperationVisitor.java
index 6403e65..f206351 100644
--- a/src/main/java/org/apache/sling/repoinit/jcr/AclOperationVisitor.java
+++ b/src/main/java/org/apache/sling/repoinit/jcr/AclOperationVisitor.java
@@ -24,6 +24,8 @@ import java.util.List;
 
 import javax.jcr.Session;
 
+import org.apache.sling.repoinit.jcr.impl.AclUtil;
+import org.apache.sling.repoinit.jcr.impl.ServiceUserUtil;
 import org.apache.sling.repoinit.parser.operations.AclLine;
 import org.apache.sling.repoinit.parser.operations.CreateServiceUser;
 import org.apache.sling.repoinit.parser.operations.DeleteServiceUser;
diff --git a/src/main/java/org/apache/sling/repoinit/jcr/impl/AclSetup.java b/src/main/java/org/apache/sling/repoinit/jcr/impl/AclSetup.java
deleted file mode 100644
index 9bb2606..0000000
--- a/src/main/java/org/apache/sling/repoinit/jcr/impl/AclSetup.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sling.repoinit.jcr.impl;
-
-import java.io.StringReader;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import javax.jcr.Session;
-
-import org.apache.felix.scr.annotations.Activate;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.ConfigurationPolicy;
-import org.apache.felix.scr.annotations.Reference;
-import org.apache.sling.repoinit.jcr.AclOperationVisitor;
-import org.apache.sling.repoinit.parser.AclDefinitionsParser;
-import org.apache.sling.repoinit.parser.operations.Operation;
-import org.apache.sling.commons.threads.ThreadPool;
-import org.apache.sling.commons.threads.ThreadPoolManager;
-import org.apache.sling.jcr.api.SlingRepository;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import aQute.bnd.annotation.component.Deactivate;
-
-/** OSGi component that sets up service users and ACLS
- *  based on configurations created by the repoinit provisioning
- *  model processor.
- *  
- *  As Oak requires a path to exist before setting an ACL on it,
- *  this component needs to retry setting ACLs when that fails
- *  due to a non-existing path.
- */
-@Component(
-        configurationFactory=true,
-        metatype=false,
-        configurationPid=AclSetup.CONFIG_PID,
-        policy=ConfigurationPolicy.REQUIRE)
-public class AclSetup implements Runnable {
-    private final Logger log = LoggerFactory.getLogger(getClass());
-    public static final String CONFIG_PID = "org.apache.sling.repoinit.jcr.AclSetup";
-    public static final String ACLDEF_PROP_PREFIX = "repoinit.text.";
-    public static final String THREAD_POOL_NAME = "ACL Definitions";
-    
-    private List<String> todo; 
-    private ThreadPool threadPool;
-    private boolean running;
-    
-    @Reference
-    AclDefinitionsParser parser;
-    
-    @Reference
-    ThreadPoolManager threadPoolManager;
-    
-    @Reference
-    SlingRepository repository;
-    
-    @Activate
-    public void activate(Map<String, Object> config) {
-        todo  = new ArrayList<String>();
-        threadPool = threadPoolManager.get(THREAD_POOL_NAME);
-        
-        for(String key : config.keySet()) {
-            if(key.startsWith(ACLDEF_PROP_PREFIX)) {
-                final String value = (String)config.get(key);
-                todo.add(value);
-            }
-        }
-        if(todo.isEmpty()) {
-            log.error("No {} properties in configuration {}, nothing to do", ACLDEF_PROP_PREFIX, config);
-        } else {
-            log.info("Got {} ACL definitions to execute asynchronously", todo.size());
-            running = true;
-            threadPool.execute(this);
-        }
-    }
-    
-    @Deactivate
-    public void deactivate(Map<String, Object> config) {
-        synchronized (this) {
-            running = false;
-            threadPoolManager.release(threadPool);
-        }
-    }
-
-    private void sleep(int msec) {
-        try {
-            Thread.sleep(msec);
-        } catch(InterruptedException ignore) {
-        }
-    }
-    
-    @Override
-    public void run() {
-        log.info("Applying {} ACL definition snippets", todo.size());
-
-        List<String> newTodo = new ArrayList<String>();
-        Session s = null;
-        try {
-            s = repository.loginAdministrative(null);
-            final AclOperationVisitor visitor = new AclOperationVisitor(s);
-            for(String repoinit : todo) {
-                try {
-                    for(Operation op : parser.parse(new StringReader(repoinit))) {
-                        op.accept(visitor);
-                        s.save();
-                    }
-                } catch(Exception e) {
-                    log.warn("Exception while executing an ACL definition:" + e.toString(), e);
-                    newTodo.add(repoinit);
-                }
-            }
-        } catch(Exception e) {
-            log.warn("Exception while executing ACL definitions, will retry everything:" + e.toString(), e);
-            newTodo = todo;
-        } finally {
-            if(s != null) {
-                s.logout();
-            }
-        }
-        
-        // TODO schedule with exponential backoff?
-        if(!newTodo.isEmpty() && running) {
-            sleep(1000);
-        }
-        
-        synchronized (this) {
-            todo = newTodo;
-            if(todo.isEmpty()) {
-                log.info("All ACL definitions executed");
-            } else if(running) {
-                log.info("{} ACL definitions left to execute, will retry", todo.size());
-                threadPool.execute(this);
-            } else {
-                log.info("Some operations failed but not running anymore");
-            }
-        }
-    }
-}
diff --git a/src/main/java/org/apache/sling/repoinit/jcr/AclUtil.java b/src/main/java/org/apache/sling/repoinit/jcr/impl/AclUtil.java
similarity index 98%
rename from src/main/java/org/apache/sling/repoinit/jcr/AclUtil.java
rename to src/main/java/org/apache/sling/repoinit/jcr/impl/AclUtil.java
index 10a7967..efe3cf5 100644
--- a/src/main/java/org/apache/sling/repoinit/jcr/AclUtil.java
+++ b/src/main/java/org/apache/sling/repoinit/jcr/impl/AclUtil.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.sling.repoinit.jcr;
+package org.apache.sling.repoinit.jcr.impl;
 
 import java.security.Principal;
 import java.util.List;
diff --git a/src/main/java/org/apache/sling/repoinit/jcr/ServiceUserUtil.java b/src/main/java/org/apache/sling/repoinit/jcr/impl/ServiceUserUtil.java
similarity index 98%
rename from src/main/java/org/apache/sling/repoinit/jcr/ServiceUserUtil.java
rename to src/main/java/org/apache/sling/repoinit/jcr/impl/ServiceUserUtil.java
index 65fa155..5f33145 100644
--- a/src/main/java/org/apache/sling/repoinit/jcr/ServiceUserUtil.java
+++ b/src/main/java/org/apache/sling/repoinit/jcr/impl/ServiceUserUtil.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.sling.repoinit.jcr;
+package org.apache.sling.repoinit.jcr.impl;
 
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
diff --git a/src/main/java/org/apache/sling/repoinit/jcr/package-info.java b/src/main/java/org/apache/sling/repoinit/jcr/package-info.java
new file mode 100644
index 0000000..a2fd18a
--- /dev/null
+++ b/src/main/java/org/apache/sling/repoinit/jcr/package-info.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+
+@Version("1.0.0")
+package org.apache.sling.repoinit.jcr;
+
+import aQute.bnd.annotation.Version;
diff --git a/src/test/java/org/apache/sling/repoinit/jcr/TestUtil.java b/src/test/java/org/apache/sling/repoinit/jcr/TestUtil.java
index 612e699..5c68f3f 100644
--- a/src/test/java/org/apache/sling/repoinit/jcr/TestUtil.java
+++ b/src/test/java/org/apache/sling/repoinit/jcr/TestUtil.java
@@ -31,6 +31,7 @@ import javax.jcr.SimpleCredentials;
 import org.apache.commons.io.IOUtils;
 import org.apache.jackrabbit.api.security.user.Authorizable;
 import org.apache.jackrabbit.api.security.user.User;
+import org.apache.sling.repoinit.jcr.impl.ServiceUserUtil;
 import org.apache.sling.repoinit.parser.AclParsingException;
 import org.apache.sling.repoinit.parser.impl.ACLDefinitionsParserService;
 import org.apache.sling.repoinit.parser.operations.Operation;

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-repoinit] 43/43: [maven-release-plugin] copy for tag org.apache.sling.jcr.repoinit-1.0.0

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.jcr.repoinit-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git

commit 2752ce1f055134973756c4ab4163a6410b7b715d
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Wed Jul 6 09:09:32 2016 +0000

    [maven-release-plugin] copy for tag org.apache.sling.jcr.repoinit-1.0.0
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.jcr.repoinit-1.0.0@1751638 13f79535-47bb-0310-9956-ffa450edef68

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-repoinit] 38/43: Remove unused source files and folders

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.jcr.repoinit-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git

commit 4273f56540080698afe20b13993f9536dad3eb26
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Mon Jul 4 12:13:54 2016 +0000

    Remove unused source files and folders
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/repoinit/jcr@1751258 13f79535-47bb-0310-9956-ffa450edef68
---
 src/main/resources/ui/acldef.css | 20 --------------------
 1 file changed, 20 deletions(-)

diff --git a/src/main/resources/ui/acldef.css b/src/main/resources/ui/acldef.css
deleted file mode 100644
index 9181889..0000000
--- a/src/main/resources/ui/acldef.css
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- 
- .msg { color:blue; }
-td { vertical-align: top; }
-textarea { width:100%; }
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-repoinit] 03/43: SLING-5355 - test with multiple users

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.jcr.repoinit-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git

commit 4b89959dd83a6feb0e98189e786490d207863c10
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Mon Dec 21 14:12:47 2015 +0000

    SLING-5355 - test with multiple users
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/acldef/oak-jcr@1721162 13f79535-47bb-0310-9956-ffa450edef68
---
 .../sling/acldef/jcr/CreateServiceUsersTest.java   | 52 +++++++++++++++++-----
 1 file changed, 41 insertions(+), 11 deletions(-)

diff --git a/src/test/java/org/apache/sling/acldef/jcr/CreateServiceUsersTest.java b/src/test/java/org/apache/sling/acldef/jcr/CreateServiceUsersTest.java
index 46a7334..0d42c47 100644
--- a/src/test/java/org/apache/sling/acldef/jcr/CreateServiceUsersTest.java
+++ b/src/test/java/org/apache/sling/acldef/jcr/CreateServiceUsersTest.java
@@ -22,7 +22,7 @@ import static org.junit.Assert.assertNull;
 import java.io.Reader;
 import java.io.StringReader;
 import java.util.List;
-import java.util.concurrent.atomic.AtomicLong;
+import java.util.Random;
 
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
@@ -49,8 +49,8 @@ public class CreateServiceUsersTest {
     
     private Session session;
     private UserManager userManager;
-    private AtomicLong counter = new AtomicLong(System.currentTimeMillis());
-    private long id; 
+    private static final Random random = new Random(42);
+    private String namePrefix;
     
     private List<Operation> parse(String input) throws ParseException {
         final Reader r = new StringReader(input);
@@ -63,16 +63,14 @@ public class CreateServiceUsersTest {
 
     @Before
     public void setup() throws RepositoryException {
+        // We don't need to logout this session, the Sling Mocks library
+        // takes care of that
         session = context.resourceResolver().adaptTo(Session.class);
+        
         userManager = ServiceUserUtil.getUserManager(session);
-        id = counter.incrementAndGet();
+        namePrefix = "user_" + random.nextInt();
     }
 
-    @After
-    public void cleanup() {
-        session.logout();
-    }
-    
     private void assertServiceUser(String info, String id, boolean expectToExist) throws RepositoryException {
         final Authorizable a = userManager.getAuthorizable(id);
         if(!expectToExist) {
@@ -92,12 +90,44 @@ public class CreateServiceUsersTest {
     }
 
     @Test
-    public void createDeleteTest() throws Exception {
-        final String userId = "bob_" + id;
+    public void createDeleteSingleTest() throws Exception {
+        final String userId = namePrefix + "_cdst";
         assertServiceUser("at start of test", userId, false);
         exec("create service user " + userId);
         assertServiceUser("affter creating user", userId, true);
         exec("delete service user " + userId);
         assertServiceUser("after deleting user", userId, false);
     }
+    
+    private String user(int index) {
+        return namePrefix + "_" + index;
+    }
+    
+    @Test
+    public void createDeleteMultipleTest() throws Exception {
+        final int n = 50;
+        
+        {
+            final StringBuilder input = new StringBuilder();
+            for(int i=0; i < n; i++) {
+                assertServiceUser("at start of test", user(i), false);
+                input.append("create service user ").append(user(i)).append("\n");
+            }
+            exec(input.toString());
+        }
+        
+        {
+            final StringBuilder input = new StringBuilder();
+            for(int i=0; i < n; i++) {
+                assertServiceUser("before deleting user", user(i), true);
+                input.append("delete service user ").append(user(i)).append("\n");
+            }
+            exec(input.toString());
+        }
+        
+
+        for(int i=0; i < n; i++) {
+            assertServiceUser("after deleting users", user(i), false);
+        }
+    }
 }

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-repoinit] 32/43: SLING-5800 - depend on related releases while releasing this module

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.jcr.repoinit-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git

commit 7b78070117b6fc17a1612027c271ec999f6cbafc
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Tue Jun 21 14:43:58 2016 +0000

    SLING-5800 - depend on related releases while releasing this module
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/repoinit/oak-jcr@1749538 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/pom.xml b/pom.xml
index 5e91d7d..f8380dc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -103,13 +103,13 @@
      <dependency>
       <groupId>org.apache.sling</groupId>
       <artifactId>org.apache.sling.repoinit.parser</artifactId>
-	  <version>0.0.1-SNAPSHOT</version>
-	  <scope>provided</scope>
+      <version>1.0.0</version>
+      <scope>provided</scope>
     </dependency>
     <dependency>
       <groupId>org.apache.sling</groupId>
       <artifactId>org.apache.sling.jcr.api</artifactId>
-      <version>2.4.1-SNAPSHOT</version>
+      <version>2.4.0</version>
     </dependency>
     <dependency>
       <groupId>org.apache.sling</groupId>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-repoinit] 08/43: SLING-5355 - parser service

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.jcr.repoinit-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git

commit de7c9809d6e88a96c4c2262a2db1eab926ca6ce4
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Wed Dec 23 12:37:23 2015 +0000

    SLING-5355 - parser service
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/acldef/oak-jcr@1721535 13f79535-47bb-0310-9956-ffa450edef68
---
 .../org/apache/sling/acldef/jcr/AclOperationVisitor.java     |  6 +++---
 .../sling/acldef/jcr/webconsole/OakAclDefConsolePlugin.java  | 11 +++++++----
 .../java/org/apache/sling/acldef/jcr/GeneralAclTest.java     |  6 +++---
 .../org/apache/sling/acldef/jcr/NonExistentPathTest.java     |  9 +++++----
 src/test/java/org/apache/sling/acldef/jcr/TestUtil.java      | 12 ++++++------
 5 files changed, 24 insertions(+), 20 deletions(-)

diff --git a/src/main/java/org/apache/sling/acldef/jcr/AclOperationVisitor.java b/src/main/java/org/apache/sling/acldef/jcr/AclOperationVisitor.java
index f99b1b6..bd6310c 100644
--- a/src/main/java/org/apache/sling/acldef/jcr/AclOperationVisitor.java
+++ b/src/main/java/org/apache/sling/acldef/jcr/AclOperationVisitor.java
@@ -16,9 +16,9 @@
  */
 package org.apache.sling.acldef.jcr;
 
-import static org.apache.sling.acldef.parser.ACLDefinitions.PROP_PATHS;
-import static org.apache.sling.acldef.parser.ACLDefinitions.PROP_PRINCIPALS;
-import static org.apache.sling.acldef.parser.ACLDefinitions.PROP_PRIVILEGES;
+import static org.apache.sling.acldef.parser.operations.AclLine.PROP_PATHS;
+import static org.apache.sling.acldef.parser.operations.AclLine.PROP_PRINCIPALS;
+import static org.apache.sling.acldef.parser.operations.AclLine.PROP_PRIVILEGES;
 
 import java.util.List;
 
diff --git a/src/main/java/org/apache/sling/acldef/jcr/webconsole/OakAclDefConsolePlugin.java b/src/main/java/org/apache/sling/acldef/jcr/webconsole/OakAclDefConsolePlugin.java
index 16d3ff3..5421c04 100644
--- a/src/main/java/org/apache/sling/acldef/jcr/webconsole/OakAclDefConsolePlugin.java
+++ b/src/main/java/org/apache/sling/acldef/jcr/webconsole/OakAclDefConsolePlugin.java
@@ -41,8 +41,8 @@ import org.apache.felix.scr.annotations.Property;
 import org.apache.felix.scr.annotations.Reference;
 import org.apache.felix.scr.annotations.Service;
 import org.apache.sling.acldef.jcr.AclOperationVisitor;
-import org.apache.sling.acldef.parser.ACLDefinitions;
-import org.apache.sling.acldef.parser.ParseException;
+import org.apache.sling.acldef.parser.AclDefinitionsParser;
+import org.apache.sling.acldef.parser.AclParsingException;
 import org.apache.sling.acldef.parser.operations.Operation;
 import org.apache.sling.acldef.parser.operations.OperationVisitor;
 import org.apache.sling.api.request.ResponseUtil;
@@ -80,6 +80,9 @@ public class OakAclDefConsolePlugin extends HttpServlet {
     @Reference
     private SlingRepository repository;
 
+    @Reference
+    private AclDefinitionsParser parser;
+
     private String thisPath(HttpServletRequest request) {
         return request.getContextPath() + request.getServletPath() + request.getPathInfo();
     }
@@ -157,13 +160,13 @@ public class OakAclDefConsolePlugin extends HttpServlet {
         }
     }
     
-    private void setAcl(String aclDef) throws RepositoryException, IOException, ParseException {
+    private void setAcl(String aclDef) throws RepositoryException, IOException, AclParsingException {
         final Reader r = new StringReader(aclDef);
         Session s = null;
         try {
             s = repository.loginAdministrative(null);
             final OperationVisitor v = new AclOperationVisitor(s);
-            for(Operation op : new ACLDefinitions(r).parse()) {
+            for(Operation op : parser.parse(r)) {
                 op.accept(v);
             }
             s.save();
diff --git a/src/test/java/org/apache/sling/acldef/jcr/GeneralAclTest.java b/src/test/java/org/apache/sling/acldef/jcr/GeneralAclTest.java
index c4cfb12..1b85e0d 100644
--- a/src/test/java/org/apache/sling/acldef/jcr/GeneralAclTest.java
+++ b/src/test/java/org/apache/sling/acldef/jcr/GeneralAclTest.java
@@ -26,7 +26,7 @@ import javax.jcr.PathNotFoundException;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 
-import org.apache.sling.acldef.parser.ParseException;
+import org.apache.sling.acldef.parser.AclParsingException;
 import org.apache.sling.testing.mock.sling.ResourceResolverType;
 import org.apache.sling.testing.mock.sling.junit.SlingContext;
 import org.junit.After;
@@ -44,14 +44,14 @@ public class GeneralAclTest {
     private Session s;
     
     @Before
-    public void setup() throws ParseException, RepositoryException {
+    public void setup() throws RepositoryException, AclParsingException {
         U = new TestUtil(context);
         U.parseAndExecute("create service user " + U.username);
         s = U.loginService(U.username);
     }
 
     @After
-    public void cleanup() throws ParseException, RepositoryException {
+    public void cleanup() throws RepositoryException, AclParsingException {
         U.cleanupUser();
         s.logout();
     }
diff --git a/src/test/java/org/apache/sling/acldef/jcr/NonExistentPathTest.java b/src/test/java/org/apache/sling/acldef/jcr/NonExistentPathTest.java
index 50746cc..f74fbe8 100644
--- a/src/test/java/org/apache/sling/acldef/jcr/NonExistentPathTest.java
+++ b/src/test/java/org/apache/sling/acldef/jcr/NonExistentPathTest.java
@@ -16,13 +16,14 @@
  */
 package org.apache.sling.acldef.jcr;
 
-import static org.junit.Assert.fail;
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
 import javax.jcr.PathNotFoundException;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 
-import org.apache.sling.acldef.parser.ParseException;
+import org.apache.sling.acldef.parser.AclParsingException;
 import org.apache.sling.testing.mock.sling.ResourceResolverType;
 import org.apache.sling.testing.mock.sling.junit.SlingContext;
 import org.junit.After;
@@ -40,14 +41,14 @@ public class NonExistentPathTest {
     private Session s;
     
     @Before
-    public void setup() throws ParseException, RepositoryException {
+    public void setup() throws RepositoryException, AclParsingException {
         U = new TestUtil(context);
         U.parseAndExecute("create service user " + U.username);
         s = U.loginService(U.username);
     }
 
     @After
-    public void cleanup() throws ParseException, RepositoryException {
+    public void cleanup() throws RepositoryException, AclParsingException {
         U.cleanupUser();
         s.logout();
     }
diff --git a/src/test/java/org/apache/sling/acldef/jcr/TestUtil.java b/src/test/java/org/apache/sling/acldef/jcr/TestUtil.java
index ea9c9bb..03782e2 100644
--- a/src/test/java/org/apache/sling/acldef/jcr/TestUtil.java
+++ b/src/test/java/org/apache/sling/acldef/jcr/TestUtil.java
@@ -31,8 +31,8 @@ import javax.jcr.SimpleCredentials;
 import org.apache.commons.io.IOUtils;
 import org.apache.jackrabbit.api.security.user.Authorizable;
 import org.apache.jackrabbit.api.security.user.User;
-import org.apache.sling.acldef.parser.ACLDefinitions;
-import org.apache.sling.acldef.parser.ParseException;
+import org.apache.sling.acldef.parser.AclParsingException;
+import org.apache.sling.acldef.parser.impl.ACLDefinitionsParserService;
 import org.apache.sling.acldef.parser.operations.Operation;
 import org.apache.sling.testing.mock.sling.junit.SlingContext;
 
@@ -49,10 +49,10 @@ class TestUtil {
         username = "user_" + id;
     }
     
-    List<Operation> parse(String input) throws ParseException {
+    List<Operation> parse(String input) throws AclParsingException {
         final Reader r = new StringReader(input);
         try {
-            return new ACLDefinitions(r).parse();
+            return new ACLDefinitionsParserService().parse(r);
         } finally {
             IOUtils.closeQuietly(r);
         }
@@ -69,7 +69,7 @@ class TestUtil {
         }
     }
     
-    void parseAndExecute(String input) throws ParseException, RepositoryException {
+    void parseAndExecute(String input) throws RepositoryException, AclParsingException {
         final AclOperationVisitor v = new AclOperationVisitor(adminSession);
         for(Operation o : parse(input)) {
             o.accept(v);
@@ -77,7 +77,7 @@ class TestUtil {
         adminSession.save();
     }
     
-    void cleanupUser() throws ParseException, RepositoryException {
+    void cleanupUser() throws RepositoryException, AclParsingException {
         parseAndExecute("delete service user " + username);
         assertServiceUser("in cleanupUser()", username, false);
     }

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-repoinit] 27/43: SLING-5449 - move the repoinit modules under extensions, they do contain Sling-specific stuff

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.jcr.repoinit-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git

commit 59387710461ad242814302eda46441580ec0a0cb
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Thu May 19 12:50:58 2016 +0000

    SLING-5449 - move the repoinit modules under extensions, they do contain Sling-specific stuff
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/repoinit/oak-jcr@1744564 13f79535-47bb-0310-9956-ffa450edef68
---
 src/main/java/org/apache/sling/repoinit/jcr/JcrRepoInitOpVisitor.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/sling/repoinit/jcr/JcrRepoInitOpVisitor.java b/src/main/java/org/apache/sling/repoinit/jcr/JcrRepoInitOpVisitor.java
index e3680bb..8abb41b 100644
--- a/src/main/java/org/apache/sling/repoinit/jcr/JcrRepoInitOpVisitor.java
+++ b/src/main/java/org/apache/sling/repoinit/jcr/JcrRepoInitOpVisitor.java
@@ -124,9 +124,10 @@ public class JcrRepoInitOpVisitor implements OperationVisitor {
                 final String fullPath = parentPath + "/" + psd.getSegment();
                 try {
                     if(session.itemExists(fullPath)) {
-                        // TODO warn if primary type is not correct 
+                        log.info("Path already exists, nothing to do (and not checking its primary type for now): {}", fullPath); 
                     } else {
                         final Node n = parentPath.equals("") ? session.getRootNode() : session.getNode(parentPath);
+                        log.info("Creating node {} with primary type {}", fullPath, psd.getPrimaryType());
                         n.addNode(psd.getSegment(), psd.getPrimaryType());
                     }
                 } catch(Exception e) {

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-repoinit] 36/43: Rename o.a.s.repoinit.oak-jcr to o.a.s.jcr.repoinit

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.jcr.repoinit-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git

commit 713d36f27cf0d7ebe989f4ef3b2e5fa58bf8787f
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Mon Jun 27 17:49:13 2016 +0000

    Rename o.a.s.repoinit.oak-jcr to o.a.s.jcr.repoinit
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/repoinit/jcr@1750393 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/pom.xml b/pom.xml
index f9c1a74..d145bae 100644
--- a/pom.xml
+++ b/pom.xml
@@ -27,10 +27,10 @@
     <relativePath />
   </parent>
 
-  <artifactId>org.apache.sling.repoinit.oak-jcr</artifactId>
+  <artifactId>org.apache.sling.jcr.repoinit</artifactId>
   <packaging>bundle</packaging>
-  <version>1.0.1-SNAPSHOT</version>
-  <name>Apache Sling RepoInit Oak/JCR module</name>
+  <version>0.9.9-SNAPSHOT</version>
+  <name>Apache Sling RepoInit JCR module</name>
   <description>
 	  Initializes a JCR repository based on the output
 	  of the RepoInit Language parser.
@@ -41,9 +41,9 @@
   </properties>
 
   <scm>
-    <connection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/repoinit/oak-jcr</connection>
-    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/repoinit/oak-jcr</developerConnection>
-    <url>https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/repoinit/oak-jcr</url>
+    <connection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/repoinit/jcr</connection>
+    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/repoinit/jcr</developerConnection>
+    <url>https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/repoinit/jcr</url>
   </scm>
   
   <build>
@@ -109,7 +109,7 @@
     <dependency>
       <groupId>org.apache.sling</groupId>
       <artifactId>org.apache.sling.jcr.api</artifactId>
-      <version>2.4.1-SNAPSHOT</version>
+      <version>2.4.0</version>
     </dependency>
     <dependency>
       <groupId>org.apache.sling</groupId>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-repoinit] 12/43: SLING-5355 - test ACL definitions in provisioning model

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.jcr.repoinit-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git

commit 32f8cf8ba59eaebe3e7fa60d7b32b15ac9bca536
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Thu Dec 31 10:36:07 2015 +0000

    SLING-5355 - test ACL definitions in provisioning model
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/acldef/oak-jcr@1722435 13f79535-47bb-0310-9956-ffa450edef68
---
 .../sling/acldef/jcr/impl/{AclSetupComponent.java => AclSetup.java} | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/main/java/org/apache/sling/acldef/jcr/impl/AclSetupComponent.java b/src/main/java/org/apache/sling/acldef/jcr/impl/AclSetup.java
similarity index 97%
rename from src/main/java/org/apache/sling/acldef/jcr/impl/AclSetupComponent.java
rename to src/main/java/org/apache/sling/acldef/jcr/impl/AclSetup.java
index 9c77c28..fd711b2 100644
--- a/src/main/java/org/apache/sling/acldef/jcr/impl/AclSetupComponent.java
+++ b/src/main/java/org/apache/sling/acldef/jcr/impl/AclSetup.java
@@ -49,11 +49,11 @@ import aQute.bnd.annotation.component.Deactivate;
 @Component(
         configurationFactory=true,
         metatype=false,
-        configurationPid=AclSetupComponent.CONFIG_PID,
+        configurationPid=AclSetup.CONFIG_PID,
         policy=ConfigurationPolicy.REQUIRE)
-public class AclSetupComponent implements Runnable {
+public class AclSetup implements Runnable {
     private final Logger log = LoggerFactory.getLogger(getClass());
-    public static final String CONFIG_PID = "org.apache.sling.acldef.jcr.AclSetupComponent";
+    public static final String CONFIG_PID = "org.apache.sling.acldef.jcr.AclSetup";
     public static final String ACLDEF_PROP_PREFIX = "acldef.text.";
     public static final String THREAD_POOL_NAME = "ACL Definitions";
     

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-repoinit] 15/43: SLING-5449 - the name is 'repoinit' instead as the parser is not JCR-specific

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.jcr.repoinit-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git

commit 462ba19be9975b1d5d7de74edbfbbd3340e75fb6
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Fri Jan 22 15:43:35 2016 +0000

    SLING-5449 - the name is 'repoinit' instead as the parser is not JCR-specific
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/jcrinit/oak-jcr@1726240 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/pom.xml b/pom.xml
index b9267c7..f723df2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -27,13 +27,13 @@
     <relativePath/>
   </parent>
 
-  <artifactId>org.apache.sling.acldef.oak-jcr</artifactId>
+  <artifactId>org.apache.sling.repoinit.oak-jcr</artifactId>
   <packaging>bundle</packaging>
   <version>0.0.1-SNAPSHOT</version>
-  <name>Apache Sling ACL Definitions Oak/JCR module</name>
+  <name>Apache Sling RepoInit Oak/JCR module</name>
   <description>
-	  Applies ACLs to an Oak JCR repository based on the output
-	  of the ACL Definition Language parser.
+	  Initializes a JCR repository based on the output
+	  of the RepoInit Language parser.
   </description>
   
   <properties>
@@ -41,9 +41,9 @@
   </properties>
 
   <scm>
-    <connection>scm:svn: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/acldef/oak-jcr</connection>
-    <developerConnection>scm:svn: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/acldef/oak-jcr</developerConnection>
-    <url> https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/acldef/oak-jcr</url>
+    <connection>scm:svn: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/repoinit/oak-jcr</connection>
+    <developerConnection>scm:svn: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/repoinit/oak-jcr</developerConnection>
+    <url> https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/repoinit/oak-jcr</url>
   </scm>
   
   <build>
@@ -112,7 +112,7 @@
     </dependency>
      <dependency>
       <groupId>org.apache.sling</groupId>
-      <artifactId>org.apache.sling.acldef.parser</artifactId>
+      <artifactId>org.apache.sling.repoinit.parser</artifactId>
 	  <version>0.0.1-SNAPSHOT</version>
 	  <scope>provided</scope>
     </dependency>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-repoinit] 04/43: SLING-5355 - factor our TestUtil

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.jcr.repoinit-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git

commit d20da334eadeb0bf6b7e7f20b2e76921bbb240d3
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Mon Dec 21 15:06:28 2015 +0000

    SLING-5355 - factor our TestUtil
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/acldef/oak-jcr@1721183 13f79535-47bb-0310-9956-ffa450edef68
---
 .../sling/acldef/jcr/CreateServiceUsersTest.java   | 71 ++++----------------
 .../java/org/apache/sling/acldef/jcr/TestUtil.java | 78 ++++++++++++++++++++++
 2 files changed, 90 insertions(+), 59 deletions(-)

diff --git a/src/test/java/org/apache/sling/acldef/jcr/CreateServiceUsersTest.java b/src/test/java/org/apache/sling/acldef/jcr/CreateServiceUsersTest.java
index 0d42c47..0f09972 100644
--- a/src/test/java/org/apache/sling/acldef/jcr/CreateServiceUsersTest.java
+++ b/src/test/java/org/apache/sling/acldef/jcr/CreateServiceUsersTest.java
@@ -16,27 +16,12 @@
  */
 package org.apache.sling.acldef.jcr;
 
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-import java.io.Reader;
-import java.io.StringReader;
-import java.util.List;
 import java.util.Random;
 
 import javax.jcr.RepositoryException;
-import javax.jcr.Session;
 
-import org.apache.commons.io.IOUtils;
-import org.apache.jackrabbit.api.security.user.Authorizable;
-import org.apache.jackrabbit.api.security.user.User;
-import org.apache.jackrabbit.api.security.user.UserManager;
-import org.apache.sling.acldef.parser.ACLDefinitions;
-import org.apache.sling.acldef.parser.ParseException;
-import org.apache.sling.acldef.parser.operations.Operation;
 import org.apache.sling.testing.mock.sling.ResourceResolverType;
 import org.apache.sling.testing.mock.sling.junit.SlingContext;
-import org.junit.After;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
@@ -47,56 +32,24 @@ public class CreateServiceUsersTest {
     @Rule
     public final SlingContext context = new SlingContext(ResourceResolverType.JCR_OAK);
     
-    private Session session;
-    private UserManager userManager;
     private static final Random random = new Random(42);
     private String namePrefix;
+    private TestUtil U;
     
-    private List<Operation> parse(String input) throws ParseException {
-        final Reader r = new StringReader(input);
-        try {
-            return new ACLDefinitions(r).parse();
-        } finally {
-            IOUtils.closeQuietly(r);
-        }
-    }
-
     @Before
     public void setup() throws RepositoryException {
-        // We don't need to logout this session, the Sling Mocks library
-        // takes care of that
-        session = context.resourceResolver().adaptTo(Session.class);
-        
-        userManager = ServiceUserUtil.getUserManager(session);
+        U = new TestUtil(context);
         namePrefix = "user_" + random.nextInt();
     }
 
-    private void assertServiceUser(String info, String id, boolean expectToExist) throws RepositoryException {
-        final Authorizable a = userManager.getAuthorizable(id);
-        if(!expectToExist) {
-            assertNull(info + ", expecting Principal to be absent:" + id, a);
-        } else {
-            assertNotNull(info + ", expecting Principal to exist:" + id, a);
-            final User u = (User)a;
-            assertNotNull(info + ", expecting Principal to be a System user:" + id, u.isSystemUser());
-        }
-    }
-    
-    private void exec(String input) throws ParseException {
-        final AclOperationVisitor v = new AclOperationVisitor(session);
-        for(Operation o : parse(input)) {
-            o.accept(v);
-        }
-    }
-
     @Test
     public void createDeleteSingleTest() throws Exception {
         final String userId = namePrefix + "_cdst";
-        assertServiceUser("at start of test", userId, false);
-        exec("create service user " + userId);
-        assertServiceUser("affter creating user", userId, true);
-        exec("delete service user " + userId);
-        assertServiceUser("after deleting user", userId, false);
+        U.assertServiceUser("at start of test", userId, false);
+        U.parseAndExecute("create service user " + userId);
+        U.assertServiceUser("after creating user", userId, true);
+        U.parseAndExecute("delete service user " + userId);
+        U.assertServiceUser("after deleting user", userId, false);
     }
     
     private String user(int index) {
@@ -110,24 +63,24 @@ public class CreateServiceUsersTest {
         {
             final StringBuilder input = new StringBuilder();
             for(int i=0; i < n; i++) {
-                assertServiceUser("at start of test", user(i), false);
+                U.assertServiceUser("at start of test", user(i), false);
                 input.append("create service user ").append(user(i)).append("\n");
             }
-            exec(input.toString());
+            U.parseAndExecute(input.toString());
         }
         
         {
             final StringBuilder input = new StringBuilder();
             for(int i=0; i < n; i++) {
-                assertServiceUser("before deleting user", user(i), true);
+                U.assertServiceUser("before deleting user", user(i), true);
                 input.append("delete service user ").append(user(i)).append("\n");
             }
-            exec(input.toString());
+            U.parseAndExecute(input.toString());
         }
         
 
         for(int i=0; i < n; i++) {
-            assertServiceUser("after deleting users", user(i), false);
+            U.assertServiceUser("after deleting users", user(i), false);
         }
     }
 }
diff --git a/src/test/java/org/apache/sling/acldef/jcr/TestUtil.java b/src/test/java/org/apache/sling/acldef/jcr/TestUtil.java
new file mode 100644
index 0000000..c07dd21
--- /dev/null
+++ b/src/test/java/org/apache/sling/acldef/jcr/TestUtil.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sling.acldef.jcr;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+import java.io.Reader;
+import java.io.StringReader;
+import java.util.List;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.SimpleCredentials;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.jackrabbit.api.security.user.Authorizable;
+import org.apache.jackrabbit.api.security.user.User;
+import org.apache.sling.acldef.parser.ACLDefinitions;
+import org.apache.sling.acldef.parser.ParseException;
+import org.apache.sling.acldef.parser.operations.Operation;
+import org.apache.sling.testing.mock.sling.junit.SlingContext;
+
+/** Test utilities */
+class TestUtil {
+    
+    final Session adminSession;
+    
+    TestUtil(SlingContext ctx) {
+        adminSession = ctx.resourceResolver().adaptTo(Session.class); 
+    }
+    
+    List<Operation> parse(String input) throws ParseException {
+        final Reader r = new StringReader(input);
+        try {
+            return new ACLDefinitions(r).parse();
+        } finally {
+            IOUtils.closeQuietly(r);
+        }
+    }
+
+    void assertServiceUser(String info, String id, boolean expectToExist) throws RepositoryException {
+        final Authorizable a = ServiceUserUtil.getUserManager(adminSession).getAuthorizable(id);
+        if(!expectToExist) {
+            assertNull(info + ", expecting Principal to be absent:" + id, a);
+        } else {
+            assertNotNull(info + ", expecting Principal to exist:" + id, a);
+            final User u = (User)a;
+            assertNotNull(info + ", expecting Principal to be a System user:" + id, u.isSystemUser());
+        }
+    }
+    
+    void parseAndExecute(String input) throws ParseException {
+        final AclOperationVisitor v = new AclOperationVisitor(adminSession);
+        for(Operation o : parse(input)) {
+            o.accept(v);
+        }
+    }
+    
+    Session getServiceSession(String serviceUsername) throws RepositoryException {
+        final SimpleCredentials cred = new SimpleCredentials(serviceUsername, new char[0]);
+        return adminSession.impersonate(cred);
+    }
+}

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-repoinit] 22/43: SLING-5449 - move repoinit under commons

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.jcr.repoinit-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git

commit 2752857f2b5c1849c20c7426e58932cc12c83279
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Fri Jan 22 19:17:30 2016 +0000

    SLING-5449 - move repoinit under commons
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/commons/repoinit/oak-jcr@1726292 13f79535-47bb-0310-9956-ffa450edef68

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-repoinit] 11/43: SLING-5355 - fail if Principal not found

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.jcr.repoinit-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git

commit 8791efe5b6c5a3ae2089722e50a988bd82600fe3
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Thu Dec 31 09:31:17 2015 +0000

    SLING-5355 - fail if Principal not found
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/acldef/oak-jcr@1722431 13f79535-47bb-0310-9956-ffa450edef68
---
 src/main/java/org/apache/sling/acldef/jcr/AclUtil.java | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/sling/acldef/jcr/AclUtil.java b/src/main/java/org/apache/sling/acldef/jcr/AclUtil.java
index 1a70be4..97f79ac 100644
--- a/src/main/java/org/apache/sling/acldef/jcr/AclUtil.java
+++ b/src/main/java/org/apache/sling/acldef/jcr/AclUtil.java
@@ -28,6 +28,7 @@ import javax.jcr.security.Privilege;
 
 import org.apache.jackrabbit.api.security.JackrabbitAccessControlList;
 import org.apache.jackrabbit.api.security.JackrabbitAccessControlManager;
+import org.apache.jackrabbit.api.security.user.Authorizable;
 import org.apache.jackrabbit.commons.jackrabbit.authorization.AccessControlUtils;
 
 /** Utilities for ACL management */
@@ -56,7 +57,11 @@ public class AclUtil {
             }
             JackrabbitAccessControlList acl = AccessControlUtils.getAccessControlList(s, path);
             for(String principal : principals) {
-                final Principal p = ServiceUserUtil.getAuthorizable(s, principal).getPrincipal(); 
+                final Authorizable a = ServiceUserUtil.getAuthorizable(s, principal);
+                if(a == null) {
+                    throw new IllegalStateException("Principal not found:" + principal);
+                }
+                final Principal p = a.getPrincipal(); 
                 acl.addEntry(p, jcrPriv, isAllow);
             }
             getJACM(s).setPolicy(path, acl);

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-repoinit] 23/43: repoinit: fix SCM urls after move

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.jcr.repoinit-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git

commit f8873b8a2d319e9d108d68e6331c74a51da0c54d
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Mon Jan 25 07:34:39 2016 +0000

    repoinit: fix SCM urls after move
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/commons/repoinit/oak-jcr@1726588 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/pom.xml b/pom.xml
index 7e95f68..d5aa694 100644
--- a/pom.xml
+++ b/pom.xml
@@ -41,9 +41,9 @@
   </properties>
 
   <scm>
-    <connection>scm:svn: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/repoinit/oak-jcr</connection>
-    <developerConnection>scm:svn: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/repoinit/oak-jcr</developerConnection>
-    <url> https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/repoinit/oak-jcr</url>
+    <connection>scm:svn: https://svn.apache.org/repos/asf/sling/trunk/bundles/commons/repoinit/oak-jcr</connection>
+    <developerConnection>scm:svn: https://svn.apache.org/repos/asf/sling/trunk/bundles/commons/repoinit/oak-jcr</developerConnection>
+    <url> https://svn.apache.org/repos/asf/sling/trunk/bundles/commons/repoinit/oak-jcr</url>
   </scm>
   
   <build>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-repoinit] 17/43: SLING-5449 - rename packages to repoinit

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.jcr.repoinit-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git

commit 8296d7d473f55c39858dff0c46ad1c734ce7dad0
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Fri Jan 22 17:22:24 2016 +0000

    SLING-5449 - rename packages to repoinit
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/repoinit/oak-jcr@1726259 13f79535-47bb-0310-9956-ffa450edef68
---
 .../jcr/AclOperationVisitor.java                   | 22 +++++++++++-----------
 .../sling/{acldef => repoinit}/jcr/AclUtil.java    |  2 +-
 .../{acldef => repoinit}/jcr/ServiceUserUtil.java  |  2 +-
 .../{acldef => repoinit}/jcr/impl/AclSetup.java    | 22 +++++++++++-----------
 .../jcr/webconsole/OakAclDefConsolePlugin.java     | 16 ++++++++--------
 .../jcr/CreateServiceUsersTest.java                |  2 +-
 .../{acldef => repoinit}/jcr/GeneralAclTest.java   |  4 ++--
 .../jcr/NonExistentPathTest.java                   |  4 ++--
 .../sling/{acldef => repoinit}/jcr/TestUtil.java   |  8 ++++----
 9 files changed, 41 insertions(+), 41 deletions(-)

diff --git a/src/main/java/org/apache/sling/acldef/jcr/AclOperationVisitor.java b/src/main/java/org/apache/sling/repoinit/jcr/AclOperationVisitor.java
similarity index 85%
rename from src/main/java/org/apache/sling/acldef/jcr/AclOperationVisitor.java
rename to src/main/java/org/apache/sling/repoinit/jcr/AclOperationVisitor.java
index 19d43f8..6403e65 100644
--- a/src/main/java/org/apache/sling/acldef/jcr/AclOperationVisitor.java
+++ b/src/main/java/org/apache/sling/repoinit/jcr/AclOperationVisitor.java
@@ -14,22 +14,22 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.sling.acldef.jcr;
+package org.apache.sling.repoinit.jcr;
 
-import static org.apache.sling.acldef.parser.operations.AclLine.PROP_PATHS;
-import static org.apache.sling.acldef.parser.operations.AclLine.PROP_PRINCIPALS;
-import static org.apache.sling.acldef.parser.operations.AclLine.PROP_PRIVILEGES;
+import static org.apache.sling.repoinit.parser.operations.AclLine.PROP_PATHS;
+import static org.apache.sling.repoinit.parser.operations.AclLine.PROP_PRINCIPALS;
+import static org.apache.sling.repoinit.parser.operations.AclLine.PROP_PRIVILEGES;
 
 import java.util.List;
 
 import javax.jcr.Session;
 
-import org.apache.sling.acldef.parser.operations.AclLine;
-import org.apache.sling.acldef.parser.operations.CreateServiceUser;
-import org.apache.sling.acldef.parser.operations.DeleteServiceUser;
-import org.apache.sling.acldef.parser.operations.OperationVisitor;
-import org.apache.sling.acldef.parser.operations.SetAclPaths;
-import org.apache.sling.acldef.parser.operations.SetAclPrincipals;
+import org.apache.sling.repoinit.parser.operations.AclLine;
+import org.apache.sling.repoinit.parser.operations.CreateServiceUser;
+import org.apache.sling.repoinit.parser.operations.DeleteServiceUser;
+import org.apache.sling.repoinit.parser.operations.OperationVisitor;
+import org.apache.sling.repoinit.parser.operations.SetAclPaths;
+import org.apache.sling.repoinit.parser.operations.SetAclPrincipals;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -114,4 +114,4 @@ public class AclOperationVisitor implements OperationVisitor {
             setAcl(line, session, require(line, PROP_PRINCIPALS), paths, require(line, PROP_PRIVILEGES), isAllow); 
         }
     }
-}
\ No newline at end of file
+}
diff --git a/src/main/java/org/apache/sling/acldef/jcr/AclUtil.java b/src/main/java/org/apache/sling/repoinit/jcr/AclUtil.java
similarity index 98%
rename from src/main/java/org/apache/sling/acldef/jcr/AclUtil.java
rename to src/main/java/org/apache/sling/repoinit/jcr/AclUtil.java
index 97f79ac..10a7967 100644
--- a/src/main/java/org/apache/sling/acldef/jcr/AclUtil.java
+++ b/src/main/java/org/apache/sling/repoinit/jcr/AclUtil.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.sling.acldef.jcr;
+package org.apache.sling.repoinit.jcr;
 
 import java.security.Principal;
 import java.util.List;
diff --git a/src/main/java/org/apache/sling/acldef/jcr/ServiceUserUtil.java b/src/main/java/org/apache/sling/repoinit/jcr/ServiceUserUtil.java
similarity index 98%
rename from src/main/java/org/apache/sling/acldef/jcr/ServiceUserUtil.java
rename to src/main/java/org/apache/sling/repoinit/jcr/ServiceUserUtil.java
index 2d131ce..65fa155 100644
--- a/src/main/java/org/apache/sling/acldef/jcr/ServiceUserUtil.java
+++ b/src/main/java/org/apache/sling/repoinit/jcr/ServiceUserUtil.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.sling.acldef.jcr;
+package org.apache.sling.repoinit.jcr;
 
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
diff --git a/src/main/java/org/apache/sling/acldef/jcr/impl/AclSetup.java b/src/main/java/org/apache/sling/repoinit/jcr/impl/AclSetup.java
similarity index 89%
rename from src/main/java/org/apache/sling/acldef/jcr/impl/AclSetup.java
rename to src/main/java/org/apache/sling/repoinit/jcr/impl/AclSetup.java
index fd711b2..9bb2606 100644
--- a/src/main/java/org/apache/sling/acldef/jcr/impl/AclSetup.java
+++ b/src/main/java/org/apache/sling/repoinit/jcr/impl/AclSetup.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.sling.acldef.jcr.impl;
+package org.apache.sling.repoinit.jcr.impl;
 
 import java.io.StringReader;
 import java.util.ArrayList;
@@ -27,9 +27,9 @@ import org.apache.felix.scr.annotations.Activate;
 import org.apache.felix.scr.annotations.Component;
 import org.apache.felix.scr.annotations.ConfigurationPolicy;
 import org.apache.felix.scr.annotations.Reference;
-import org.apache.sling.acldef.jcr.AclOperationVisitor;
-import org.apache.sling.acldef.parser.AclDefinitionsParser;
-import org.apache.sling.acldef.parser.operations.Operation;
+import org.apache.sling.repoinit.jcr.AclOperationVisitor;
+import org.apache.sling.repoinit.parser.AclDefinitionsParser;
+import org.apache.sling.repoinit.parser.operations.Operation;
 import org.apache.sling.commons.threads.ThreadPool;
 import org.apache.sling.commons.threads.ThreadPoolManager;
 import org.apache.sling.jcr.api.SlingRepository;
@@ -39,7 +39,7 @@ import org.slf4j.LoggerFactory;
 import aQute.bnd.annotation.component.Deactivate;
 
 /** OSGi component that sets up service users and ACLS
- *  based on configurations created by the acldef provisioning
+ *  based on configurations created by the repoinit provisioning
  *  model processor.
  *  
  *  As Oak requires a path to exist before setting an ACL on it,
@@ -53,8 +53,8 @@ import aQute.bnd.annotation.component.Deactivate;
         policy=ConfigurationPolicy.REQUIRE)
 public class AclSetup implements Runnable {
     private final Logger log = LoggerFactory.getLogger(getClass());
-    public static final String CONFIG_PID = "org.apache.sling.acldef.jcr.AclSetup";
-    public static final String ACLDEF_PROP_PREFIX = "acldef.text.";
+    public static final String CONFIG_PID = "org.apache.sling.repoinit.jcr.AclSetup";
+    public static final String ACLDEF_PROP_PREFIX = "repoinit.text.";
     public static final String THREAD_POOL_NAME = "ACL Definitions";
     
     private List<String> todo; 
@@ -114,15 +114,15 @@ public class AclSetup implements Runnable {
         try {
             s = repository.loginAdministrative(null);
             final AclOperationVisitor visitor = new AclOperationVisitor(s);
-            for(String acldef : todo) {
+            for(String repoinit : todo) {
                 try {
-                    for(Operation op : parser.parse(new StringReader(acldef))) {
+                    for(Operation op : parser.parse(new StringReader(repoinit))) {
                         op.accept(visitor);
                         s.save();
                     }
                 } catch(Exception e) {
                     log.warn("Exception while executing an ACL definition:" + e.toString(), e);
-                    newTodo.add(acldef);
+                    newTodo.add(repoinit);
                 }
             }
         } catch(Exception e) {
@@ -151,4 +151,4 @@ public class AclSetup implements Runnable {
             }
         }
     }
-}
\ No newline at end of file
+}
diff --git a/src/main/java/org/apache/sling/acldef/jcr/webconsole/OakAclDefConsolePlugin.java b/src/main/java/org/apache/sling/repoinit/jcr/webconsole/OakAclDefConsolePlugin.java
similarity index 94%
rename from src/main/java/org/apache/sling/acldef/jcr/webconsole/OakAclDefConsolePlugin.java
rename to src/main/java/org/apache/sling/repoinit/jcr/webconsole/OakAclDefConsolePlugin.java
index 5421c04..464f5b0 100644
--- a/src/main/java/org/apache/sling/acldef/jcr/webconsole/OakAclDefConsolePlugin.java
+++ b/src/main/java/org/apache/sling/repoinit/jcr/webconsole/OakAclDefConsolePlugin.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.sling.acldef.jcr.webconsole;
+package org.apache.sling.repoinit.jcr.webconsole;
 
 import java.io.IOException;
 import java.io.PrintWriter;
@@ -40,11 +40,11 @@ import org.apache.felix.scr.annotations.Properties;
 import org.apache.felix.scr.annotations.Property;
 import org.apache.felix.scr.annotations.Reference;
 import org.apache.felix.scr.annotations.Service;
-import org.apache.sling.acldef.jcr.AclOperationVisitor;
-import org.apache.sling.acldef.parser.AclDefinitionsParser;
-import org.apache.sling.acldef.parser.AclParsingException;
-import org.apache.sling.acldef.parser.operations.Operation;
-import org.apache.sling.acldef.parser.operations.OperationVisitor;
+import org.apache.sling.repoinit.jcr.AclOperationVisitor;
+import org.apache.sling.repoinit.parser.AclDefinitionsParser;
+import org.apache.sling.repoinit.parser.AclParsingException;
+import org.apache.sling.repoinit.parser.operations.Operation;
+import org.apache.sling.repoinit.parser.operations.OperationVisitor;
 import org.apache.sling.api.request.ResponseUtil;
 import org.apache.sling.jcr.api.SlingRepository;
 import org.osgi.framework.Constants;
@@ -56,13 +56,13 @@ import org.osgi.framework.Constants;
     @Property(name=Constants.SERVICE_DESCRIPTION, value="Apache Sling ACL Definitions Console Plugin"),
     @Property(name="felix.webconsole.label", value=OakAclDefConsolePlugin.LABEL),
     @Property(name="felix.webconsole.title", value="Set ACLs"),
-    @Property(name="felix.webconsole.css", value="/" + OakAclDefConsolePlugin.LABEL + "/res/ui/acldef.css"),
+    @Property(name="felix.webconsole.css", value="/" + OakAclDefConsolePlugin.LABEL + "/res/ui/repoinit.css"),
     @Property(name="felix.webconsole.category", value="Sling"),
 })
 public class OakAclDefConsolePlugin extends HttpServlet {
 
     private static final long serialVersionUID = 1234;
-    private static final String PAR_ACLDEF = "acldef";
+    private static final String PAR_ACLDEF = "repoinit";
     private static final String PAR_MSG = "msg";
     public static final String LABEL = "setACL";
     private static final String ATTR_SUBMIT = "plugin.submit";
diff --git a/src/test/java/org/apache/sling/acldef/jcr/CreateServiceUsersTest.java b/src/test/java/org/apache/sling/repoinit/jcr/CreateServiceUsersTest.java
similarity index 98%
rename from src/test/java/org/apache/sling/acldef/jcr/CreateServiceUsersTest.java
rename to src/test/java/org/apache/sling/repoinit/jcr/CreateServiceUsersTest.java
index 23e4174..db31485 100644
--- a/src/test/java/org/apache/sling/acldef/jcr/CreateServiceUsersTest.java
+++ b/src/test/java/org/apache/sling/repoinit/jcr/CreateServiceUsersTest.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.sling.acldef.jcr;
+package org.apache.sling.repoinit.jcr;
 
 import java.util.Random;
 
diff --git a/src/test/java/org/apache/sling/acldef/jcr/GeneralAclTest.java b/src/test/java/org/apache/sling/repoinit/jcr/GeneralAclTest.java
similarity index 97%
rename from src/test/java/org/apache/sling/acldef/jcr/GeneralAclTest.java
rename to src/test/java/org/apache/sling/repoinit/jcr/GeneralAclTest.java
index 1b85e0d..5634a21 100644
--- a/src/test/java/org/apache/sling/acldef/jcr/GeneralAclTest.java
+++ b/src/test/java/org/apache/sling/repoinit/jcr/GeneralAclTest.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.sling.acldef.jcr;
+package org.apache.sling.repoinit.jcr;
 
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
@@ -26,7 +26,7 @@ import javax.jcr.PathNotFoundException;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 
-import org.apache.sling.acldef.parser.AclParsingException;
+import org.apache.sling.repoinit.parser.AclParsingException;
 import org.apache.sling.testing.mock.sling.ResourceResolverType;
 import org.apache.sling.testing.mock.sling.junit.SlingContext;
 import org.junit.After;
diff --git a/src/test/java/org/apache/sling/acldef/jcr/NonExistentPathTest.java b/src/test/java/org/apache/sling/repoinit/jcr/NonExistentPathTest.java
similarity index 95%
rename from src/test/java/org/apache/sling/acldef/jcr/NonExistentPathTest.java
rename to src/test/java/org/apache/sling/repoinit/jcr/NonExistentPathTest.java
index f74fbe8..9e20ea0 100644
--- a/src/test/java/org/apache/sling/acldef/jcr/NonExistentPathTest.java
+++ b/src/test/java/org/apache/sling/repoinit/jcr/NonExistentPathTest.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.sling.acldef.jcr;
+package org.apache.sling.repoinit.jcr;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
@@ -23,7 +23,7 @@ import javax.jcr.PathNotFoundException;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 
-import org.apache.sling.acldef.parser.AclParsingException;
+import org.apache.sling.repoinit.parser.AclParsingException;
 import org.apache.sling.testing.mock.sling.ResourceResolverType;
 import org.apache.sling.testing.mock.sling.junit.SlingContext;
 import org.junit.After;
diff --git a/src/test/java/org/apache/sling/acldef/jcr/TestUtil.java b/src/test/java/org/apache/sling/repoinit/jcr/TestUtil.java
similarity index 93%
rename from src/test/java/org/apache/sling/acldef/jcr/TestUtil.java
rename to src/test/java/org/apache/sling/repoinit/jcr/TestUtil.java
index 03782e2..612e699 100644
--- a/src/test/java/org/apache/sling/acldef/jcr/TestUtil.java
+++ b/src/test/java/org/apache/sling/repoinit/jcr/TestUtil.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.sling.acldef.jcr;
+package org.apache.sling.repoinit.jcr;
 
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
@@ -31,9 +31,9 @@ import javax.jcr.SimpleCredentials;
 import org.apache.commons.io.IOUtils;
 import org.apache.jackrabbit.api.security.user.Authorizable;
 import org.apache.jackrabbit.api.security.user.User;
-import org.apache.sling.acldef.parser.AclParsingException;
-import org.apache.sling.acldef.parser.impl.ACLDefinitionsParserService;
-import org.apache.sling.acldef.parser.operations.Operation;
+import org.apache.sling.repoinit.parser.AclParsingException;
+import org.apache.sling.repoinit.parser.impl.ACLDefinitionsParserService;
+import org.apache.sling.repoinit.parser.operations.Operation;
 import org.apache.sling.testing.mock.sling.junit.SlingContext;
 
 /** Test utilities */

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-repoinit] 42/43: [maven-release-plugin] prepare release org.apache.sling.jcr.repoinit-1.0.0

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.jcr.repoinit-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git

commit bb14f7d7f87c414042d06ed4cd975f5d0d912297
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Wed Jul 6 09:09:19 2016 +0000

    [maven-release-plugin] prepare release org.apache.sling.jcr.repoinit-1.0.0
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/repoinit/jcr@1751637 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pom.xml b/pom.xml
index 6b399be..6c2556a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -29,7 +29,7 @@
 
   <artifactId>org.apache.sling.jcr.repoinit</artifactId>
   <packaging>bundle</packaging>
-  <version>0.9.9-SNAPSHOT</version>
+  <version>1.0.0</version>
   <name>Apache Sling RepoInit JCR module</name>
   <description>
 	  Initializes a JCR repository based on the output
@@ -41,9 +41,9 @@
   </properties>
 
   <scm>
-    <connection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/repoinit/jcr</connection>
-    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/repoinit/jcr</developerConnection>
-    <url>https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/repoinit/jcr</url>
+    <connection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.jcr.repoinit-1.0.0</connection>
+    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.jcr.repoinit-1.0.0</developerConnection>
+    <url>https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.jcr.repoinit-1.0.0</url>
   </scm>
   
   <build>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-repoinit] 39/43: SLING-5819 - rename repoinit.jcr package to jcr.repoinit

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.jcr.repoinit-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git

commit 92c425453de8ea2a41b4c7a74f2e3210dccca9ac
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Mon Jul 4 12:21:03 2016 +0000

    SLING-5819 - rename repoinit.jcr package to jcr.repoinit
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/repoinit/jcr@1751260 13f79535-47bb-0310-9956-ffa450edef68
---
 .../sling/{repoinit/jcr => jcr/repoinit}/JcrRepoInitOpsProcessor.java | 2 +-
 .../org/apache/sling/{repoinit/jcr => jcr/repoinit}/impl/AclUtil.java | 2 +-
 .../jcr => jcr/repoinit}/impl/JcrRepoInitOperationVisitor.java        | 2 +-
 .../jcr => jcr/repoinit}/impl/JcrRepoInitOpsProcessorImpl.java        | 4 ++--
 .../{repoinit/jcr => jcr/repoinit}/impl/RepositoryInitializer.java    | 4 ++--
 .../sling/{repoinit/jcr => jcr/repoinit}/impl/ServiceUserUtil.java    | 2 +-
 .../org/apache/sling/{repoinit/jcr => jcr/repoinit}/package-info.java | 2 +-
 .../apache/sling/{repoinit/jcr => jcr/repoinit}/CreatePathsTest.java  | 4 ++--
 .../sling/{repoinit/jcr => jcr/repoinit}/CreateServiceUsersTest.java  | 4 ++--
 .../apache/sling/{repoinit/jcr => jcr/repoinit}/GeneralAclTest.java   | 4 ++--
 .../sling/{repoinit/jcr => jcr/repoinit}/NonExistentPathTest.java     | 4 ++--
 .../apache/sling/{repoinit/jcr => jcr/repoinit}/impl/TestUtil.java    | 4 +---
 12 files changed, 18 insertions(+), 20 deletions(-)

diff --git a/src/main/java/org/apache/sling/repoinit/jcr/JcrRepoInitOpsProcessor.java b/src/main/java/org/apache/sling/jcr/repoinit/JcrRepoInitOpsProcessor.java
similarity index 96%
rename from src/main/java/org/apache/sling/repoinit/jcr/JcrRepoInitOpsProcessor.java
rename to src/main/java/org/apache/sling/jcr/repoinit/JcrRepoInitOpsProcessor.java
index 572a41e..31de8ca 100644
--- a/src/main/java/org/apache/sling/repoinit/jcr/JcrRepoInitOpsProcessor.java
+++ b/src/main/java/org/apache/sling/jcr/repoinit/JcrRepoInitOpsProcessor.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.sling.repoinit.jcr;
+package org.apache.sling.jcr.repoinit;
 
 import java.util.List;
 
diff --git a/src/main/java/org/apache/sling/repoinit/jcr/impl/AclUtil.java b/src/main/java/org/apache/sling/jcr/repoinit/impl/AclUtil.java
similarity index 98%
rename from src/main/java/org/apache/sling/repoinit/jcr/impl/AclUtil.java
rename to src/main/java/org/apache/sling/jcr/repoinit/impl/AclUtil.java
index efe3cf5..e0828f8 100644
--- a/src/main/java/org/apache/sling/repoinit/jcr/impl/AclUtil.java
+++ b/src/main/java/org/apache/sling/jcr/repoinit/impl/AclUtil.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.sling.repoinit.jcr.impl;
+package org.apache.sling.jcr.repoinit.impl;
 
 import java.security.Principal;
 import java.util.List;
diff --git a/src/main/java/org/apache/sling/repoinit/jcr/impl/JcrRepoInitOperationVisitor.java b/src/main/java/org/apache/sling/jcr/repoinit/impl/JcrRepoInitOperationVisitor.java
similarity index 99%
rename from src/main/java/org/apache/sling/repoinit/jcr/impl/JcrRepoInitOperationVisitor.java
rename to src/main/java/org/apache/sling/jcr/repoinit/impl/JcrRepoInitOperationVisitor.java
index bfe7e97..153ff40 100644
--- a/src/main/java/org/apache/sling/repoinit/jcr/impl/JcrRepoInitOperationVisitor.java
+++ b/src/main/java/org/apache/sling/jcr/repoinit/impl/JcrRepoInitOperationVisitor.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.sling.repoinit.jcr.impl;
+package org.apache.sling.jcr.repoinit.impl;
 
 import static org.apache.sling.repoinit.parser.operations.AclLine.PROP_PATHS;
 import static org.apache.sling.repoinit.parser.operations.AclLine.PROP_PRINCIPALS;
diff --git a/src/main/java/org/apache/sling/repoinit/jcr/impl/JcrRepoInitOpsProcessorImpl.java b/src/main/java/org/apache/sling/jcr/repoinit/impl/JcrRepoInitOpsProcessorImpl.java
similarity index 93%
rename from src/main/java/org/apache/sling/repoinit/jcr/impl/JcrRepoInitOpsProcessorImpl.java
rename to src/main/java/org/apache/sling/jcr/repoinit/impl/JcrRepoInitOpsProcessorImpl.java
index c4e3ed0..4b633d2 100644
--- a/src/main/java/org/apache/sling/repoinit/jcr/impl/JcrRepoInitOpsProcessorImpl.java
+++ b/src/main/java/org/apache/sling/jcr/repoinit/impl/JcrRepoInitOpsProcessorImpl.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.sling.repoinit.jcr.impl;
+package org.apache.sling.jcr.repoinit.impl;
 
 import java.util.List;
 
@@ -22,7 +22,7 @@ import javax.jcr.Session;
 
 import org.apache.felix.scr.annotations.Component;
 import org.apache.felix.scr.annotations.Service;
-import org.apache.sling.repoinit.jcr.JcrRepoInitOpsProcessor;
+import org.apache.sling.jcr.repoinit.JcrRepoInitOpsProcessor;
 import org.apache.sling.repoinit.parser.operations.Operation;
 
 /** Apply Operations produced by the repoinit parser to a JCR Repository */
diff --git a/src/main/java/org/apache/sling/repoinit/jcr/impl/RepositoryInitializer.java b/src/main/java/org/apache/sling/jcr/repoinit/impl/RepositoryInitializer.java
similarity index 98%
rename from src/main/java/org/apache/sling/repoinit/jcr/impl/RepositoryInitializer.java
rename to src/main/java/org/apache/sling/jcr/repoinit/impl/RepositoryInitializer.java
index adbca24..50e6f41 100644
--- a/src/main/java/org/apache/sling/repoinit/jcr/impl/RepositoryInitializer.java
+++ b/src/main/java/org/apache/sling/jcr/repoinit/impl/RepositoryInitializer.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.sling.repoinit.jcr.impl;
+package org.apache.sling.jcr.repoinit.impl;
 
 import java.io.IOException;
 import java.io.InputStream;
@@ -37,11 +37,11 @@ import org.apache.felix.scr.annotations.Service;
 import org.apache.sling.commons.osgi.PropertiesUtil;
 import org.apache.sling.jcr.api.SlingRepository;
 import org.apache.sling.jcr.api.SlingRepositoryInitializer;
+import org.apache.sling.jcr.repoinit.JcrRepoInitOpsProcessor;
 import org.apache.sling.provisioning.model.Feature;
 import org.apache.sling.provisioning.model.Model;
 import org.apache.sling.provisioning.model.Section;
 import org.apache.sling.provisioning.model.io.ModelReader;
-import org.apache.sling.repoinit.jcr.JcrRepoInitOpsProcessor;
 import org.apache.sling.repoinit.parser.RepoInitParser;
 import org.apache.sling.repoinit.parser.operations.Operation;
 import org.osgi.framework.Constants;
diff --git a/src/main/java/org/apache/sling/repoinit/jcr/impl/ServiceUserUtil.java b/src/main/java/org/apache/sling/jcr/repoinit/impl/ServiceUserUtil.java
similarity index 98%
rename from src/main/java/org/apache/sling/repoinit/jcr/impl/ServiceUserUtil.java
rename to src/main/java/org/apache/sling/jcr/repoinit/impl/ServiceUserUtil.java
index 5f33145..203b069 100644
--- a/src/main/java/org/apache/sling/repoinit/jcr/impl/ServiceUserUtil.java
+++ b/src/main/java/org/apache/sling/jcr/repoinit/impl/ServiceUserUtil.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.sling.repoinit.jcr.impl;
+package org.apache.sling.jcr.repoinit.impl;
 
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
diff --git a/src/main/java/org/apache/sling/repoinit/jcr/package-info.java b/src/main/java/org/apache/sling/jcr/repoinit/package-info.java
similarity index 96%
rename from src/main/java/org/apache/sling/repoinit/jcr/package-info.java
rename to src/main/java/org/apache/sling/jcr/repoinit/package-info.java
index a672011..e52e88f 100644
--- a/src/main/java/org/apache/sling/repoinit/jcr/package-info.java
+++ b/src/main/java/org/apache/sling/jcr/repoinit/package-info.java
@@ -16,6 +16,6 @@
  ******************************************************************************/
 
 @Version("1.1.0")
-package org.apache.sling.repoinit.jcr;
+package org.apache.sling.jcr.repoinit;
 
 import aQute.bnd.annotation.Version;
diff --git a/src/test/java/org/apache/sling/repoinit/jcr/CreatePathsTest.java b/src/test/java/org/apache/sling/jcr/repoinit/CreatePathsTest.java
similarity index 96%
rename from src/test/java/org/apache/sling/repoinit/jcr/CreatePathsTest.java
rename to src/test/java/org/apache/sling/jcr/repoinit/CreatePathsTest.java
index 23a560e..5fac3a0 100644
--- a/src/test/java/org/apache/sling/repoinit/jcr/CreatePathsTest.java
+++ b/src/test/java/org/apache/sling/jcr/repoinit/CreatePathsTest.java
@@ -14,14 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.sling.repoinit.jcr;
+package org.apache.sling.jcr.repoinit;
 
 import java.io.IOException;
 
 import javax.jcr.RepositoryException;
 
 import org.apache.sling.commons.testing.jcr.RepositoryUtil;
-import org.apache.sling.repoinit.jcr.impl.TestUtil;
+import org.apache.sling.jcr.repoinit.impl.TestUtil;
 import org.apache.sling.testing.mock.sling.ResourceResolverType;
 import org.apache.sling.testing.mock.sling.junit.SlingContext;
 import org.junit.Before;
diff --git a/src/test/java/org/apache/sling/repoinit/jcr/CreateServiceUsersTest.java b/src/test/java/org/apache/sling/jcr/repoinit/CreateServiceUsersTest.java
similarity index 97%
rename from src/test/java/org/apache/sling/repoinit/jcr/CreateServiceUsersTest.java
rename to src/test/java/org/apache/sling/jcr/repoinit/CreateServiceUsersTest.java
index 4cbdcd4..fbb641e 100644
--- a/src/test/java/org/apache/sling/repoinit/jcr/CreateServiceUsersTest.java
+++ b/src/test/java/org/apache/sling/jcr/repoinit/CreateServiceUsersTest.java
@@ -14,13 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.sling.repoinit.jcr;
+package org.apache.sling.jcr.repoinit;
 
 import java.util.Random;
 
 import javax.jcr.RepositoryException;
 
-import org.apache.sling.repoinit.jcr.impl.TestUtil;
+import org.apache.sling.jcr.repoinit.impl.TestUtil;
 import org.apache.sling.testing.mock.sling.ResourceResolverType;
 import org.apache.sling.testing.mock.sling.junit.SlingContext;
 import org.junit.Before;
diff --git a/src/test/java/org/apache/sling/repoinit/jcr/GeneralAclTest.java b/src/test/java/org/apache/sling/jcr/repoinit/GeneralAclTest.java
similarity index 97%
rename from src/test/java/org/apache/sling/repoinit/jcr/GeneralAclTest.java
rename to src/test/java/org/apache/sling/jcr/repoinit/GeneralAclTest.java
index 01424c7..764fa10 100644
--- a/src/test/java/org/apache/sling/repoinit/jcr/GeneralAclTest.java
+++ b/src/test/java/org/apache/sling/jcr/repoinit/GeneralAclTest.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.sling.repoinit.jcr;
+package org.apache.sling.jcr.repoinit;
 
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
@@ -26,7 +26,7 @@ import javax.jcr.PathNotFoundException;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 
-import org.apache.sling.repoinit.jcr.impl.TestUtil;
+import org.apache.sling.jcr.repoinit.impl.TestUtil;
 import org.apache.sling.repoinit.parser.RepoInitParsingException;
 import org.apache.sling.testing.mock.sling.ResourceResolverType;
 import org.apache.sling.testing.mock.sling.junit.SlingContext;
diff --git a/src/test/java/org/apache/sling/repoinit/jcr/NonExistentPathTest.java b/src/test/java/org/apache/sling/jcr/repoinit/NonExistentPathTest.java
similarity index 96%
rename from src/test/java/org/apache/sling/repoinit/jcr/NonExistentPathTest.java
rename to src/test/java/org/apache/sling/jcr/repoinit/NonExistentPathTest.java
index 4c11e8f..2c34847 100644
--- a/src/test/java/org/apache/sling/repoinit/jcr/NonExistentPathTest.java
+++ b/src/test/java/org/apache/sling/jcr/repoinit/NonExistentPathTest.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.sling.repoinit.jcr;
+package org.apache.sling.jcr.repoinit;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
@@ -23,7 +23,7 @@ import javax.jcr.PathNotFoundException;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 
-import org.apache.sling.repoinit.jcr.impl.TestUtil;
+import org.apache.sling.jcr.repoinit.impl.TestUtil;
 import org.apache.sling.repoinit.parser.RepoInitParsingException;
 import org.apache.sling.testing.mock.sling.ResourceResolverType;
 import org.apache.sling.testing.mock.sling.junit.SlingContext;
diff --git a/src/test/java/org/apache/sling/repoinit/jcr/impl/TestUtil.java b/src/test/java/org/apache/sling/jcr/repoinit/impl/TestUtil.java
similarity index 96%
rename from src/test/java/org/apache/sling/repoinit/jcr/impl/TestUtil.java
rename to src/test/java/org/apache/sling/jcr/repoinit/impl/TestUtil.java
index 42e173c..2561ad1 100644
--- a/src/test/java/org/apache/sling/repoinit/jcr/impl/TestUtil.java
+++ b/src/test/java/org/apache/sling/jcr/repoinit/impl/TestUtil.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.sling.repoinit.jcr.impl;
+package org.apache.sling.jcr.repoinit.impl;
 
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
@@ -33,8 +33,6 @@ import javax.jcr.SimpleCredentials;
 import org.apache.commons.io.IOUtils;
 import org.apache.jackrabbit.api.security.user.Authorizable;
 import org.apache.jackrabbit.api.security.user.User;
-import org.apache.sling.repoinit.jcr.impl.JcrRepoInitOperationVisitor;
-import org.apache.sling.repoinit.jcr.impl.ServiceUserUtil;
 import org.apache.sling.repoinit.parser.RepoInitParsingException;
 import org.apache.sling.repoinit.parser.impl.RepoInitParserService;
 import org.apache.sling.repoinit.parser.operations.Operation;

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-repoinit] 41/43: Prepare for release

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.jcr.repoinit-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git

commit 014d655dba5247090f9e6e532b1e29243ce8b3fa
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Wed Jul 6 09:08:49 2016 +0000

    Prepare for release
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/repoinit/jcr@1751636 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index d145bae..6b399be 100644
--- a/pom.xml
+++ b/pom.xml
@@ -103,7 +103,7 @@
      <dependency>
       <groupId>org.apache.sling</groupId>
       <artifactId>org.apache.sling.repoinit.parser</artifactId>
-      <version>1.0.1-SNAPSHOT</version>
+      <version>1.0.2</version>
       <scope>provided</scope>
     </dependency>
     <dependency>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-repoinit] 02/43: SLING-5355 - rename jcr to oak-jcr

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.jcr.repoinit-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git

commit eabeb26283547ee80fed2d6bef1a0632eae7ef48
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Mon Dec 21 10:40:41 2015 +0000

    SLING-5355 - rename jcr to oak-jcr
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/acldef/oak-jcr@1721117 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/pom.xml b/pom.xml
index 8845101..31eda7e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -27,19 +27,19 @@
     <relativePath/>
   </parent>
 
-  <artifactId>org.apache.sling.acldef.jcr</artifactId>
+  <artifactId>org.apache.sling.acldef.oak-jcr</artifactId>
   <packaging>bundle</packaging>
   <version>0.0.1-SNAPSHOT</version>
-  <name>Apache Sling ACL Definitions JCR module</name>
+  <name>Apache Sling ACL Definitions Oak/JCR module</name>
   <description>
-	  Applies ACLs to a JCR repository based on the output
+	  Applies ACLs to an Oak JCR repository based on the output
 	  of the ACL Definition Language parser.
   </description>
 
   <scm>
-    <connection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/acldef-jcr</connection>
-    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/acldef-jcr</developerConnection>
-    <url>https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/acldef-jcr</url>
+    <connection>scm:svn: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/acldef/oak-jcr</connection>
+    <developerConnection>scm:svn: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/acldef/oak-jcr</developerConnection>
+    <url> https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/acldef/oak-jcr</url>
   </scm>
   
   <build>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-repoinit] 16/43: SLING-5449 - the name is 'repoinit' instead as the parser is not JCR-specific

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.jcr.repoinit-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git

commit 6bc3f85b6a4075d25d6aa522a140b64bf080a61a
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Fri Jan 22 15:44:17 2016 +0000

    SLING-5449 - the name is 'repoinit' instead as the parser is not JCR-specific
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/repoinit/oak-jcr@1726242 13f79535-47bb-0310-9956-ffa450edef68

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-repoinit] 37/43: SLING-5819 - jcr.repoinit bundle should only export what's strictly needed

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.jcr.repoinit-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git

commit 1a15e8633e21efbac543d6537a352ba8083c6eac
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Mon Jul 4 11:38:33 2016 +0000

    SLING-5819 - jcr.repoinit bundle should only export what's strictly needed
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/repoinit/jcr@1751251 13f79535-47bb-0310-9956-ffa450edef68
---
 ...kage-info.java => JcrRepoInitOpsProcessor.java} | 19 +++++++----
 .../JcrRepoInitOperationVisitor.java}              |  8 ++---
 .../jcr/impl/JcrRepoInitOpsProcessorImpl.java      | 38 ++++++++++++++++++++++
 .../jcr/{ => impl}/RepositoryInitializer.java      | 20 ++++++------
 .../apache/sling/repoinit/jcr/package-info.java    |  2 +-
 .../apache/sling/repoinit/jcr/CreatePathsTest.java |  1 +
 .../sling/repoinit/jcr/CreateServiceUsersTest.java |  1 +
 .../apache/sling/repoinit/jcr/GeneralAclTest.java  |  1 +
 .../sling/repoinit/jcr/NonExistentPathTest.java    |  1 +
 .../sling/repoinit/jcr/{ => impl}/TestUtil.java    | 29 +++++++++--------
 10 files changed, 84 insertions(+), 36 deletions(-)

diff --git a/src/main/java/org/apache/sling/repoinit/jcr/package-info.java b/src/main/java/org/apache/sling/repoinit/jcr/JcrRepoInitOpsProcessor.java
similarity index 69%
copy from src/main/java/org/apache/sling/repoinit/jcr/package-info.java
copy to src/main/java/org/apache/sling/repoinit/jcr/JcrRepoInitOpsProcessor.java
index a2fd18a..572a41e 100644
--- a/src/main/java/org/apache/sling/repoinit/jcr/package-info.java
+++ b/src/main/java/org/apache/sling/repoinit/jcr/JcrRepoInitOpsProcessor.java
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
@@ -6,16 +6,23 @@
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
  *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ *      http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- ******************************************************************************/
-
-@Version("1.0.0")
+ */
 package org.apache.sling.repoinit.jcr;
 
-import aQute.bnd.annotation.Version;
+import java.util.List;
+
+import javax.jcr.Session;
+
+import org.apache.sling.repoinit.parser.operations.Operation;
+
+/** Apply Operations produced by the repoinit parser to a JCR Repository */
+public interface JcrRepoInitOpsProcessor {
+    void apply(Session session, List<Operation> ops);
+}
diff --git a/src/main/java/org/apache/sling/repoinit/jcr/JcrRepoInitOpVisitor.java b/src/main/java/org/apache/sling/repoinit/jcr/impl/JcrRepoInitOperationVisitor.java
similarity index 95%
rename from src/main/java/org/apache/sling/repoinit/jcr/JcrRepoInitOpVisitor.java
rename to src/main/java/org/apache/sling/repoinit/jcr/impl/JcrRepoInitOperationVisitor.java
index 8abb41b..bfe7e97 100644
--- a/src/main/java/org/apache/sling/repoinit/jcr/JcrRepoInitOpVisitor.java
+++ b/src/main/java/org/apache/sling/repoinit/jcr/impl/JcrRepoInitOperationVisitor.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.sling.repoinit.jcr;
+package org.apache.sling.repoinit.jcr.impl;
 
 import static org.apache.sling.repoinit.parser.operations.AclLine.PROP_PATHS;
 import static org.apache.sling.repoinit.parser.operations.AclLine.PROP_PRINCIPALS;
@@ -25,8 +25,6 @@ import java.util.List;
 import javax.jcr.Node;
 import javax.jcr.Session;
 
-import org.apache.sling.repoinit.jcr.impl.AclUtil;
-import org.apache.sling.repoinit.jcr.impl.ServiceUserUtil;
 import org.apache.sling.repoinit.parser.operations.AclLine;
 import org.apache.sling.repoinit.parser.operations.CreatePath;
 import org.apache.sling.repoinit.parser.operations.CreateServiceUser;
@@ -39,7 +37,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /** JCR visitor for the Operations produced by the repoinit parser */
-public class JcrRepoInitOpVisitor implements OperationVisitor {
+class JcrRepoInitOperationVisitor implements OperationVisitor {
 
     private final Logger log = LoggerFactory.getLogger(getClass());
     
@@ -49,7 +47,7 @@ public class JcrRepoInitOpVisitor implements OperationVisitor {
      * @param s must have sufficient rights to create users
      *      and set ACLs.
      */
-    public JcrRepoInitOpVisitor(Session s) {
+    public JcrRepoInitOperationVisitor(Session s) {
         session = s;
     }
     
diff --git a/src/main/java/org/apache/sling/repoinit/jcr/impl/JcrRepoInitOpsProcessorImpl.java b/src/main/java/org/apache/sling/repoinit/jcr/impl/JcrRepoInitOpsProcessorImpl.java
new file mode 100644
index 0000000..c4e3ed0
--- /dev/null
+++ b/src/main/java/org/apache/sling/repoinit/jcr/impl/JcrRepoInitOpsProcessorImpl.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sling.repoinit.jcr.impl;
+
+import java.util.List;
+
+import javax.jcr.Session;
+
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Service;
+import org.apache.sling.repoinit.jcr.JcrRepoInitOpsProcessor;
+import org.apache.sling.repoinit.parser.operations.Operation;
+
+/** Apply Operations produced by the repoinit parser to a JCR Repository */
+@Component
+@Service(JcrRepoInitOpsProcessor.class)
+public class JcrRepoInitOpsProcessorImpl implements JcrRepoInitOpsProcessor {
+    public void apply(Session session, List<Operation> ops) {
+        final JcrRepoInitOperationVisitor v = new JcrRepoInitOperationVisitor(session);
+        for(Operation op : ops) {
+            op.accept(v);
+        }
+    }
+}
diff --git a/src/main/java/org/apache/sling/repoinit/jcr/RepositoryInitializer.java b/src/main/java/org/apache/sling/repoinit/jcr/impl/RepositoryInitializer.java
similarity index 94%
rename from src/main/java/org/apache/sling/repoinit/jcr/RepositoryInitializer.java
rename to src/main/java/org/apache/sling/repoinit/jcr/impl/RepositoryInitializer.java
index 648d073..adbca24 100644
--- a/src/main/java/org/apache/sling/repoinit/jcr/RepositoryInitializer.java
+++ b/src/main/java/org/apache/sling/repoinit/jcr/impl/RepositoryInitializer.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.sling.repoinit.jcr;
+package org.apache.sling.repoinit.jcr.impl;
 
 import java.io.IOException;
 import java.io.InputStream;
@@ -22,6 +22,7 @@ import java.io.StringReader;
 import java.io.StringWriter;
 import java.net.URL;
 import java.net.URLConnection;
+import java.util.List;
 import java.util.Map;
 
 import javax.jcr.Session;
@@ -40,6 +41,7 @@ import org.apache.sling.provisioning.model.Feature;
 import org.apache.sling.provisioning.model.Model;
 import org.apache.sling.provisioning.model.Section;
 import org.apache.sling.provisioning.model.io.ModelReader;
+import org.apache.sling.repoinit.jcr.JcrRepoInitOpsProcessor;
 import org.apache.sling.repoinit.parser.RepoInitParser;
 import org.apache.sling.repoinit.parser.operations.Operation;
 import org.osgi.framework.Constants;
@@ -87,6 +89,9 @@ public class RepositoryInitializer implements SlingRepositoryInitializer {
     @Reference
     private RepoInitParser parser;
     
+    @Reference
+    private JcrRepoInitOpsProcessor processor;
+    
     @Activate
     public void activate(Map<String, Object> config) {
         textURL = PropertiesUtil.toString(config.get(PROP_TEXT_URL), DEFAULT_TEXT_URL);
@@ -96,19 +101,14 @@ public class RepositoryInitializer implements SlingRepositoryInitializer {
     @Override
     public void processRepository(SlingRepository repo) throws Exception {
         final String repoinit = getRepoInitText();
-        int count=0;
         
         // loginAdministrative is ok here, definitely an admin operation
         final Session s = repo.loginAdministrative(null);
-        final JcrRepoInitOpVisitor v = new JcrRepoInitOpVisitor(s);
         try {
-            for(Operation op : parser.parse(new StringReader(repoinit))) {
-                count++;
-                log.info("Executing {}", op);
-                op.accept(v);
-            }
+            final List<Operation> ops = parser.parse(new StringReader(repoinit));
+            log.info("Executing {} repoinit operations", ops.size());
+            processor.apply(s, ops);
             s.save();
-            log.info("{} repoinit operations executed", count);
         } finally {
             s.logout();
         }
@@ -164,4 +164,4 @@ public class RepositoryInitializer implements SlingRepositoryInitializer {
         }
         return result;
     }
-}
\ No newline at end of file
+}
diff --git a/src/main/java/org/apache/sling/repoinit/jcr/package-info.java b/src/main/java/org/apache/sling/repoinit/jcr/package-info.java
index a2fd18a..a672011 100644
--- a/src/main/java/org/apache/sling/repoinit/jcr/package-info.java
+++ b/src/main/java/org/apache/sling/repoinit/jcr/package-info.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  ******************************************************************************/
 
-@Version("1.0.0")
+@Version("1.1.0")
 package org.apache.sling.repoinit.jcr;
 
 import aQute.bnd.annotation.Version;
diff --git a/src/test/java/org/apache/sling/repoinit/jcr/CreatePathsTest.java b/src/test/java/org/apache/sling/repoinit/jcr/CreatePathsTest.java
index faf5cf2..23a560e 100644
--- a/src/test/java/org/apache/sling/repoinit/jcr/CreatePathsTest.java
+++ b/src/test/java/org/apache/sling/repoinit/jcr/CreatePathsTest.java
@@ -21,6 +21,7 @@ import java.io.IOException;
 import javax.jcr.RepositoryException;
 
 import org.apache.sling.commons.testing.jcr.RepositoryUtil;
+import org.apache.sling.repoinit.jcr.impl.TestUtil;
 import org.apache.sling.testing.mock.sling.ResourceResolverType;
 import org.apache.sling.testing.mock.sling.junit.SlingContext;
 import org.junit.Before;
diff --git a/src/test/java/org/apache/sling/repoinit/jcr/CreateServiceUsersTest.java b/src/test/java/org/apache/sling/repoinit/jcr/CreateServiceUsersTest.java
index db31485..4cbdcd4 100644
--- a/src/test/java/org/apache/sling/repoinit/jcr/CreateServiceUsersTest.java
+++ b/src/test/java/org/apache/sling/repoinit/jcr/CreateServiceUsersTest.java
@@ -20,6 +20,7 @@ import java.util.Random;
 
 import javax.jcr.RepositoryException;
 
+import org.apache.sling.repoinit.jcr.impl.TestUtil;
 import org.apache.sling.testing.mock.sling.ResourceResolverType;
 import org.apache.sling.testing.mock.sling.junit.SlingContext;
 import org.junit.Before;
diff --git a/src/test/java/org/apache/sling/repoinit/jcr/GeneralAclTest.java b/src/test/java/org/apache/sling/repoinit/jcr/GeneralAclTest.java
index 0055d83..01424c7 100644
--- a/src/test/java/org/apache/sling/repoinit/jcr/GeneralAclTest.java
+++ b/src/test/java/org/apache/sling/repoinit/jcr/GeneralAclTest.java
@@ -26,6 +26,7 @@ import javax.jcr.PathNotFoundException;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 
+import org.apache.sling.repoinit.jcr.impl.TestUtil;
 import org.apache.sling.repoinit.parser.RepoInitParsingException;
 import org.apache.sling.testing.mock.sling.ResourceResolverType;
 import org.apache.sling.testing.mock.sling.junit.SlingContext;
diff --git a/src/test/java/org/apache/sling/repoinit/jcr/NonExistentPathTest.java b/src/test/java/org/apache/sling/repoinit/jcr/NonExistentPathTest.java
index bb727b0..4c11e8f 100644
--- a/src/test/java/org/apache/sling/repoinit/jcr/NonExistentPathTest.java
+++ b/src/test/java/org/apache/sling/repoinit/jcr/NonExistentPathTest.java
@@ -23,6 +23,7 @@ import javax.jcr.PathNotFoundException;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 
+import org.apache.sling.repoinit.jcr.impl.TestUtil;
 import org.apache.sling.repoinit.parser.RepoInitParsingException;
 import org.apache.sling.testing.mock.sling.ResourceResolverType;
 import org.apache.sling.testing.mock.sling.junit.SlingContext;
diff --git a/src/test/java/org/apache/sling/repoinit/jcr/TestUtil.java b/src/test/java/org/apache/sling/repoinit/jcr/impl/TestUtil.java
similarity index 78%
rename from src/test/java/org/apache/sling/repoinit/jcr/TestUtil.java
rename to src/test/java/org/apache/sling/repoinit/jcr/impl/TestUtil.java
index 7d72df8..42e173c 100644
--- a/src/test/java/org/apache/sling/repoinit/jcr/TestUtil.java
+++ b/src/test/java/org/apache/sling/repoinit/jcr/impl/TestUtil.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.sling.repoinit.jcr;
+package org.apache.sling.repoinit.jcr.impl;
 
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
@@ -33,6 +33,7 @@ import javax.jcr.SimpleCredentials;
 import org.apache.commons.io.IOUtils;
 import org.apache.jackrabbit.api.security.user.Authorizable;
 import org.apache.jackrabbit.api.security.user.User;
+import org.apache.sling.repoinit.jcr.impl.JcrRepoInitOperationVisitor;
 import org.apache.sling.repoinit.jcr.impl.ServiceUserUtil;
 import org.apache.sling.repoinit.parser.RepoInitParsingException;
 import org.apache.sling.repoinit.parser.impl.RepoInitParserService;
@@ -40,20 +41,20 @@ import org.apache.sling.repoinit.parser.operations.Operation;
 import org.apache.sling.testing.mock.sling.junit.SlingContext;
 
 /** Test utilities */
-class TestUtil {
+public class TestUtil {
     
     public static final String JCR_PRIMARY_TYPE = "jcr:primaryType";
-    final Session adminSession;
-    final String id;
-    final String username;
+    public final Session adminSession;
+    public final String id;
+    public final String username;
     
-    TestUtil(SlingContext ctx) {
+    public TestUtil(SlingContext ctx) {
         adminSession = ctx.resourceResolver().adaptTo(Session.class);
         id = UUID.randomUUID().toString();
         username = "user_" + id;
     }
     
-    List<Operation> parse(String input) throws RepoInitParsingException {
+    public List<Operation> parse(String input) throws RepoInitParsingException {
         final Reader r = new StringReader(input);
         try {
             return new RepoInitParserService().parse(r);
@@ -62,7 +63,7 @@ class TestUtil {
         }
     }
 
-    void assertServiceUser(String info, String id, boolean expectToExist) throws RepositoryException {
+    public void assertServiceUser(String info, String id, boolean expectToExist) throws RepositoryException {
         final Authorizable a = ServiceUserUtil.getUserManager(adminSession).getAuthorizable(id);
         if(!expectToExist) {
             assertNull(info + ", expecting Principal to be absent:" + id, a);
@@ -73,11 +74,11 @@ class TestUtil {
         }
     }
     
-    void assertNodeExists(String path) throws RepositoryException {
+    public void assertNodeExists(String path) throws RepositoryException {
         assertNodeExists(path, null);
     }
     
-    void assertNodeExists(String path, String primaryType) throws RepositoryException {
+    public void assertNodeExists(String path, String primaryType) throws RepositoryException {
         if(!adminSession.nodeExists(path)) {
             fail("Node does not exist:" + path);
         }
@@ -93,20 +94,20 @@ class TestUtil {
         }
     }
     
-    void parseAndExecute(String input) throws RepositoryException, RepoInitParsingException {
-        final JcrRepoInitOpVisitor v = new JcrRepoInitOpVisitor(adminSession);
+    public void parseAndExecute(String input) throws RepositoryException, RepoInitParsingException {
+        final JcrRepoInitOperationVisitor v = new JcrRepoInitOperationVisitor(adminSession);
         for(Operation o : parse(input)) {
             o.accept(v);
         }
         adminSession.save();
     }
     
-    void cleanupUser() throws RepositoryException, RepoInitParsingException {
+    public void cleanupUser() throws RepositoryException, RepoInitParsingException {
         parseAndExecute("delete service user " + username);
         assertServiceUser("in cleanupUser()", username, false);
     }
     
-    Session loginService(String serviceUsername) throws RepositoryException {
+    public Session loginService(String serviceUsername) throws RepositoryException {
         final SimpleCredentials cred = new SimpleCredentials(serviceUsername, new char[0]);
         return adminSession.impersonate(cred);
     }

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-repoinit] 07/43: SLING-5355 - better error reporting

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.jcr.repoinit-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git

commit 909608ba6832c9b1924fa7aede1ec5dc1c95def8
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Wed Dec 23 11:31:49 2015 +0000

    SLING-5355 - better error reporting
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/acldef/oak-jcr@1721523 13f79535-47bb-0310-9956-ffa450edef68
---
 src/main/java/org/apache/sling/acldef/jcr/AclOperationVisitor.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/sling/acldef/jcr/AclOperationVisitor.java b/src/main/java/org/apache/sling/acldef/jcr/AclOperationVisitor.java
index e4748ec..f99b1b6 100644
--- a/src/main/java/org/apache/sling/acldef/jcr/AclOperationVisitor.java
+++ b/src/main/java/org/apache/sling/acldef/jcr/AclOperationVisitor.java
@@ -89,7 +89,7 @@ public class AclOperationVisitor implements OperationVisitor {
         try {
             AclUtil.setAcl(s, principals, paths, privileges, isAllow);
         } catch(Exception e) {
-            throw new RuntimeException("Failed to set ACL (" + e.getClass().getSimpleName() + ") " + line, e);
+            throw new RuntimeException("Failed to set ACL (" + e.toString() + ") " + line, e);
         }
     }
     

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-repoinit] 33/43: [maven-release-plugin] prepare release org.apache.sling.repoinit.oak-jcr-1.0.0

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.jcr.repoinit-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git

commit 3663d69c0247758b85bfaaa6a0723410adc0ebd8
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Tue Jun 21 14:44:44 2016 +0000

    [maven-release-plugin] prepare release org.apache.sling.repoinit.oak-jcr-1.0.0
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/repoinit/oak-jcr@1749539 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/pom.xml b/pom.xml
index f8380dc..6d76d86 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,12 +24,12 @@
     <groupId>org.apache.sling</groupId>
     <artifactId>sling</artifactId>
     <version>26</version>
-    <relativePath/>
+    <relativePath />
   </parent>
 
   <artifactId>org.apache.sling.repoinit.oak-jcr</artifactId>
   <packaging>bundle</packaging>
-  <version>0.0.1-SNAPSHOT</version>
+  <version>1.0.0</version>
   <name>Apache Sling RepoInit Oak/JCR module</name>
   <description>
 	  Initializes a JCR repository based on the output
@@ -41,9 +41,9 @@
   </properties>
 
   <scm>
-    <connection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/repoinit/oak-jcr</connection>
-    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/repoinit/oak-jcr</developerConnection>
-    <url>https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/repoinit/oak-jcr</url>
+    <connection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.repoinit.oak-jcr-1.0.0</connection>
+    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.repoinit.oak-jcr-1.0.0</developerConnection>
+    <url>https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.repoinit.oak-jcr-1.0.0</url>
   </scm>
   
   <build>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-repoinit] 06/43: SLING-5355 - cleanup tests

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.jcr.repoinit-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git

commit a52d167e8820f048d58da12161ab8a6ea0e060ff
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Wed Dec 23 11:27:28 2015 +0000

    SLING-5355 - cleanup tests
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/acldef/oak-jcr@1721522 13f79535-47bb-0310-9956-ffa450edef68
---
 ...otAddChildNodeTest.java => GeneralAclTest.java} | 24 ++++++++++++++++------
 .../sling/acldef/jcr/NonExistentPathTest.java      |  2 +-
 .../java/org/apache/sling/acldef/jcr/TestUtil.java |  5 +++++
 3 files changed, 24 insertions(+), 7 deletions(-)

diff --git a/src/test/java/org/apache/sling/acldef/jcr/RootAddChildNodeTest.java b/src/test/java/org/apache/sling/acldef/jcr/GeneralAclTest.java
similarity index 84%
rename from src/test/java/org/apache/sling/acldef/jcr/RootAddChildNodeTest.java
rename to src/test/java/org/apache/sling/acldef/jcr/GeneralAclTest.java
index 63d5b3e..c4cfb12 100644
--- a/src/test/java/org/apache/sling/acldef/jcr/RootAddChildNodeTest.java
+++ b/src/test/java/org/apache/sling/acldef/jcr/GeneralAclTest.java
@@ -34,8 +34,8 @@ import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 
-/** Test root node and node creation privileges */
-public class RootAddChildNodeTest {
+/** Various ACL-related tests */
+public class GeneralAclTest {
 
     @Rule
     public final SlingContext context = new SlingContext(ResourceResolverType.JCR_OAK);
@@ -52,17 +52,17 @@ public class RootAddChildNodeTest {
 
     @After
     public void cleanup() throws ParseException, RepositoryException {
-        U.parseAndExecute("delete service user " + U.username);
+        U.cleanupUser();
         s.logout();
     }
     
     @Test(expected=AccessDeniedException.class)
-    public void getRootNodeFails() throws Exception {
+    public void getRootNodeIntiallyFails() throws Exception {
         s.getRootNode();
     }
     
     @Test
-    public void readOnlyThenWrite() throws Exception {
+    public void readOnlyThenWriteThenDeny() throws Exception {
         final Node tmp = U.adminSession.getRootNode().addNode("tmp_" + U.id);
         U.adminSession.save();
         final String path = tmp.getPath();
@@ -84,7 +84,7 @@ public class RootAddChildNodeTest {
         try {
             n.setProperty("U.id", U.id);
             s.save();
-            fail("Expected write access to be denied:" + path);
+            fail("Expected write access to be initially denied:" + path);
         } catch(AccessDeniedException ignore) {
         }
         s.refresh(false);
@@ -97,6 +97,18 @@ public class RootAddChildNodeTest {
         U.parseAndExecute(allowWrite);
         n.setProperty("U.id", U.id);
         s.save();
+        
+        final String deny = 
+                "set ACL for " + U.username + "\n"
+                + "deny jcr:all on " + path + "\n"
+                + "end"
+                ;
+        U.parseAndExecute(deny);
+        try {
+            s.getNode(path);
+            fail("Expected access to be denied again:" + path);
+        } catch(PathNotFoundException ignore) {
+        }
     }
     
     @Test
diff --git a/src/test/java/org/apache/sling/acldef/jcr/NonExistentPathTest.java b/src/test/java/org/apache/sling/acldef/jcr/NonExistentPathTest.java
index 184853d..50746cc 100644
--- a/src/test/java/org/apache/sling/acldef/jcr/NonExistentPathTest.java
+++ b/src/test/java/org/apache/sling/acldef/jcr/NonExistentPathTest.java
@@ -48,7 +48,7 @@ public class NonExistentPathTest {
 
     @After
     public void cleanup() throws ParseException, RepositoryException {
-        U.parseAndExecute("delete service user " + U.username);
+        U.cleanupUser();
         s.logout();
     }
     
diff --git a/src/test/java/org/apache/sling/acldef/jcr/TestUtil.java b/src/test/java/org/apache/sling/acldef/jcr/TestUtil.java
index 70d5533..ea9c9bb 100644
--- a/src/test/java/org/apache/sling/acldef/jcr/TestUtil.java
+++ b/src/test/java/org/apache/sling/acldef/jcr/TestUtil.java
@@ -77,6 +77,11 @@ class TestUtil {
         adminSession.save();
     }
     
+    void cleanupUser() throws ParseException, RepositoryException {
+        parseAndExecute("delete service user " + username);
+        assertServiceUser("in cleanupUser()", username, false);
+    }
+    
     Session loginService(String serviceUsername) throws RepositoryException {
         final SimpleCredentials cred = new SimpleCredentials(serviceUsername, new char[0]);
         return adminSession.impersonate(cred);

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-repoinit] 09/43: SLING-5355 - it's ok for service user to already exist

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.jcr.repoinit-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git

commit 1d0ac30e74fe848df9a823b70084bcb82011dda5
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Tue Dec 29 12:31:06 2015 +0000

    SLING-5355 - it's ok for service user to already exist
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/acldef/oak-jcr@1722119 13f79535-47bb-0310-9956-ffa450edef68
---
 .../org/apache/sling/acldef/jcr/AclOperationVisitor.java    |  8 ++++++--
 .../java/org/apache/sling/acldef/jcr/ServiceUserUtil.java   | 13 +++++++++++++
 .../org/apache/sling/acldef/jcr/CreateServiceUsersTest.java | 11 +++++++++++
 3 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/sling/acldef/jcr/AclOperationVisitor.java b/src/main/java/org/apache/sling/acldef/jcr/AclOperationVisitor.java
index bd6310c..19d43f8 100644
--- a/src/main/java/org/apache/sling/acldef/jcr/AclOperationVisitor.java
+++ b/src/main/java/org/apache/sling/acldef/jcr/AclOperationVisitor.java
@@ -58,9 +58,13 @@ public class AclOperationVisitor implements OperationVisitor {
     @Override
     public void visitCreateServiceUser(CreateServiceUser s) {
         final String id = s.getUsername();
-        log.info("Creating service user {}", id);
         try {
-            ServiceUserUtil.createServiceUser(session, id);
+            if(!ServiceUserUtil.serviceUserExists(session, id)) {
+                log.info("Creating service user {}", id);
+                ServiceUserUtil.createServiceUser(session, id);
+            } else {
+                log.info("Service user {} already exists, no changes made", id);
+            }
         } catch(Exception e) {
             report(e, "Unable to create service user [" + id + "]:" + e);
         }
diff --git a/src/main/java/org/apache/sling/acldef/jcr/ServiceUserUtil.java b/src/main/java/org/apache/sling/acldef/jcr/ServiceUserUtil.java
index 09b6426..2d131ce 100644
--- a/src/main/java/org/apache/sling/acldef/jcr/ServiceUserUtil.java
+++ b/src/main/java/org/apache/sling/acldef/jcr/ServiceUserUtil.java
@@ -21,6 +21,7 @@ import javax.jcr.Session;
 
 import org.apache.jackrabbit.api.JackrabbitSession;
 import org.apache.jackrabbit.api.security.user.Authorizable;
+import org.apache.jackrabbit.api.security.user.User;
 import org.apache.jackrabbit.api.security.user.UserManager;
 
 /** Utilities for Service Users management */
@@ -37,10 +38,22 @@ public class ServiceUserUtil {
         return getUserManager(session).getAuthorizable(username);
     }
     
+    /** Create a service user - fails if it already exists */
     public static void createServiceUser(Session s, String username) throws RepositoryException {
         getUserManager(s).createSystemUser(username, null);
     }
     
+    /** True if specified service user exists */
+    public static boolean serviceUserExists(Session session, String username) throws RepositoryException {
+        boolean result = false;
+        final Authorizable a = getAuthorizable(session, username);
+        if(a != null) {
+            final User u = (User)a;
+            result = u.isSystemUser();
+        }
+        return result;
+    }
+    
     public static void deleteServiceUser(Session s, String username) throws RepositoryException {
         final Authorizable a = getUserManager(s).getAuthorizable(username);
         if(a == null) {
diff --git a/src/test/java/org/apache/sling/acldef/jcr/CreateServiceUsersTest.java b/src/test/java/org/apache/sling/acldef/jcr/CreateServiceUsersTest.java
index 0f09972..23e4174 100644
--- a/src/test/java/org/apache/sling/acldef/jcr/CreateServiceUsersTest.java
+++ b/src/test/java/org/apache/sling/acldef/jcr/CreateServiceUsersTest.java
@@ -57,6 +57,17 @@ public class CreateServiceUsersTest {
     }
     
     @Test
+    public void createUserMultipleTimes() throws Exception {
+        final String username = namePrefix + "_multiple";
+        U.assertServiceUser("before test", username, false);
+        final String input = "create service user " + username;
+        for(int i=0; i < 50; i++) {
+            U.parseAndExecute(input);
+        }
+        U.assertServiceUser("after creating it multiple times", username, true);
+    }
+    
+    @Test
     public void createDeleteMultipleTest() throws Exception {
         final int n = 50;
         

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-repoinit] 19/43: SLING-5449 - rename the remaining things from ACL to 'repoinit'

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.jcr.repoinit-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git

commit 77904246ac6c77bc582481f1a84a3ec3f5436f51
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Fri Jan 22 18:33:42 2016 +0000

    SLING-5449 - rename the remaining things from ACL to 'repoinit'
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/repoinit/oak-jcr@1726273 13f79535-47bb-0310-9956-ffa450edef68
---
 .../repoinit/jcr/webconsole/OakAclDefConsolePlugin.java      | 12 ++++++------
 .../java/org/apache/sling/repoinit/jcr/GeneralAclTest.java   |  6 +++---
 .../org/apache/sling/repoinit/jcr/NonExistentPathTest.java   |  6 +++---
 src/test/java/org/apache/sling/repoinit/jcr/TestUtil.java    | 12 ++++++------
 4 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/src/main/java/org/apache/sling/repoinit/jcr/webconsole/OakAclDefConsolePlugin.java b/src/main/java/org/apache/sling/repoinit/jcr/webconsole/OakAclDefConsolePlugin.java
index 464f5b0..48bc4c5 100644
--- a/src/main/java/org/apache/sling/repoinit/jcr/webconsole/OakAclDefConsolePlugin.java
+++ b/src/main/java/org/apache/sling/repoinit/jcr/webconsole/OakAclDefConsolePlugin.java
@@ -40,13 +40,13 @@ import org.apache.felix.scr.annotations.Properties;
 import org.apache.felix.scr.annotations.Property;
 import org.apache.felix.scr.annotations.Reference;
 import org.apache.felix.scr.annotations.Service;
+import org.apache.sling.api.request.ResponseUtil;
+import org.apache.sling.jcr.api.SlingRepository;
 import org.apache.sling.repoinit.jcr.AclOperationVisitor;
-import org.apache.sling.repoinit.parser.AclDefinitionsParser;
-import org.apache.sling.repoinit.parser.AclParsingException;
+import org.apache.sling.repoinit.parser.RepoInitParser;
+import org.apache.sling.repoinit.parser.RepoInitParsingException;
 import org.apache.sling.repoinit.parser.operations.Operation;
 import org.apache.sling.repoinit.parser.operations.OperationVisitor;
-import org.apache.sling.api.request.ResponseUtil;
-import org.apache.sling.jcr.api.SlingRepository;
 import org.osgi.framework.Constants;
 
 @Component
@@ -81,7 +81,7 @@ public class OakAclDefConsolePlugin extends HttpServlet {
     private SlingRepository repository;
 
     @Reference
-    private AclDefinitionsParser parser;
+    private RepoInitParser parser;
 
     private String thisPath(HttpServletRequest request) {
         return request.getContextPath() + request.getServletPath() + request.getPathInfo();
@@ -160,7 +160,7 @@ public class OakAclDefConsolePlugin extends HttpServlet {
         }
     }
     
-    private void setAcl(String aclDef) throws RepositoryException, IOException, AclParsingException {
+    private void setAcl(String aclDef) throws RepositoryException, IOException, RepoInitParsingException {
         final Reader r = new StringReader(aclDef);
         Session s = null;
         try {
diff --git a/src/test/java/org/apache/sling/repoinit/jcr/GeneralAclTest.java b/src/test/java/org/apache/sling/repoinit/jcr/GeneralAclTest.java
index 5634a21..0055d83 100644
--- a/src/test/java/org/apache/sling/repoinit/jcr/GeneralAclTest.java
+++ b/src/test/java/org/apache/sling/repoinit/jcr/GeneralAclTest.java
@@ -26,7 +26,7 @@ import javax.jcr.PathNotFoundException;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 
-import org.apache.sling.repoinit.parser.AclParsingException;
+import org.apache.sling.repoinit.parser.RepoInitParsingException;
 import org.apache.sling.testing.mock.sling.ResourceResolverType;
 import org.apache.sling.testing.mock.sling.junit.SlingContext;
 import org.junit.After;
@@ -44,14 +44,14 @@ public class GeneralAclTest {
     private Session s;
     
     @Before
-    public void setup() throws RepositoryException, AclParsingException {
+    public void setup() throws RepositoryException, RepoInitParsingException {
         U = new TestUtil(context);
         U.parseAndExecute("create service user " + U.username);
         s = U.loginService(U.username);
     }
 
     @After
-    public void cleanup() throws RepositoryException, AclParsingException {
+    public void cleanup() throws RepositoryException, RepoInitParsingException {
         U.cleanupUser();
         s.logout();
     }
diff --git a/src/test/java/org/apache/sling/repoinit/jcr/NonExistentPathTest.java b/src/test/java/org/apache/sling/repoinit/jcr/NonExistentPathTest.java
index 9e20ea0..bb727b0 100644
--- a/src/test/java/org/apache/sling/repoinit/jcr/NonExistentPathTest.java
+++ b/src/test/java/org/apache/sling/repoinit/jcr/NonExistentPathTest.java
@@ -23,7 +23,7 @@ import javax.jcr.PathNotFoundException;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 
-import org.apache.sling.repoinit.parser.AclParsingException;
+import org.apache.sling.repoinit.parser.RepoInitParsingException;
 import org.apache.sling.testing.mock.sling.ResourceResolverType;
 import org.apache.sling.testing.mock.sling.junit.SlingContext;
 import org.junit.After;
@@ -41,14 +41,14 @@ public class NonExistentPathTest {
     private Session s;
     
     @Before
-    public void setup() throws RepositoryException, AclParsingException {
+    public void setup() throws RepositoryException, RepoInitParsingException {
         U = new TestUtil(context);
         U.parseAndExecute("create service user " + U.username);
         s = U.loginService(U.username);
     }
 
     @After
-    public void cleanup() throws RepositoryException, AclParsingException {
+    public void cleanup() throws RepositoryException, RepoInitParsingException {
         U.cleanupUser();
         s.logout();
     }
diff --git a/src/test/java/org/apache/sling/repoinit/jcr/TestUtil.java b/src/test/java/org/apache/sling/repoinit/jcr/TestUtil.java
index 5c68f3f..0a0681e 100644
--- a/src/test/java/org/apache/sling/repoinit/jcr/TestUtil.java
+++ b/src/test/java/org/apache/sling/repoinit/jcr/TestUtil.java
@@ -32,8 +32,8 @@ import org.apache.commons.io.IOUtils;
 import org.apache.jackrabbit.api.security.user.Authorizable;
 import org.apache.jackrabbit.api.security.user.User;
 import org.apache.sling.repoinit.jcr.impl.ServiceUserUtil;
-import org.apache.sling.repoinit.parser.AclParsingException;
-import org.apache.sling.repoinit.parser.impl.ACLDefinitionsParserService;
+import org.apache.sling.repoinit.parser.RepoInitParsingException;
+import org.apache.sling.repoinit.parser.impl.RepoInitParserService;
 import org.apache.sling.repoinit.parser.operations.Operation;
 import org.apache.sling.testing.mock.sling.junit.SlingContext;
 
@@ -50,10 +50,10 @@ class TestUtil {
         username = "user_" + id;
     }
     
-    List<Operation> parse(String input) throws AclParsingException {
+    List<Operation> parse(String input) throws RepoInitParsingException {
         final Reader r = new StringReader(input);
         try {
-            return new ACLDefinitionsParserService().parse(r);
+            return new RepoInitParserService().parse(r);
         } finally {
             IOUtils.closeQuietly(r);
         }
@@ -70,7 +70,7 @@ class TestUtil {
         }
     }
     
-    void parseAndExecute(String input) throws RepositoryException, AclParsingException {
+    void parseAndExecute(String input) throws RepositoryException, RepoInitParsingException {
         final AclOperationVisitor v = new AclOperationVisitor(adminSession);
         for(Operation o : parse(input)) {
             o.accept(v);
@@ -78,7 +78,7 @@ class TestUtil {
         adminSession.save();
     }
     
-    void cleanupUser() throws RepositoryException, AclParsingException {
+    void cleanupUser() throws RepositoryException, RepoInitParsingException {
         parseAndExecute("delete service user " + username);
         assertServiceUser("in cleanupUser()", username, false);
     }

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-repoinit] 21/43: SLING-5449 - remove console plugin, we don't want this module to be Sling specific

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.jcr.repoinit-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git

commit 9bd6e4b220fe96d9df64c96e281daf22c2735550
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Fri Jan 22 18:51:07 2016 +0000

    SLING-5449 - remove console plugin, we don't want this module to be Sling specific
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/repoinit/oak-jcr@1726286 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                            |  18 --
 .../jcr/webconsole/OakAclDefConsolePlugin.java     | 206 ---------------------
 2 files changed, 224 deletions(-)

diff --git a/pom.xml b/pom.xml
index f723df2..7e95f68 100644
--- a/pom.xml
+++ b/pom.xml
@@ -94,24 +94,6 @@
     </dependency>
      <dependency>
       <groupId>org.apache.sling</groupId>
-      <artifactId>org.apache.sling.api</artifactId>
-      <version>2.4.0</version>
-      <scope>provided</scope>
-    </dependency>
-     <dependency>
-      <groupId>org.apache.sling</groupId>
-      <artifactId>org.apache.sling.jcr.api</artifactId>
-      <version>2.0.4</version>
-      <scope>provided</scope>
-    </dependency>
-     <dependency>
-      <groupId>org.apache.sling</groupId>
-      <artifactId>org.apache.sling.commons.threads</artifactId>
-      <version>3.0.0</version>
-      <scope>provided</scope>
-    </dependency>
-     <dependency>
-      <groupId>org.apache.sling</groupId>
       <artifactId>org.apache.sling.repoinit.parser</artifactId>
 	  <version>0.0.1-SNAPSHOT</version>
 	  <scope>provided</scope>
diff --git a/src/main/java/org/apache/sling/repoinit/jcr/webconsole/OakAclDefConsolePlugin.java b/src/main/java/org/apache/sling/repoinit/jcr/webconsole/OakAclDefConsolePlugin.java
deleted file mode 100644
index e432188..0000000
--- a/src/main/java/org/apache/sling/repoinit/jcr/webconsole/OakAclDefConsolePlugin.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.sling.repoinit.jcr.webconsole;
-
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.Reader;
-import java.io.StringReader;
-import java.io.UnsupportedEncodingException;
-import java.net.URL;
-import java.net.URLEncoder;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import javax.servlet.Servlet;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Properties;
-import org.apache.felix.scr.annotations.Property;
-import org.apache.felix.scr.annotations.Reference;
-import org.apache.felix.scr.annotations.Service;
-import org.apache.sling.api.request.ResponseUtil;
-import org.apache.sling.jcr.api.SlingRepository;
-import org.apache.sling.repoinit.jcr.JcrRepoInitOpVisitor;
-import org.apache.sling.repoinit.parser.RepoInitParser;
-import org.apache.sling.repoinit.parser.RepoInitParsingException;
-import org.apache.sling.repoinit.parser.operations.Operation;
-import org.apache.sling.repoinit.parser.operations.OperationVisitor;
-import org.osgi.framework.Constants;
-
-@Component
-@Service(value=Servlet.class)
-@Properties({
-    @Property(name=Constants.SERVICE_VENDOR, value="The Apache Software Foundation"),
-    @Property(name=Constants.SERVICE_DESCRIPTION, value="Apache Sling ACL Definitions Console Plugin"),
-    @Property(name="felix.webconsole.label", value=OakAclDefConsolePlugin.LABEL),
-    @Property(name="felix.webconsole.title", value="Set ACLs"),
-    @Property(name="felix.webconsole.css", value="/" + OakAclDefConsolePlugin.LABEL + "/res/ui/repoinit.css"),
-    @Property(name="felix.webconsole.category", value="Sling"),
-})
-public class OakAclDefConsolePlugin extends HttpServlet {
-
-    private static final long serialVersionUID = 1234;
-    private static final String PAR_ACLDEF = "repoinit";
-    private static final String PAR_MSG = "msg";
-    public static final String LABEL = "setACL";
-    private static final String ATTR_SUBMIT = "plugin.submit";
-    private AtomicInteger counter = new AtomicInteger();
-
-    private static final String EXAMPLE =
-            "# Example ACL definition\n"
-            + "# (with service user creation commented out)\n"
-            + "# create service user test_42\n"
-            + "set ACL for test_42\n"
-            + "  allow jcr:read,jcr:modifyProperties on /tmp\n"
-            + "end\n"
-            ;
-    
-    @Reference
-    private SlingRepository repository;
-
-    @Reference
-    private RepoInitParser parser;
-
-    private String thisPath(HttpServletRequest request) {
-        return request.getContextPath() + request.getServletPath() + request.getPathInfo();
-    }
-    
-    @Override
-    protected void doGet(final HttpServletRequest request, final HttpServletResponse response) 
-            throws ServletException, IOException {
-        String aclDef = request.getParameter(PAR_ACLDEF);
-        if(aclDef == null || aclDef.trim().length() == 0) {
-            aclDef = EXAMPLE;
-        }
-        
-        String msg = request.getParameter(PAR_MSG);
-        if(msg == null) {
-            msg = "";
-        }
-
-        final PrintWriter pw = response.getWriter();
-        pw.println("<table class='content' cellpadding='0' cellspacing='0' width='100%'>");
-        titleHtml(
-                pw,
-                "ACL definitions",
-                "To create service users or set ACLs, enter a valid statement below."
-                );
-
-        pw.println("<tr class='content'>");
-        pw.print("<td class='content' colspan='3'>");
-        pw.print("<form method='post' action='" + thisPath(request) + "'>");
-        pw.print("<input type='submit' name='" + ATTR_SUBMIT + "' value='Execute' class='submit'>");
-        pw.print("<div class='msg'>");
-        pw.print(msg);
-        pw.println("</div>");
-        pw.print("<textarea type='text' name='" + PAR_ACLDEF + "' class='input' cols='80' rows='25'>");
-        pw.print(ResponseUtil.escapeXml(aclDef));
-        pw.println("</textarea>");
-        pw.print("</form>");
-        pw.print("</td>");
-        pw.println("</tr>");
-        pw.println("</table>");
-    }
-
-    @Override
-    protected void doPost(HttpServletRequest request,
-            HttpServletResponse response) throws ServletException, IOException {
-
-        String aclDef = request.getParameter(PAR_ACLDEF);
-        String msg = "No ACL definitions executed";
-        if(aclDef == null || aclDef.trim().length() == 0) {
-            aclDef = "";
-        } else {
-            try {
-                setAcl(aclDef);
-                msg = "ACL definitions successfully executed";
-            } catch(Exception e) {
-                throw new ServletException("Error setting ACLs:\n" + e.getMessage(), e);
-            }
-        }
-        msg += " (" + counter.incrementAndGet() + ")";
-        
-        // Redirect to GET on the same page
-        final StringBuilder target = new StringBuilder();
-        target
-            .append(thisPath(request))
-            .append("?").append(PAR_ACLDEF).append("=").append(encodeParam(aclDef))
-            .append("&").append(PAR_MSG).append("=").append(encodeParam(msg))
-        ;
-        response.sendRedirect(target.toString());
-    }
-    
-    private static String encodeParam(final String value) {
-        try {
-            return URLEncoder.encode(value, "UTF-8");
-        } catch (UnsupportedEncodingException e) {
-            throw new RuntimeException("Unexpected UnsupportedEncodingException", e);
-        }
-    }
-    
-    private void setAcl(String aclDef) throws RepositoryException, IOException, RepoInitParsingException {
-        final Reader r = new StringReader(aclDef);
-        Session s = null;
-        try {
-            s = repository.loginAdministrative(null);
-            final OperationVisitor v = new JcrRepoInitOpVisitor(s);
-            for(Operation op : parser.parse(r)) {
-                op.accept(v);
-            }
-            s.save();
-        } finally {
-            r.close();
-            if(s != null) {
-                s.logout();
-            }
-        }
-    }
-
-    private void titleHtml(PrintWriter pw, String title, String description) {
-        pw.print("<tr class='content'>");
-        pw.print("<th colspan='3'class='content container'>");
-        pw.print(ResponseUtil.escapeXml(title));
-        pw.println("</th></tr>");
-
-        if (description != null) {
-            pw.print("<tr class='content'>");
-            pw.print("<td colspan='3'class='content'>");
-            pw.print(ResponseUtil.escapeXml(description));
-            pw.println("</th></tr>");
-        }
-    }
-
-    /**
-     * Method to retrieve static resources from this bundle.
-     */
-    @SuppressWarnings("unused")
-    private URL getResource(final String path) {
-        final String prefix = "/" + LABEL + "/res";
-        if(path.startsWith(prefix + "/ui")) {
-            return this.getClass().getResource(path.substring(prefix.length()));
-        }
-        return null;
-    }
-}

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-repoinit] 34/43: [maven-release-plugin] prepare for next development iteration

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.jcr.repoinit-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git

commit 60f5b7bc24f2bb3f03f88f993dee772ead8f8558
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Tue Jun 21 14:45:00 2016 +0000

    [maven-release-plugin] prepare for next development iteration
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/repoinit/oak-jcr@1749541 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pom.xml b/pom.xml
index 6d76d86..8cc55a2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -29,7 +29,7 @@
 
   <artifactId>org.apache.sling.repoinit.oak-jcr</artifactId>
   <packaging>bundle</packaging>
-  <version>1.0.0</version>
+  <version>1.0.1-SNAPSHOT</version>
   <name>Apache Sling RepoInit Oak/JCR module</name>
   <description>
 	  Initializes a JCR repository based on the output
@@ -41,9 +41,9 @@
   </properties>
 
   <scm>
-    <connection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.repoinit.oak-jcr-1.0.0</connection>
-    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.repoinit.oak-jcr-1.0.0</developerConnection>
-    <url>https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.repoinit.oak-jcr-1.0.0</url>
+    <connection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/repoinit/oak-jcr</connection>
+    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/repoinit/oak-jcr</developerConnection>
+    <url>https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/repoinit/oak-jcr</url>
   </scm>
   
   <build>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-repoinit] 10/43: SLING-5355 - AclSetupComponent, work in progress

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.jcr.repoinit-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git

commit 1bc8999096fbb1e62084fad24228260f908f3a21
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Wed Dec 30 10:58:37 2015 +0000

    SLING-5355 - AclSetupComponent, work in progress
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/acldef/oak-jcr@1722308 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                            |   6 +
 .../sling/acldef/jcr/impl/AclSetupComponent.java   | 154 +++++++++++++++++++++
 2 files changed, 160 insertions(+)

diff --git a/pom.xml b/pom.xml
index e0a4b01..70a623c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -106,6 +106,12 @@
     </dependency>
      <dependency>
       <groupId>org.apache.sling</groupId>
+      <artifactId>org.apache.sling.commons.threads</artifactId>
+      <version>3.0.0</version>
+      <scope>provided</scope>
+    </dependency>
+     <dependency>
+      <groupId>org.apache.sling</groupId>
       <artifactId>org.apache.sling.acldef.parser</artifactId>
 	  <version>0.0.1-SNAPSHOT</version>
 	  <scope>provided</scope>
diff --git a/src/main/java/org/apache/sling/acldef/jcr/impl/AclSetupComponent.java b/src/main/java/org/apache/sling/acldef/jcr/impl/AclSetupComponent.java
new file mode 100644
index 0000000..9c77c28
--- /dev/null
+++ b/src/main/java/org/apache/sling/acldef/jcr/impl/AclSetupComponent.java
@@ -0,0 +1,154 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sling.acldef.jcr.impl;
+
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import javax.jcr.Session;
+
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.ConfigurationPolicy;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.sling.acldef.jcr.AclOperationVisitor;
+import org.apache.sling.acldef.parser.AclDefinitionsParser;
+import org.apache.sling.acldef.parser.operations.Operation;
+import org.apache.sling.commons.threads.ThreadPool;
+import org.apache.sling.commons.threads.ThreadPoolManager;
+import org.apache.sling.jcr.api.SlingRepository;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import aQute.bnd.annotation.component.Deactivate;
+
+/** OSGi component that sets up service users and ACLS
+ *  based on configurations created by the acldef provisioning
+ *  model processor.
+ *  
+ *  As Oak requires a path to exist before setting an ACL on it,
+ *  this component needs to retry setting ACLs when that fails
+ *  due to a non-existing path.
+ */
+@Component(
+        configurationFactory=true,
+        metatype=false,
+        configurationPid=AclSetupComponent.CONFIG_PID,
+        policy=ConfigurationPolicy.REQUIRE)
+public class AclSetupComponent implements Runnable {
+    private final Logger log = LoggerFactory.getLogger(getClass());
+    public static final String CONFIG_PID = "org.apache.sling.acldef.jcr.AclSetupComponent";
+    public static final String ACLDEF_PROP_PREFIX = "acldef.text.";
+    public static final String THREAD_POOL_NAME = "ACL Definitions";
+    
+    private List<String> todo; 
+    private ThreadPool threadPool;
+    private boolean running;
+    
+    @Reference
+    AclDefinitionsParser parser;
+    
+    @Reference
+    ThreadPoolManager threadPoolManager;
+    
+    @Reference
+    SlingRepository repository;
+    
+    @Activate
+    public void activate(Map<String, Object> config) {
+        todo  = new ArrayList<String>();
+        threadPool = threadPoolManager.get(THREAD_POOL_NAME);
+        
+        for(String key : config.keySet()) {
+            if(key.startsWith(ACLDEF_PROP_PREFIX)) {
+                final String value = (String)config.get(key);
+                todo.add(value);
+            }
+        }
+        if(todo.isEmpty()) {
+            log.error("No {} properties in configuration {}, nothing to do", ACLDEF_PROP_PREFIX, config);
+        } else {
+            log.info("Got {} ACL definitions to execute asynchronously", todo.size());
+            running = true;
+            threadPool.execute(this);
+        }
+    }
+    
+    @Deactivate
+    public void deactivate(Map<String, Object> config) {
+        synchronized (this) {
+            running = false;
+            threadPoolManager.release(threadPool);
+        }
+    }
+
+    private void sleep(int msec) {
+        try {
+            Thread.sleep(msec);
+        } catch(InterruptedException ignore) {
+        }
+    }
+    
+    @Override
+    public void run() {
+        log.info("Applying {} ACL definition snippets", todo.size());
+
+        List<String> newTodo = new ArrayList<String>();
+        Session s = null;
+        try {
+            s = repository.loginAdministrative(null);
+            final AclOperationVisitor visitor = new AclOperationVisitor(s);
+            for(String acldef : todo) {
+                try {
+                    for(Operation op : parser.parse(new StringReader(acldef))) {
+                        op.accept(visitor);
+                        s.save();
+                    }
+                } catch(Exception e) {
+                    log.warn("Exception while executing an ACL definition:" + e.toString(), e);
+                    newTodo.add(acldef);
+                }
+            }
+        } catch(Exception e) {
+            log.warn("Exception while executing ACL definitions, will retry everything:" + e.toString(), e);
+            newTodo = todo;
+        } finally {
+            if(s != null) {
+                s.logout();
+            }
+        }
+        
+        // TODO schedule with exponential backoff?
+        if(!newTodo.isEmpty() && running) {
+            sleep(1000);
+        }
+        
+        synchronized (this) {
+            todo = newTodo;
+            if(todo.isEmpty()) {
+                log.info("All ACL definitions executed");
+            } else if(running) {
+                log.info("{} ACL definitions left to execute, will retry", todo.size());
+                threadPool.execute(this);
+            } else {
+                log.info("Some operations failed but not running anymore");
+            }
+        }
+    }
+}
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-repoinit] 20/43: SLING-5449 - rename one more thing from ACL to 'repoinit'

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.jcr.repoinit-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git

commit 8a6aec61c2aa3d966f866f70725533ff33e2cc5f
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Fri Jan 22 18:40:32 2016 +0000

    SLING-5449 - rename one more thing from ACL to 'repoinit'
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/repoinit/oak-jcr@1726279 13f79535-47bb-0310-9956-ffa450edef68
---
 .../jcr/{AclOperationVisitor.java => JcrRepoInitOpVisitor.java}  | 9 +++------
 .../sling/repoinit/jcr/webconsole/OakAclDefConsolePlugin.java    | 4 ++--
 src/test/java/org/apache/sling/repoinit/jcr/TestUtil.java        | 2 +-
 3 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/src/main/java/org/apache/sling/repoinit/jcr/AclOperationVisitor.java b/src/main/java/org/apache/sling/repoinit/jcr/JcrRepoInitOpVisitor.java
similarity index 94%
rename from src/main/java/org/apache/sling/repoinit/jcr/AclOperationVisitor.java
rename to src/main/java/org/apache/sling/repoinit/jcr/JcrRepoInitOpVisitor.java
index f206351..4bab1d9 100644
--- a/src/main/java/org/apache/sling/repoinit/jcr/AclOperationVisitor.java
+++ b/src/main/java/org/apache/sling/repoinit/jcr/JcrRepoInitOpVisitor.java
@@ -35,11 +35,8 @@ import org.apache.sling.repoinit.parser.operations.SetAclPrincipals;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-/** Processes the Operations produced by the ACL
- *  definitions parser to create the users and
- *  set the ACLs defined by the parser input.
- */
-public class AclOperationVisitor implements OperationVisitor {
+/** JCR visitor for the Operations produced by the repoinit parser */
+public class JcrRepoInitOpVisitor implements OperationVisitor {
 
     private final Logger log = LoggerFactory.getLogger(getClass());
     
@@ -49,7 +46,7 @@ public class AclOperationVisitor implements OperationVisitor {
      * @param s must have sufficient rights to create users
      *      and set ACLs.
      */
-    public AclOperationVisitor(Session s) {
+    public JcrRepoInitOpVisitor(Session s) {
         session = s;
     }
     
diff --git a/src/main/java/org/apache/sling/repoinit/jcr/webconsole/OakAclDefConsolePlugin.java b/src/main/java/org/apache/sling/repoinit/jcr/webconsole/OakAclDefConsolePlugin.java
index 48bc4c5..e432188 100644
--- a/src/main/java/org/apache/sling/repoinit/jcr/webconsole/OakAclDefConsolePlugin.java
+++ b/src/main/java/org/apache/sling/repoinit/jcr/webconsole/OakAclDefConsolePlugin.java
@@ -42,7 +42,7 @@ import org.apache.felix.scr.annotations.Reference;
 import org.apache.felix.scr.annotations.Service;
 import org.apache.sling.api.request.ResponseUtil;
 import org.apache.sling.jcr.api.SlingRepository;
-import org.apache.sling.repoinit.jcr.AclOperationVisitor;
+import org.apache.sling.repoinit.jcr.JcrRepoInitOpVisitor;
 import org.apache.sling.repoinit.parser.RepoInitParser;
 import org.apache.sling.repoinit.parser.RepoInitParsingException;
 import org.apache.sling.repoinit.parser.operations.Operation;
@@ -165,7 +165,7 @@ public class OakAclDefConsolePlugin extends HttpServlet {
         Session s = null;
         try {
             s = repository.loginAdministrative(null);
-            final OperationVisitor v = new AclOperationVisitor(s);
+            final OperationVisitor v = new JcrRepoInitOpVisitor(s);
             for(Operation op : parser.parse(r)) {
                 op.accept(v);
             }
diff --git a/src/test/java/org/apache/sling/repoinit/jcr/TestUtil.java b/src/test/java/org/apache/sling/repoinit/jcr/TestUtil.java
index 0a0681e..e1d2383 100644
--- a/src/test/java/org/apache/sling/repoinit/jcr/TestUtil.java
+++ b/src/test/java/org/apache/sling/repoinit/jcr/TestUtil.java
@@ -71,7 +71,7 @@ class TestUtil {
     }
     
     void parseAndExecute(String input) throws RepositoryException, RepoInitParsingException {
-        final AclOperationVisitor v = new AclOperationVisitor(adminSession);
+        final JcrRepoInitOpVisitor v = new JcrRepoInitOpVisitor(adminSession);
         for(Operation o : parse(input)) {
             o.accept(v);
         }

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-repoinit] 28/43: SLING-5449 - fix scm strings

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.jcr.repoinit-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git

commit e5e302eaa2808aa85d8f2648ca747163b9006224
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Thu May 19 13:03:08 2016 +0000

    SLING-5449 - fix scm strings
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/repoinit/oak-jcr@1744566 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/pom.xml b/pom.xml
index 90ce530..a469558 100644
--- a/pom.xml
+++ b/pom.xml
@@ -41,9 +41,9 @@
   </properties>
 
   <scm>
-    <connection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/commons/repoinit/oak-jcr</connection>
-    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/commons/repoinit/oak-jcr</developerConnection>
-    <url>https://svn.apache.org/repos/asf/sling/trunk/bundles/commons/repoinit/oak-jcr</url>
+    <connection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/repoinit/oak-jcr</connection>
+    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/repoinit/oak-jcr</developerConnection>
+    <url>https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/repoinit/oak-jcr</url>
   </scm>
   
   <build>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-repoinit] 25/43: SLING-5449 - initial base tree creation language, see test-20.txt for examples

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.jcr.repoinit-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git

commit 70c5d7b6ef0296e63df6dc4484f0a7a609d410b5
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Tue May 17 14:12:23 2016 +0000

    SLING-5449 - initial base tree creation language, see test-20.txt for examples
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/commons/repoinit/oak-jcr@1744274 13f79535-47bb-0310-9956-ffa450edef68
---
 .../java/org/apache/sling/repoinit/jcr/JcrRepoInitOpVisitor.java    | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/main/java/org/apache/sling/repoinit/jcr/JcrRepoInitOpVisitor.java b/src/main/java/org/apache/sling/repoinit/jcr/JcrRepoInitOpVisitor.java
index 4bab1d9..1b991af 100644
--- a/src/main/java/org/apache/sling/repoinit/jcr/JcrRepoInitOpVisitor.java
+++ b/src/main/java/org/apache/sling/repoinit/jcr/JcrRepoInitOpVisitor.java
@@ -27,6 +27,7 @@ import javax.jcr.Session;
 import org.apache.sling.repoinit.jcr.impl.AclUtil;
 import org.apache.sling.repoinit.jcr.impl.ServiceUserUtil;
 import org.apache.sling.repoinit.parser.operations.AclLine;
+import org.apache.sling.repoinit.parser.operations.CreatePath;
 import org.apache.sling.repoinit.parser.operations.CreateServiceUser;
 import org.apache.sling.repoinit.parser.operations.DeleteServiceUser;
 import org.apache.sling.repoinit.parser.operations.OperationVisitor;
@@ -113,4 +114,9 @@ public class JcrRepoInitOpVisitor implements OperationVisitor {
             setAcl(line, session, require(line, PROP_PRINCIPALS), paths, require(line, PROP_PRIVILEGES), isAllow); 
         }
     }
+
+    @Override
+    public void visitCreatePath(CreatePath cp) {
+        throw new UnsupportedOperationException("visitCreatePath is not implemented yet");
+    }
 }

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-repoinit] 05/43: SLING-5355 - AclOperationVisitor partially implemented, and webconsole plugin added

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.jcr.repoinit-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git

commit d7a5f83fda7e92c420a387cffc938059a3726fda
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Wed Dec 23 11:00:28 2015 +0000

    SLING-5355 - AclOperationVisitor partially implemented, and webconsole plugin added
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/acldef/oak-jcr@1721521 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                            |  24 ++-
 .../sling/acldef/jcr/AclOperationVisitor.java      |  39 +++-
 .../java/org/apache/sling/acldef/jcr/AclUtil.java  |  65 +++++++
 .../apache/sling/acldef/jcr/ServiceUserUtil.java   |   4 +
 .../jcr/webconsole/OakAclDefConsolePlugin.java     | 203 +++++++++++++++++++++
 src/main/resources/ui/acldef.css                   |  20 ++
 .../sling/acldef/jcr/NonExistentPathTest.java      |  70 +++++++
 .../sling/acldef/jcr/RootAddChildNodeTest.java     | 126 +++++++++++++
 .../java/org/apache/sling/acldef/jcr/TestUtil.java |  12 +-
 9 files changed, 554 insertions(+), 9 deletions(-)

diff --git a/pom.xml b/pom.xml
index 31eda7e..e0a4b01 100644
--- a/pom.xml
+++ b/pom.xml
@@ -35,6 +35,10 @@
 	  Applies ACLs to an Oak JCR repository based on the output
 	  of the ACL Definition Language parser.
   </description>
+  
+  <properties>
+    <jackrabbit.version>2.10.0</jackrabbit.version>
+  </properties>
 
   <scm>
     <connection>scm:svn: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/acldef/oak-jcr</connection>
@@ -75,13 +79,29 @@
     <dependency>
       <groupId>org.apache.jackrabbit</groupId>
       <artifactId>jackrabbit-api</artifactId>
-      <version>2.11.3</version>
+      <version>${jackrabbit.version}</version>
       <scope>provided</scope>
     </dependency>
     <dependency>
       <groupId>org.apache.jackrabbit</groupId>
       <artifactId>jackrabbit-jcr-commons</artifactId>
-      <version>2.2.9</version>
+      <version>${jackrabbit.version}</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>javax.servlet</groupId>
+      <artifactId>servlet-api</artifactId>
+    </dependency>
+     <dependency>
+      <groupId>org.apache.sling</groupId>
+      <artifactId>org.apache.sling.api</artifactId>
+      <version>2.4.0</version>
+      <scope>provided</scope>
+    </dependency>
+     <dependency>
+      <groupId>org.apache.sling</groupId>
+      <artifactId>org.apache.sling.jcr.api</artifactId>
+      <version>2.0.4</version>
       <scope>provided</scope>
     </dependency>
      <dependency>
diff --git a/src/main/java/org/apache/sling/acldef/jcr/AclOperationVisitor.java b/src/main/java/org/apache/sling/acldef/jcr/AclOperationVisitor.java
index 48ff05e..e4748ec 100644
--- a/src/main/java/org/apache/sling/acldef/jcr/AclOperationVisitor.java
+++ b/src/main/java/org/apache/sling/acldef/jcr/AclOperationVisitor.java
@@ -16,8 +16,15 @@
  */
 package org.apache.sling.acldef.jcr;
 
+import static org.apache.sling.acldef.parser.ACLDefinitions.PROP_PATHS;
+import static org.apache.sling.acldef.parser.ACLDefinitions.PROP_PRINCIPALS;
+import static org.apache.sling.acldef.parser.ACLDefinitions.PROP_PRIVILEGES;
+
+import java.util.List;
+
 import javax.jcr.Session;
 
+import org.apache.sling.acldef.parser.operations.AclLine;
 import org.apache.sling.acldef.parser.operations.CreateServiceUser;
 import org.apache.sling.acldef.parser.operations.DeleteServiceUser;
 import org.apache.sling.acldef.parser.operations.OperationVisitor;
@@ -70,13 +77,37 @@ public class AclOperationVisitor implements OperationVisitor {
         }
     }
 
+    private List<String> require(AclLine line, String propertyName) {
+        final List<String> result = line.getProperty(propertyName);
+        if(result == null) {
+            throw new IllegalStateException("Missing property " + propertyName + " on " + line);
+        }
+        return result;
+    }
+    
+    private void setAcl(AclLine line, Session s, List<String> principals, List<String> paths, List<String> privileges, boolean isAllow) {
+        try {
+            AclUtil.setAcl(s, principals, paths, privileges, isAllow);
+        } catch(Exception e) {
+            throw new RuntimeException("Failed to set ACL (" + e.getClass().getSimpleName() + ") " + line, e);
+        }
+    }
+    
     @Override
     public void visitSetAclPrincipal(SetAclPrincipals s) {
-        log.warn("TODO - set ACL for Principals");
-    }
+        final List<String> principals = s.getPrincipals();
+        for(AclLine line : s.getLines()) {
+            final boolean isAllow = line.getAction().equals(AclLine.Action.ALLOW);
+            setAcl(line, session, principals, require(line, PROP_PATHS), require(line, PROP_PRIVILEGES), isAllow);
+        }
+     }
 
     @Override
     public void visitSetAclPaths(SetAclPaths s) {
-        log.warn("TODO - set ACL for Paths");
+        final List<String> paths = s.getPaths();
+        for(AclLine line : s.getLines()) {
+            final boolean isAllow = line.getAction().equals(AclLine.Action.ALLOW);
+            setAcl(line, session, require(line, PROP_PRINCIPALS), paths, require(line, PROP_PRIVILEGES), isAllow); 
+        }
     }
-}
+}
\ No newline at end of file
diff --git a/src/main/java/org/apache/sling/acldef/jcr/AclUtil.java b/src/main/java/org/apache/sling/acldef/jcr/AclUtil.java
new file mode 100644
index 0000000..1a70be4
--- /dev/null
+++ b/src/main/java/org/apache/sling/acldef/jcr/AclUtil.java
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sling.acldef.jcr;
+
+import java.security.Principal;
+import java.util.List;
+
+import javax.jcr.PathNotFoundException;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.UnsupportedRepositoryOperationException;
+import javax.jcr.security.AccessControlManager;
+import javax.jcr.security.Privilege;
+
+import org.apache.jackrabbit.api.security.JackrabbitAccessControlList;
+import org.apache.jackrabbit.api.security.JackrabbitAccessControlManager;
+import org.apache.jackrabbit.commons.jackrabbit.authorization.AccessControlUtils;
+
+/** Utilities for ACL management */
+public class AclUtil {
+
+    public static JackrabbitAccessControlManager getJACM(Session s) throws UnsupportedRepositoryOperationException, RepositoryException {
+        final AccessControlManager acm = s.getAccessControlManager();
+        if(!(acm instanceof JackrabbitAccessControlManager)) {
+            throw new IllegalStateException(
+                "AccessControlManager is not a JackrabbitAccessControlManager:" 
+                + acm.getClass().getName());
+        }
+        return (JackrabbitAccessControlManager) acm;
+    }
+    
+    public static void setAcl(Session s, List<String> principals, List<String> paths, List<String> privileges, boolean isAllow) 
+            throws UnsupportedRepositoryOperationException, RepositoryException {
+        
+        final String [] privArray = privileges.toArray(new String[privileges.size()]);
+        final Privilege[] jcrPriv = AccessControlUtils.privilegesFromNames(s, privArray);
+
+        
+        for(String path : paths) {
+            if(!s.nodeExists(path)) {
+                throw new PathNotFoundException("Cannot set ACL on non-existent path " + path);
+            }
+            JackrabbitAccessControlList acl = AccessControlUtils.getAccessControlList(s, path);
+            for(String principal : principals) {
+                final Principal p = ServiceUserUtil.getAuthorizable(s, principal).getPrincipal(); 
+                acl.addEntry(p, jcrPriv, isAllow);
+            }
+            getJACM(s).setPolicy(path, acl);
+        }
+    }
+}
diff --git a/src/main/java/org/apache/sling/acldef/jcr/ServiceUserUtil.java b/src/main/java/org/apache/sling/acldef/jcr/ServiceUserUtil.java
index 265c7df..09b6426 100644
--- a/src/main/java/org/apache/sling/acldef/jcr/ServiceUserUtil.java
+++ b/src/main/java/org/apache/sling/acldef/jcr/ServiceUserUtil.java
@@ -33,6 +33,10 @@ public class ServiceUserUtil {
         return ((JackrabbitSession)session).getUserManager();
     }
     
+    public static Authorizable getAuthorizable(Session session, String username) throws RepositoryException {
+        return getUserManager(session).getAuthorizable(username);
+    }
+    
     public static void createServiceUser(Session s, String username) throws RepositoryException {
         getUserManager(s).createSystemUser(username, null);
     }
diff --git a/src/main/java/org/apache/sling/acldef/jcr/webconsole/OakAclDefConsolePlugin.java b/src/main/java/org/apache/sling/acldef/jcr/webconsole/OakAclDefConsolePlugin.java
new file mode 100644
index 0000000..16d3ff3
--- /dev/null
+++ b/src/main/java/org/apache/sling/acldef/jcr/webconsole/OakAclDefConsolePlugin.java
@@ -0,0 +1,203 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.acldef.jcr.webconsole;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.Reader;
+import java.io.StringReader;
+import java.io.UnsupportedEncodingException;
+import java.net.URL;
+import java.net.URLEncoder;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.servlet.Servlet;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Properties;
+import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.Service;
+import org.apache.sling.acldef.jcr.AclOperationVisitor;
+import org.apache.sling.acldef.parser.ACLDefinitions;
+import org.apache.sling.acldef.parser.ParseException;
+import org.apache.sling.acldef.parser.operations.Operation;
+import org.apache.sling.acldef.parser.operations.OperationVisitor;
+import org.apache.sling.api.request.ResponseUtil;
+import org.apache.sling.jcr.api.SlingRepository;
+import org.osgi.framework.Constants;
+
+@Component
+@Service(value=Servlet.class)
+@Properties({
+    @Property(name=Constants.SERVICE_VENDOR, value="The Apache Software Foundation"),
+    @Property(name=Constants.SERVICE_DESCRIPTION, value="Apache Sling ACL Definitions Console Plugin"),
+    @Property(name="felix.webconsole.label", value=OakAclDefConsolePlugin.LABEL),
+    @Property(name="felix.webconsole.title", value="Set ACLs"),
+    @Property(name="felix.webconsole.css", value="/" + OakAclDefConsolePlugin.LABEL + "/res/ui/acldef.css"),
+    @Property(name="felix.webconsole.category", value="Sling"),
+})
+public class OakAclDefConsolePlugin extends HttpServlet {
+
+    private static final long serialVersionUID = 1234;
+    private static final String PAR_ACLDEF = "acldef";
+    private static final String PAR_MSG = "msg";
+    public static final String LABEL = "setACL";
+    private static final String ATTR_SUBMIT = "plugin.submit";
+    private AtomicInteger counter = new AtomicInteger();
+
+    private static final String EXAMPLE =
+            "# Example ACL definition\n"
+            + "# (with service user creation commented out)\n"
+            + "# create service user test_42\n"
+            + "set ACL for test_42\n"
+            + "  allow jcr:read,jcr:modifyProperties on /tmp\n"
+            + "end\n"
+            ;
+    
+    @Reference
+    private SlingRepository repository;
+
+    private String thisPath(HttpServletRequest request) {
+        return request.getContextPath() + request.getServletPath() + request.getPathInfo();
+    }
+    
+    @Override
+    protected void doGet(final HttpServletRequest request, final HttpServletResponse response) 
+            throws ServletException, IOException {
+        String aclDef = request.getParameter(PAR_ACLDEF);
+        if(aclDef == null || aclDef.trim().length() == 0) {
+            aclDef = EXAMPLE;
+        }
+        
+        String msg = request.getParameter(PAR_MSG);
+        if(msg == null) {
+            msg = "";
+        }
+
+        final PrintWriter pw = response.getWriter();
+        pw.println("<table class='content' cellpadding='0' cellspacing='0' width='100%'>");
+        titleHtml(
+                pw,
+                "ACL definitions",
+                "To create service users or set ACLs, enter a valid statement below."
+                );
+
+        pw.println("<tr class='content'>");
+        pw.print("<td class='content' colspan='3'>");
+        pw.print("<form method='post' action='" + thisPath(request) + "'>");
+        pw.print("<input type='submit' name='" + ATTR_SUBMIT + "' value='Execute' class='submit'>");
+        pw.print("<div class='msg'>");
+        pw.print(msg);
+        pw.println("</div>");
+        pw.print("<textarea type='text' name='" + PAR_ACLDEF + "' class='input' cols='80' rows='25'>");
+        pw.print(ResponseUtil.escapeXml(aclDef));
+        pw.println("</textarea>");
+        pw.print("</form>");
+        pw.print("</td>");
+        pw.println("</tr>");
+        pw.println("</table>");
+    }
+
+    @Override
+    protected void doPost(HttpServletRequest request,
+            HttpServletResponse response) throws ServletException, IOException {
+
+        String aclDef = request.getParameter(PAR_ACLDEF);
+        String msg = "No ACL definitions executed";
+        if(aclDef == null || aclDef.trim().length() == 0) {
+            aclDef = "";
+        } else {
+            try {
+                setAcl(aclDef);
+                msg = "ACL definitions successfully executed";
+            } catch(Exception e) {
+                throw new ServletException("Error setting ACLs:\n" + e.getMessage(), e);
+            }
+        }
+        msg += " (" + counter.incrementAndGet() + ")";
+        
+        // Redirect to GET on the same page
+        final StringBuilder target = new StringBuilder();
+        target
+            .append(thisPath(request))
+            .append("?").append(PAR_ACLDEF).append("=").append(encodeParam(aclDef))
+            .append("&").append(PAR_MSG).append("=").append(encodeParam(msg))
+        ;
+        response.sendRedirect(target.toString());
+    }
+    
+    private static String encodeParam(final String value) {
+        try {
+            return URLEncoder.encode(value, "UTF-8");
+        } catch (UnsupportedEncodingException e) {
+            throw new RuntimeException("Unexpected UnsupportedEncodingException", e);
+        }
+    }
+    
+    private void setAcl(String aclDef) throws RepositoryException, IOException, ParseException {
+        final Reader r = new StringReader(aclDef);
+        Session s = null;
+        try {
+            s = repository.loginAdministrative(null);
+            final OperationVisitor v = new AclOperationVisitor(s);
+            for(Operation op : new ACLDefinitions(r).parse()) {
+                op.accept(v);
+            }
+            s.save();
+        } finally {
+            r.close();
+            if(s != null) {
+                s.logout();
+            }
+        }
+    }
+
+    private void titleHtml(PrintWriter pw, String title, String description) {
+        pw.print("<tr class='content'>");
+        pw.print("<th colspan='3'class='content container'>");
+        pw.print(ResponseUtil.escapeXml(title));
+        pw.println("</th></tr>");
+
+        if (description != null) {
+            pw.print("<tr class='content'>");
+            pw.print("<td colspan='3'class='content'>");
+            pw.print(ResponseUtil.escapeXml(description));
+            pw.println("</th></tr>");
+        }
+    }
+
+    /**
+     * Method to retrieve static resources from this bundle.
+     */
+    @SuppressWarnings("unused")
+    private URL getResource(final String path) {
+        final String prefix = "/" + LABEL + "/res";
+        if(path.startsWith(prefix + "/ui")) {
+            return this.getClass().getResource(path.substring(prefix.length()));
+        }
+        return null;
+    }
+}
diff --git a/src/main/resources/ui/acldef.css b/src/main/resources/ui/acldef.css
new file mode 100644
index 0000000..9181889
--- /dev/null
+++ b/src/main/resources/ui/acldef.css
@@ -0,0 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ 
+ .msg { color:blue; }
+td { vertical-align: top; }
+textarea { width:100%; }
\ No newline at end of file
diff --git a/src/test/java/org/apache/sling/acldef/jcr/NonExistentPathTest.java b/src/test/java/org/apache/sling/acldef/jcr/NonExistentPathTest.java
new file mode 100644
index 0000000..184853d
--- /dev/null
+++ b/src/test/java/org/apache/sling/acldef/jcr/NonExistentPathTest.java
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sling.acldef.jcr;
+
+import static org.junit.Assert.fail;
+import static org.junit.Assert.assertEquals;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+
+import org.apache.sling.acldef.parser.ParseException;
+import org.apache.sling.testing.mock.sling.ResourceResolverType;
+import org.apache.sling.testing.mock.sling.junit.SlingContext;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+/** Test setting ACLS on non-existent paths */
+public class NonExistentPathTest {
+
+    @Rule
+    public final SlingContext context = new SlingContext(ResourceResolverType.JCR_OAK);
+    
+    private TestUtil U;
+    private Session s;
+    
+    @Before
+    public void setup() throws ParseException, RepositoryException {
+        U = new TestUtil(context);
+        U.parseAndExecute("create service user " + U.username);
+        s = U.loginService(U.username);
+    }
+
+    @After
+    public void cleanup() throws ParseException, RepositoryException {
+        U.parseAndExecute("delete service user " + U.username);
+        s.logout();
+    }
+    
+    @Test
+    public void setAclOnFoo() throws Exception {
+        final String aclDef =
+            "set ACL on /foo_" + U.id + "\n"
+            + "  allow jcr:all for " + U.username + "\n"
+            + "end"
+        ;
+        try {
+            U.parseAndExecute(aclDef);
+            fail("Expecting a wrapped PathNotFoundException");
+        } catch(RuntimeException rux) {
+            assertEquals(PathNotFoundException.class, rux.getCause().getClass());
+        }
+    }
+    
+}
diff --git a/src/test/java/org/apache/sling/acldef/jcr/RootAddChildNodeTest.java b/src/test/java/org/apache/sling/acldef/jcr/RootAddChildNodeTest.java
new file mode 100644
index 0000000..63d5b3e
--- /dev/null
+++ b/src/test/java/org/apache/sling/acldef/jcr/RootAddChildNodeTest.java
@@ -0,0 +1,126 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sling.acldef.jcr;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import javax.jcr.AccessDeniedException;
+import javax.jcr.Node;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+
+import org.apache.sling.acldef.parser.ParseException;
+import org.apache.sling.testing.mock.sling.ResourceResolverType;
+import org.apache.sling.testing.mock.sling.junit.SlingContext;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+/** Test root node and node creation privileges */
+public class RootAddChildNodeTest {
+
+    @Rule
+    public final SlingContext context = new SlingContext(ResourceResolverType.JCR_OAK);
+    
+    private TestUtil U;
+    private Session s;
+    
+    @Before
+    public void setup() throws ParseException, RepositoryException {
+        U = new TestUtil(context);
+        U.parseAndExecute("create service user " + U.username);
+        s = U.loginService(U.username);
+    }
+
+    @After
+    public void cleanup() throws ParseException, RepositoryException {
+        U.parseAndExecute("delete service user " + U.username);
+        s.logout();
+    }
+    
+    @Test(expected=AccessDeniedException.class)
+    public void getRootNodeFails() throws Exception {
+        s.getRootNode();
+    }
+    
+    @Test
+    public void readOnlyThenWrite() throws Exception {
+        final Node tmp = U.adminSession.getRootNode().addNode("tmp_" + U.id);
+        U.adminSession.save();
+        final String path = tmp.getPath();
+        
+        try {
+            s.getNode(path);
+            fail("Expected read access to be initially denied:" + path);
+        } catch(PathNotFoundException ignore) {
+        }
+        
+        final String allowRead =  
+                "set ACL for " + U.username + "\n"
+                + "allow jcr:read on " + path + "\n"
+                + "end"
+                ;
+        U.parseAndExecute(allowRead);
+        final Node n = s.getNode(path);
+        
+        try {
+            n.setProperty("U.id", U.id);
+            s.save();
+            fail("Expected write access to be denied:" + path);
+        } catch(AccessDeniedException ignore) {
+        }
+        s.refresh(false);
+        
+        final String allowWrite = 
+                "set ACL for " + U.username + "\n"
+                + "allow jcr:write on " + path + "\n"
+                + "end"
+                ;
+        U.parseAndExecute(allowWrite);
+        n.setProperty("U.id", U.id);
+        s.save();
+    }
+    
+    @Test
+    public void addChildAtRoot() throws Exception {
+        final String nodename = "test_" + U.id;
+        final String path = "/" + nodename;
+        
+        final String aclSetup = 
+            "set ACL for " + U.username + "\n"
+            + "allow jcr:all on /\n"
+            + "end"
+            ;
+        
+        U.parseAndExecute(aclSetup);
+        try {
+            assertFalse(s.itemExists(path));
+            s.getRootNode().addNode(nodename);
+            s.save();
+            assertTrue(s.nodeExists(path));
+            s.getNode(path).remove();
+            s.save();
+            assertFalse(s.itemExists(path));
+        } finally {
+            s.logout();
+        }
+    }
+}
diff --git a/src/test/java/org/apache/sling/acldef/jcr/TestUtil.java b/src/test/java/org/apache/sling/acldef/jcr/TestUtil.java
index c07dd21..70d5533 100644
--- a/src/test/java/org/apache/sling/acldef/jcr/TestUtil.java
+++ b/src/test/java/org/apache/sling/acldef/jcr/TestUtil.java
@@ -22,6 +22,7 @@ import static org.junit.Assert.assertNull;
 import java.io.Reader;
 import java.io.StringReader;
 import java.util.List;
+import java.util.UUID;
 
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
@@ -39,9 +40,13 @@ import org.apache.sling.testing.mock.sling.junit.SlingContext;
 class TestUtil {
     
     final Session adminSession;
+    final String id;
+    final String username;
     
     TestUtil(SlingContext ctx) {
-        adminSession = ctx.resourceResolver().adaptTo(Session.class); 
+        adminSession = ctx.resourceResolver().adaptTo(Session.class);
+        id = UUID.randomUUID().toString();
+        username = "user_" + id;
     }
     
     List<Operation> parse(String input) throws ParseException {
@@ -64,14 +69,15 @@ class TestUtil {
         }
     }
     
-    void parseAndExecute(String input) throws ParseException {
+    void parseAndExecute(String input) throws ParseException, RepositoryException {
         final AclOperationVisitor v = new AclOperationVisitor(adminSession);
         for(Operation o : parse(input)) {
             o.accept(v);
         }
+        adminSession.save();
     }
     
-    Session getServiceSession(String serviceUsername) throws RepositoryException {
+    Session loginService(String serviceUsername) throws RepositoryException {
         final SimpleCredentials cred = new SimpleCredentials(serviceUsername, new char[0]);
         return adminSession.impersonate(cred);
     }

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-repoinit] 31/43: SLING-5800 - remove unnecessary snapshots and use current jcr.api snapshot

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.jcr.repoinit-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git

commit 029bbe3f243e2a093782022ce41256dfb180301e
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Tue Jun 21 14:38:16 2016 +0000

    SLING-5800 - remove unnecessary snapshots and use current jcr.api snapshot
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/repoinit/oak-jcr@1749533 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pom.xml b/pom.xml
index dfc5d61..5e91d7d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -109,7 +109,7 @@
     <dependency>
       <groupId>org.apache.sling</groupId>
       <artifactId>org.apache.sling.jcr.api</artifactId>
-      <version>2.3.1-SNAPSHOT</version>
+      <version>2.4.1-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.apache.sling</groupId>
@@ -153,7 +153,7 @@
     <dependency>
       <groupId>org.apache.sling</groupId>
       <artifactId>org.apache.sling.testing.sling-mock-oak</artifactId>
-      <version>1.0.1-SNAPSHOT</version>
+      <version>1.0.0</version>
       <scope>test</scope>
     </dependency>
     <dependency>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-jcr-repoinit] 30/43: SLING-5355 - ProvisioningModelIT passes

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.jcr.repoinit-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git

commit 4fc1e2130260eaf06f47245ab6edd580be3aa665
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Fri May 20 09:40:50 2016 +0000

    SLING-5355 - ProvisioningModelIT passes
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/repoinit/oak-jcr@1744678 13f79535-47bb-0310-9956-ffa450edef68
---
 .../apache/sling/repoinit/jcr/RepositoryInitializer.java   | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/main/java/org/apache/sling/repoinit/jcr/RepositoryInitializer.java b/src/main/java/org/apache/sling/repoinit/jcr/RepositoryInitializer.java
index 3f4f288..648d073 100644
--- a/src/main/java/org/apache/sling/repoinit/jcr/RepositoryInitializer.java
+++ b/src/main/java/org/apache/sling/repoinit/jcr/RepositoryInitializer.java
@@ -49,7 +49,10 @@ import org.slf4j.LoggerFactory;
 /** SlingRepositoryInitializer that executes repoinit statements read
  *  from a configurable URL.
  */
-@Component
+@Component(
+        name="Apache Sling Repository Initializer",
+        description="Initializes the JCR content repository using repoinit statements",
+        metatype=true)
 @Service(SlingRepositoryInitializer.class)
 @Properties({
     // SlingRepositoryInitializers are executed in ascending
@@ -69,13 +72,13 @@ public class RepositoryInitializer implements SlingRepositoryInitializer {
     public static final String PROP_TEXT_URL = "text.url";
     private String textURL;
     
-    public static final String DEFAULT_MODEL_SECTION_NAME = ":repoinit";
+    public static final String DEFAULT_MODEL_SECTION_NAME = "repoinit";
     
     @Property(
             label="Model section name", 
             description=
-                "Optional provisioning model section name to used to extract repoinit statements"
-                + " from the raw text provided by our text URL. Leave empty to consider the content"
+                "Optional provisioning model additional section name (without leading colon) used to extract"
+                + " repoinit statements from the raw text provided by our text URL. Leave empty to consider the content"
                 + " provided by that URL to already be in repoinit format", 
             value=DEFAULT_MODEL_SECTION_NAME)
     public static final String PROP_MODEL_SECTION_NAME = "model.section.name";
@@ -104,6 +107,7 @@ public class RepositoryInitializer implements SlingRepositoryInitializer {
                 log.info("Executing {}", op);
                 op.accept(v);
             }
+            s.save();
             log.info("{} repoinit operations executed", count);
         } finally {
             s.logout();
@@ -122,6 +126,7 @@ public class RepositoryInitializer implements SlingRepositoryInitializer {
             } else {
                 final StringWriter w = new StringWriter();
                 IOUtils.copy(is, w, "UTF-8");
+                result = w.toString();
             }
         } catch(Exception e) {
             log.warn("Error reading repoinit statements from " + textURL, e);
@@ -138,6 +143,7 @@ public class RepositoryInitializer implements SlingRepositoryInitializer {
         }
         String result = getRawRepoInitText();
         log.debug("Raw text from {}: \n{}", textURL, result);
+        log.info("Got {} characters from {}", result.length(), textURL);
         if(parseRawText) {
             final StringReader r = new StringReader(result);
             try {

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.