3 Replies Latest reply on May 15, 2013 8:07 AM by rhauch

    Plain text sequencers




             I am trying to configure and use various sequencers in modeshape. Configuration for sequencers in my JSON are:

          "sequencing" : {
       "removeDerivedContentWithOriginal" : true,
              "threadPool" : "modeshape-workers",
              "sequencers" : {
                  "ZIP Sequencer" : {
                      "description" : "ZIP Files loaded under '/files' and extracted into '/sequenced/zip/$1'",
                      "classname" : "ZipSequencer",
                      "pathExpressions" : ["default:/archive(//)(*.zip[*])/jcr:content[@jcr:data] => default:/sequenced/zip/$1"]
                  "Delimited Text File Sequencer" : {
                      "classname" : "org.modeshape.sequencer.text.DelimitedTextSequencer",
                      "pathExpressions" : ["default:/archive(//) (*.csv[*])/jcr:content[@jcr:data] => default:/sequenced/text/$1"],
                      "splitPattern" : ","
                                                      "image File Sequencer" : {
                      "classname" : "org.modeshape.sequencer.image.ImageMetadataSequencer",
                      "pathExpressions" : [
                          "default:/archive[//](*.png[*])/jcr:content[@jcr:data] => default:/sequenced/image/$1"
                                                      "Plain Text File Sequencer" : {
                      "classname" : "org.modeshape.sequencer.text.FixedWidthTextSequencer",
                      "pathExpressions" : ["default:/archive(//) (*.log[*])/jcr:content[@jcr:data] => default:/sequenced/log/$1"],
                     "columnStartPositions" : [3,6],
                      "commentMarker" : "#"


      Sequencers are wprking fine for Zip, csv and image but for plain text file (in my case .log), they dont seem to work, Can anybody tell me what I might be missing?


      Thanks in advance.

        • 1. Re: Plain text sequencers

          Sequencers are wprking fine for Zip, csv and image but for plain text file (in my case .log), they dont seem to work.

          Perhaps it's a formatting mistake in the post, but several of the "pathExpressions" field values in the configuration you posted include spaces. ModeShape internally builds a regular expression after pre-processing those values, and I think the space would mess up the expression so that it won't match the paths of the nodes you're trying to sequence.


          So first suggestion is to make sure those are not in the file, or that there are no strange characters there.


          The second suggestion is to turn on debug logging for the sequencing operations (e.g., "org.modeshape.jcr.sequencing"), which will say when ModeShape determines whether or not a sequencer should be run on a given path. If the sequencer is being run on a particular node and the sequencing results in an error, it will be written to the log.

          • 2. Re: Plain text sequencers



                  Thanks for the reply, Yes the problem was the extra spaces in pathsExpression for plain text sequencer. Once I removed them, it got working as well. Now I have another question.


                  Can we somehow enforce a sequencer on an existing node? I mean if I uploaded a file, and due to some reason, the sequencer fails, Can I Somehow enforce or re-run the sequencer on the same file(s)?


                 Thanks in advance.

            • 3. Re: Plain text sequencers

              The only way to have ModeShape re-evaluate whether to run sequencers is to modify the node. The thought is that re-running the same sequencer on the same (unchanged) node should really reproduce the same result. So if a sequencer failed on the first attempt, it will also fail on the second attempt (unless the sequencer is not deterministic).

              1 of 1 people found this helpful