4 Replies Latest reply on Mar 30, 2012 12:23 PM by rhauch

    Explicit Sequencer invocation

    franck102

      Hi,

       

      I am considering using the sequencer framework to support two different views on the same repository data. Basically I would like to point a FileSystem connector w/ a CustomPropertiesFactory at existing legacy data (XML files with separate .attributes companion files), and use a custom XML sequencer to create and maintain a much finer-grained, read-only hierarchy. I would need to explicitly invoke the sequencer explicitly to update the sequenced hierarchy whenever the FileSystem connector detects a change in the underlying data.

       

      Does this sound like something that could work? Is there any recommended way for the FileSystem connector to detect that the data has been changed by an external legacy application?

       

      Thanks!

        • 1. Re: Explicit Sequencer invocation
          rhauch

          Does this sound like something that could work?

          Yes, this should work fine. You can even control where the sequencer output goes, including into separate workspaces. (Most sequencer output does not consist of 'nt:file' and 'nt:folder' nodes, so you'll want to put that in a part of the repository that is backed by a storage connector.)

           

           

          Is there any recommended way for the FileSystem connector to detect that the data has been changed by an external legacy application?

          There is nothing out of the box. The challenge is that Java 6 and earlier do not have a JVM-based way to tie into the native OS file system events. You could extend the file system connector and use external libraries or use a polling mechanism. This would be easier the more you know about the files and folders (and OS), which is why it is difficult for us to do in a very general way.

           

          Best regards

          • 2. Re: Explicit Sequencer invocation
            franck102

            Thanks Randall, I am making good progress although I am struggling a bit with the schema.

             

            I have defined a mixin node type to account for legacy properties, and I import it in the repository using

            <jcr:nodeTypes>                <mode:resource>...</mode:resource>...

             

            The cnd file looks like this:

            <acme='http://www.fico.com/acme/1.0'>

             

            [acme:repofile] mixin

            - acme:guid (string)

            - acme:contentType (string)

            - acme:displayName (string)

            - acme:type (string)

            - acme:subType (string)

            - acme:target (string)

             

            What I haven't figured out yet is if there is a way tell modeshape that pre-existing Files loaded from the filesystem by the engine should have the acme:repofile mixin type in addition to the nt:file primary type?

             

            Probably as a consequence, my properties are currently returned by the REST API like multivalued properties, I assume they have been caught by some residual property definition somewhere:

             

            {"properties": {

            • "acme:guid": [
              • "Tmm79iCVOH5uwRbSFmn06M4oJVO"
              ],

             

            I am tracking this in the source code, so I should eventually figure it out... unless I missed something fundamental.

             

            Franck

            • 3. Re: Explicit Sequencer invocation
              franck102

              Just found one of your earlier answer on that topic (https://community.jboss.org/message/543466), looks like my properties factory itself needs to add the "jcr:mixinTypes" property, I will try that next...

               

              Thanks for your helpful insights!

              Franck

              • 4. Re: Explicit Sequencer invocation
                rhauch

                Just found one of your earlier answer on that topic (https://community.jboss.org/message/543466), looks like my properties factory itself needs to add the "jcr:mixinTypes" property, I will try that next...

                Yes, your properties factory needs to add the "jcr:mixinTypes" property (since this property is not stored by the connector via the file system data).