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
diff --git a/README.md b/README.md
index 5bc2b92..52b05d0 100644
--- a/README.md
+++ b/README.md
@@ -5,10 +5,10 @@
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 97%
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 @@
@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.assertNotNull;
import static org.junit.Assert.assertNull;
-public class JcrXmlContentParserTest {
+public class JCRXMLContentParserTest {
private File file;
private ContentParser underTest;
@@ -49,7 +49,7 @@
@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 @@
@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