You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ra...@apache.org on 2019/07/22 09:59:05 UTC

[sling-org-apache-sling-contentparser-xml-jcr] 04/05: SLING-8570 - Extract a generic Content Parser API from org.apache.sling.jcr.contentparser with pluggable implementations

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

radu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-contentparser-xml-jcr.git

commit cc6c4e337a6b157ba8f51ff27ccf1c4fd407934d
Author: Radu Cotescu <ra...@apache.org>
AuthorDate: Mon Jul 22 09:39:40 2019 +0200

    SLING-8570 - Extract a generic Content Parser API from org.apache.sling.jcr.contentparser with pluggable implementations
    
    * completely decoupled the API from implementations - the ContentParser API
    doesn't suggest any content types any more
    * removed JSON specific parser options from the ParserOptions class
    * made the ParserOptions class extendable
    * switched exported API packages to version 2.0.0, to eliminate all possible
    confusion with the older org.apache.sling.jcr.contentparser API
---
 README.md                                                         | 4 ++--
 .../{JcrXmlContentParser.java => JCRXMLContentParser.java}        | 6 +++---
 ...{JcrXmlContentParserTest.java => JCRXMLContentParserTest.java} | 8 ++++----
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/README.md b/README.md
index 5bc2b92..52b05d0 100644
--- a/README.md
+++ b/README.md
@@ -5,10 +5,10 @@ This module is part of the [Apache Sling](https://sling.apache.org) project.
 The Apache Sling Content Parser for JackRabbit FileVault XML provides support for parsing XML files into Apache Sling resource trees, by implementing the 
 API provided by the [`org.apache.sling.contentparser.api`](https://github.com/apache/sling-whiteboard/tree/master/contentparser/org-apache-sling-contentparser-api) bundle.
 
-To obtain a reference to the JackRabbit FileVault XMLL content parser just filter on the `ContentParser.SERVICE_PROPERTY_CONTENT_TYPE` service registration 
+To obtain a reference to the JackRabbit FileVault XML content parser just filter on the `ContentParser.SERVICE_PROPERTY_CONTENT_TYPE` service registration 
 property:
 
 ```java
-    @Reference(target = "(" + ContentParser.SERVICE_PROPERTY_CONTENT_TYPE + "=" + ContentParser.JCR_XML_CONTENT_TYPE + ")")
+    @Reference(target = "(" + ContentParser.SERVICE_PROPERTY_CONTENT_TYPE + "=jcr-xml)")
     private ContentParser jcrXmlParser;
 ``` 
diff --git a/src/main/java/org/apache/sling/contentparser/xml/jcr/internal/JcrXmlContentParser.java b/src/main/java/org/apache/sling/contentparser/xml/jcr/internal/JCRXMLContentParser.java
similarity index 98%
rename from src/main/java/org/apache/sling/contentparser/xml/jcr/internal/JcrXmlContentParser.java
rename to src/main/java/org/apache/sling/contentparser/xml/jcr/internal/JCRXMLContentParser.java
index 1e01575..d402ac6 100644
--- a/src/main/java/org/apache/sling/contentparser/xml/jcr/internal/JcrXmlContentParser.java
+++ b/src/main/java/org/apache/sling/contentparser/xml/jcr/internal/JCRXMLContentParser.java
@@ -46,14 +46,14 @@ import org.xml.sax.helpers.DefaultHandler;
 @Component(
         service = ContentParser.class,
         property = {
-                ContentParser.SERVICE_PROPERTY_CONTENT_TYPE + "=" + ContentParser.JCR_XML_CONTENT_TYPE
+                ContentParser.SERVICE_PROPERTY_CONTENT_TYPE + "=jcr-xml"
         }
 )
-public final class JcrXmlContentParser implements ContentParser {
+public final class JCRXMLContentParser implements ContentParser {
 
     private final SAXParserFactory saxParserFactory;
 
-    public JcrXmlContentParser() {
+    public JCRXMLContentParser() {
         saxParserFactory = SAXParserFactory.newInstance();
         saxParserFactory.setNamespaceAware(true);
     }
diff --git a/src/test/java/org/apache/sling/contentparser/xml/jcr/internal/JcrXmlContentParserTest.java b/src/test/java/org/apache/sling/contentparser/xml/jcr/internal/JCRXMLContentParserTest.java
similarity index 96%
rename from src/test/java/org/apache/sling/contentparser/xml/jcr/internal/JcrXmlContentParserTest.java
rename to src/test/java/org/apache/sling/contentparser/xml/jcr/internal/JCRXMLContentParserTest.java
index 0c2a826..349a991 100644
--- a/src/test/java/org/apache/sling/contentparser/xml/jcr/internal/JcrXmlContentParserTest.java
+++ b/src/test/java/org/apache/sling/contentparser/xml/jcr/internal/JCRXMLContentParserTest.java
@@ -41,7 +41,7 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 
-public class JcrXmlContentParserTest {
+public class JCRXMLContentParserTest {
 
     private File file;
     private ContentParser underTest;
@@ -49,7 +49,7 @@ public class JcrXmlContentParserTest {
     @Before
     public void setUp() {
         file = new File("src/test/resources/content-test/content.jcr.xml");
-        underTest = new JcrXmlContentParser();
+        underTest = new JCRXMLContentParser();
     }
 
     @Test
@@ -96,8 +96,8 @@ public class JcrXmlContentParserTest {
 
     @Test
     public void testDecodeName() {
-        assertEquals("jcr:title", JcrXmlContentParser.decodeName("jcr:" + ISO9075.encode("title")));
-        assertEquals("sling:123", JcrXmlContentParser.decodeName("sling:" + ISO9075.encode("123")));
+        assertEquals("jcr:title", JCRXMLContentParser.decodeName("jcr:" + ISO9075.encode("title")));
+        assertEquals("sling:123", JCRXMLContentParser.decodeName("sling:" + ISO9075.encode("123")));
     }
 
     @Test