4 Replies Latest reply on Mar 22, 2013 5:55 AM by ozhou

    Import/Export versionable node with its version history

    ozhou

      Hi Author,

       

      Right now, I can use session.importXML/exportSystemView to import/export nodes, it works pretty well.

      But for versionable node, it has corresponding nt:versionHistory nodes under jcr:versionStorage.

      How can I import/export them together with versionable node?

        • 1. Re: Import/Export versionable node with its version history
          hchiorean

          Since jcr:versionStorage is stored in the protected jcr:system area, the only way you can create a document which will contain both the versionable nodes and the version history, is to export either a document or system view (via session.export...) using the root node "/" as "entry point".

           

          The reason is that /jcr:system is a child directly under the root node.

          • 2. Re: Import/Export versionable node with its version history
            ozhou

            Hi Horia,

             

            Okay, I understand. I read the JCR 2.0 spec, it seems not defining how to import/export versionable node with its version history (maybe I'm wrong).

            If this is the case,  it will be implementation specific.

            Maybe ModeShape can implement this feature as an JCR extension.

            I think it's pretty useful.

             

            Simply exporting the root node is not an option because the requirement is exactly exporting a versionable node with its version history.

             

            What do you think?

            • 3. Re: Import/Export versionable node with its version history
              hchiorean

              Fair enough. Having a custom extension which provides such functionality would make sense. Now, since we can't really change the "spec regulated" import/export, we have the following options (at least):

               

              • export using XML format (a structure similar to our initial content import format - https://docs.jboss.org/author/display/MODE/Initial+Content)
              • export using JSON format - we currently have a custom API extension which provides backup/restore functionality, for an entire repository, by writing out/reading JSON files.
              • something else ?

               

              Also, we need to think about how to export/group system area content: structurally, there is information that pertains to nodes (such as the version history, versions, locks etc) which is held in a completely different area than the nodes themselves.

              When exporting, do we want to leave this information as-is, or do we want to re-group it ? (e.g. group nodes & their versions) together

               

              What do you think ? BTW, please feel free to open an Enhancement Request in our JIRA

               

              Tx

              • 4. Re: Import/Export versionable node with its version history
                ozhou

                An enhancement request has been created, thanks.

                 

                I think you are right. node and its version history are sotred in two areas, so how to handle this in exporting/importing will be a little different from exsiting import/export feature.

                 

                It's up to you guys to decide what the best way to implement this in ModeShape is.