4 Replies Latest reply on May 6, 2013 9:17 PM by Tamer Elgamal

    Modeshape 3.2 sequencer

    Tamer Elgamal Newbie

      Hello,

       

      I have 2 questions

       

      1- I have started playing around with Modeshape 3.2 on EAP 6.1. I am having an issue when sequencing java files. Here is the current config for the java sequencer

       

      <sequencer name="java-source-sequencer" classname="org.modeshape.sequencer.javafile.JavaFileSequencer" module="org.modeshape.sequencer.java" path-expression="default://(*.java[*])/jcr:content[@jcr:data]"/>

       

      As you can see I have the input path but not output path. My understanding is if I do not specify an output path, the sequencing information will be generated under the same node. Instead, I get the following error

       

       

      12:54:51,513 ERROR [org.modeshape.sequencer.javafile.JavaFileSequencer] (modesha

      pe-sequencer-8-thread-1) Error sequencing file: javax.jcr.nodetype.ConstraintVio

      lationException: Unable to determine a valid node definition for the node "/Jcrr

      1. esttestResource.java/JcrresttestResource.java/com" in workspace "default" of "sa

      mple"

      at org.modeshape.jcr.AbstractJcrNode.validateChildNodeDefinition(Abstrac

      1. tJcrNode.java:1213) [modeshape-jcr-3.2.0.Final.jar:3.2.0.Final]

      at org.modeshape.jcr.AbstractJcrNode.addChildNode(AbstractJcrNode.java:1

      045) [modeshape-jcr-3.2.0.Final.jar:3.2.0.Final]

      at org.modeshape.jcr.AbstractJcrNode.addNode(AbstractJcrNode.java:1001)

      [modeshape-jcr-3.2.0.Final.jar:3.2.0.Final]

      at org.modeshape.jcr.AbstractJcrNode.addNode(AbstractJcrNode.java:922) [

      modeshape-jcr-3.2.0.Final.jar:3.2.0.Final]

      at org.modeshape.jcr.AbstractJcrNode.addNode(AbstractJcrNode.java:107) [

      modeshape-jcr-3.2.0.Final.jar:3.2.0.Final]

      at org.modeshape.sequencer.javafile.ClassSourceFileRecorder.getTypeNode(

      1. ClassSourceFileRecorder.java:56)

      at org.modeshape.sequencer.javafile.ClassSourceFileRecorder.record(Class

      1. SourceFileRecorder.java:47)

      at org.modeshape.sequencer.javafile.JavaFileSequencer.execute(JavaFileSe

      1. quencer.java:67)

      at org.modeshape.jcr.SequencingRunner.run(SequencingRunner.java:224) [mo

      deshape-jcr-3.2.0.Final.jar:3.2.0.Final]

      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec

      1. utor.java:895) [rt.jar:1.6.0_45]

      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor

      .java:918) [rt.jar:1.6.0_45]

      at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_45]

       

      Am I missing anything in my configs.

       

      2- Is there any way I can have my output path created dynamically during runtime based on application needs.

       

      Thanks,

      Tamer

        • 1. Re: Modeshape 3.2 sequencer
          Randall Hauch Master

          As you can see I have the input path but not output path. My understanding is if I do not specify an output path, the sequencing information will be generated under the same node.

          That is true, as long as the input node can actually handle the generated structure. For example, if the input node is of type "nt:resource" under an "nt:file" node, then neither of those types will allow extra (residual) properties. You could add a mixin that adds extra properties/children to the "jcr:content" node prior to saving the uploaded file. Note that you can either add residual properties/children (e.g., see how "nt:unstructured" does this) or you can define a mixin with child node definitions for those nodes created by the sequencer (Java sequencer in this case).

           

          If you don't do this, then when the sequencer attempts to save the generated content under the input node, ModeShape validation will result in an error (which will be logged, as this is done asynchronously).

           

           

          2- Is there any way I can have my output path created dynamically during runtime based on application needs.

           

          Well, you could use an output path with a variable (see here) which references a system property within the server, or you could dynamically add/update the sequencer configuration using the EAP administrative APIs. But that's about as dynamic as it gets at this point.

          • 2. Re: Modeshape 3.2 sequencer
            Tamer Elgamal Newbie

            Hi Randall,

            First of all, thank you very much for the quick response.

             

            I think I am clear on the first question. Now for the second question, would implemetnting a custom sequncer be an option? What would be the steps for implementing a customized sequncer for EAP 6.1.

             

            Thanks,

            Tamer

            • 3. Re: Modeshape 3.2 sequencer
              Randall Hauch Master

              Now for the second question, would implemetnting a custom sequncer be an option?

              I'm not sure whether a custom sequencer would apply. I guess it depends on what kind of functionality you wanted to enable.

               

               

              What would be the steps for implementing a customized sequncer for EAP 6.1.

              The steps are basically the same as described in our documentation for creating the sequencer JAR, but for EAP you'll need to create a new EAP module, install that module, and then reference the module in your configuration (though the default is to look for a module with the same ID as the package name of the sequencer class). It's not too difficult, especially if you follow the pattern used in one of our built-in modules inside the ModeShape kit.

              • 4. Re: Modeshape 3.2 sequencer
                Tamer Elgamal Newbie

                Hi Randall,

                The scenario I am working on is each node will represent a system user. I need to make sure when the user uploads a file to Modeshape, the sequenced information is stored under the user’s node and not in a different node. Hope this clarifies what I am trying to achieve. So would a custom sequencer in this case be a better option?

                Thank you very much again for your help.

                Tamer