You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2011/03/01 18:10:04 UTC
svn commit: r1075927 - in
/camel/trunk/camel-core/src/main/java/org/apache/camel:
builder/ProcessorBuilder.java model/BeanDefinition.java
model/ProcessorDefinition.java
Author: davsclaus
Date: Tue Mar 1 17:10:03 2011
New Revision: 1075927
URL: http://svn.apache.org/viewvc?rev=1075927&view=rev
Log:
CAMEL-3736: Attribute beanType changed from Class to String in model. Also using ClassResolver from CamelContext to load the class which works better in OSGi etc.
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ProcessorBuilder.java
camel/trunk/camel-core/src/main/java/org/apache/camel/model/BeanDefinition.java
camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ProcessorBuilder.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ProcessorBuilder.java?rev=1075927&r1=1075926&r2=1075927&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ProcessorBuilder.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ProcessorBuilder.java Tue Mar 1 17:10:03 2011
@@ -206,7 +206,9 @@ public final class ProcessorBuilder {
/**
* Removes the header on the FAULT message
+ * @deprecated use {@link #removeHeader(String)}
*/
+ @Deprecated
public static Processor removeFaultHeader(final String name) {
return new Processor() {
public void process(Exchange exchange) {
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/BeanDefinition.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/BeanDefinition.java?rev=1075927&r1=1075926&r2=1075927&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/model/BeanDefinition.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/BeanDefinition.java Tue Mar 1 17:10:03 2011
@@ -45,7 +45,7 @@ public class BeanDefinition extends Outp
@XmlAttribute
private String method;
@XmlAttribute
- private Class<?> beanType;
+ private String beanType;
@XmlTransient
private Object bean;
@@ -92,14 +92,14 @@ public class BeanDefinition extends Outp
this.bean = bean;
}
- public Class<?> getBeanType() {
+ public String getBeanType() {
return beanType;
}
- public void setBeanType(Class<?> beanType) {
+ public void setBeanType(String beanType) {
this.beanType = beanType;
}
-
+
// Fluent API
//-------------------------------------------------------------------------
/**
@@ -157,7 +157,13 @@ public class BeanDefinition extends Outp
} else {
if (bean == null) {
ObjectHelper.notNull(beanType, "bean, ref or beanType", this);
- bean = CamelContextHelper.newInstance(routeContext.getCamelContext(), beanType);
+ Class<?> clazz;
+ try {
+ clazz = routeContext.getCamelContext().getClassResolver().resolveMandatoryClass(beanType);
+ } catch (ClassNotFoundException e) {
+ throw ObjectHelper.wrapRuntimeCamelException(e);
+ }
+ bean = CamelContextHelper.newInstance(routeContext.getCamelContext(), clazz);
}
ObjectHelper.notNull(bean, "bean", this);
@@ -192,7 +198,7 @@ public class BeanDefinition extends Outp
} else if (bean != null) {
return bean.toString();
} else if (beanType != null) {
- return beanType.getName();
+ return beanType;
} else {
return "";
}
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java?rev=1075927&r1=1075926&r2=1075927&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java Tue Mar 1 17:10:03 2011
@@ -2229,7 +2229,7 @@ public abstract class ProcessorDefinitio
* Adds a bean which is invoked which could be a final destination, or could be a transformation in a pipeline
*
* @param bean the bean to invoke
- * @param method the method name to invoke on the bean (can be used to avoid ambiguty)
+ * @param method the method name to invoke on the bean (can be used to avoid ambiguity)
* @return the builder
*/
@SuppressWarnings("unchecked")
@@ -2251,7 +2251,7 @@ public abstract class ProcessorDefinitio
@SuppressWarnings("unchecked")
public Type bean(Class beanType) {
BeanDefinition answer = new BeanDefinition();
- answer.setBeanType(beanType);
+ answer.setBeanType(beanType.getName());
addOutput(answer);
return (Type) this;
}
@@ -2261,13 +2261,13 @@ public abstract class ProcessorDefinitio
* Adds a bean which is invoked which could be a final destination, or could be a transformation in a pipeline
*
* @param beanType the bean class, Camel will instantiate an object at runtime
- * @param method the method name to invoke on the bean (can be used to avoid ambiguty)
+ * @param method the method name to invoke on the bean (can be used to avoid ambiguity)
* @return the builder
*/
@SuppressWarnings("unchecked")
public Type bean(Class beanType, String method) {
BeanDefinition answer = new BeanDefinition();
- answer.setBeanType(beanType);
+ answer.setBeanType(beanType.getName());
answer.setMethod(method);
addOutput(answer);
return (Type) this;
@@ -2292,7 +2292,7 @@ public abstract class ProcessorDefinitio
* Adds a bean which is invoked which could be a final destination, or could be a transformation in a pipeline
*
* @param ref reference to a bean to lookup in the registry
- * @param method the method name to invoke on the bean (can be used to avoid ambiguty)
+ * @param method the method name to invoke on the bean (can be used to avoid ambiguity)
* @return the builder
*/
@SuppressWarnings("unchecked")
@@ -2505,7 +2505,9 @@ public abstract class ProcessorDefinitio
*
* @param name the header name
* @return the builder
+ * @deprecated use {@link #removeHeader(String)}
*/
+ @Deprecated
public Type removeFaultHeader(String name) {
return process(ProcessorBuilder.removeFaultHeader(name));
}