[sling-org-apache-sling-repoinit-parser] branch master updated: Tweak docs and links
This is an automated email from the ASF dual-hosted git repository. bdelacretaz pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-repoinit-parser.git The following commit(s) were added to refs/heads/master by this push: new bb6086c Tweak docs and links bb6086c is described below commit bb6086c98076c6230c6e7a592b322d3523e318bd Author: Bertrand Delacretaz AuthorDate: Thu May 6 10:45:57 2021 +0200 Tweak docs and links --- README.md | 18 +- src/main/javacc/RepoInitGrammar.jjt | 1 + 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index a65104d..656c433 100644 --- a/README.md +++ b/README.md @@ -6,17 +6,25 @@ This module is part of the [Apache Sling](https://sling.apache.org) project. -Parser for the [Repository Initialization language](https://sling.apache.org/documentation/bundles/repository-initialization.html) used in Sling. +It implements the [Repository Initialization language](https://sling.apache.org/documentation/bundles/repository-initialization.html) parser. To parse repoinit statements use the [RepoInitParser](./src/main/java/org/apache/sling/repoinit/parser/RepoInitParser.java) service. -See the [Sling Website Repository Initialization page](https://sling.apache.org/documentation/bundles/repository-initialization.html) for more information. +The companion [jcr-repoinit](https://github.com/apache/sling-org-apache-sling-jcr-repoinit) module can execute the resulting `Operations` on a +JCR content repository. -## Module dependencies +The JavaCC parser grammar is defined in the [RepoInitGrammar.jjt](./src/main/javacc/RepoInitGrammar.jjt) file, which has links to +the JavaCC documentation. + +## Dependent modules The [Feature Model Analyser](https://github.com/apache/sling-org-apache-sling-feature-analyser) uses this -module to validate repoinit statements embedded in feature models. It should be kept up to date with new -releases of this parser. +parser to validate repoinit statements embedded in feature models. It should be kept up to date with new +releases of this module. + +The [bnd.bnd](./bnd.bnd) file defines an `org.apache.sling.repoinit.language` OSGi capability which indicates +the version of the repoinit language that this parser implements. That value should be incremented when the +grammar changes, so that modules that depend on those changes can require the appropriate version. ## Documenting the language diff --git a/src/main/javacc/RepoInitGrammar.jjt b/src/main/javacc/RepoInitGrammar.jjt index f255b47..3d3d9ea 100644 --- a/src/main/javacc/RepoInitGrammar.jjt +++ b/src/main/javacc/RepoInitGrammar.jjt @@ -3,6 +3,7 @@ * See https://javacc.github.io/javacc/ for the most recent docs, * including links to grammar examples * See http://www.engr.mun.ca/~theo/JavaCC-FAQ/javacc-faq-moz.htm for a FAQ from 2011 + * See also http://eriklievaart.com/web/javacc1.html (from 2014) for additional information */ options
[sling-org-apache-sling-distribution-core] 01/01: SLING-9873 - Add test that covers paths with namespaced names
This is an automated email from the ASF dual-hosted git repository. tmaret pushed a commit to branch SLING-9873-1 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-distribution-core.git commit a38c4fbb4a4d506239c486bdc39bfca2510278b3 Author: tmaret AuthorDate: Thu May 6 10:55:05 2021 +0200 SLING-9873 - Add test that covers paths with namespaced names --- .../packaging/impl/SimpleDistributionPackageTest.java | 14 ++ 1 file changed, 14 insertions(+) diff --git a/src/test/java/org/apache/sling/distribution/packaging/impl/SimpleDistributionPackageTest.java b/src/test/java/org/apache/sling/distribution/packaging/impl/SimpleDistributionPackageTest.java index 5bbe4df..76d1dc1 100644 --- a/src/test/java/org/apache/sling/distribution/packaging/impl/SimpleDistributionPackageTest.java +++ b/src/test/java/org/apache/sling/distribution/packaging/impl/SimpleDistributionPackageTest.java @@ -21,6 +21,7 @@ package org.apache.sling.distribution.packaging.impl; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; +import java.nio.charset.Charset; import java.util.Arrays; import org.apache.commons.io.IOUtils; @@ -30,8 +31,10 @@ import org.apache.sling.distribution.SimpleDistributionRequest; import org.junit.Test; import org.mockito.Mockito; +import static org.apache.commons.io.IOUtils.toInputStream; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.nullValue; +import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertThat; @@ -44,6 +47,8 @@ import static org.mockito.Mockito.when; */ public class SimpleDistributionPackageTest { +private static final String TYPE = "testPackageType"; + private static final String DSTRPCK_DELETE = "DSTRPCK::DELETE|/abc:/c"; private static final String DSTRPCK_ITEM_WITH_COMMA_DELETE = "DSTRPCK::DELETE|/ab,c:/c"; @@ -77,6 +82,15 @@ public class SimpleDistributionPackageTest { } @Test +public void testPackageWithNamespaceInPath() { +DistributionRequest req = new SimpleDistributionRequest(DistributionRequestType.ADD, "/a/jcr:content", "/b"); +SimpleDistributionPackage pkgOut = new SimpleDistributionPackage(req, TYPE); +SimpleDistributionPackage pkgIn = SimpleDistributionPackage.fromStream(toInputStream(pkgOut.toString(), Charset.defaultCharset()), TYPE); +assertNotNull(pkgIn); +assertArrayEquals(pkgOut.getInfo().getPaths(), pkgIn.getInfo().getPaths()); +} + +@Test public void testCreatedAndReadPackagesEqualityWithCommaInName() throws Exception { DistributionRequest request = new SimpleDistributionRequest(DistributionRequestType.DELETE, "/ab,c", "/c"); SimpleDistributionPackage createdPackage = new SimpleDistributionPackage(request, "VOID");
[sling-org-apache-sling-distribution-core] branch SLING-9873-1 created (now a38c4fb)
This is an automated email from the ASF dual-hosted git repository. tmaret pushed a change to branch SLING-9873-1 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-distribution-core.git. at a38c4fb SLING-9873 - Add test that covers paths with namespaced names This branch includes the following new commits: new a38c4fb SLING-9873 - Add test that covers paths with namespaced names The 1 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.
[sling-org-apache-sling-distribution-core] branch SLING-9873-1 updated: SLING-9873 - Use the character ] as path delimiter
This is an automated email from the ASF dual-hosted git repository. tmaret pushed a commit to branch SLING-9873-1 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-distribution-core.git The following commit(s) were added to refs/heads/SLING-9873-1 by this push: new c3f273b SLING-9873 - Use the character ] as path delimiter c3f273b is described below commit c3f273b5843ce6addb6737fbff0f2d8356413fee Author: tmaret AuthorDate: Thu May 6 11:25:11 2021 +0200 SLING-9873 - Use the character ] as path delimiter --- .../packaging/impl/SimpleDistributionPackage.java | 2 +- .../impl/SimpleDistributionPackageTest.java| 51 ++ 2 files changed, 15 insertions(+), 38 deletions(-) diff --git a/src/main/java/org/apache/sling/distribution/packaging/impl/SimpleDistributionPackage.java b/src/main/java/org/apache/sling/distribution/packaging/impl/SimpleDistributionPackage.java index 8aec301..c8196a6 100644 --- a/src/main/java/org/apache/sling/distribution/packaging/impl/SimpleDistributionPackage.java +++ b/src/main/java/org/apache/sling/distribution/packaging/impl/SimpleDistributionPackage.java @@ -41,7 +41,7 @@ public class SimpleDistributionPackage extends AbstractDistributionPackage imple private final static String PACKAGE_START = "DSTRPCK::"; private final static String PACKAGE_START_OLD = "DSTRPCK:"; private final static String DELIM = "|"; -private final static String PATH_DELIM = ":"; +private final static String PATH_DELIM = "]"; private final static String PATH_DELIM_OLD = ","; private final long size; diff --git a/src/test/java/org/apache/sling/distribution/packaging/impl/SimpleDistributionPackageTest.java b/src/test/java/org/apache/sling/distribution/packaging/impl/SimpleDistributionPackageTest.java index 76d1dc1..9009d54 100644 --- a/src/test/java/org/apache/sling/distribution/packaging/impl/SimpleDistributionPackageTest.java +++ b/src/test/java/org/apache/sling/distribution/packaging/impl/SimpleDistributionPackageTest.java @@ -32,7 +32,6 @@ import org.junit.Test; import org.mockito.Mockito; import static org.apache.commons.io.IOUtils.toInputStream; -import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.nullValue; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; @@ -49,9 +48,6 @@ public class SimpleDistributionPackageTest { private static final String TYPE = "testPackageType"; -private static final String DSTRPCK_DELETE = "DSTRPCK::DELETE|/abc:/c"; -private static final String DSTRPCK_ITEM_WITH_COMMA_DELETE = "DSTRPCK::DELETE|/ab,c:/c"; - @Test public void testInvalid() { String id = "invalid"; @@ -83,49 +79,20 @@ public class SimpleDistributionPackageTest { @Test public void testPackageWithNamespaceInPath() { -DistributionRequest req = new SimpleDistributionRequest(DistributionRequestType.ADD, "/a/jcr:content", "/b"); -SimpleDistributionPackage pkgOut = new SimpleDistributionPackage(req, TYPE); -SimpleDistributionPackage pkgIn = SimpleDistributionPackage.fromStream(toInputStream(pkgOut.toString(), Charset.defaultCharset()), TYPE); -assertNotNull(pkgIn); -assertArrayEquals(pkgOut.getInfo().getPaths(), pkgIn.getInfo().getPaths()); +DistributionRequest request = new SimpleDistributionRequest(DistributionRequestType.ADD, "/a/jcr:content", "/b"); +testPackageSerDeser(request); } @Test public void testCreatedAndReadPackagesEqualityWithCommaInName() throws Exception { DistributionRequest request = new SimpleDistributionRequest(DistributionRequestType.DELETE, "/ab,c", "/c"); -SimpleDistributionPackage createdPackage = new SimpleDistributionPackage(request, "VOID"); -assertThat(createdPackage.toString(), equalTo(DSTRPCK_ITEM_WITH_COMMA_DELETE)); -// Just to run the code -createdPackage.acquire(); -createdPackage.release(); -createdPackage.close(); -createdPackage.delete(); - -SimpleDistributionPackage readPackage = SimpleDistributionPackage.fromStream(new ByteArrayInputStream(DSTRPCK_ITEM_WITH_COMMA_DELETE.getBytes()), "VOID"); -assertNotNull(readPackage); -assertEquals(Arrays.toString(createdPackage.getInfo().getPaths()), Arrays.toString(readPackage.getInfo().getPaths())); +testPackageSerDeser(request); } @Test public void testCreatedAndReadPackagesEquality() throws Exception { DistributionRequest request = new SimpleDistributionRequest(DistributionRequestType.DELETE, "/abc", "/c"); -SimpleDistributionPackage createdPackage = new SimpleDistributionPackage(request, "VOID"); -assertThat(createdPackage.toString(), equalTo(DSTRPCK_DELETE)); -// Just to run the code -createdPackage.acquire(); -createdPackage.release(); -
[sling-whiteboard] branch master updated: Add help field to commands
This is an automated email from the ASF dual-hosted git repository. bdelacretaz pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/sling-whiteboard.git The following commit(s) were added to refs/heads/master by this push: new c42f038 Add help field to commands c42f038 is described below commit c42f038f3f53981c9538fdac8e26fec5564e2e71 Author: Bertrand Delacretaz AuthorDate: Thu May 6 13:30:39 2021 +0200 Add help field to commands --- .../org/apache/sling/remotecontentapi/graphql/CommandDataFetcher.java | 2 ++ .../SLING-INF/initial-content/apps/samples/graphql/GQLschema.jsp| 1 + 2 files changed, 3 insertions(+) diff --git a/remote-content-api/sample-graphql-api/src/main/java/org/apache/sling/remotecontentapi/graphql/CommandDataFetcher.java b/remote-content-api/sample-graphql-api/src/main/java/org/apache/sling/remotecontentapi/graphql/CommandDataFetcher.java index 4c37016..3aa7655 100644 --- a/remote-content-api/sample-graphql-api/src/main/java/org/apache/sling/remotecontentapi/graphql/CommandDataFetcher.java +++ b/remote-content-api/sample-graphql-api/src/main/java/org/apache/sling/remotecontentapi/graphql/CommandDataFetcher.java @@ -64,6 +64,8 @@ public class CommandDataFetcher implements SlingDataFetcher { result.put("success", false); result.put("output", ex.toString()); } + +result.put("help", "See https://sling.apache.org/documentation/bundles/repository-initialization.html for information about the repoinit language"); return result; diff --git a/remote-content-api/sample-graphql-api/src/main/resources/SLING-INF/initial-content/apps/samples/graphql/GQLschema.jsp b/remote-content-api/sample-graphql-api/src/main/resources/SLING-INF/initial-content/apps/samples/graphql/GQLschema.jsp index 7539aa4..425ff57 100644 --- a/remote-content-api/sample-graphql-api/src/main/resources/SLING-INF/initial-content/apps/samples/graphql/GQLschema.jsp +++ b/remote-content-api/sample-graphql-api/src/main/resources/SLING-INF/initial-content/apps/samples/graphql/GQLschema.jsp @@ -33,6 +33,7 @@ type Mutation { type CommandResult { success: Boolean output: String + help: String links: [Link] }
[sling-org-apache-sling-distribution-core] branch SLING-9873-2 created (now e4f9f7d)
This is an automated email from the ASF dual-hosted git repository. tmaret pushed a change to branch SLING-9873-2 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-distribution-core.git. at e4f9f7d SLING-9873 - Use the characters :: as path delimiter This branch includes the following new commits: new e4f9f7d SLING-9873 - Use the characters :: as path delimiter The 1 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.
[sling-org-apache-sling-distribution-core] 01/01: SLING-9873 - Use the characters :: as path delimiter
This is an automated email from the ASF dual-hosted git repository. tmaret pushed a commit to branch SLING-9873-2 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-distribution-core.git commit e4f9f7de6f589d0a43ab638b9dd07a864695f339 Author: tmaret AuthorDate: Thu May 6 13:53:45 2021 +0200 SLING-9873 - Use the characters :: as path delimiter --- .../packaging/impl/SimpleDistributionPackage.java | 2 +- .../impl/SimpleDistributionPackageTest.java| 51 ++ 2 files changed, 15 insertions(+), 38 deletions(-) diff --git a/src/main/java/org/apache/sling/distribution/packaging/impl/SimpleDistributionPackage.java b/src/main/java/org/apache/sling/distribution/packaging/impl/SimpleDistributionPackage.java index 8aec301..88f2a4a 100644 --- a/src/main/java/org/apache/sling/distribution/packaging/impl/SimpleDistributionPackage.java +++ b/src/main/java/org/apache/sling/distribution/packaging/impl/SimpleDistributionPackage.java @@ -41,7 +41,7 @@ public class SimpleDistributionPackage extends AbstractDistributionPackage imple private final static String PACKAGE_START = "DSTRPCK::"; private final static String PACKAGE_START_OLD = "DSTRPCK:"; private final static String DELIM = "|"; -private final static String PATH_DELIM = ":"; +private final static String PATH_DELIM = "::"; private final static String PATH_DELIM_OLD = ","; private final long size; diff --git a/src/test/java/org/apache/sling/distribution/packaging/impl/SimpleDistributionPackageTest.java b/src/test/java/org/apache/sling/distribution/packaging/impl/SimpleDistributionPackageTest.java index 76d1dc1..9009d54 100644 --- a/src/test/java/org/apache/sling/distribution/packaging/impl/SimpleDistributionPackageTest.java +++ b/src/test/java/org/apache/sling/distribution/packaging/impl/SimpleDistributionPackageTest.java @@ -32,7 +32,6 @@ import org.junit.Test; import org.mockito.Mockito; import static org.apache.commons.io.IOUtils.toInputStream; -import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.nullValue; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; @@ -49,9 +48,6 @@ public class SimpleDistributionPackageTest { private static final String TYPE = "testPackageType"; -private static final String DSTRPCK_DELETE = "DSTRPCK::DELETE|/abc:/c"; -private static final String DSTRPCK_ITEM_WITH_COMMA_DELETE = "DSTRPCK::DELETE|/ab,c:/c"; - @Test public void testInvalid() { String id = "invalid"; @@ -83,49 +79,20 @@ public class SimpleDistributionPackageTest { @Test public void testPackageWithNamespaceInPath() { -DistributionRequest req = new SimpleDistributionRequest(DistributionRequestType.ADD, "/a/jcr:content", "/b"); -SimpleDistributionPackage pkgOut = new SimpleDistributionPackage(req, TYPE); -SimpleDistributionPackage pkgIn = SimpleDistributionPackage.fromStream(toInputStream(pkgOut.toString(), Charset.defaultCharset()), TYPE); -assertNotNull(pkgIn); -assertArrayEquals(pkgOut.getInfo().getPaths(), pkgIn.getInfo().getPaths()); +DistributionRequest request = new SimpleDistributionRequest(DistributionRequestType.ADD, "/a/jcr:content", "/b"); +testPackageSerDeser(request); } @Test public void testCreatedAndReadPackagesEqualityWithCommaInName() throws Exception { DistributionRequest request = new SimpleDistributionRequest(DistributionRequestType.DELETE, "/ab,c", "/c"); -SimpleDistributionPackage createdPackage = new SimpleDistributionPackage(request, "VOID"); -assertThat(createdPackage.toString(), equalTo(DSTRPCK_ITEM_WITH_COMMA_DELETE)); -// Just to run the code -createdPackage.acquire(); -createdPackage.release(); -createdPackage.close(); -createdPackage.delete(); - -SimpleDistributionPackage readPackage = SimpleDistributionPackage.fromStream(new ByteArrayInputStream(DSTRPCK_ITEM_WITH_COMMA_DELETE.getBytes()), "VOID"); -assertNotNull(readPackage); -assertEquals(Arrays.toString(createdPackage.getInfo().getPaths()), Arrays.toString(readPackage.getInfo().getPaths())); +testPackageSerDeser(request); } @Test public void testCreatedAndReadPackagesEquality() throws Exception { DistributionRequest request = new SimpleDistributionRequest(DistributionRequestType.DELETE, "/abc", "/c"); -SimpleDistributionPackage createdPackage = new SimpleDistributionPackage(request, "VOID"); -assertThat(createdPackage.toString(), equalTo(DSTRPCK_DELETE)); -// Just to run the code -createdPackage.acquire(); -createdPackage.release(); -createdPackage.close(); -createdPackage.delete(); - -SimpleDistributionPackage readPackage = SimpleDistributionPackage.fromStream(new ByteArray
[sling-whiteboard] branch master updated (c42f038 -> 74d4146)
This is an automated email from the ASF dual-hosted git repository. bdelacretaz pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/sling-whiteboard.git. from c42f038 Add help field to commands add 74d4146 Make the sample-graphql-api module standalone (which broke a few things in terms of document rendering) No new revisions were added by this update. Summary of changes: remote-content-api/sample-graphql-api/README.md| 8 ++- remote-content-api/sample-graphql-api/pom.xml | 21 +++--- .../documentmapper/api/AnnotationNames.java| 2 +- .../documentmapper/api/AnnotationRegistry.java | 17 ++--- .../documentmapper/api/DocumentMapper.java | 4 +- .../documentmapper/api/MappingTarget.java | 4 +- .../remotecontent/documentmapper/impl/A.java} | 23 +++ .../documentmapper/impl/ContentDocumentMapper.java | 39 ++- .../impl/ContentPropertiesSelector.java| 15 +++-- .../documentmapper/impl/JsonMappingTarget.java | 4 +- .../documentmapper/impl/JsonTargetNode.java| 6 +- .../documentmapper/impl/MapMappingTarget.java | 4 +- .../documentmapper/impl/MapTargetNode.java | 6 +- .../documentmapper/impl/PropertiesMapper.java | 4 +- .../documentmapper/impl/PropertiesSelector.java| 2 +- .../samples}/graphql/CommandDataFetcher.java | 2 +- .../samples}/graphql/DocumentDataFetcher.java | 19 +++--- .../samples}/graphql/DocumentsDataFetcher.java | 28 +++- .../samples}/graphql/ObjectScalar.java | 2 +- .../samples/graphql/UrlBuilderStub.java| 12 ++-- .../graphql/annotations}/AnnotationImpl.java | 21 +++--- .../annotations/AnnotationRegistryImpl.java} | 71 .../samples/graphql/annotations/Builder.java} | 33 +- .../sling/remotecontentapi/typesystem/Builder.java | 77 -- .../remotecontentapi/typesystem/PropertyImpl.java | 73 .../features/feature-sample-graphql-api.json | 4 +- 26 files changed, 163 insertions(+), 338 deletions(-) copy remote-content-api/{document-mapper/src/main/java/org/apache/sling => sample-graphql-api/src/main/java/org/apache/sling/remotecontent}/documentmapper/api/AnnotationNames.java (96%) copy mdresourcedecorator/src/main/java/org/apache/sling/mdresource/impl/md/ProcessingResult.java => remote-content-api/sample-graphql-api/src/main/java/org/apache/sling/remotecontent/documentmapper/api/AnnotationRegistry.java (72%) copy remote-content-api/{document-mapper/src/main/java/org/apache/sling => sample-graphql-api/src/main/java/org/apache/sling/remotecontent}/documentmapper/api/DocumentMapper.java (90%) copy remote-content-api/{document-mapper/src/main/java/org/apache/sling => sample-graphql-api/src/main/java/org/apache/sling/remotecontent}/documentmapper/api/MappingTarget.java (91%) copy remote-content-api/{document-mapper/src/main/java/org/apache/sling/documentmapper/api/DocumentMapper.java => sample-graphql-api/src/main/java/org/apache/sling/remotecontent/documentmapper/impl/A.java} (61%) copy remote-content-api/{document-mapper/src/main/java/org/apache/sling => sample-graphql-api/src/main/java/org/apache/sling/remotecontent}/documentmapper/impl/ContentDocumentMapper.java (67%) copy remote-content-api/{document-mapper/src/main/java/org/apache/sling => sample-graphql-api/src/main/java/org/apache/sling/remotecontent}/documentmapper/impl/ContentPropertiesSelector.java (66%) copy remote-content-api/{document-mapper/src/main/java/org/apache/sling => sample-graphql-api/src/main/java/org/apache/sling/remotecontent}/documentmapper/impl/JsonMappingTarget.java (90%) copy remote-content-api/{document-mapper/src/main/java/org/apache/sling => sample-graphql-api/src/main/java/org/apache/sling/remotecontent}/documentmapper/impl/JsonTargetNode.java (91%) copy remote-content-api/{document-mapper/src/main/java/org/apache/sling => sample-graphql-api/src/main/java/org/apache/sling/remotecontent}/documentmapper/impl/MapMappingTarget.java (90%) copy remote-content-api/{document-mapper/src/main/java/org/apache/sling => sample-graphql-api/src/main/java/org/apache/sling/remotecontent}/documentmapper/impl/MapTargetNode.java (89%) copy remote-content-api/{document-mapper/src/main/java/org/apache/sling => sample-graphql-api/src/main/java/org/apache/sling/remotecontent}/documentmapper/impl/PropertiesMapper.java (92%) copy remote-content-api/{document-mapper/src/main/java/org/apache/sling => sample-graphql-api/src/main/java/org/apache/sling/remotecontent}/documentmapper/impl/PropertiesSelector.java (93%) rename remote-content-api/sample-graphql-api/src/main/java/org/apache/sling/{remotecontentapi => remotecontent/samples}/graphql/CommandDataFetcher.java (98%) rename remote-content-api/sample-graphql-api/src/main/java/org/apache/sling/{remotecontentapi => remotecontent/samples}/graphql/Documen
[sling-whiteboard] branch master updated: Use a class for Annotations
This is an automated email from the ASF dual-hosted git repository. bdelacretaz pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/sling-whiteboard.git The following commit(s) were added to refs/heads/master by this push: new f46c41f Use a class for Annotations f46c41f is described below commit f46c41f8d6784ff983665fc43de9d9775a91fb3d Author: Bertrand Delacretaz AuthorDate: Thu May 6 15:39:27 2021 +0200 Use a class for Annotations --- .../documentmapper/api/AnnotationNames.java| 35 -- .../documentmapper/api/Annotations.java| 127 + ...ationRegistry.java => AnnotationsRegistry.java} | 5 +- .../sling/remotecontent/documentmapper/impl/A.java | 34 -- .../documentmapper/impl/ContentDocumentMapper.java | 33 +++--- .../impl/ContentPropertiesSelector.java| 47 .../documentmapper/impl/PropertiesMapper.java | 5 +- ...istryImpl.java => AnnotationsRegistryImpl.java} | 53 + 8 files changed, 174 insertions(+), 165 deletions(-) diff --git a/remote-content-api/sample-graphql-api/src/main/java/org/apache/sling/remotecontent/documentmapper/api/AnnotationNames.java b/remote-content-api/sample-graphql-api/src/main/java/org/apache/sling/remotecontent/documentmapper/api/AnnotationNames.java deleted file mode 100644 index d4ed5ae..000 --- a/remote-content-api/sample-graphql-api/src/main/java/org/apache/sling/remotecontent/documentmapper/api/AnnotationNames.java +++ /dev/null @@ -1,35 +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.remotecontent.documentmapper.api; - -import org.osgi.annotation.versioning.ProviderType; - -@ProviderType -public interface AnnotationNames { -String SLING_PREFIX = "sling:"; -String NAVIGABLE = SLING_PREFIX + "isNavigable"; -String DOCUMENT_ROOT = SLING_PREFIX + "documentRoot"; -String VISIT_CONTENT = SLING_PREFIX + "visitContent"; -String VISIT_CONTENT_RESOURCE_NAME_PATTERN = SLING_PREFIX + "visitContentResourceNamePattern"; -String CONTENT_INCLUDE_PROPERTY_REGEXP = SLING_PREFIX + "includePropertyRegexp"; -String CONTENT_EXCLUDE_PROPERTY_REGEXP = SLING_PREFIX + "excludePropertyRegexp"; -String NAVIGATION_PROPERTIES_LIST = SLING_PREFIX + "navigationPropertiesList"; -String DEREFERENCE_BY_PATH = SLING_PREFIX + "dereferenceByPath"; -} \ No newline at end of file diff --git a/remote-content-api/sample-graphql-api/src/main/java/org/apache/sling/remotecontent/documentmapper/api/Annotations.java b/remote-content-api/sample-graphql-api/src/main/java/org/apache/sling/remotecontent/documentmapper/api/Annotations.java new file mode 100644 index 000..c460ac8 --- /dev/null +++ b/remote-content-api/sample-graphql-api/src/main/java/org/apache/sling/remotecontent/documentmapper/api/Annotations.java @@ -0,0 +1,127 @@ +/* + * 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.remotecontent.documentmapper.api; + +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.regex.Pattern; + +import org.osgi.annotation.versioning.ProviderType; + +/** Document mapping annotations for a given Resource Type */ +@ProviderType +public class Annotations { +public final String resourceType; +private boolean navigable; +private boolean visitContent; +private boolean documentRoot; +private Pat
[sling-whiteboard] branch master updated (a88e408 -> 3eff62c)
This is an automated email from the ASF dual-hosted git repository. bdelacretaz pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/sling-whiteboard.git. from a88e408 Move unused modules aside new 9529f22 Tweak annotations new 3eff62c Add sling:dmap:debug The 2 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. Summary of changes: .../documentmapper/api/Annotations.java| 65 -- .../documentmapper/api/DocumentMapper.java | 11 +++- .../documentmapper/impl/ContentDocumentMapper.java | 64 - .../documentmapper/impl/PropertiesMapper.java | 3 + .../samples/graphql/DocumentDataFetcher.java | 10 +--- .../samples/graphql/DocumentsDataFetcher.java | 17 +++--- .../annotations/AnnotationsRegistryImpl.java | 48 +--- .../apps/samples/graphql/GQLschema.jsp | 4 +- .../features/feature-sample-graphql-api.json | 2 +- 9 files changed, 164 insertions(+), 60 deletions(-)
[sling-whiteboard] 01/02: Tweak annotations
This is an automated email from the ASF dual-hosted git repository. bdelacretaz pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/sling-whiteboard.git commit 9529f2269285ae84296ed6e3dc3538652d8904be Author: Bertrand Delacretaz AuthorDate: Thu May 6 17:15:45 2021 +0200 Tweak annotations --- .../documentmapper/api/Annotations.java| 27 +++ .../documentmapper/impl/ContentDocumentMapper.java | 18 - .../documentmapper/impl/PropertiesMapper.java | 3 +++ .../annotations/AnnotationsRegistryImpl.java | 31 +- .../features/feature-sample-graphql-api.json | 2 +- 5 files changed, 55 insertions(+), 26 deletions(-) diff --git a/remote-content-api/sample-graphql-api/src/main/java/org/apache/sling/remotecontent/documentmapper/api/Annotations.java b/remote-content-api/sample-graphql-api/src/main/java/org/apache/sling/remotecontent/documentmapper/api/Annotations.java index c460ac8..a0402a0 100644 --- a/remote-content-api/sample-graphql-api/src/main/java/org/apache/sling/remotecontent/documentmapper/api/Annotations.java +++ b/remote-content-api/sample-graphql-api/src/main/java/org/apache/sling/remotecontent/documentmapper/api/Annotations.java @@ -19,6 +19,7 @@ package org.apache.sling.remotecontent.documentmapper.api; +import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; @@ -42,6 +43,21 @@ public class Annotations { this.resourceType = resourceType; } +@Override +public String toString() { +return String.format( +"RT=%s N=%b VC=%b DR=%b VCRN=%s IP=%s EP=%s DR=%s", +resourceType, +navigable, +visitContent, +documentRoot, +visitContentResourceNamePattern, +includePropertyPattern, +excludePropertyPattern, +dereferenceByPathProperties +); +} + // TODO equals + hashcode public String getResourceType() { @@ -63,6 +79,7 @@ public class Annotations { return visitContentResourceNamePattern == null ? true : visitContentResourceNamePattern.matcher(resourceName).matches(); } +// TODO should accept a parent Annotations - other methods as well? public boolean includeProperty(String name) { // include has priority over exclude boolean result = includePropertyPattern == null ? true : includePropertyPattern.matcher(name).matches(); @@ -120,6 +137,16 @@ public class Annotations { return this; } +public Builder withDereferenceByPathProperties(String ... names) { +if(target.dereferenceByPathProperties == null) { +target.dereferenceByPathProperties = new ArrayList(); +} +for(String name : names) { +target.dereferenceByPathProperties.add(name); +} +return this; +} + public Annotations build() { return target; } diff --git a/remote-content-api/sample-graphql-api/src/main/java/org/apache/sling/remotecontent/documentmapper/impl/ContentDocumentMapper.java b/remote-content-api/sample-graphql-api/src/main/java/org/apache/sling/remotecontent/documentmapper/impl/ContentDocumentMapper.java index 47b95be..40cbfda 100644 --- a/remote-content-api/sample-graphql-api/src/main/java/org/apache/sling/remotecontent/documentmapper/impl/ContentDocumentMapper.java +++ b/remote-content-api/sample-graphql-api/src/main/java/org/apache/sling/remotecontent/documentmapper/impl/ContentDocumentMapper.java @@ -45,18 +45,20 @@ public class ContentDocumentMapper implements DocumentMapper { final String resourceType = r.getResourceType(); final Annotations annot = annotationsRegistry.getAnnotations(resourceType); dest.addValue("path", r.getPath()); +log.debug("Top level Resource map {} as {}: {}", r.getPath(), r.getResourceType(), annot); mapResource(r, dest, urlb, resourceType, annot, annot.isDocumentRoot()); } private void mapResource(@NotNull Resource r, @NotNull MappingTarget.TargetNode dest, -UrlBuilder urlb, String parentResourceType, Annotations annot, boolean recurse) { +UrlBuilder urlb, String documentResourceType, Annotations documentAnnot, boolean recurse) { -log.debug("Mapping Resource {} as {}", r.getPath(), r.getResourceType()); -propertiesMapper.mapProperties(dest, r, annot); +log.debug("Mapping Resource {} as {}: {}", r.getPath(), r.getResourceType(), documentAnnot); +propertiesMapper.mapProperties(dest, r, documentAnnot); +final Annotations thisAnnot = annotationsRegistry.getAnnotations(r.getResourceType()); // Dereference by path if specified // TODO detect cycles which might lead to infinite loops -annot.dereferenceByPathPropertyNames().forEach(dere
[sling-whiteboard] 02/02: Add sling:dmap:debug
This is an automated email from the ASF dual-hosted git repository. bdelacretaz pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/sling-whiteboard.git commit 3eff62c8cba12b1d912eda7c35ae037d5d642fa0 Author: Bertrand Delacretaz AuthorDate: Thu May 6 18:25:40 2021 +0200 Add sling:dmap:debug --- .../documentmapper/api/Annotations.java| 50 +++ .../documentmapper/api/DocumentMapper.java | 11 +++- .../documentmapper/impl/ContentDocumentMapper.java | 58 -- .../samples/graphql/DocumentDataFetcher.java | 10 +--- .../samples/graphql/DocumentsDataFetcher.java | 17 --- .../annotations/AnnotationsRegistryImpl.java | 23 ++--- .../apps/samples/graphql/GQLschema.jsp | 4 +- 7 files changed, 124 insertions(+), 49 deletions(-) diff --git a/remote-content-api/sample-graphql-api/src/main/java/org/apache/sling/remotecontent/documentmapper/api/Annotations.java b/remote-content-api/sample-graphql-api/src/main/java/org/apache/sling/remotecontent/documentmapper/api/Annotations.java index a0402a0..4f00c4f 100644 --- a/remote-content-api/sample-graphql-api/src/main/java/org/apache/sling/remotecontent/documentmapper/api/Annotations.java +++ b/remote-content-api/sample-graphql-api/src/main/java/org/apache/sling/remotecontent/documentmapper/api/Annotations.java @@ -34,10 +34,12 @@ public class Annotations { private boolean navigable; private boolean visitContent; private boolean documentRoot; +private String childSubstitutePath; private Pattern visitContentResourceNamePattern; private Pattern includePropertyPattern; private Pattern excludePropertyPattern; -private List dereferenceByPathProperties; +private List resolveByPathProperties; +private List excludeNodeNames; private Annotations(String resourceType) { this.resourceType = resourceType; @@ -46,7 +48,7 @@ public class Annotations { @Override public String toString() { return String.format( -"RT=%s N=%b VC=%b DR=%b VCRN=%s IP=%s EP=%s DR=%s", +"RT=%s N=%b VC=%b DR=%b VCRN=%s IP=%s EP=%s DR=%s ENN=%s", resourceType, navigable, visitContent, @@ -54,7 +56,8 @@ public class Annotations { visitContentResourceNamePattern, includePropertyPattern, excludePropertyPattern, -dereferenceByPathProperties +resolveByPathProperties, +excludeNodeNames ); } @@ -89,14 +92,26 @@ public class Annotations { return result; } -public Collection dereferenceByPathPropertyNames() { -if(dereferenceByPathProperties != null) { -return dereferenceByPathProperties; +public Collection resolveByPathPropertyNames() { +if(resolveByPathProperties != null) { +return resolveByPathProperties; } else { return Collections.emptyList(); } } +public Collection excludeNodeNames() { +if(excludeNodeNames != null) { +return excludeNodeNames; +} else { +return Collections.emptyList(); +} +} + +public String childSubstitutePath() { +return childSubstitutePath; +} + public static Builder forResourceType(String resourceType) { return new Builder(resourceType); } @@ -137,16 +152,31 @@ public class Annotations { return this; } -public Builder withDereferenceByPathProperties(String ... names) { -if(target.dereferenceByPathProperties == null) { -target.dereferenceByPathProperties = new ArrayList(); +public Builder withResolveByPathPropertyNames(String ... names) { +if(target.resolveByPathProperties == null) { +target.resolveByPathProperties = new ArrayList(); +} +for(String name : names) { +target.resolveByPathProperties.add(name); +} +return this; +} + +public Builder withExcludeNodeNames(String ... names) { +if(target.excludeNodeNames == null) { +target.excludeNodeNames = new ArrayList(); } for(String name : names) { -target.dereferenceByPathProperties.add(name); +target.excludeNodeNames.add(name); } return this; } +public Builder withChildSubstituePath(String path) { +target.childSubstitutePath = path; +return this; +} + public Annotations build() { return target; } diff --git a/remote-content-api/sample-graphql-api/src/main/java/org/apache/sling/remotecontent/documentmapper/api/DocumentMapper.java b/remote-content-api/sample-graphql-api/src/main/java/org/apache/sling/remotecontent/documentmapper/api/Doc
[sling-whiteboard] branch master updated: Debug false by default
This is an automated email from the ASF dual-hosted git repository. bdelacretaz pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/sling-whiteboard.git The following commit(s) were added to refs/heads/master by this push: new 917ec3d Debug false by default 917ec3d is described below commit 917ec3d560f83f2054a365bbc4a95f4351c0e8c3 Author: Bertrand Delacretaz AuthorDate: Thu May 6 18:27:38 2021 +0200 Debug false by default --- .../apache/sling/remotecontent/samples/graphql/DocumentDataFetcher.java | 2 +- .../sling/remotecontent/samples/graphql/DocumentsDataFetcher.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/remote-content-api/sample-graphql-api/src/main/java/org/apache/sling/remotecontent/samples/graphql/DocumentDataFetcher.java b/remote-content-api/sample-graphql-api/src/main/java/org/apache/sling/remotecontent/samples/graphql/DocumentDataFetcher.java index ff432e0..1472361 100644 --- a/remote-content-api/sample-graphql-api/src/main/java/org/apache/sling/remotecontent/samples/graphql/DocumentDataFetcher.java +++ b/remote-content-api/sample-graphql-api/src/main/java/org/apache/sling/remotecontent/samples/graphql/DocumentDataFetcher.java @@ -49,7 +49,7 @@ public class DocumentDataFetcher implements SlingDataFetcher { final Map data = new HashMap<>(); data.put("path", path); data.put("selectors", e.getArgument("selectors")); -final DocumentMapper.Options opt = new DocumentMapper.Options(e.getArgument("debug", true), new UrlBuilderStub()); +final DocumentMapper.Options opt = new DocumentMapper.Options(e.getArgument("debug", false), new UrlBuilderStub()); // Get the target Resource final Resource target = e.getCurrentResource().getResourceResolver().getResource(path); diff --git a/remote-content-api/sample-graphql-api/src/main/java/org/apache/sling/remotecontent/samples/graphql/DocumentsDataFetcher.java b/remote-content-api/sample-graphql-api/src/main/java/org/apache/sling/remotecontent/samples/graphql/DocumentsDataFetcher.java index 581a905..a56843f 100644 --- a/remote-content-api/sample-graphql-api/src/main/java/org/apache/sling/remotecontent/samples/graphql/DocumentsDataFetcher.java +++ b/remote-content-api/sample-graphql-api/src/main/java/org/apache/sling/remotecontent/samples/graphql/DocumentsDataFetcher.java @@ -69,7 +69,7 @@ public class DocumentsDataFetcher implements SlingDataFetcher { // Use a suffix as we might not keep these built-in language in the long term final String langSuffix = "2020"; -final DocumentMapper.Options opt = new DocumentMapper.Options(e.getArgument("debug", true), new UrlBuilderStub()); +final DocumentMapper.Options opt = new DocumentMapper.Options(e.getArgument("debug", false), new UrlBuilderStub()); String lang = e.getArgument("lang", "xpath" + langSuffix); if(!lang.endsWith(langSuffix)) {
[sling-org-apache-sling-distribution-core] branch master updated (1511fb3 -> 7326f21)
This is an automated email from the ASF dual-hosted git repository. tmaret pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-distribution-core.git. from 1511fb3 SLING-10123 Distribution agent queue processor should implement a backoff in case of retries for processing an item (#49) add a38c4fb SLING-9873 - Add test that covers paths with namespaced names add e4f9f7d SLING-9873 - Use the characters :: as path delimiter new 7326f21 Merge pull request #51 from apache/SLING-9873-2 The 1 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. Summary of changes: .../packaging/impl/SimpleDistributionPackage.java | 2 +- .../impl/SimpleDistributionPackageTest.java| 53 +- 2 files changed, 23 insertions(+), 32 deletions(-)
[sling-org-apache-sling-distribution-core] 01/01: Merge pull request #51 from apache/SLING-9873-2
This is an automated email from the ASF dual-hosted git repository. tmaret pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-distribution-core.git commit 7326f21f8a5aa3e4c118ca5c263488e6c826d361 Merge: 1511fb3 e4f9f7d Author: Timothee Maret AuthorDate: Thu May 6 21:04:05 2021 +0200 Merge pull request #51 from apache/SLING-9873-2 SLING-9873 - Use the characters :: as path delimiter .../packaging/impl/SimpleDistributionPackage.java | 2 +- .../impl/SimpleDistributionPackageTest.java| 53 +- 2 files changed, 23 insertions(+), 32 deletions(-)