You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@sling.apache.org by "David G." <da...@gmail.com> on 2012/01/18 05:11:37 UTC

Sling-Initial-Content Question

So i have a pretty nice maven build setup going using a variety of maven plugins including the maven-bundle-plugin for building my packages. One of the great features is Sling-Initial-Content which allows me to model nodes via JSON and have them created upon deployment. 

Im running into a problem where I want to load initial files under certain pre-made nodes. 

Example

/etc/designs/my-site/js/jquery.min.js

where "my-site" is a node w jcr:primaryType of "cq:Page"

If I create a my-site.json (which defines a primaryType and place it  SLING-INF/initial-content/etc/designs/my-site.json, the folder  SLING-INF/initial-content/etc/designs/my-site seems to override the JSON during import and I'm left with a my-site node with type "sling:Folder"

Thoughts on how to get around this?

Thanks

Below are the relevant plugin configs:

<Include-Resource>
    {maven-resources},
    src/main/scripts
</Include-Resource>

<Sling-Bundle-Resources>
    /apps/${project.artifactId},
    /var/classes!/org/apache/jsp/apps/${project.artifactId}
</Sling-Bundle-Resources>

<Sling-Initial-Content>
    SLING-INF/initial-content/apps/${project.artifactId}/; path:=/apps/${project.artifactId}; overwrite:=true; uninstall:=false,
    SLING-INF/initial-content/etc/designs/${project.artifactId}/; path:=/etc/designs/${project.artifactId}; overwrite:=true; uninstall:=false,
    SLING-INF/initial-content/content/${project.artifactId}/; path:=/content/${project.artifactId}; overwrite:=true; uninstall:=false
</Sling-Initial-Content>








-- 
David Gonzalez
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)


Re: Sling-Initial-Content Question

Posted by Sarwar Bhuiyan <sa...@gmail.com>.
I've managed to do it by a slight change to the instructions:  Here is my
sample snippet:

<Sling-Initial-Content>

SLING-CONTENT/apps/my-sling-app;overwrite:=true;uninstall:=true;path:=/apps/my-sling-app,

SLING-CONTENT/content/my-sling-app;overwrite:=true;uninstall:=true;path:=/content/my-sling-app,

SLING-CONTENT/etc/designs/my-sling-app.json;overwrite:=true;uninstall:=true;path:=/etc/designs/,

SLING-CONTENT/etc/designs/my-sling-app/;overwrite:=true;uninstall:=true;path:=/etc/designs/my-sling-app
</Sling-Initial-Content>

Sarwar




On Sat, Jan 21, 2012 at 4:13 PM, David G. <da...@gmail.com> wrote:

> Sarwar,
>
> Yup - that's the reason -- thanks!
>
>
> --
> David Gonzalez
> Sent with Sparrow (http://www.sparrowmailapp.com/?sig)
>
>
> On Thursday, January 19, 2012 at 9:33 AM, Sarwar Bhuiyan wrote:
>
> > i'm having this same problem. It seems the instruction
> >
> > SLING-INF/initial-content/etc/designs/${project.artifactId}/;
> > path:=/apps/${project.artifactId}; overwrite:=true; uninstall:=false
> >
> > seems to be looking under the folder ${project.artifactId} for assets and
> > json files but not the /etc/designs/ folder where your mysite.json should
> > reside. So what I've done is do something like /etc/design/mysite/design
> > as the actual node which is the cq:Page.
> >
> > Anybody have a better workaround?
> >
> > Sarwar
> >
> > On Wed, Jan 18, 2012 at 4:11 AM, David G. <davidjgonzalez@gmail.com(mailto:
> davidjgonzalez@gmail.com)> wrote:
> >
> > > So i have a pretty nice maven build setup going using a variety of
> maven
> > > plugins including the maven-bundle-plugin for building my packages.
> One of
> > > the great features is Sling-Initial-Content which allows me to model
> nodes
> > > via JSON and have them created upon deployment.
> > >
> > > Im running into a problem where I want to load initial files under
> certain
> > > pre-made nodes.
> > >
> > > Example
> > >
> > > /etc/designs/my-site/js/jquery.min.js
> > >
> > > where "my-site" is a node w jcr:primaryType of "cq:Page"
> > >
> > > If I create a my-site.json (which defines a primaryType and place it
> > > SLING-INF/initial-content/etc/designs/my-site.json, the folder
> > > SLING-INF/initial-content/etc/designs/my-site seems to override the
> JSON
> > > during import and I'm left with a my-site node with type "sling:Folder"
> > >
> > > Thoughts on how to get around this?
> > >
> > > Thanks
> > >
> > > Below are the relevant plugin configs:
> > >
> > > <Include-Resource>
> > > {maven-resources},
> > > src/main/scripts
> > > </Include-Resource>
> > >
> > > <Sling-Bundle-Resources>
> > > /apps/${project.artifactId},
> > > /var/classes!/org/apache/jsp/apps/${project.artifactId}
> > > </Sling-Bundle-Resources>
> > >
> > > <Sling-Initial-Content>
> > > SLING-INF/initial-content/apps/${project.artifactId}/;
> > > path:=/apps/${project.artifactId}; overwrite:=true; uninstall:=false,
> > > SLING-INF/initial-content/etc/designs/${project.artifactId}/;
> > > path:=/etc/designs/${project.artifactId}; overwrite:=true;
> uninstall:=false,
> > > SLING-INF/initial-content/content/${project.artifactId}/;
> > > path:=/content/${project.artifactId}; overwrite:=true; uninstall:=false
> > > </Sling-Initial-Content>
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > --
> > > David Gonzalez
> > > Sent with Sparrow (http://www.sparrowmailapp.com/?sig)
> > >
> >
> >
> >
>
>
>

Re: Sling-Initial-Content Question

Posted by "David G." <da...@gmail.com>.
Sarwar,

Yup - that's the reason -- thanks!


-- 
David Gonzalez
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)


On Thursday, January 19, 2012 at 9:33 AM, Sarwar Bhuiyan wrote:

> i'm having this same problem. It seems the instruction
> 
> SLING-INF/initial-content/etc/designs/${project.artifactId}/;
> path:=/apps/${project.artifactId}; overwrite:=true; uninstall:=false
> 
> seems to be looking under the folder ${project.artifactId} for assets and
> json files but not the /etc/designs/ folder where your mysite.json should
> reside. So what I've done is do something like /etc/design/mysite/design
> as the actual node which is the cq:Page.
> 
> Anybody have a better workaround?
> 
> Sarwar
> 
> On Wed, Jan 18, 2012 at 4:11 AM, David G. <davidjgonzalez@gmail.com (mailto:davidjgonzalez@gmail.com)> wrote:
> 
> > So i have a pretty nice maven build setup going using a variety of maven
> > plugins including the maven-bundle-plugin for building my packages. One of
> > the great features is Sling-Initial-Content which allows me to model nodes
> > via JSON and have them created upon deployment.
> > 
> > Im running into a problem where I want to load initial files under certain
> > pre-made nodes.
> > 
> > Example
> > 
> > /etc/designs/my-site/js/jquery.min.js
> > 
> > where "my-site" is a node w jcr:primaryType of "cq:Page"
> > 
> > If I create a my-site.json (which defines a primaryType and place it
> > SLING-INF/initial-content/etc/designs/my-site.json, the folder
> > SLING-INF/initial-content/etc/designs/my-site seems to override the JSON
> > during import and I'm left with a my-site node with type "sling:Folder"
> > 
> > Thoughts on how to get around this?
> > 
> > Thanks
> > 
> > Below are the relevant plugin configs:
> > 
> > <Include-Resource>
> > {maven-resources},
> > src/main/scripts
> > </Include-Resource>
> > 
> > <Sling-Bundle-Resources>
> > /apps/${project.artifactId},
> > /var/classes!/org/apache/jsp/apps/${project.artifactId}
> > </Sling-Bundle-Resources>
> > 
> > <Sling-Initial-Content>
> > SLING-INF/initial-content/apps/${project.artifactId}/;
> > path:=/apps/${project.artifactId}; overwrite:=true; uninstall:=false,
> > SLING-INF/initial-content/etc/designs/${project.artifactId}/;
> > path:=/etc/designs/${project.artifactId}; overwrite:=true; uninstall:=false,
> > SLING-INF/initial-content/content/${project.artifactId}/;
> > path:=/content/${project.artifactId}; overwrite:=true; uninstall:=false
> > </Sling-Initial-Content>
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > --
> > David Gonzalez
> > Sent with Sparrow (http://www.sparrowmailapp.com/?sig)
> > 
> 
> 
> 



Re: Sling-Initial-Content Question

Posted by Sarwar Bhuiyan <sa...@gmail.com>.
i'm having this same problem.  It seems the instruction

 SLING-INF/initial-content/etc/designs/${project.artifactId}/;
path:=/apps/${project.artifactId}; overwrite:=true; uninstall:=false

seems to be looking under the folder ${project.artifactId} for assets and
json files but not the /etc/designs/ folder where your mysite.json should
reside.  So what I've done is do something like /etc/design/mysite/design
as the actual node which is the cq:Page.

Anybody have a better workaround?

Sarwar

On Wed, Jan 18, 2012 at 4:11 AM, David G. <da...@gmail.com> wrote:

> So i have a pretty nice maven build setup going using a variety of maven
> plugins including the maven-bundle-plugin for building my packages. One of
> the great features is Sling-Initial-Content which allows me to model nodes
> via JSON and have them created upon deployment.
>
> Im running into a problem where I want to load initial files under certain
> pre-made nodes.
>
> Example
>
> /etc/designs/my-site/js/jquery.min.js
>
> where "my-site" is a node w jcr:primaryType of "cq:Page"
>
> If I create a my-site.json (which defines a primaryType and place it
>  SLING-INF/initial-content/etc/designs/my-site.json, the folder
>  SLING-INF/initial-content/etc/designs/my-site seems to override the JSON
> during import and I'm left with a my-site node with type "sling:Folder"
>
> Thoughts on how to get around this?
>
> Thanks
>
> Below are the relevant plugin configs:
>
> <Include-Resource>
>    {maven-resources},
>    src/main/scripts
> </Include-Resource>
>
> <Sling-Bundle-Resources>
>    /apps/${project.artifactId},
>    /var/classes!/org/apache/jsp/apps/${project.artifactId}
> </Sling-Bundle-Resources>
>
> <Sling-Initial-Content>
>    SLING-INF/initial-content/apps/${project.artifactId}/;
> path:=/apps/${project.artifactId}; overwrite:=true; uninstall:=false,
>    SLING-INF/initial-content/etc/designs/${project.artifactId}/;
> path:=/etc/designs/${project.artifactId}; overwrite:=true; uninstall:=false,
>    SLING-INF/initial-content/content/${project.artifactId}/;
> path:=/content/${project.artifactId}; overwrite:=true; uninstall:=false
> </Sling-Initial-Content>
>
>
>
>
>
>
>
>
> --
> David Gonzalez
> Sent with Sparrow (http://www.sparrowmailapp.com/?sig)
>
>

Re: Sling-Initial-Content Question

Posted by "David G." <da...@gmail.com>.
Mike,

Thanks -- the gist seems to be the same. From what im reading if i
want to use sling-initial-content to create a nt:unstructured node
with a file under it, i should be able to define my initial content
as:

/SLING-INF/initial-content/content/mynode.json
/SLING-INF/initial-content/content/mynode/thumbnail.png


This would create a in the JCR

/content<nt:file>/mynode<nt:folder>/thumbnail.png<nt:file>

.. I wonder if i need to set overwriteProperties:=true (overwrite is
already set to true, so i would think that would supercede the
overwriteProperties default of false)

Thanks for the updated link -- if you see any falacies in my
interpretation, please let me know :)




On Thu, Jan 19, 2012 at 9:20 AM, Mike Müller <mi...@mysign.ch> wrote:
> Hi David
>
> Maybe the link you mentioned is outdated, try this one on the
> sling website:
> http://sling.apache.org/site/content-loading-jcrcontentloader.html
>
> best regards
> mike
>
>> -----Original Message-----
>> From: David G. [mailto:davidjgonzalez@gmail.com]
>> Sent: Wednesday, January 18, 2012 6:25 AM
>> To: users@sling.apache.org
>> Subject: Re: Sling-Initial-Content Question
>>
>> FYI - I was following the instructions for "directory" at:
>>
>> http://wiki.apache.org/jackrabbit/ApacheSling/SlingContent
>>
>> I believe what I'm doing should work according to the above link, though the wording is
>> slightly ambiguous.
>>
>> Thank
>>
>> --
>> David Gonzalez
>> Sent with Sparrow (http://www.sparrowmailapp.com/?sig)
>>
>>
>> On Tuesday, January 17, 2012 at 11:11 PM, David G. wrote:
>>
>> > So i have a pretty nice maven build setup going using a variety of maven plugins
>> including the maven-bundle-plugin for building my packages. One of the great features
>> is Sling-Initial-Content which allows me to model nodes via JSON and have them
>> created upon deployment.
>> >
>> > Im running into a problem where I want to load initial files under certain pre-made
>> nodes.
>> >
>> > Example
>> >
>> > /etc/designs/my-site/js/jquery.min.js
>> >
>> > where "my-site" is a node w jcr:primaryType of "cq:Page"
>> >
>> > If I create a my-site.json (which defines a primaryType and place it  SLING-
>> INF/initial-content/etc/designs/my-site.json, the folder  SLING-INF/initial-
>> content/etc/designs/my-site seems to override the JSON during import and I'm left
>> with a my-site node with type "sling:Folder"
>> >
>> > Thoughts on how to get around this?
>> >
>> > Thanks
>> >
>> > Below are the relevant plugin configs:
>> >
>> > <Include-Resource>
>> >     {maven-resources},
>> >     src/main/scripts
>> > </Include-Resource>
>> >
>> > <Sling-Bundle-Resources>
>> >     /apps/${project.artifactId},
>> >     /var/classes!/org/apache/jsp/apps/${project.artifactId}
>> > </Sling-Bundle-Resources>
>> >
>> > <Sling-Initial-Content>
>> >     SLING-INF/initial-content/apps/${project.artifactId}/;
>> path:=/apps/${project.artifactId}; overwrite:=true; uninstall:=false,
>> >     SLING-INF/initial-content/etc/designs/${project.artifactId}/;
>> path:=/etc/designs/${project.artifactId}; overwrite:=true; uninstall:=false,
>> >     SLING-INF/initial-content/content/${project.artifactId}/;
>> path:=/content/${project.artifactId}; overwrite:=true; uninstall:=false
>> > </Sling-Initial-Content>
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > --
>> > David Gonzalez
>> > Sent with Sparrow (http://www.sparrowmailapp.com/?sig)
>> >
>

RE: Sling-Initial-Content Question

Posted by Mike Müller <mi...@mysign.ch>.
Hi David

Maybe the link you mentioned is outdated, try this one on the
sling website:
http://sling.apache.org/site/content-loading-jcrcontentloader.html

best regards
mike

> -----Original Message-----
> From: David G. [mailto:davidjgonzalez@gmail.com]
> Sent: Wednesday, January 18, 2012 6:25 AM
> To: users@sling.apache.org
> Subject: Re: Sling-Initial-Content Question
> 
> FYI - I was following the instructions for "directory" at:
> 
> http://wiki.apache.org/jackrabbit/ApacheSling/SlingContent
> 
> I believe what I'm doing should work according to the above link, though the wording is
> slightly ambiguous.
> 
> Thank
> 
> --
> David Gonzalez
> Sent with Sparrow (http://www.sparrowmailapp.com/?sig)
> 
> 
> On Tuesday, January 17, 2012 at 11:11 PM, David G. wrote:
> 
> > So i have a pretty nice maven build setup going using a variety of maven plugins
> including the maven-bundle-plugin for building my packages. One of the great features
> is Sling-Initial-Content which allows me to model nodes via JSON and have them
> created upon deployment.
> >
> > Im running into a problem where I want to load initial files under certain pre-made
> nodes.
> >
> > Example
> >
> > /etc/designs/my-site/js/jquery.min.js
> >
> > where "my-site" is a node w jcr:primaryType of "cq:Page"
> >
> > If I create a my-site.json (which defines a primaryType and place it  SLING-
> INF/initial-content/etc/designs/my-site.json, the folder  SLING-INF/initial-
> content/etc/designs/my-site seems to override the JSON during import and I'm left
> with a my-site node with type "sling:Folder"
> >
> > Thoughts on how to get around this?
> >
> > Thanks
> >
> > Below are the relevant plugin configs:
> >
> > <Include-Resource>
> >     {maven-resources},
> >     src/main/scripts
> > </Include-Resource>
> >
> > <Sling-Bundle-Resources>
> >     /apps/${project.artifactId},
> >     /var/classes!/org/apache/jsp/apps/${project.artifactId}
> > </Sling-Bundle-Resources>
> >
> > <Sling-Initial-Content>
> >     SLING-INF/initial-content/apps/${project.artifactId}/;
> path:=/apps/${project.artifactId}; overwrite:=true; uninstall:=false,
> >     SLING-INF/initial-content/etc/designs/${project.artifactId}/;
> path:=/etc/designs/${project.artifactId}; overwrite:=true; uninstall:=false,
> >     SLING-INF/initial-content/content/${project.artifactId}/;
> path:=/content/${project.artifactId}; overwrite:=true; uninstall:=false
> > </Sling-Initial-Content>
> >
> >
> >
> >
> >
> >
> >
> >
> > --
> > David Gonzalez
> > Sent with Sparrow (http://www.sparrowmailapp.com/?sig)
> >


Re: Sling-Initial-Content Question

Posted by "David G." <da...@gmail.com>.
FYI - I was following the instructions for "directory" at: 

http://wiki.apache.org/jackrabbit/ApacheSling/SlingContent

I believe what I'm doing should work according to the above link, though the wording is slightly ambiguous.

Thank

-- 
David Gonzalez
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)


On Tuesday, January 17, 2012 at 11:11 PM, David G. wrote:

> So i have a pretty nice maven build setup going using a variety of maven plugins including the maven-bundle-plugin for building my packages. One of the great features is Sling-Initial-Content which allows me to model nodes via JSON and have them created upon deployment. 
> 
> Im running into a problem where I want to load initial files under certain pre-made nodes. 
> 
> Example
> 
> /etc/designs/my-site/js/jquery.min.js
> 
> where "my-site" is a node w jcr:primaryType of "cq:Page"
> 
> If I create a my-site.json (which defines a primaryType and place it  SLING-INF/initial-content/etc/designs/my-site.json, the folder  SLING-INF/initial-content/etc/designs/my-site seems to override the JSON during import and I'm left with a my-site node with type "sling:Folder"
> 
> Thoughts on how to get around this?
> 
> Thanks
> 
> Below are the relevant plugin configs:
> 
> <Include-Resource>
>     {maven-resources},
>     src/main/scripts
> </Include-Resource>
> 
> <Sling-Bundle-Resources>
>     /apps/${project.artifactId},
>     /var/classes!/org/apache/jsp/apps/${project.artifactId}
> </Sling-Bundle-Resources>
> 
> <Sling-Initial-Content>
>     SLING-INF/initial-content/apps/${project.artifactId}/; path:=/apps/${project.artifactId}; overwrite:=true; uninstall:=false,
>     SLING-INF/initial-content/etc/designs/${project.artifactId}/; path:=/etc/designs/${project.artifactId}; overwrite:=true; uninstall:=false,
>     SLING-INF/initial-content/content/${project.artifactId}/; path:=/content/${project.artifactId}; overwrite:=true; uninstall:=false
> </Sling-Initial-Content>
> 
> 
> 
> 
> 
> 
> 
> 
> -- 
> David Gonzalez
> Sent with Sparrow (http://www.sparrowmailapp.com/?sig)
>