2 Replies Latest reply on Jun 16, 2010 11:58 AM by Manuel Gentile

    Problem with jcr:versionStorage

    Manuel Gentile Newbie

      I create a mix:versionable node and made some changes with checkout/checkin methods.

      The node seems to have the right verisoning information such as:

       

      jcr:predecessors   = []
      jcr:baseVersion    = 7f9b3e2f-cc11-474a-a4ee-fd2b466e59e9
      jcr:isCheckedOut   = false
      value              = prova1
      jcr:versionHistory = 8a03251e-f84b-429c-a14b-56a9b01ab182
      jcr:uuid           = c24fd667-20f3-42f9-82de-ec21645d6e05
      jcr:mixinTypes     = mix:versionable
      jcr:primaryType    = nt:unstructured
      

       

      During the same session  the referenced nodes  exist in jcr:versionStorage.

       

      If I shutdown and restart the repository  the versioning information are mantained in the node but the referenced nodes don't exist in the  /jcr:versionStorage , it appears  empty.

       

      I suppose that the jcr:system tree is not persisted in the database.

       

      I'm using  the JpaSource with the Simple model on Mysql5.

        • 1. Re: Problem with jcr:versionStorage
          Randall Hauch Master

          You are correct, that unless otherwise specified, the content under "/jcr:system" is not persisted. We should make that much clearer in the documentation, and I'll log a JIRA about this.

           

          However, it's very easy to configure. Each repository configuration has a SYSTEM_SOURCE_NAME option to specify the particular workspace name and source name in which this "/jcr:system" content should be stored. The format for the option value is "workspaceName@sourceName" (or just "sourceName" if the source's default workspace name should be used for the system workspace).

           

          For many cases, you'll probably use the same source that your JCR repository uses, but you'll want to specify a workspace name that won't clash with your other workspace names. But sometimes it is desirable to store the system content in another source altogether.

           

          If you're using an XML file for your configuration, specifying this option is via a "mode:option" element under the "mode:options" element inside the "mode:repository", or something like:

           

          {code:xml}

          <configuration xmlns:mode="http://www.modeshape.org/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0">

            <mode:sources>

              ...

              <mode:source jcr:name="Store" mode:classname="org.modeshape.connector.store.jpa.JpaSource" ... >

              ...

            </mode:sources>

            ...

            <mode:repositories>

              <mode:repository jcr:name="My Repository" mode:source="MySource">

                <mode:options>

                  ...

                  <mode:option jcr:name="systemSourceName" mode:value="systemWorkspace@Store"/>

                  ...

                </mode:options>

              </mode:repository>

              ...

            </mode:repositories>

          </configuration>

          {code:xml}

           

          If you're defining your configuration programmatically, you simply use the constant:

           

          {code}

            JcrConfiguration configuration = new JcrConfiguration();

            configuration.repositorySource("Store").usingClass(JpaSource.class);

            configuration.repository("My Repository")

                         .setSource("Store")

                         .setOption(Option.SYSTEM_STORE_NAME, "systemWorkspace@Store");

            engine = configuration.build();

            engine.start();

          {code}

           

          (Note some of the other configuration details were ommitted.)