-
1. Re: Error using custom language in filter
njiang Jul 27, 2012 9:31 PM (in response to futuredan)How did you deploy your camel route?
BTW, did you have change to write a simple unit test to verify your language.
You should find some example in the unit tests of camel-core.
Willem
-
2. Re: Error using custom language in filter
futuredan Jul 30, 2012 5:36 PM (in response to njiang)I am using a bundle whose only contents is a camel-context.xml in META-INF/spring to deploy the context.
I tried creating a test case, but I'm using Fuse 4.3.1 which uses Camel 2.6 and that source isn't available anymore.
I tried coming up with something based on the Camel 2.8 source, but I'm not sure I pulled it off.
My classes are quite small. Here they are in their entirety.
I assume I am missing something necessary to create a language.
Do you know what it could be?
public class MyXpathLanguage extends XPathLanguage
{
public MyXpathLanguage()
{
}
public Predicate createPredicate( String expression )
{
MyXpathBuilder builder = MyXpathBuilder.xpath( expression );
super.configureBuilder( builder );
return builder;
}
}
public class MyXpathBuilder extends XPathBuilder
{
private static final Log LOG = LogFactory.getLog( MyXpathBuilder.class );
public MyXpathBuilder( String text )
{
super( text );
// TODO Auto-generated constructor stub
}
public static MyXpathBuilder xpath( String text )
{
LOG.info( "Building XPath with :" + text + ":" );
return new MyXpathBuilder( text );
}
public boolean matches( Exchange exchange )
{
LOG.info( "Matching :" + exchange.getIn().getBody().toString() + ":" );
return( super.matches( exchange ) );
}
}
-
3. Re: Error using custom language in filter
njiang Aug 9, 2012 10:04 PM (in response to futuredan)It is more complicate if you want to add Spring support of the MyXpathLanguage yourself.
You need to update the camel-core to add the MyXpathLanguage into the module of language.
Willem
-
4. Re: Error using custom language in filter
davsclaus Aug 13, 2012 1:31 AM (in response to futuredan)Yeah would be nice with a dynamic xpath/xquery for predicates out of the box. I logged a JIRA ticket some time back.
So possible in the future its out of the box. But the caveat is that the dynamism may requires a change in the DSL, and thus not so easy to introduce as fast.
-
5. Re: Error using custom language in filter
futuredan Aug 14, 2012 3:52 PM (in response to njiang)So in the directive:
I can't use a value for the language attribute that isn't built into camel-core?
I had assumed languages were dynamic like components with META-INF/services/org/apache/camel/component
Thank you for the information.
-
6. Re: Error using custom language in filter
futuredan Aug 14, 2012 3:59 PM (in response to davsclaus)I see the ticket at https://issues.apache.org/jira/browse/CAMEL-3697
Thanks for the information. I'll keep an eye on that ticket.