You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@sling.apache.org by Christian Eugster <ch...@gmx.net> on 2013/04/21 17:45:46 UTC

Initial-Content

Hi,

I developped a simple bundle in eclipse (3.8.2) using the archetype 
sling-initial-content. In the section

src/main/resources/SLING-INF/content

I added the following structure:

apps/thun/home/html.esp
apps/thun/header.esp
shared/css/screen.css
shared/images/thun.jpg
content/header.json
content/pages.json

The pages.json looks like following:

{
	"jcr:primaryType": "sling:Folder",
	
	"nodes":
	[
	    {
	        "name": "Home",
	        "jcr:primaryType": "sling.Folder",
	        "jcr:mixinTypes":
	        [
	            {
	                "sling:Resource"
	            }
	        ],
	        "properties":
	        {
	            "title": "Home",
	            "menu": "Home",
	            "menu-tooltip": "Home",
	            "sling:resourceType": "thun/home"
	        }
	    }
	]
}

while header.json looks like this:

{
	"jcr:primaryType": "sling:Folder",
	"jcr:mixinTypes":
	[
	    {
	        "sling:Resource"
	    }
	],
	"properties":
	{
	    "title": "Die Korrespondenz von Leo von Thun-Hohenstein",
		"subtitle": "Ein Forschungsprojekt am Institut für 
Geschichtswissenschaften und Europäische Ethnologie an der Universität 
Innsbruck"
		"logo-alias": "Portrait Graf Leo von Thun-Hohenstein"
	    "sling:resourceType": "thun/header"
	}
}

I deploy the bundle using:

mvn -P autoInstallBundle clean install 
-Dsling.url=http://localhost:8888/system/console

The bundle is deployed without any error messages and shown in the 
/system/console/bundle view but the resources are not added to the 
repository.

Am I missing something? Thank you for any hint!

Christian
-- 
**************************************
Christian Eugster
Grissian 14
I-39010 Tisens
0039 0473 420 873
0041 79 594 85 45
christian.eugster@gmx.net

Re: Initial-Content

Posted by Christian Eugster <ch...@gmx.net>.
Hi Bob,

thank you for your answers. I must admit I am new to sling and json, 
sorry. After several trials I succeded to import the initial-content. I 
changed the json documents to:

{
	"jcr:primaryType" : "sling:Folder",
	"Home":
	{
         "jcr:primaryType": "sling:Folder",
         "jcr:mixinTypes": [ "sling:Resource" ],
         "title": "Home",
         "menu": "Home",
         "tooltip": "Home",
         "sling:resourceType": "thun/home"
     }
}

and

{
	"jcr:primaryType": "sling:Folder",
	"jcr:mixinTypes": [ "sling:Resource" ],
     "title": "Die Korrespondenz von Leo von Thun-Hohenstein",
	"subtitle": "Ein Forschungsprojekt am Institut für 
Geschichtswissenschaften und Europäische Ethnologie an der Universität 
Innsbruck",
	"logo": "Portrait Graf Leo von Thun-Hohenstein",
     "sling:resourceType": "thun/header"
}

and, as it seems the initial-import is in one transaction. cool!

Thank you!

Re: Initial-Content

Posted by Bob Paulin <bo...@bobpaulin.com>.
A couple of things stand out:
1) nodes should not be an array
2) "jcr:primaryType": "sling.Folder" should use a colon on sling:Folder 
instead of period

The bundle will install fine even with bad content but the content 
importer will generally log out some errors.  Do you see anything in the 
error.log?



On 4/21/2013 10:45 AM, Christian Eugster wrote:
> Hi,
>
> I developped a simple bundle in eclipse (3.8.2) using the archetype 
> sling-initial-content. In the section
>
> src/main/resources/SLING-INF/content
>
> I added the following structure:
>
> apps/thun/home/html.esp
> apps/thun/header.esp
> shared/css/screen.css
> shared/images/thun.jpg
> content/header.json
> content/pages.json
>
> The pages.json looks like following:
>
> {
>     "jcr:primaryType": "sling:Folder",
>
>     "nodes":
>     [
>         {
>             "name": "Home",
>             "jcr:primaryType": "sling.Folder",
>             "jcr:mixinTypes":
>             [
>                 {
>                     "sling:Resource"
>                 }
>             ],
>             "properties":
>             {
>                 "title": "Home",
>                 "menu": "Home",
>                 "menu-tooltip": "Home",
>                 "sling:resourceType": "thun/home"
>             }
>         }
>     ]
> }
>
> while header.json looks like this:
>
> {
>     "jcr:primaryType": "sling:Folder",
>     "jcr:mixinTypes":
>     [
>         {
>             "sling:Resource"
>         }
>     ],
>     "properties":
>     {
>         "title": "Die Korrespondenz von Leo von Thun-Hohenstein",
>         "subtitle": "Ein Forschungsprojekt am Institut für 
> Geschichtswissenschaften und Europäische Ethnologie an der Universität 
> Innsbruck"
>         "logo-alias": "Portrait Graf Leo von Thun-Hohenstein"
>         "sling:resourceType": "thun/header"
>     }
> }
>
> I deploy the bundle using:
>
> mvn -P autoInstallBundle clean install 
> -Dsling.url=http://localhost:8888/system/console
>
> The bundle is deployed without any error messages and shown in the 
> /system/console/bundle view but the resources are not added to the 
> repository.
>
> Am I missing something? Thank you for any hint!
>
> Christian