2 Replies Latest reply on Nov 20, 2011 7:21 PM by Brian Wallis

    Mapped Repository?

    Brian Wallis Master

      Is there a way to define a mapping from one repository tree structure to another? What I have is a simple repository with a date based hierarchy like so




      and I also have some metadata on each ID node that gives me a patientID and admissionID. I would like to represent this in a JCR view as




      but I don't really want to create a second repository with references across to the first (which I suppose I could do using a sequencer).


      Can I instead define a mapping using xpaths (or something similar) from the first structure to the other using the metadata contained in the id node? The first thought that comes to mind is that this could be done with a connector that sits on top of the real connector and does the mapping on request. Is there anything like this already available?



        • 1. Re: Mapped Repository?
          Randall Hauch Master

          I can think of two ways of approaching this.


          The first is to use shared nodes. Basically, the file node (in your example) would really live under one structure (probably the one that is more stable, such as date), and your application could process the metadata and create the alternative structure and create a shared node for the file node. That your application has to programmatically create the shared node is the big disadvantage to this approach.


          Also, if the original content is actually stored in a non-storage connector (e.g., the file system connector, svn connector), then alternative structure and the shared nodes would probably need to be stored in a regular storage connector (e.g., disk storage, Infinispan, or JPA connectors).


          Note that the JCR specification does dicate some peculiarities in how shared nodes are treated: basically, the sharable node is indexed and appears in the search results, but the shared nodes would not.



          The second approach would be to use a custom connector that uses one (or more) other connectors. This is obviously more involved, but it probably would allow you to achieve a behavior closest to what you want.


          Hope this helps.

          • 2. Re: Mapped Repository?
            Brian Wallis Master

            Thanks for that.


            Using shared nodes could be a bit clumsy so I'm currently looking at a custom connector and have started writing my first one to learn the technology.