6 Replies Latest reply on Jul 30, 2012 12:31 PM by oranjedog

    Restore jcr node to another repository

    oranjedog

      Here I got the metadata info from the source repostiory within a oracle DB by jdbc metadata connector, and then I want to store the metadata info into another target repository within a database, maybe another oracle DB.  Should I read properties from each node recursively and write properties to corresponding nodes in another repository? For example, I got a node hirachy: schema->tables, I think I should read schama node first and write the properties into a node in the target repository and then the table nodes... However, I'm not sure if I'm doing the right thing... is there a standard way or tools to handle this situation?

        • 1. Re: Restore jcr node to another repository
          rhauch

          Cloning information from one repository to another repository is beyond the scope of the JCR specification and APIs. So if you do work with two repositories, you'll not have much choice than to either programmatically walk the content in the first repository and copy the information into the second.

           

          However, with ModeShape it is possible to use federation to define a single repository that uses multiple sources. See the chapter in our ModeShape 2.x documentation that covers the Federation Connector.

           

          Perhaps the easiest and most common way is to define one workspace to use one source, and other workspaces to use other sources. For example, you could define one workspace (e.g., "live-metadata") to use the JDBC Metadata Connector, and another workspace to use the JPA Connector (or whichever persisting connector you choose). Thus, you could use JCR's Workspace.clone(...) methods to implement the copy operation. (We have a configuration file in our integration tests that shows how this can be done.)

           

          Hope that helps!

          1 of 1 people found this helpful
          • 2. Re: Restore jcr node to another repository
            oranjedog

            Thank you for your reply, I will give it a try. I've a further question, in the jpa test code in the integration test project, when a node add a new node and session save it, modeshape will add node into table in the db and users will dont know the tables' name and structure,right?

            • 3. Re: Restore jcr node to another repository
              rhauch

              How and where ModeShape persists information is completely transparent to users of the JCR API. So, yes, when nodes are added/changed/removed and saved, ModeShape will then insert/udpate/delete rows in the database tables.

              1 of 1 people found this helpful
              • 4. Re: Restore jcr node to another repository
                oranjedog

                Get it. One more question, if there are a lot of tables in one schema, how about the performance with the JCR node? Thanks.

                • 5. Re: Restore jcr node to another repository
                  hchiorean

                  ModeShape uses about 8 tables in total for storing it's data, out of which only about 4 are "hit on a regular basis", storing node information. So there isn't really the case of a lot of tables in a schema.

                  If you have lots of nodes (which will translate into table rows), the performance should be no worse than a simple Hibernate application working with the same tables/rows.

                  • 6. Re: Restore jcr node to another repository
                    oranjedog

                    Got you...thanks...