You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ie...@apache.org on 2013/02/19 05:42:21 UTC

svn commit: r1447587 - /sling/site/trunk/content/site/content-loading-jcrcontentloader.html

Author: ieb
Date: Tue Feb 19 04:42:21 2013
New Revision: 1447587

URL: http://svn.apache.org/r1447587
Log:
SLING-2565 Update json format

Modified:
    sling/site/trunk/content/site/content-loading-jcrcontentloader.html

Modified: sling/site/trunk/content/site/content-loading-jcrcontentloader.html
URL: http://svn.apache.org/viewvc/sling/site/trunk/content/site/content-loading-jcrcontentloader.html?rev=1447587&r1=1447586&r2=1447587&view=diff
==============================================================================
--- sling/site/trunk/content/site/content-loading-jcrcontentloader.html (original)
+++ sling/site/trunk/content/site/content-loading-jcrcontentloader.html Tue Feb 19 04:42:21 2013
@@ -1,4 +1,3 @@
-
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <HTML>
   <HEAD>
@@ -296,58 +295,27 @@ primary node type &quot;nt:file&quot;. U
 
 <H3><A name="ContentLoading%28jcr.contentloader%29-JSONDescriptorFiles"></A>JSON Descriptor Files</H3>
 
-<P>Nodes, Properties and in fact complete subtrees may be described in JSON files using the following skeleton structure (see <A href="http://www.json.org/" class="external-link" rel="nofollow">http://www.json.org</A> or information on the syntax of JSON) :</P>
+<P>Nodes, Properties and in fact complete subtrees may be described in JSON files using the following skeleton structure (see <A href="http://www.json.org/" class="external-link" rel="nofollow">http://www.json.org</A> or information on the syntax of JSON).
+The name of parent node is taken from the file name. :</P>
 <DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
 <PRE class="code-java">
 {
-		<SPAN class="code-comment">// optional node name on top level, <SPAN class="code-keyword">default</SPAN> is file name without .json ext.
-</SPAN>		<SPAN class="code-quote">&quot;name&quot;</SPAN>: <SPAN class="code-quote">&quot;nodename&quot;</SPAN>,
-
-		<SPAN class="code-comment">// optional primary node type, <SPAN class="code-keyword">default</SPAN> <SPAN class="code-quote">&quot;nt:unstructured&quot;</SPAN>
-</SPAN>		<SPAN class="code-quote">&quot;primaryNodeType&quot;</SPAN>: <SPAN class="code-quote">&quot;sling:ScriptedComponent&quot;</SPAN>,
-
-		<SPAN class="code-comment">// optional mixin node types as array
-</SPAN>		<SPAN class="code-quote">&quot;mixinNodeTypes&quot;</SPAN>: [ ],
-
-	    <SPAN class="code-comment">// the <SPAN class="code-quote">&quot;properties&quot;</SPAN> property is an object indexed by property name whose
-</SPAN>	    <SPAN class="code-comment">// value is either the string property value, array <SPAN class="code-keyword">for</SPAN> multi-values or
-</SPAN>	    <SPAN class="code-comment">// an object whose value[s] property denotes the property value(s) and
-</SPAN>	    <SPAN class="code-comment">// whose type property denotes the property type
-</SPAN>	    <SPAN class="code-quote">&quot;properties&quot;</SPAN>: {
-	    	<SPAN class="code-quote">&quot;sling:contentClass&quot;</SPAN>: <SPAN class="code-quote">&quot;com.day.sling.jcr.test.Test&quot;</SPAN>,
-	    	<SPAN class="code-quote">&quot;sampleMulti&quot;</SPAN>: [ <SPAN class="code-quote">&quot;v1&quot;</SPAN>, <SPAN class="code-quote">&quot;v2&quot;</SPAN> ],
-	    	<SPAN class="code-quote">&quot;sampleStruct&quot;</SPAN>: {
-	    		<SPAN class="code-quote">&quot;value&quot;</SPAN>: 1,
-	    		<SPAN class="code-quote">&quot;type&quot;</SPAN>: <SPAN class="code-quote">&quot;<SPAN class="code-object">Long</SPAN>&quot;</SPAN>
-	    	}
-	    	<SPAN class="code-quote">&quot;sampleStructMulti&quot;</SPAN>: {
-	    		<SPAN class="code-quote">&quot;value&quot;</SPAN>: [ 1, 2, 3 ],
-	    		<SPAN class="code-quote">&quot;type&quot;</SPAN>: <SPAN class="code-quote">&quot;<SPAN class="code-object">Long</SPAN>&quot;</SPAN>
-	    	}
-	    },
-
-	    <SPAN class="code-comment">// the <SPAN class="code-quote">&quot;nodes&quot;</SPAN> property is an array of objects denoting child nodes. Nodes
-</SPAN>	    <SPAN class="code-comment">// may be further nested.
-</SPAN>		<SPAN class="code-quote">&quot;nodes&quot;</SPAN>: [
-			{
-				<SPAN class="code-comment">// the name property is required on (nested) child nodes
-</SPAN>	            <SPAN class="code-quote">&quot;name&quot;</SPAN>: <SPAN class="code-quote">&quot;sling:scripts&quot;</SPAN>,
-
-				<SPAN class="code-quote">&quot;primaryNodeType&quot;</SPAN>: <SPAN class="code-quote">&quot;sling:ScriptList&quot;</SPAN>,
-
-				<SPAN class="code-quote">&quot;nodes&quot;</SPAN>: [
-					{
-						<SPAN class="code-quote">&quot;primaryNodeType&quot;</SPAN>: <SPAN class="code-quote">&quot;sling:Script&quot;</SPAN>,
-						<SPAN class="code-quote">&quot;properties&quot;</SPAN>: {
-							<SPAN class="code-quote">&quot;sling:name&quot;</SPAN>: <SPAN class="code-quote">&quot;/test/content/jsp/start.jsp&quot;</SPAN>,
-							<SPAN class="code-quote">&quot;sling:type&quot;</SPAN>: <SPAN class="code-quote">&quot;jsp&quot;</SPAN>,
-							<SPAN class="code-quote">&quot;sling:glob&quot;</SPAN>: <SPAN class="code-quote">&quot;*&quot;</SPAN>
-						}
-					}
-				]
-			}
-		]
-	}
+        <SPAN class="code-comment">// Properties are represented as json properties</SPAN>
+        "jcr:createdBy":"admin",
+        "jcr:primaryType":"nt:folder",
+        <SPAN class="code-comment">// Child nodes are named json Objects. This will create a node named "childOne" </SPAN>
+        "nodeName": {
+                "jcr:primaryType": "nt:unstructured",
+                "jcr:mixinTypes": [
+                        "mix:referenceable"
+                ],
+                "propOne" : "propOneValue",
+                
+                "childOne" : {
+                        "childPropOne" : true
+                }
+        }
+}
 </PRE>
 </DIV></DIV>