You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@sling.apache.org by Andreas Schaefer <as...@headwire.com> on 2017/03/19 18:24:13 UTC

Bundle based JCR File

Hi

I want to add a JSon file to Sling as JCR Node (primary type nt:file) inside a Bundle Content.

Is that possible and if how does the structure look like:

In the XML based export the structure looks like this:

- my-file (raw file)
- my-file.dir
	- .content.xml (jcr:root of type nt:file with a jcr:content of type nt:resource and the files mime type)

I tried the following:

- my-file
- my-file.dir.json with a JSon-ified version of the XML)

but that did not work.

Cheers - Andy Schaefer


RE: Bundle based JCR File

Posted by Stefan Seifert <ss...@pro-vision.de>.
you mean a bundle with Sling-Intial-Content containing a json file which should be imported as binary file?

by default the JCR content loader tries to parse the JSON file and import it as content structure. you can disable this behavior for your bundle by adding a "ignoreImportProviders" directive (see [1]) the the bundle header.

example for Sling-Initial-Content header:
SLING-INF/content/home;path:=/sites/sling_website;ignoreImportProviders:=json

filevault-typical structures like xyz.dir do not work in this context. you just name your file xyz.json and it is imported as nt:file node names xyz.json.

stefan

[1] https://sling.apache.org/documentation/bundles/content-loading-jcr-contentloader.html




>-----Original Message-----
>From: Andreas Schaefer [mailto:as@headwire.com]
>Sent: Sunday, March 19, 2017 7:24 PM
>To: users@sling.apache.org
>Cc: Andreas Schaefer
>Subject: Bundle based JCR File
>
>Hi
>
>I want to add a JSon file to Sling as JCR Node (primary type nt:file)
>inside a Bundle Content.
>
>Is that possible and if how does the structure look like:
>
>In the XML based export the structure looks like this:
>
>- my-file (raw file)
>- my-file.dir
>	- .content.xml (jcr:root of type nt:file with a jcr:content of type
>nt:resource and the files mime type)
>
>I tried the following:
>
>- my-file
>- my-file.dir.json with a JSon-ified version of the XML)
>
>but that did not work.
>
>Cheers - Andy Schaefer
>



Re: Bundle based JCR File

Posted by Daniel Klco <dk...@apache.org>.
Hey Andreas,

Have you checked the log files? The Sling Content Importer will log any
errors encountered in installing content when the bundle is installed. In
general, that concept should be fine, but it would depend on the exact
structure.

There are a couple of Sling-based apps out there which do leverage bundle
content you may want to check out as examples:

https://github.com/auniverseaway/slick-2/tree/master/ui.apps
https://github.com/nateyolles/publick-sling-blog/tree/master/ui

-Dan

On Sun, Mar 19, 2017 at 2:24 PM, Andreas Schaefer <as...@headwire.com> wrote:

> Hi
>
> I want to add a JSon file to Sling as JCR Node (primary type nt:file)
> inside a Bundle Content.
>
> Is that possible and if how does the structure look like:
>
> In the XML based export the structure looks like this:
>
> - my-file (raw file)
> - my-file.dir
>         - .content.xml (jcr:root of type nt:file with a jcr:content of
> type nt:resource and the files mime type)
>
> I tried the following:
>
> - my-file
> - my-file.dir.json with a JSon-ified version of the XML)
>
> but that did not work.
>
> Cheers - Andy Schaefer
>
>