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:58:17 UTC

[sling-org-apache-sling-repoinit-parser] annotated tag org.apache.sling.repoinit.parser-1.0.4 created (now bd1bd2b)

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

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


      at bd1bd2b  (tag)
 tagging de156c21a4f4e0291676cf102f184fe035a0a913 (commit)
      by Bertrand Delacretaz
      on Mon Aug 22 16:18:29 2016 +0000

- Log -----------------------------------------------------------------
org.apache.sling.repoinit.parser-1.0.4
-----------------------------------------------------------------------

This annotated tag includes the following new commits:

     new 52bef86  SLING-5355 - initial parser and tests
     new 73dc487  SLING-5355 - make space for more acldef modules
     new c593f72  SLING-5355 - jcr module added, work in progress
     new 230fdf7  fix build by setting commons-io’s version to 2.4
     new 847aa69  SLING-5355 - parser service
     new 0ac405a  SLING-5355 - AclSetupComponent, work in progress
     new 69e2707  Switch to parent pom 26
     new 464dd03  SLING-5449 - rename the modules to 'jcrinit'
     new 061b136  SLING-5449 - the name is 'repoinit' instead as the parser is not JCR-specific
     new 0ea77fd  SLING-5449 - the name is 'repoinit' instead as the parser is not JCR-specific
     new 1f9131f  SLING-5449 - rename packages to repoinit
     new 927bc9e  SLING-5449 - rename the remaining things from ACL to 'repoinit'
     new 593ad88  SLING-5449 - move repoinit under commons
     new 83b37d9  repoinit: fix SCM urls after move
     new a7fbbdd  normalize line endings to ensure tests run on windows as well
     new 09f97e2  SLING-5449 - initial base tree creation language, see test-20.txt for examples
     new db642cd  SLING-5449 - use nicer 'create path' syntax
     new 69753a9  SLING-5449 - Implement CreatePath in oak-jcr module
     new 73201e5  SLING-5449 - move the repoinit modules under extensions, they do contain Sling-specific stuff
     new ab73315  SLING-5449 - fix scm strings
     new 63ef28c  [maven-release-plugin] prepare release org.apache.sling.repoinit.parser-1.0.0
     new ca6a748  [maven-release-plugin] prepare for next development iteration
     new 2b63863  Comment the example
     new 9723e19  [maven-release-plugin] prepare release org.apache.sling.repoinit.parser-1.0.2
     new 8fe796d  [maven-release-plugin] prepare for next development iteration
     new 539cbbd  SLING-5843 - add 'register namespace' statement to repoinit parser
     new 4563ff6  SLING-5842 - add 'register nodetypes' statement to repoinit parser
     new a4ad0c3  SLING-5842 - optional prefix for CND files to avoid provisioning model parser conflicts
     new 337a211  SLING-5842, SLING-5843 - implement the register namespace and nodetype operations in the jcr.repoinit module
     new fcbb581  SLING-5843 - prefix is required when registering JCR namespaces
     new 73fa148  Remove extra import
     new a9f71de  fix javadoc, style
     new 826aab7  [maven-release-plugin] prepare release org.apache.sling.repoinit.parser-1.0.4
     new de156c2  [maven-release-plugin] copy for tag org.apache.sling.repoinit.parser-1.0.4

The 34 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-repoinit-parser] 04/10: SLING-5842 - optional prefix for CND files to avoid provisioning model parser conflicts

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.repoinit.parser-1.0.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-repoinit-parser.git

commit a4ad0c3a143338f15025ac0a9e109216eddfd25c
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Mon Jul 18 16:13:22 2016 +0000

    SLING-5842 - optional prefix for CND files to avoid provisioning model parser conflicts
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/repoinit/parser@1753260 13f79535-47bb-0310-9956-ffa450edef68
---
 .../parser/operations/LinePrefixCleaner.java       | 57 ++++++++++++++++++++
 .../parser/operations/RegisterNodetypes.java       |  9 +++-
 src/main/javacc/RepoInitGrammar.jjt                |  4 +-
 .../parser/test/LinePrefixCleanerTest.java         | 60 ++++++++++++++++++++++
 src/test/resources/testcases/test-50-output.txt    |  8 +--
 src/test/resources/testcases/test-50.txt           | 14 +++--
 src/test/resources/testcases/test-99-output.txt    |  4 +-
 src/test/resources/testcases/test-99.txt           |  6 +--
 8 files changed, 145 insertions(+), 17 deletions(-)

diff --git a/src/main/java/org/apache/sling/repoinit/parser/operations/LinePrefixCleaner.java b/src/main/java/org/apache/sling/repoinit/parser/operations/LinePrefixCleaner.java
new file mode 100644
index 0000000..456e65f
--- /dev/null
+++ b/src/main/java/org/apache/sling/repoinit/parser/operations/LinePrefixCleaner.java
@@ -0,0 +1,57 @@
+/*
+ * 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.parser.operations;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.StringReader;
+
+/** Removes an prefix at the beginning of
+ *  each line in a String. 
+ *  Used for embedding CND files in repoinit
+ *  statements and hiding them from the Sling
+ *  provisioning model parser which fails on
+ *  statements like [sling:someNodetype] which
+ *  are similar to provisioning model sections. 
+ */
+public class LinePrefixCleaner {
+    public String removePrefix(String prefix, String textBlock) {
+        final StringBuilder result = new StringBuilder();
+        try {
+            final BufferedReader r = new BufferedReader(new StringReader(textBlock));
+            try {
+                String line = null;
+                while( (line = r.readLine()) != null) {
+                    if(result.length() > 0) {
+                        result.append("\n");
+                    }
+                    if(line.startsWith(prefix)) {
+                        result.append(line.substring(prefix.length()));
+                    } else {
+                        result.append(line);
+                    }
+                }
+            } finally {
+                r.close();
+            }
+        } catch(IOException ioe) {
+            throw new RuntimeException("Unexpected IOException", ioe);
+        }
+        return result.toString();
+    }
+}
diff --git a/src/main/java/org/apache/sling/repoinit/parser/operations/RegisterNodetypes.java b/src/main/java/org/apache/sling/repoinit/parser/operations/RegisterNodetypes.java
index 3266900..54356b5 100644
--- a/src/main/java/org/apache/sling/repoinit/parser/operations/RegisterNodetypes.java
+++ b/src/main/java/org/apache/sling/repoinit/parser/operations/RegisterNodetypes.java
@@ -21,8 +21,15 @@ package org.apache.sling.repoinit.parser.operations;
 public class RegisterNodetypes extends Operation {
     private final String cndStatements;
     
+    /** Optional prefix used at the beginning of CND lines,
+     *  to avoid conflicts with Sling provisioning
+     *  model parser. If present at the beginning of CND lines,
+     *  this string is removed.
+     */
+    public static final String CND_OPTIONAL_PREFIX = "<< ";
+    
     public RegisterNodetypes(String cndStatements) {
-        this.cndStatements = cndStatements;
+        this.cndStatements = new LinePrefixCleaner().removePrefix(CND_OPTIONAL_PREFIX, cndStatements);
     }
     
     @Override
diff --git a/src/main/javacc/RepoInitGrammar.jjt b/src/main/javacc/RepoInitGrammar.jjt
index f1191eb..9939f81 100644
--- a/src/main/javacc/RepoInitGrammar.jjt
+++ b/src/main/javacc/RepoInitGrammar.jjt
@@ -69,7 +69,7 @@ TOKEN:
 |   < NODETYPES: "nodetypes" >
 |   < REGISTER: "register" >
 |   < NAMESPACE: "namespace" >
-|   < START_TEXTBLOCK: "<<<===" > : TEXTBLOCK
+|   < START_TEXTBLOCK: "<<===" > : TEXTBLOCK
 |   < LPAREN: "(" >
 |   < RPAREN: ")" >
 |   < COMMA: "," >
@@ -90,7 +90,7 @@ TOKEN:
 <TEXTBLOCK> TOKEN :
 {
     < TEXT : ~[] > 
-|   < END_TEXTBLOCK: "===>>>" > : DEFAULT
+|   < END_TEXTBLOCK: "===>>" > : DEFAULT
 } 
 
 List<Operation> parse() :
diff --git a/src/test/java/org/apache/sling/repoinit/parser/test/LinePrefixCleanerTest.java b/src/test/java/org/apache/sling/repoinit/parser/test/LinePrefixCleanerTest.java
new file mode 100644
index 0000000..4ab5685
--- /dev/null
+++ b/src/test/java/org/apache/sling/repoinit/parser/test/LinePrefixCleanerTest.java
@@ -0,0 +1,60 @@
+/*
+ * 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.parser.test;
+
+import static org.junit.Assert.assertEquals;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.sling.repoinit.parser.operations.LinePrefixCleaner;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+@RunWith(Parameterized.class)
+
+public class LinePrefixCleanerTest {
+    private final String prefix;
+    private final String input;
+    private final String expected;
+    
+    @Parameters(name="{0}")
+    public static Collection<Object[]> data() {
+        final List<Object []> result = new ArrayList<Object[]>();
+        result.add(new Object[] { "", "", ""});
+        result.add(new Object[] { "<< ", "", ""});
+        result.add(new Object[] { "", "One\ntwo", "One\ntwo"});
+        result.add(new Object[] { "<< ", "<< Three\n<< four", "Three\nfour"});
+        result.add(new Object[] { "<", "<Five\nsix\n< seven", "Five\nsix\n seven"});
+        return result;
+        
+    }
+
+    public LinePrefixCleanerTest(String prefix, String input, String expected) {
+        this.prefix = prefix;
+        this.input = input;
+        this.expected = expected;
+    }
+    
+    @Test
+    public void cleanup() {
+        final LinePrefixCleaner c = new LinePrefixCleaner();
+        assertEquals(expected, c.removePrefix(prefix, input));
+    }
+ }
diff --git a/src/test/resources/testcases/test-50-output.txt b/src/test/resources/testcases/test-50-output.txt
index dfa1efd..2c3ca6b 100644
--- a/src/test/resources/testcases/test-50-output.txt
+++ b/src/test/resources/testcases/test-50-output.txt
@@ -1,5 +1,4 @@
 RegisterNodetypes:
-
     <slingevent='http://sling.apache.org/jcr/event/1.0'>
     <nt='http://www.jcp.org/jcr/nt/1.0'>
     <mix='http://www.jcp.org/jcr/mix/1.0'>
@@ -21,7 +20,8 @@ RegisterNodetypes:
       - slingevent:expression (string)
       - slingevent:date (date)
       - slingevent:period (long)
-
 RegisterNodetypes:
-
-Just one line, not indented
\ No newline at end of file
+Just one line, not indented
+RegisterNodetypes:
+Using line prefixes
+to avoid conflicts with Sling provisioning model parser
\ No newline at end of file
diff --git a/src/test/resources/testcases/test-50.txt b/src/test/resources/testcases/test-50.txt
index 230a071..b358f05 100644
--- a/src/test/resources/testcases/test-50.txt
+++ b/src/test/resources/testcases/test-50.txt
@@ -1,7 +1,7 @@
 # Test parsing embedded CNDs
 
 register nodetypes
-<<<===
+<<===
     <slingevent='http://sling.apache.org/jcr/event/1.0'>
     <nt='http://www.jcp.org/jcr/nt/1.0'>
     <mix='http://www.jcp.org/jcr/mix/1.0'>
@@ -23,9 +23,15 @@ register nodetypes
       - slingevent:expression (string)
       - slingevent:date (date)
       - slingevent:period (long)
-===>>>
+===>>
 
 register nodetypes
-<<<===
+<<===
 Just one line, not indented
-===>>>
+===>>
+
+register nodetypes
+<<===
+<< Using line prefixes
+<< to avoid conflicts with Sling provisioning model parser
+===>>
diff --git a/src/test/resources/testcases/test-99-output.txt b/src/test/resources/testcases/test-99-output.txt
index 1fe2f1a..0544b4a 100644
--- a/src/test/resources/testcases/test-99-output.txt
+++ b/src/test/resources/testcases/test-99-output.txt
@@ -18,11 +18,9 @@ SetAclPrincipals for alice bob fred
   AclLine DENY {nodetypes=[example:Page], paths=[/], privileges=[jcr:all]}
 RegisterNamespace (NSprefix) uri:someURI/v1.42
 RegisterNodetypes:
-
     <slingevent='http://sling.apache.org/jcr/event/1.0'>
     
-    [slingevent:Event] > nt:unstructured, nt:hierarchyNode
+ [slingevent:Event] > nt:unstructured, nt:hierarchyNode
       - slingevent:topic (string)
       - slingevent:properties (binary)
-
 CreateServiceUser the-last-one
\ No newline at end of file
diff --git a/src/test/resources/testcases/test-99.txt b/src/test/resources/testcases/test-99.txt
index a2f200a..c8b16a0 100644
--- a/src/test/resources/testcases/test-99.txt
+++ b/src/test/resources/testcases/test-99.txt
@@ -34,12 +34,12 @@ end
 register namespace ( NSprefix ) uri:someURI/v1.42
 
 register nodetypes
-<<<===
+<<===
     <slingevent='http://sling.apache.org/jcr/event/1.0'>
     
-    [slingevent:Event] > nt:unstructured, nt:hierarchyNode
+<<  [slingevent:Event] > nt:unstructured, nt:hierarchyNode
       - slingevent:topic (string)
       - slingevent:properties (binary)
-===>>>
+===>>
 
 create service user the-last-one
\ 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-repoinit-parser] 10/10: [maven-release-plugin] copy for tag org.apache.sling.repoinit.parser-1.0.4

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.repoinit.parser-1.0.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-repoinit-parser.git

commit de156c21a4f4e0291676cf102f184fe035a0a913
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Mon Aug 22 16:18:29 2016 +0000

    [maven-release-plugin] copy for tag org.apache.sling.repoinit.parser-1.0.4
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.repoinit.parser-1.0.4@1757222 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-repoinit-parser] 03/10: SLING-5842 - add 'register nodetypes' statement to repoinit parser

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.repoinit.parser-1.0.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-repoinit-parser.git

commit 4563ff6ea16b1b374fa2fc36576f1dbbdf1d3158
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Mon Jul 18 15:08:18 2016 +0000

    SLING-5842 - add 'register nodetypes' statement to repoinit parser
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/repoinit/parser@1753237 13f79535-47bb-0310-9956-ffa450edef68
---
 .../parser/operations/OperationVisitor.java        |  1 +
 ...perationVisitor.java => RegisterNodetypes.java} | 35 ++++++++++++++++-----
 src/main/javacc/RepoInitGrammar.jjt                | 36 ++++++++++++++++++++++
 .../parser/test/OperationToStringVisitor.java      |  6 ++++
 src/test/resources/testcases/test-50-output.txt    | 27 ++++++++++++++++
 src/test/resources/testcases/test-50.txt           | 31 +++++++++++++++++++
 src/test/resources/testcases/test-99-output.txt    |  8 +++++
 src/test/resources/testcases/test-99.txt           |  9 ++++++
 8 files changed, 146 insertions(+), 7 deletions(-)

diff --git a/src/main/java/org/apache/sling/repoinit/parser/operations/OperationVisitor.java b/src/main/java/org/apache/sling/repoinit/parser/operations/OperationVisitor.java
index d7d2682..8693a99 100644
--- a/src/main/java/org/apache/sling/repoinit/parser/operations/OperationVisitor.java
+++ b/src/main/java/org/apache/sling/repoinit/parser/operations/OperationVisitor.java
@@ -24,4 +24,5 @@ public interface OperationVisitor {
     void visitSetAclPaths(SetAclPaths s);
     void visitCreatePath(CreatePath cp);
     void visitRegisterNamespace(RegisterNamespace rn);
+    void visitRegisterNodetypes(RegisterNodetypes b);
 }
diff --git a/src/main/java/org/apache/sling/repoinit/parser/operations/OperationVisitor.java b/src/main/java/org/apache/sling/repoinit/parser/operations/RegisterNodetypes.java
similarity index 53%
copy from src/main/java/org/apache/sling/repoinit/parser/operations/OperationVisitor.java
copy to src/main/java/org/apache/sling/repoinit/parser/operations/RegisterNodetypes.java
index d7d2682..3266900 100644
--- a/src/main/java/org/apache/sling/repoinit/parser/operations/OperationVisitor.java
+++ b/src/main/java/org/apache/sling/repoinit/parser/operations/RegisterNodetypes.java
@@ -17,11 +17,32 @@
 
 package org.apache.sling.repoinit.parser.operations;
 
-public interface OperationVisitor {
-    void visitCreateServiceUser(CreateServiceUser s);
-    void visitDeleteServiceUser(DeleteServiceUser s);
-    void visitSetAclPrincipal(SetAclPrincipals s);
-    void visitSetAclPaths(SetAclPaths s);
-    void visitCreatePath(CreatePath cp);
-    void visitRegisterNamespace(RegisterNamespace rn);
+/** An embedded block of text */
+public class RegisterNodetypes extends Operation {
+    private final String cndStatements;
+    
+    public RegisterNodetypes(String cndStatements) {
+        this.cndStatements = cndStatements;
+    }
+    
+    @Override
+    public String toString() {
+        return getClass().getSimpleName() + ":\n" + getParametersDescription();
+    }
+    
+    @Override
+    protected String getParametersDescription() {
+        final StringBuilder sb = new StringBuilder();
+        sb.append(getCndStatements());
+        return sb.toString();
+    }
+    
+    @Override
+    public void accept(OperationVisitor v) {
+        v.visitRegisterNodetypes(this);
+    }
+    
+    public String getCndStatements() {
+        return cndStatements;
+    }
 }
diff --git a/src/main/javacc/RepoInitGrammar.jjt b/src/main/javacc/RepoInitGrammar.jjt
index 1f887b5..f1191eb 100644
--- a/src/main/javacc/RepoInitGrammar.jjt
+++ b/src/main/javacc/RepoInitGrammar.jjt
@@ -69,6 +69,7 @@ TOKEN:
 |   < NODETYPES: "nodetypes" >
 |   < REGISTER: "register" >
 |   < NAMESPACE: "namespace" >
+|   < START_TEXTBLOCK: "<<<===" > : TEXTBLOCK
 |   < LPAREN: "(" >
 |   < RPAREN: ")" >
 |   < COMMA: "," >
@@ -81,6 +82,17 @@ TOKEN:
 |   < EOL: "\n" >
 }
 
+<TEXTBLOCK> SKIP : 
+{
+    "\r"
+}
+
+<TEXTBLOCK> TOKEN :
+{
+    < TEXT : ~[] > 
+|   < END_TEXTBLOCK: "===>>>" > : DEFAULT
+} 
+
 List<Operation> parse() :
 {}
 {
@@ -92,6 +104,7 @@ List<Operation> parse() :
         | setAclPrincipals(result)
         | createPathStatement(result)
         | registerNamespaceStatement(result)
+        | registerNodetypesStatement(result)
         | blankLine() 
     ) * 
     <EOF>
@@ -302,3 +315,26 @@ void registerNamespaceStatement(List<Operation> result) :
     
     (<EOL> | <EOF>)
 }
+
+void textBlock(StringBuilder b) : 
+{
+    Token t;
+}
+{
+    <START_TEXTBLOCK>
+    ( t = <TEXT> { b.append(t.image); } )*
+    <END_TEXTBLOCK>
+}
+     
+void registerNodetypesStatement(List<Operation> result) :
+{
+    StringBuilder b = new StringBuilder();
+}
+{
+    <REGISTER> <NODETYPES> <EOL> 
+    textBlock(b) 
+    (<EOL> | <EOF>)
+    {
+        result.add(new RegisterNodetypes(b.toString()));
+    }
+}
\ No newline at end of file
diff --git a/src/test/java/org/apache/sling/repoinit/parser/test/OperationToStringVisitor.java b/src/test/java/org/apache/sling/repoinit/parser/test/OperationToStringVisitor.java
index a25128a..ede1c58 100644
--- a/src/test/java/org/apache/sling/repoinit/parser/test/OperationToStringVisitor.java
+++ b/src/test/java/org/apache/sling/repoinit/parser/test/OperationToStringVisitor.java
@@ -24,6 +24,7 @@ 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.RegisterNodetypes;
 import org.apache.sling.repoinit.parser.operations.OperationVisitor;
 import org.apache.sling.repoinit.parser.operations.RegisterNamespace;
 import org.apache.sling.repoinit.parser.operations.SetAclPaths;
@@ -84,6 +85,11 @@ class OperationToStringVisitor implements OperationVisitor {
         out.println(rn.toString());
     }
 
+    @Override
+    public void visitRegisterNodetypes(RegisterNodetypes nt) {
+        out.println(nt.toString());
+    }
+
     private void dumpAclLines(Collection<AclLine> c) {
         for(AclLine line : c) {
             out.print("  ");
diff --git a/src/test/resources/testcases/test-50-output.txt b/src/test/resources/testcases/test-50-output.txt
new file mode 100644
index 0000000..dfa1efd
--- /dev/null
+++ b/src/test/resources/testcases/test-50-output.txt
@@ -0,0 +1,27 @@
+RegisterNodetypes:
+
+    <slingevent='http://sling.apache.org/jcr/event/1.0'>
+    <nt='http://www.jcp.org/jcr/nt/1.0'>
+    <mix='http://www.jcp.org/jcr/mix/1.0'>
+    
+    [slingevent:Event] > nt:unstructured, nt:hierarchyNode
+      - slingevent:topic (string)
+      - slingevent:application (string)
+      - slingevent:created (date)
+      - slingevent:properties (binary)
+      
+    [slingevent:Job] > slingevent:Event, mix:lockable
+      - slingevent:processor (string)
+      - slingevent:id (string)
+      - slingevent:finished (date)
+     
+    [slingevent:TimedEvent] > slingevent:Event, mix:lockable
+      - slingevent:processor (string)
+      - slingevent:id (string)
+      - slingevent:expression (string)
+      - slingevent:date (date)
+      - slingevent:period (long)
+
+RegisterNodetypes:
+
+Just one line, not indented
\ No newline at end of file
diff --git a/src/test/resources/testcases/test-50.txt b/src/test/resources/testcases/test-50.txt
new file mode 100644
index 0000000..230a071
--- /dev/null
+++ b/src/test/resources/testcases/test-50.txt
@@ -0,0 +1,31 @@
+# Test parsing embedded CNDs
+
+register nodetypes
+<<<===
+    <slingevent='http://sling.apache.org/jcr/event/1.0'>
+    <nt='http://www.jcp.org/jcr/nt/1.0'>
+    <mix='http://www.jcp.org/jcr/mix/1.0'>
+    
+    [slingevent:Event] > nt:unstructured, nt:hierarchyNode
+      - slingevent:topic (string)
+      - slingevent:application (string)
+      - slingevent:created (date)
+      - slingevent:properties (binary)
+      
+    [slingevent:Job] > slingevent:Event, mix:lockable
+      - slingevent:processor (string)
+      - slingevent:id (string)
+      - slingevent:finished (date)
+     
+    [slingevent:TimedEvent] > slingevent:Event, mix:lockable
+      - slingevent:processor (string)
+      - slingevent:id (string)
+      - slingevent:expression (string)
+      - slingevent:date (date)
+      - slingevent:period (long)
+===>>>
+
+register nodetypes
+<<<===
+Just one line, not indented
+===>>>
diff --git a/src/test/resources/testcases/test-99-output.txt b/src/test/resources/testcases/test-99-output.txt
index fcbe63c..1fe2f1a 100644
--- a/src/test/resources/testcases/test-99-output.txt
+++ b/src/test/resources/testcases/test-99-output.txt
@@ -17,4 +17,12 @@ SetAclPrincipals for alice bob fred
   AclLine DENY {paths=[/content/example.com], privileges=[jcr:write]}
   AclLine DENY {nodetypes=[example:Page], paths=[/], privileges=[jcr:all]}
 RegisterNamespace (NSprefix) uri:someURI/v1.42
+RegisterNodetypes:
+
+    <slingevent='http://sling.apache.org/jcr/event/1.0'>
+    
+    [slingevent:Event] > nt:unstructured, nt:hierarchyNode
+      - slingevent:topic (string)
+      - slingevent:properties (binary)
+
 CreateServiceUser the-last-one
\ No newline at end of file
diff --git a/src/test/resources/testcases/test-99.txt b/src/test/resources/testcases/test-99.txt
index 54927c4..a2f200a 100644
--- a/src/test/resources/testcases/test-99.txt
+++ b/src/test/resources/testcases/test-99.txt
@@ -33,4 +33,13 @@ end
 
 register namespace ( NSprefix ) uri:someURI/v1.42
 
+register nodetypes
+<<<===
+    <slingevent='http://sling.apache.org/jcr/event/1.0'>
+    
+    [slingevent:Event] > nt:unstructured, nt:hierarchyNode
+      - slingevent:topic (string)
+      - slingevent:properties (binary)
+===>>>
+
 create service user the-last-one
\ 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-repoinit-parser] 07/10: Remove extra import

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.repoinit.parser-1.0.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-repoinit-parser.git

commit 73fa14821950a0ac9f25f0c6fefac1d734e0cb23
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Wed Jul 20 15:25:03 2016 +0000

    Remove extra import
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/repoinit/parser@1753536 13f79535-47bb-0310-9956-ffa450edef68
---
 .../java/org/apache/sling/repoinit/parser/test/ParsingErrorsTest.java    | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/test/java/org/apache/sling/repoinit/parser/test/ParsingErrorsTest.java b/src/test/java/org/apache/sling/repoinit/parser/test/ParsingErrorsTest.java
index c902ac1..00ab007 100644
--- a/src/test/java/org/apache/sling/repoinit/parser/test/ParsingErrorsTest.java
+++ b/src/test/java/org/apache/sling/repoinit/parser/test/ParsingErrorsTest.java
@@ -28,7 +28,6 @@ import java.util.List;
 
 import org.apache.sling.repoinit.parser.impl.ParseException;
 import org.apache.sling.repoinit.parser.impl.RepoInitParserImpl;
-import org.apache.sling.repoinit.parser.impl.TokenMgrError;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;

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

[sling-org-apache-sling-repoinit-parser] 01/10: [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.repoinit.parser-1.0.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-repoinit-parser.git

commit 8fe796dfb92f657e0a6830c1cf2114c7b74a8397
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Wed Jul 6 09:05:24 2016 +0000

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

diff --git a/pom.xml b/pom.xml
index 4c447b2..29890ff 100644
--- a/pom.xml
+++ b/pom.xml
@@ -29,14 +29,14 @@
 
   <artifactId>org.apache.sling.repoinit.parser</artifactId>
   <packaging>bundle</packaging>
-  <version>1.0.2</version>
+  <version>1.0.3-SNAPSHOT</version>
   <name>Apache Sling RepoInit Parser</name>
   <description>Parser for the Repository Initialization language used in Sling</description>
 
   <scm>
-    <connection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.repoinit.parser-1.0.2</connection>
-    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.repoinit.parser-1.0.2</developerConnection>
-    <url>https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.repoinit.parser-1.0.2</url>
+    <connection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/repoinit/parser</connection>
+    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/repoinit/parser</developerConnection>
+    <url>https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/repoinit/parser</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-repoinit-parser] 06/10: SLING-5843 - prefix is required when registering JCR namespaces

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.repoinit.parser-1.0.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-repoinit-parser.git

commit fcbb581cac72dc84612d732614bde28d6b64ca3d
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Wed Jul 20 15:22:53 2016 +0000

    SLING-5843 - prefix is required when registering JCR namespaces
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/repoinit/parser@1753535 13f79535-47bb-0310-9956-ffa450edef68
---
 src/main/javacc/RepoInitGrammar.jjt             | 8 ++------
 src/test/resources/testcases/test-40-output.txt | 1 -
 src/test/resources/testcases/test-40.txt        | 1 -
 3 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/src/main/javacc/RepoInitGrammar.jjt b/src/main/javacc/RepoInitGrammar.jjt
index 9939f81..288b6d5 100644
--- a/src/main/javacc/RepoInitGrammar.jjt
+++ b/src/main/javacc/RepoInitGrammar.jjt
@@ -302,15 +302,11 @@ void registerNamespaceStatement(List<Operation> result) :
 }
 {
     <REGISTER> <NAMESPACE> 
-    ( <LPAREN> prefix = <STRING> <RPAREN> )? 
+    <LPAREN> prefix = <STRING> <RPAREN> 
     uri = <STRING> 
 
     {
-        if(prefix == null) {
-            result.add(new RegisterNamespace(null, uri.image)); 
-        } else {
-            result.add(new RegisterNamespace(prefix.image, uri.image)); 
-        } 
+        result.add(new RegisterNamespace(prefix.image, uri.image)); 
     }
     
     (<EOL> | <EOF>)
diff --git a/src/test/resources/testcases/test-40-output.txt b/src/test/resources/testcases/test-40-output.txt
index e80b5c8..097e4bf 100644
--- a/src/test/resources/testcases/test-40-output.txt
+++ b/src/test/resources/testcases/test-40-output.txt
@@ -1,3 +1,2 @@
 RegisterNamespace (foo) uri:some-uri/V/1.0
-RegisterNamespace () uri:without-prefix
 RegisterNamespace (prefix_with-other.things) andSimpleURI
\ No newline at end of file
diff --git a/src/test/resources/testcases/test-40.txt b/src/test/resources/testcases/test-40.txt
index aa77e26..f5be1b9 100644
--- a/src/test/resources/testcases/test-40.txt
+++ b/src/test/resources/testcases/test-40.txt
@@ -1,4 +1,3 @@
 # Test the register namespace statement
 register namespace (foo) uri:some-uri/V/1.0
-register namespace uri:without-prefix
 register namespace ( prefix_with-other.things ) andSimpleURI
\ 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-repoinit-parser] 05/10: SLING-5842, SLING-5843 - implement the register namespace and nodetype operations in the jcr.repoinit 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.repoinit.parser-1.0.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-repoinit-parser.git

commit 337a21142bed241dd5cb6cf0a3641a9d4397e76a
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Tue Jul 19 15:54:38 2016 +0000

    SLING-5842, SLING-5843 - implement the register namespace and nodetype operations in the jcr.repoinit module
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/repoinit/parser@1753399 13f79535-47bb-0310-9956-ffa450edef68
---
 .../sling/repoinit/parser/operations/RegisterNamespace.java       | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/main/java/org/apache/sling/repoinit/parser/operations/RegisterNamespace.java b/src/main/java/org/apache/sling/repoinit/parser/operations/RegisterNamespace.java
index b5a947b..bbdcbd5 100644
--- a/src/main/java/org/apache/sling/repoinit/parser/operations/RegisterNamespace.java
+++ b/src/main/java/org/apache/sling/repoinit/parser/operations/RegisterNamespace.java
@@ -43,4 +43,12 @@ public class RegisterNamespace extends Operation {
     public void accept(OperationVisitor v) {
         v.visitRegisterNamespace(this);
     }
+    
+    public String getPrefix() {
+        return prefix;
+    }
+    
+    public String getURI() {
+        return uri;
+    }
 }

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

[sling-org-apache-sling-repoinit-parser] 02/10: SLING-5843 - add 'register namespace' statement to repoinit parser

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.repoinit.parser-1.0.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-repoinit-parser.git

commit 539cbbd2a702d45d17ed30a3965257d03e8519d8
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Mon Jul 18 08:50:04 2016 +0000

    SLING-5843 - add 'register namespace' statement to repoinit parser
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/repoinit/parser@1753177 13f79535-47bb-0310-9956-ffa450edef68
---
 .../parser/operations/OperationVisitor.java        |  1 +
 ...perationVisitor.java => RegisterNamespace.java} | 32 +++++++++++++----
 .../repoinit/parser/operations/package-info.java   |  2 +-
 src/main/javacc/RepoInitGrammar.jjt                | 40 ++++++++++++++++++----
 .../parser/test/OperationToStringVisitor.java      |  6 ++++
 .../repoinit/parser/test/ParsingErrorsTest.java    | 21 ++++++++----
 src/test/resources/testcases/test-40-output.txt    |  3 ++
 src/test/resources/testcases/test-40.txt           |  4 +++
 src/test/resources/testcases/test-99-output.txt    |  1 +
 src/test/resources/testcases/test-99.txt           |  2 ++
 10 files changed, 92 insertions(+), 20 deletions(-)

diff --git a/src/main/java/org/apache/sling/repoinit/parser/operations/OperationVisitor.java b/src/main/java/org/apache/sling/repoinit/parser/operations/OperationVisitor.java
index 4079386..d7d2682 100644
--- a/src/main/java/org/apache/sling/repoinit/parser/operations/OperationVisitor.java
+++ b/src/main/java/org/apache/sling/repoinit/parser/operations/OperationVisitor.java
@@ -23,4 +23,5 @@ public interface OperationVisitor {
     void visitSetAclPrincipal(SetAclPrincipals s);
     void visitSetAclPaths(SetAclPaths s);
     void visitCreatePath(CreatePath cp);
+    void visitRegisterNamespace(RegisterNamespace rn);
 }
diff --git a/src/main/java/org/apache/sling/repoinit/parser/operations/OperationVisitor.java b/src/main/java/org/apache/sling/repoinit/parser/operations/RegisterNamespace.java
similarity index 53%
copy from src/main/java/org/apache/sling/repoinit/parser/operations/OperationVisitor.java
copy to src/main/java/org/apache/sling/repoinit/parser/operations/RegisterNamespace.java
index 4079386..b5a947b 100644
--- a/src/main/java/org/apache/sling/repoinit/parser/operations/OperationVisitor.java
+++ b/src/main/java/org/apache/sling/repoinit/parser/operations/RegisterNamespace.java
@@ -17,10 +17,30 @@
 
 package org.apache.sling.repoinit.parser.operations;
 
-public interface OperationVisitor {
-    void visitCreateServiceUser(CreateServiceUser s);
-    void visitDeleteServiceUser(DeleteServiceUser s);
-    void visitSetAclPrincipal(SetAclPrincipals s);
-    void visitSetAclPaths(SetAclPaths s);
-    void visitCreatePath(CreatePath cp);
+public class RegisterNamespace extends Operation {
+    private final String prefix;
+    private final String uri;
+    
+    public RegisterNamespace(String prefix, String uri) {
+        this.prefix = prefix;
+        this.uri = uri;
+    }
+    
+    @Override
+    public String toString() {
+        return getClass().getSimpleName() + " " + getParametersDescription();
+    }
+    
+    @Override
+    protected String getParametersDescription() {
+        final StringBuilder sb = new StringBuilder();
+        sb.append("(").append(prefix == null ? "" : prefix).append(") ");
+        sb.append(uri);
+        return sb.toString();
+    }
+
+    @Override
+    public void accept(OperationVisitor v) {
+        v.visitRegisterNamespace(this);
+    }
 }
diff --git a/src/main/java/org/apache/sling/repoinit/parser/operations/package-info.java b/src/main/java/org/apache/sling/repoinit/parser/operations/package-info.java
index fad0a42..b1ee857 100644
--- a/src/main/java/org/apache/sling/repoinit/parser/operations/package-info.java
+++ b/src/main/java/org/apache/sling/repoinit/parser/operations/package-info.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  ******************************************************************************/
 
-@Version("1.0.0")
+@Version("2.0.0")
 package org.apache.sling.repoinit.parser.operations;
 
 import aQute.bnd.annotation.Version;
diff --git a/src/main/javacc/RepoInitGrammar.jjt b/src/main/javacc/RepoInitGrammar.jjt
index 66b52b0..1f887b5 100644
--- a/src/main/javacc/RepoInitGrammar.jjt
+++ b/src/main/javacc/RepoInitGrammar.jjt
@@ -8,6 +8,8 @@ options
     STATIC=false;
     LOOKAHEAD=3;
     //FORCE_LA_CHECK=true;
+    //DEBUG_PARSER=true;
+    //DEBUG_LOOKAHEAD=true;
 }
 
 PARSER_BEGIN(RepoInitParserImpl)
@@ -65,13 +67,17 @@ TOKEN:
 |   < END: "end" >
 |   < USER: "user" >
 |   < NODETYPES: "nodetypes" >
+|   < REGISTER: "register" >
+|   < NAMESPACE: "namespace" >
 |   < LPAREN: "(" >
 |   < RPAREN: ")" >
-|   < PRINCIPAL: (["a"-"z"] | ["A"-"Z"] | ["0"-"9"] | "_" | "-")+ >
 |   < COMMA: "," >
 |   < STAR: "*" >
+
+/* The order of these fuzzy statements is important (first match wins?) */ 
 |   < NAMESPACED_ITEM: (["a"-"z"] | ["A"-"Z"])+ ":" (["a"-"z"] | ["A"-"Z"])+ >
 |   < PATH_STRING: "/" (["a"-"z"] | ["A"-"Z"] | ["0"-"9"] | ["-"] | ["_"] | ["."] | ["/"]) * >
+|   < STRING: (["a"-"z"] | ["A"-"Z"] | ["0"-"9"] | ["-"] | ["_"] | ["."] | ["/"] | [":"]) * >
 |   < EOL: "\n" >
 }
 
@@ -85,6 +91,7 @@ List<Operation> parse() :
         | setAclPaths(result) 
         | setAclPrincipals(result)
         | createPathStatement(result)
+        | registerNamespaceStatement(result)
         | blankLine() 
     ) * 
     <EOF>
@@ -104,8 +111,8 @@ List<String> principalsList() :
     List<String> principals = new ArrayList<String>(); 
 }
 {
-    t = <PRINCIPAL> { principals.add(t.image); } 
-    ( <COMMA> t = <PRINCIPAL> { principals.add(t.image); } )* 
+    t = <STRING> { principals.add(t.image); } 
+    ( <COMMA> t = <STRING> { principals.add(t.image); } )* 
     { return principals; }
 }
 
@@ -121,11 +128,11 @@ void serviceUserStatement(List<Operation> result) :
     (<EOL> | <EOF>)
     
     {
-        for(String PRINCIPAL : principals) {
+        for(String principal : principals) {
             if(CREATE == t.kind) {
-                result.add(new CreateServiceUser(PRINCIPAL));
+                result.add(new CreateServiceUser(principal));
             } else {
-                result.add(new DeleteServiceUser(PRINCIPAL));
+                result.add(new DeleteServiceUser(principal));
             }
         } 
     }
@@ -274,3 +281,24 @@ void setAclPrincipals(List<Operation> result) :
         result.add(new SetAclPrincipals(principals, lines));
     }
 }
+
+void registerNamespaceStatement(List<Operation> result) :
+{
+    Token prefix = null;
+    Token uri;
+}
+{
+    <REGISTER> <NAMESPACE> 
+    ( <LPAREN> prefix = <STRING> <RPAREN> )? 
+    uri = <STRING> 
+
+    {
+        if(prefix == null) {
+            result.add(new RegisterNamespace(null, uri.image)); 
+        } else {
+            result.add(new RegisterNamespace(prefix.image, uri.image)); 
+        } 
+    }
+    
+    (<EOL> | <EOF>)
+}
diff --git a/src/test/java/org/apache/sling/repoinit/parser/test/OperationToStringVisitor.java b/src/test/java/org/apache/sling/repoinit/parser/test/OperationToStringVisitor.java
index a439549..a25128a 100644
--- a/src/test/java/org/apache/sling/repoinit/parser/test/OperationToStringVisitor.java
+++ b/src/test/java/org/apache/sling/repoinit/parser/test/OperationToStringVisitor.java
@@ -25,6 +25,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.RegisterNamespace;
 import org.apache.sling.repoinit.parser.operations.SetAclPaths;
 import org.apache.sling.repoinit.parser.operations.SetAclPrincipals;
 
@@ -77,6 +78,11 @@ class OperationToStringVisitor implements OperationVisitor {
     public void visitCreatePath(CreatePath cp) {
         out.println(cp.toString());
     }
+    
+    @Override
+    public void visitRegisterNamespace(RegisterNamespace rn) {
+        out.println(rn.toString());
+    }
 
     private void dumpAclLines(Collection<AclLine> c) {
         for(AclLine line : c) {
diff --git a/src/test/java/org/apache/sling/repoinit/parser/test/ParsingErrorsTest.java b/src/test/java/org/apache/sling/repoinit/parser/test/ParsingErrorsTest.java
index fb46eef..c902ac1 100644
--- a/src/test/java/org/apache/sling/repoinit/parser/test/ParsingErrorsTest.java
+++ b/src/test/java/org/apache/sling/repoinit/parser/test/ParsingErrorsTest.java
@@ -56,9 +56,13 @@ public class ParsingErrorsTest {
             
             add(new Object[] { "create service user bob, alice, tom21", null  });
             add(new Object[] { "create service user bob-221_BOB", null  });
-            add(new Object[] { "create service user bob/221", ParseException.class  });
+            
+            // this passes since introducing "register namespace" and loosening
+            // the PRINCIPAL regexp
+            add(new Object[] { "create service user bob/221", null  });
+            
             add(new Object[] { "create service user bob,/alice, tom21", ParseException.class  });
-            add(new Object[] { "create service user bob,alice,tom21 # comment not allowed here", TokenMgrError.class  });
+            add(new Object[] { "create service user bob,alice,tom21 # comment not allowed here", ParseException.class });
             add(new Object[] { "CREATE service user bob, alice, tom21", ParseException.class });
             add(new Object[] { "create SERVICE user bob, alice, tom21", ParseException.class });
         }};
@@ -73,17 +77,20 @@ public class ParsingErrorsTest {
     @Test
     public void checkResult() throws ParseException, IOException {
         final StringReader r = new StringReader(input);
+        boolean noException = false;
         try {
             new RepoInitParserImpl(r).parse();
-            if(expected != null) {
-                fail("Expected a " + expected.getSimpleName() + " for [" + input + "]");
-            }
+            noException = true;
         } catch(Exception e) {
-            assertEquals(expected, e.getClass());
+            assertEquals("for input " + input, expected, e.getClass());
         } catch(Error err) {
-            assertEquals(expected, err.getClass());
+            assertEquals("for input " + input, expected, err.getClass());
         } finally {
             r.close();
         }
+        
+        if(noException && expected != null) {
+            fail("Expected a " + expected.getSimpleName() + " for [" + input + "]");
+        }
     }
 }
diff --git a/src/test/resources/testcases/test-40-output.txt b/src/test/resources/testcases/test-40-output.txt
new file mode 100644
index 0000000..e80b5c8
--- /dev/null
+++ b/src/test/resources/testcases/test-40-output.txt
@@ -0,0 +1,3 @@
+RegisterNamespace (foo) uri:some-uri/V/1.0
+RegisterNamespace () uri:without-prefix
+RegisterNamespace (prefix_with-other.things) andSimpleURI
\ No newline at end of file
diff --git a/src/test/resources/testcases/test-40.txt b/src/test/resources/testcases/test-40.txt
new file mode 100644
index 0000000..aa77e26
--- /dev/null
+++ b/src/test/resources/testcases/test-40.txt
@@ -0,0 +1,4 @@
+# Test the register namespace statement
+register namespace (foo) uri:some-uri/V/1.0
+register namespace uri:without-prefix
+register namespace ( prefix_with-other.things ) andSimpleURI
\ No newline at end of file
diff --git a/src/test/resources/testcases/test-99-output.txt b/src/test/resources/testcases/test-99-output.txt
index 2761b1b..fcbe63c 100644
--- a/src/test/resources/testcases/test-99-output.txt
+++ b/src/test/resources/testcases/test-99-output.txt
@@ -16,4 +16,5 @@ SetAclPrincipals for alice bob fred
   AclLine ALLOW {paths=[/content, /var], privileges=[jcr:read]}
   AclLine DENY {paths=[/content/example.com], privileges=[jcr:write]}
   AclLine DENY {nodetypes=[example:Page], paths=[/], privileges=[jcr:all]}
+RegisterNamespace (NSprefix) uri:someURI/v1.42
 CreateServiceUser the-last-one
\ No newline at end of file
diff --git a/src/test/resources/testcases/test-99.txt b/src/test/resources/testcases/test-99.txt
index 44de7e9..54927c4 100644
--- a/src/test/resources/testcases/test-99.txt
+++ b/src/test/resources/testcases/test-99.txt
@@ -31,4 +31,6 @@ set ACL for alice, bob,fred
     
 end
 
+register namespace ( NSprefix ) uri:someURI/v1.42
+
 create service user the-last-one
\ 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-repoinit-parser] 09/10: [maven-release-plugin] prepare release org.apache.sling.repoinit.parser-1.0.4

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.repoinit.parser-1.0.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-repoinit-parser.git

commit 826aab7c6aaa924d0e35fc3fa91d78a8de8858e0
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Mon Aug 22 16:18:15 2016 +0000

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

diff --git a/pom.xml b/pom.xml
index 29890ff..0a552da 100644
--- a/pom.xml
+++ b/pom.xml
@@ -29,14 +29,14 @@
 
   <artifactId>org.apache.sling.repoinit.parser</artifactId>
   <packaging>bundle</packaging>
-  <version>1.0.3-SNAPSHOT</version>
+  <version>1.0.4</version>
   <name>Apache Sling RepoInit Parser</name>
   <description>Parser for the Repository Initialization language used in Sling</description>
 
   <scm>
-    <connection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/repoinit/parser</connection>
-    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/repoinit/parser</developerConnection>
-    <url>https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/repoinit/parser</url>
+    <connection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.repoinit.parser-1.0.4</connection>
+    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.repoinit.parser-1.0.4</developerConnection>
+    <url>https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.repoinit.parser-1.0.4</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-repoinit-parser] 08/10: fix javadoc, style

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.repoinit.parser-1.0.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-repoinit-parser.git

commit a9f71de59bf57b274e5886dbf5b276a3d792853d
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Fri Jul 29 06:55:36 2016 +0000

    fix javadoc, style
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/repoinit/parser@1754480 13f79535-47bb-0310-9956-ffa450edef68
---
 .../apache/sling/repoinit/parser/RepoInitParser.java    | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/src/main/java/org/apache/sling/repoinit/parser/RepoInitParser.java b/src/main/java/org/apache/sling/repoinit/parser/RepoInitParser.java
index 8fe70eb..a975931 100644
--- a/src/main/java/org/apache/sling/repoinit/parser/RepoInitParser.java
+++ b/src/main/java/org/apache/sling/repoinit/parser/RepoInitParser.java
@@ -23,12 +23,17 @@ import java.util.List;
 
 import org.apache.sling.repoinit.parser.operations.Operation;
 
-/** ACL definitions parser service interface */
+/**
+ * repoinit parser service interface
+ */
 public interface RepoInitParser {
-    /** Parse the supplied input.
-     * @param r Input in ACL definitions format. The reader is closed
-     *  by this method. 
-     * @throws AclParsingException on parsing errors
+
+    /**
+     * Parse the supplied input.
+     *
+     * @param reader Input in repoinit format. The reader is closed by this method.
+     * @throws RepoInitParsingException on parsing errors
      */
-    List<Operation> parse(Reader r) throws RepoInitParsingException;
+    List<Operation> parse(Reader reader) throws RepoInitParsingException;
+
 }

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