You can build you own Camel language component. On Tue, May 28, 2013 at 11:41 PM, javamonkey79 <javamonke...@gmail.com> wrote: > Is there a standard way to evaluate bean expressions\OGNL in custom > languages? > > For example: > > I have a custom language expression like this: > > <language > language="e4x"> > > ${someString}.indexOf('"'+message['PV1']['PV1.3']['PV1.3.1']+'"') != > -1 > </language> > > And in my Expression code I have something like this: > Matcher matcher = BEAN_PATTERN.matcher( _expressionString ); > while ( matcher.find() ) { > String beanName = matcher.group( 1 ); > > _logger.debug( "found bean with name: [{}]", beanName > ); > > Object lookupByName = > exchange.getContext().getRegistry().lookupByName( > beanName ); > if ( lookupByName == null ) { > throw new ExpressionEvaluationException( > this, "failed to lookup bean > with name: " + beanName, exchange, > new IllegalArgumentException() ); > } > > expressionString = expressionString.replaceFirst( > String.format( > "\\$\\{%s\\}", beanName ), lookupByName.toString() ); > } > > But this seems very wrong, as there is probably code in Camel to do this > already. It is also fairly limited, as I am only able to do String > replacement rather than full on OGNL. > > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/evaluating-bean-expressions-in-custom-language-tp5733377.html > Sent from the Camel - Users mailing list archive at Nabble.com.
-- Claus Ibsen ----------------- www.camelone.org: The open source integration conference. Red Hat, Inc. FuseSource is now part of Red Hat Email: cib...@redhat.com Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen