You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2009/05/16 14:18:14 UTC
svn commit: r775452 - in /camel/branches/camel-1.x: ./
camel-core/src/main/java/org/apache/camel/builder/
camel-core/src/main/java/org/apache/camel/model/language/
camel-core/src/test/java/org/apache/camel/processor/
Author: ningjiang
Date: Sat May 16 12:18:13 2009
New Revision: 775452
URL: http://svn.apache.org/viewvc?rev=775452&view=rev
Log:
CAMEL-1618 revert the change in Camel-1.x branch
Removed:
camel/branches/camel-1.x/camel-core/src/test/java/org/apache/camel/processor/ChoiceWhenBeanExpressionTest.java
Modified:
camel/branches/camel-1.x/ (props changed)
camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/builder/Builder.java
camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/builder/BuilderSupport.java
camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/builder/ExpressionBuilder.java
camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/builder/ExpressionClause.java
camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/language/MethodCallExpression.java
Propchange: camel/branches/camel-1.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat May 16 12:18:13 2009
@@ -1 +1 @@
-/camel/trunk:736980,739733,739904,740251,740295,740306,740596,740663,741848,742231,742705,742739,742854,742856,742898,742906,743613,743762,743773,743920,743959-743960,744123,745105,745367,745541,745751,745826,745978,746269,746872,746895,746962,747258,747678-747704,748392,748436,748821,749563-749564,749574,749628-749629,749936,749956,750017,750334,750396,750761,750796,752068,752117,752418,752751-752755,752764-752773,752956,753087,753101,753175,755136,755487,756313,756348,756870,756939,757636,757693,757743,757865,758539,758563,758600,758617,758692,758990,759362,759453,759887,759931,760003,760890,760909,760937,761194,761536,761583,761607,762047,762633,762650,762935,763095,763484,763551,765154,765686,765729,765743,765824,766016,766289,766584,766588,766590,766602,766673,767403,767824,768342,769239,769346,769368,769434,770172,770906,771303,773193,773446,773781,774192,774383,774658-774659,775123,775155
+/camel/trunk:736980,739733,739904,740251,740295,740306,740596,740663,741848,742231,742705,742739,742854,742856,742898,742906,743613,743762,743773,743920,743959-743960,744123,745105,745367,745541,745751,745826,745978,746269,746872,746895,746962,747258,747678-747704,748392,748436,748821,749563-749564,749574,749628-749629,749936,749956,750017,750334,750396,750761,750796,752068,752117,752418,752751-752755,752764-752773,752956,753087,753101,753175,755136,755487,756313,756348,756870,756939,757636,757693,757743,757865,758539,758563,758600,758617,758692,758990,759362,759453,759887,759931,760003,760890,760909,760937,761194,761536,761583,761607,762047,762633,762650,762935,763095,763484,763551,765154,765686,765729,765743,765824,766016,766289,766584,766588,766590,766602,766673,767403,767824,768342,769239,769346,769368,769434,770172,770906,771303,773193,773446,773781,774192,774383,774658-774659
Propchange: camel/branches/camel-1.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/builder/Builder.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/builder/Builder.java?rev=775452&r1=775451&r2=775452&view=diff
==============================================================================
--- camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/builder/Builder.java (original)
+++ camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/builder/Builder.java Sat May 16 12:18:13 2009
@@ -36,44 +36,6 @@
}
/**
- * Returns a <a href="http://camel.apache.org/bean-language.html">bean expression</a>
- * value builder
- *
- * @param beanRef reference to bean to lookup in the Registry
- * @return the builder
- */
- public static ValueBuilder bean(String beanRef) {
- Expression expression = ExpressionBuilder.beanExpression(beanRef);
- return new ValueBuilder(expression);
- }
-
- /**
- * Returns a <a href="http://camel.apache.org/bean-language.html">bean expression</a>
- * value builder
- *
- * @param beanRef reference to bean to lookup in the Registry
- * @param method name of method to invoke
- * @return the builder
- */
- public static ValueBuilder bean(String beanRef, String method) {
- Expression expression = ExpressionBuilder.beanExpression(beanRef, method);
- return new ValueBuilder(expression);
- }
-
- /**
- * Returns a <a href="http://camel.apache.org/bean-language.html">bean expression</a>
- * value builder
- *
- * @param beanType the bean class which will be invoked
- * @param method name of method to invoke
- * @return the builder
- */
- public static ValueBuilder bean(Class beanType, String method) {
- Expression expression = ExpressionBuilder.beanExpression(beanType, method);
- return new ValueBuilder(expression);
- }
-
- /**
* Returns a constant expression
*/
public static <E extends Exchange> ValueBuilder<E> constant(Object value) {
Modified: camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/builder/BuilderSupport.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/builder/BuilderSupport.java?rev=775452&r1=775451&r2=775452&view=diff
==============================================================================
--- camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/builder/BuilderSupport.java (original)
+++ camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/builder/BuilderSupport.java Sat May 16 12:18:13 2009
@@ -133,41 +133,7 @@
}
/**
- * Returns a <a href="http://camel.apache.org/bean-language.html">bean expression</a>
- * value builder
- *
- * @param beanRef reference to bean to lookup in the Registry
- * @return the builder
- */
- public ValueBuilder bean(String beanRef) {
- return Builder.bean(beanRef, null);
- }
-
- /**
- * Returns a <a href="http://camel.apache.org/bean-language.html">bean expression</a>
- * value builder
- *
- * @param beanType the Class of the bean which we want to invoke
- * @return the builder
- */
- public ValueBuilder bean(Class<?> beanType) {
- return Builder.bean(beanType, null);
- }
-
- /**
- * Returns a <a href="http://camel.apache.org/bean-language.html">bean expression</a>
- * value builder
- *
- * @param beanType the Class of the bean which we want to invoke
- * @param methodName the method name that will be invoked
- * @return the builder
- */
- public ValueBuilder bean(Class<?> beanType, String methodName) {
- return Builder.bean(beanType, methodName);
- }
-
- /**
- * Returns an expression value builder that replaces all occurrences of the
+ * Returns an expression value builder that replaces all occurrences of the
* regular expression with the given replacement
*/
public ValueBuilder regexReplaceAll(Expression content, String regex, String replacement) {
Modified: camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/builder/ExpressionBuilder.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/builder/ExpressionBuilder.java?rev=775452&r1=775451&r2=775452&view=diff
==============================================================================
--- camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/builder/ExpressionBuilder.java (original)
+++ camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/builder/ExpressionBuilder.java Sat May 16 12:18:13 2009
@@ -33,7 +33,6 @@
import org.apache.camel.language.bean.BeanLanguage;
import org.apache.camel.language.simple.SimpleLanguage;
-
/**
* A helper class for working with <a href="http://activemq.apache.org/camel/expression.html">expressions</a>.
*
@@ -724,14 +723,18 @@
}
public static <E extends Exchange> Expression<E> beanExpression(final String bean) {
- return BeanLanguage.bean(bean);
- }
-
- public static <E extends Exchange> Expression<E> beanExpression(final String bean, final String method) {
- return BeanLanguage.bean(bean, method);
- }
- public static Expression beanExpression(final Class beanType, final String methodName) {
- return BeanLanguage.bean(beanType, methodName);
+ return new Expression<E>() {
+ public Object evaluate(E exchange) {
+ // must call evalute to return the nested langauge evaluate when evaluating
+ // stacked expressions
+ return BeanLanguage.bean(bean).evaluate(exchange);
+ }
+
+ @Override
+ public String toString() {
+ return "bean(" + bean + ")";
+ }
+ };
}
}
Modified: camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/builder/ExpressionClause.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/builder/ExpressionClause.java?rev=775452&r1=775451&r2=775452&view=diff
==============================================================================
--- camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/builder/ExpressionClause.java (original)
+++ camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/builder/ExpressionClause.java Sat May 16 12:18:13 2009
@@ -172,21 +172,6 @@
setExpressionType(expression);
return result;
}
-
- /**
- * Evaluates an expression using the <a
- * href="http://camel.apache.org/bean-language.html>bean language</a>
- * which basically means the bean is invoked to determine the expression
- * value.
- *
- * @param beanType the Class of the bean which we want to invoke
- * @return the builder to continue processing the DSL
- */
- public T method(Class beanType) {
- MethodCallExpression expression = new MethodCallExpression(beanType);
- setExpressionType(expression);
- return result;
- }
/**
* Evaluates an expression using the
@@ -202,22 +187,6 @@
setExpressionType(expression);
return result;
}
-
- /**
- * Evaluates an expression using the <a
- * href="http://camel.apache.org/bean-language.html>bean language</a>
- * which basically means the bean is invoked to determine the expression
- * value.
- *
- * @param beanType the Class of the bean which we want to invoke
- * @param method the name of the method to invoke on the bean
- * @return the builder to continue processing the DSL
- */
- public T method(Class beanType, String method) {
- MethodCallExpression expression = new MethodCallExpression(beanType, method);
- setExpressionType(expression);
- return result;
- }
/**
* Evaluates a <a href="http://activemq.apache.org/camel/beanshell.html">BeanShell expression</a>
Modified: camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/language/MethodCallExpression.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/language/MethodCallExpression.java?rev=775452&r1=775451&r2=775452&view=diff
==============================================================================
--- camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/language/MethodCallExpression.java (original)
+++ camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/language/MethodCallExpression.java Sat May 16 12:18:13 2009
@@ -20,14 +20,12 @@
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlTransient;
import org.apache.camel.Exchange;
import org.apache.camel.Expression;
import org.apache.camel.Predicate;
import org.apache.camel.language.bean.BeanExpression;
import org.apache.camel.spi.RouteContext;
-import org.apache.camel.util.ObjectHelper;
/**
* For expressions and predicates using the
@@ -42,10 +40,6 @@
private String bean;
@XmlAttribute(required = false)
private String method;
- @XmlTransient
- // we don't need to support the beanType class in Spring
- private Class beanType;
-
public MethodCallExpression() {
}
@@ -58,17 +52,6 @@
super(beanName);
this.method = method;
}
-
- public MethodCallExpression(Class type) {
- super(type.toString());
- this.beanType = type;
- }
-
- public MethodCallExpression(Class type, String method) {
- super(type.toString());
- this.beanType = type;
- this.method = method;
- }
public String getLanguage() {
return "bean";
@@ -82,24 +65,14 @@
this.method = method;
}
- @SuppressWarnings("unchecked")
@Override
public Expression createExpression(RouteContext routeContext) {
- if (beanType != null) {
- return new BeanExpression(ObjectHelper.newInstance(beanType), getMethod());
- } else {
- return new BeanExpression(beanName(), getMethod());
- }
+ return new BeanExpression(beanName(), getMethod());
}
- @SuppressWarnings("unchecked")
@Override
- public Predicate createPredicate(RouteContext routeContext) {
- if (beanType != null) {
- return new BeanExpression(ObjectHelper.newInstance(beanType), getMethod());
- } else {
- return new BeanExpression(beanName(), getMethod());
- }
+ public Predicate<Exchange> createPredicate(RouteContext routeContext) {
+ return new BeanExpression<Exchange>(beanName(), getMethod());
}
protected String beanName() {