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:47:16 UTC
[sling-org-apache-sling-jcr-contentloader] 13/36: SLING-971 Patch
applied (from myself) Corrects the Java doc and readme surrounding the
contentloader, especially for the json format.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.jcr.contentloader-2.0.6
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-contentloader.git
commit d003a8a5e834a5ceedf46c00e65b8367df356f62
Author: Ian Boston <ie...@apache.org>
AuthorDate: Thu Jul 16 12:21:30 2009 +0000
SLING-971
Patch applied (from myself)
Corrects the Java doc and readme surrounding the contentloader, especially for the json format.
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/jcr/contentloader@794650 13f79535-47bb-0310-9956-ffa450edef68
---
.../contentloader/internal/readers/JsonReader.java | 49 ++++++++++++++++++-
.../contentloader/internal/readers/XmlReader.java | 55 ++++++++++++----------
2 files changed, 76 insertions(+), 28 deletions(-)
diff --git a/src/main/java/org/apache/sling/jcr/contentloader/internal/readers/JsonReader.java b/src/main/java/org/apache/sling/jcr/contentloader/internal/readers/JsonReader.java
index 75a9802..8a2ee2e 100644
--- a/src/main/java/org/apache/sling/jcr/contentloader/internal/readers/JsonReader.java
+++ b/src/main/java/org/apache/sling/jcr/contentloader/internal/readers/JsonReader.java
@@ -37,9 +37,54 @@ import org.apache.sling.jcr.contentloader.internal.ContentCreator;
import org.apache.sling.jcr.contentloader.internal.ContentReader;
import org.apache.sling.jcr.contentloader.internal.ImportProvider;
-
/**
- * The <code>JsonReader</code> TODO
+ * The <code>JsonReader</code> Parses a Json document on content load and creates the
+ * corresponding node structure with properties. Will not update protected nodes and
+ * properties like rep:Policy and children.
+ *
+ * <pre>
+ * Nodes, Properties and in fact complete subtrees may be described in JSON files
+ * using the following skeleton structure (see http://www.json.org for information
+ * on the syntax of JSON) :
+ *
+ * # the name of the node is taken from the name of the file without the .json ext.
+ * {
+ *
+ * # optional primary node type, default "nt:unstructured"
+ * "jcr:primaryType":"sling:ScriptedComponent",
+ * # optional mixin node types as array
+ * "jcr:mixinTypes": [ ],
+ *
+ *
+ * # "properties" are added as key value pairs, the name of the key being the name
+ * # of the property. The value is either the string property value, array for
+ * # multi-values or an object whose value[s] property denotes the property
+ * # value(s) and whose type property denotes the property type
+ * "sling:contentClass": "com.day.sling.jcr.test.Test",
+ * "sampleMulti": [ "v1", "v2" ],
+ * "sampleStruct": 1,
+ * "sampleStructMulti": [ 1, 2, 3 ],
+ *
+ * # reference properties start with jcr:reference
+ * "jcr:reference:sampleReference": "/test/content",
+ *
+ * # path propertie start with jcr:path
+ * "jcr:path:sampleReference": "/test/path",
+ *
+ * # nested nodes are added as nested maps.
+ * "sling:scripts": {
+ *
+ * "jcr:primaryType": "sling:ScriptList",
+ * "script1" :{
+ * "primaryNodeType": "sling:Script",
+ * "sling:name": "/test/content/jsp/start.jsp",
+ * "sling:type": "jsp",
+ * "sling:glob": "*"
+ * }
+ * }
+ * }
+ *
+ * </pre>
*/
public class JsonReader implements ContentReader {
diff --git a/src/main/java/org/apache/sling/jcr/contentloader/internal/readers/XmlReader.java b/src/main/java/org/apache/sling/jcr/contentloader/internal/readers/XmlReader.java
index 6b6fcaf..39a69a8 100644
--- a/src/main/java/org/apache/sling/jcr/contentloader/internal/readers/XmlReader.java
+++ b/src/main/java/org/apache/sling/jcr/contentloader/internal/readers/XmlReader.java
@@ -50,34 +50,37 @@ import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
/**
- * This reader reads an xml file defining the content.
- * The xml format should have this format:
- * <node>
- * <name>the name of the node</name>
- * <primaryNodeType>type</primaryNodeType>
- * <mixinNodeTypes>
- * <mixinNodeType>mixtype1</mixinNodeType>
- * <mixinNodeType>mixtype2</mixinNodeType>
- * </mixingNodeTypes>
- * <properties>
- * <property>
- * <name>propName</name>
- * <value>propValue</value>
+ * This reader reads an xml file defining the content. The xml format should have this
+ * format:
+ *
+ * <pre>
+ * <node>
+ * <name>the name of the node</name>
+ * <primaryNodeType>type</primaryNodeType>
+ * <mixinNodeTypes>
+ * <mixinNodeType>mixtype1</mixinNodeType>
+ * <mixinNodeType>mixtype2</mixinNodeType>
+ * </mixingNodeTypes>
+ * <properties>
+ * <property>
+ * <name>propName</name>
+ * <value>propValue</value>
* or
- * <values>
- * <value/> for multi value properties
- * </values>
- * <type>propType</type>
- * </property>
- * <!-- more properties -->
- * </properties>
- * <nodes>
- * <!-- child nodes -->
- * <node>
+ * <values>
+ * <value/> for multi value properties
+ * </values>
+ * <type>propType</type>
+ * </property>
+ * <!-- more properties -->
+ * </properties>
+ * <nodes>
+ * <!-- child nodes -->
+ * <node>
* ..
- * </node>
- * </nodes>
- * </node>
+ * </node>
+ * </nodes>
+ * </node>
+ * </pre>
*/
public class XmlReader implements ContentReader {
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.