Announcement Announcement Module
Collapse
No announcement yet.
XPath Selector - with multiple XPaths Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • XPath Selector - with multiple XPaths

    I'm trying to figure out how to set up a XPath Selector with multiple XPaths - basically I want to filter out a bunch of trades based on XPaths.

    The XPaths are going to come from a db - so there will be some kind of list built up and set on the the bean.

    I've looked at the selector stuff and can only see how I can do this with a single xpath expression - I'm now thinking about writing my own xpath selector that extends the spring one.

    Any help would be appreciated.

    Thanks

    Robin

  • #2
    Implementation

    MessageSelectingInterceptor(MessageSelector selectors[])
    Last edited by robin.sharp; Jul 8th, 2011, 09:54 AM.

    Comment


    • #3
      Could you please add a comment to this issue?: https://jira.springsource.org/browse/INT-1761

      That way we will be sure to provide first class support for your use-case in 2.1.

      Thanks!
      -Mark

      Comment


      • #4
        Sorry I cant log in

        Comment


        • #5
          So I ended up with this class called XPathsMessageSelectingInterceptor, as a quick fix. The ref "lookupOutboundXPathFilter" refers to a List<String> of XPaths that is pulled by a Method factory from my service bean. That all works fine ...

          <bean id="tradeOutboundInterceptor" class="com.acme.xml.XPathsMessageSelectingIntercep tor">
          <constructor-arg index="0" ref="lookupOutboundXPathFilter"/>
          </bean>

          So should I use it like this ???

          <int:channel id="tradeChannel">
          <int:interceptors>
          <ref bean="tradeOutboundInterceptor"/>
          </int:interceptors>
          </int:channel>




          public class XPathsMessageSelectingInterceptor extends MessageSelectingInterceptor
          {
          /**
          * Construct an Array of BooleanTestXPathMessageSelectors
          */
          public XPathsMessageSelectingInterceptor( List<String> xPathExpressions )
          {
          super( newBooleanTestXPathMessageSelector(xPathExpression s) );
          }

          /**
          * Static method to create a bunch of selectors
          */
          public static BooleanTestXPathMessageSelector[] newBooleanTestXPathMessageSelector( List<String> xPathExpressions )
          {
          BooleanTestXPathMessageSelector[] messageSelectors = new BooleanTestXPathMessageSelector[ xPathExpressions.size() ];

          for( int index = 0; index < xPathExpressions.size(); index++ )
          {
          messageSelectors[index] = new BooleanTestXPathMessageSelector( xPathExpressions.get(index) );
          }

          return messageSelectors;
          }
          }
          Last edited by robin.sharp; Jul 8th, 2011, 11:30 AM.

          Comment

          Working...
          X