3 Replies Latest reply on Dec 6, 2008 4:00 AM by tfennelly

    Question about XPathLanguage.dsl

      I need to define some CBR rules in my DRL file, which will compare several elements inside the incoming XML data for routing to the appropriate destination.

      XPathLanguage.dsl file provides only the constructs for working with the single match/compare operations - for one specific element in XML data fetched via XPath request: xpathMatch, xpathEquals etc.

      I want to extend XPathLanguage.dsl with some additional constructs for working with several match/compare operations for XML data. So in the target DRL file I will be able to write something like this:

      when
       xpathEqualMany
       - "/root/header/val1", "1"
       - "/root/header/val2", "2"
       - "/root/header/val3", "3"
      then
       Destination : "somedest";
      


      At the same time, amount of match/compare operations is not fixed - it can be 2, 3, 5, 10, 100 etc.

      For now I was not able to find the appropriate mechanisms in both DSL and DRL syntax for enabling such kind of rules.

      Can you please advice regarding the direction of possible answers to this question?

      Thanks in advance.


        • 1. Re: Question about XPathLanguage.dsl
          beve

          Hi,

          you can extend/modify the .dsl by specifying a different one to meet you requirements:

          <property name="ruleLanguage" value="CustomXPathLanguage.dsl"/>

          Just put your CustomXPahtLanguage.dsl in the root of your .esb archive.
          The XPathLanguage.dsl can be found in deploy/jbrules.esb/ directory.

          Regards,

          /Daniel



          • 2. Re: Question about XPathLanguage.dsl

            Hi Beve,

            Thanks for your comments.

            But my question was about DSL file itself - I'm trying to figure out the correct constructs for DSL-DRL language for enabling the match/compare logic for several elements from XML data.

            Can you help me with this?

            Again, I need to implement a construct xpathEqualMany inside DSL file, which will enable the following code for my DRL file:

            when
             xpathEqualMany
             - "/root/header/val1", "1"
             - "/root/header/val2", "2"
             - "/root/header/val3", "3"
            then
             Destination : "somedest";
            


            • 3. Re: Question about XPathLanguage.dsl
              tfennelly

              Have you done any research on this? Have you looked at Drools and how to write a DSL? What have you done?

              Looking at XPathLanguage.dsl it looks like you just need to define a static method that evaluates multiple xpaths and then configure that in your own .dsl and on the action (just like Danny suggested).