3 Replies Latest reply on Aug 22, 2012 10:14 AM by hchiorean

    Initial content

    nl

      Hi,

       

      right now I am able to specify an initial content file in my repository configuration. Mine looks like this:

       

      {code:xml}

      <?xml version="1.0" encoding="UTF-8"?>

      <files xmlns:jcr="http://www.jcp.org/jcr/1.0" jcr:primaryType="nt:folder" jcr:mixinTypes="mode:publishArea" />

      {code:xml}

       

      This is convenient, because all my files are stored under /files node and I do not need to create the first path segment.

      But if I want to add another sibling path on repository/workspace creation I get into troubles because an xml file can only contain one root element, otherwise it is not valid.

      In this concrete case I want to create/import a query folder which contains all the named queries I am using in my application.

      Additional "mode:initialContent" 's are silently ignored.

       

      Is there a way to do so?

       

      Thanks, Niels

        • 1. Re: Initial content
          rhauch

          I think you're right: ModeShape cannot handle initial content with multiple root nodes. Please feel free to add an enhancement request. The easiest way would probably be to support multiple "mode:initialContent" elements (though there are other options, too).

           

          An implementation-independent way to add initial content would be for your application to use the JCR API and check for the desired structure and, if missing, add it. This is all our limited "initial content" feature is doing.

          • 2. Re: Initial content
            nl

            See MODE-1563, thanks.

            • 3. Re: Initial content
              hchiorean

              Since we'd like to implement this feature for 3.x as well, what format do you think would be better/easier to work with, in this case ?

              IMO, since we are talking about initial content, one of the goals should be that it's as easy as possible to quickly create such content - e.g. node hierarchies with properties, instead of having a format which supports advanced JCR concepts (like versioning for example)

               

              Some of the options are:

              • XML - we can extend the format used in 2.x, like Randall suggested
              • JSON - what structure do you think would be better suited for this - one option is to use a similar structure to our RestService
              • something else

               

              Please fell free to add you suggestions either here, or in JIRA: https://issues.jboss.org/browse/MODE-1564