camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1172723 - in /camel/branches/camel-2.8.x: ./ camel-core/src/main/java/org/apache/camel/model/ camel-core/src/main/java/org/apache/camel/model/dataformat/ camel-core/src/main/java/org/apache/camel/model/language/ camel-core/src/main/java/or...
Date Mon, 19 Sep 2011 17:41:06 GMT
Author: dkulp
Date: Mon Sep 19 17:41:05 2011
New Revision: 1172723

URL: http://svn.apache.org/viewvc?rev=1172723&view=rev
Log:
Merged revisions 1150300,1150311 via svnmerge from 
https://svn.apache.org/repos/asf/camel/trunk

........
  r1150300 | davsclaus | 2011-07-24 04:39:15 -0400 (Sun, 24 Jul 2011) | 1 line
  
  CAMEL-4092: Use Camels class resolver to load classes configured in the DSL.
........
  r1150311 | davsclaus | 2011-07-24 05:54:46 -0400 (Sun, 24 Jul 2011) | 1 line
  
  CAMEL-4092: Use Camels class resolver to load classes configured in the DSL.
........

Added:
    camel/branches/camel-2.8.x/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/blueprint-21.xml
      - copied unchanged from r1150311, camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/blueprint-21.xml
Modified:
    camel/branches/camel-2.8.x/   (props changed)
    camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/model/ConvertBodyDefinition.java
    camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/model/DataFormatDefinition.java
    camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/model/OnExceptionDefinition.java
    camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/model/dataformat/JibxDataFormat.java
    camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/model/dataformat/TidyMarkupDataFormat.java
    camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/model/language/MethodCallExpression.java
    camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/model/language/SimpleExpression.java
    camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/model/language/XPathExpression.java
    camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/model/language/XQueryExpression.java
    camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java
    camel/branches/camel-2.8.x/camel-core/src/test/java/org/apache/camel/model/StartingRoutesErrorReportedTest.java
    camel/branches/camel-2.8.x/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringSetHeaderXPathResultTypeTest.xml
    camel/branches/camel-2.8.x/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/CamelBlueprint4Test.java

Propchange: camel/branches/camel-2.8.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Sep 19 17:41:05 2011
@@ -1 +1 @@
-/camel/trunk:1148706,1148710,1149570,1150651,1151000,1151054,1151087,1151126,1151362,1152170,1152569,1152733,1152755,1152868,1153620,1153812,1153829,1154684,1155230,1156108,1156260,1156277,1156479,1156524,1157348,1157749,1157798,1157831,1157878,1158153,1158230,1158295,1159171,1159174,1159326,1159457,1159460,1159606,1159682-1159683,1159867,1160547,1160637,1161010,1161082,1161524,1162309,1162395,1163231,1163420,1163656-1163669,1163725,1164544,1164557,1164633,1164972-1165000,1165152,1165157,1165658,1165971,1165987,1167098,1167131,1167448,1167487,1167555,1169610,1169620,1170122,1170226,1170397,1170956,1171396,1171755,1171941,1171947
+/camel/trunk:1148706,1148710,1149570,1150300-1150311,1150651,1151000,1151054,1151087,1151126,1151362,1152170,1152569,1152733,1152755,1152868,1153620,1153812,1153829,1154684,1155230,1156108,1156260,1156277,1156479,1156524,1157348,1157749,1157798,1157831,1157878,1158153,1158230,1158295,1159171,1159174,1159326,1159457,1159460,1159606,1159682-1159683,1159867,1160547,1160637,1161010,1161082,1161524,1162309,1162395,1163231,1163420,1163656-1163669,1163725,1164544,1164557,1164633,1164972-1165000,1165152,1165157,1165658,1165971,1165987,1167098,1167131,1167448,1167487,1167555,1169610,1169620,1170122,1170226,1170397,1170956,1171396,1171755,1171941,1171947

Propchange: camel/branches/camel-2.8.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/model/ConvertBodyDefinition.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/model/ConvertBodyDefinition.java?rev=1172723&r1=1172722&r2=1172723&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/model/ConvertBodyDefinition.java
(original)
+++ camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/model/ConvertBodyDefinition.java
Mon Sep 19 17:41:05 2011
@@ -23,7 +23,6 @@ import javax.xml.bind.annotation.XmlRoot
 import javax.xml.bind.annotation.XmlTransient;
 
 import org.apache.camel.Processor;
-import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.converter.IOConverter;
 import org.apache.camel.processor.ConvertBodyProcessor;
 import org.apache.camel.spi.Required;
@@ -72,11 +71,8 @@ public class ConvertBodyDefinition exten
 
     @Override
     public Processor createProcessor(RouteContext routeContext) throws Exception {
-        if (getTypeClass() == null) {
-            this.typeClass = routeContext.getCamelContext().getClassResolver().resolveClass(getType());
-            if (getTypeClass() == null) {
-                throw new RuntimeCamelException("Cannot load the class with the class name:
" + getType());
-            }
+        if (typeClass == null && type != null) {
+            typeClass = routeContext.getCamelContext().getClassResolver().resolveMandatoryClass(type);
         }
 
         // validate charset

Modified: camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/model/DataFormatDefinition.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/model/DataFormatDefinition.java?rev=1172723&r1=1172722&r2=1172723&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/model/DataFormatDefinition.java
(original)
+++ camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/model/DataFormatDefinition.java
Mon Sep 19 17:41:05 2011
@@ -89,7 +89,7 @@ public class DataFormatDefinition extend
             } else {
                 throw new IllegalArgumentException(
                     "Data format '" + (dataFormatName != null ? dataFormatName : "<null>")
+ "' could not be created. "
-                    + "Ensure that the dataformat is valid and the associated Camel component
is present on the classpath");
+                    + "Ensure that the data format is valid and the associated Camel component
is present on the classpath");
             }
         }
         return dataFormat;

Modified: camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/model/OnExceptionDefinition.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/model/OnExceptionDefinition.java?rev=1172723&r1=1172722&r2=1172723&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/model/OnExceptionDefinition.java
(original)
+++ camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/model/OnExceptionDefinition.java
Mon Sep 19 17:41:05 2011
@@ -38,6 +38,7 @@ import org.apache.camel.builder.Expressi
 import org.apache.camel.processor.CatchProcessor;
 import org.apache.camel.processor.FatalFallbackErrorHandler;
 import org.apache.camel.processor.RedeliveryPolicy;
+import org.apache.camel.spi.ClassResolver;
 import org.apache.camel.spi.RouteContext;
 import org.apache.camel.util.CamelContextHelper;
 import org.apache.camel.util.CastUtils;
@@ -160,6 +161,11 @@ public class OnExceptionDefinition exten
         setRetryWhileFromExpressionType(routeContext);
         setOnRedeliveryFromRedeliveryRef(routeContext);
 
+        // load exception classes
+        if (exceptions != null && !exceptions.isEmpty()) {
+            exceptionClasses = createExceptionClasses(routeContext.getCamelContext().getClassResolver());
+        }
+
         // must validate configuration before creating processor
         validateConfiguration();
 
@@ -180,6 +186,11 @@ public class OnExceptionDefinition exten
 
     @Override
     public CatchProcessor createProcessor(RouteContext routeContext) throws Exception {
+        // load exception classes
+        if (exceptions != null && !exceptions.isEmpty()) {
+            exceptionClasses = createExceptionClasses(routeContext.getCamelContext().getClassResolver());
+        }
+
         // must validate configuration before creating processor
         validateConfiguration();
 
@@ -204,7 +215,7 @@ public class OnExceptionDefinition exten
         }
 
         List<Class> exceptions = getExceptionClasses();
-        if (exceptions.isEmpty()) {
+        if (exceptions == null || exceptions.isEmpty()) {
             throw new IllegalArgumentException("At least one exception must be configured
on " + this);
         }
 
@@ -715,9 +726,6 @@ public class OnExceptionDefinition exten
     }
 
     public List<Class> getExceptionClasses() {
-        if (exceptionClasses == null) {
-            exceptionClasses = createExceptionClasses();
-        }
         return exceptionClasses;
     }
 
@@ -854,12 +862,12 @@ public class OnExceptionDefinition exten
         return redeliveryPolicy;
     }
 
-    protected List<Class> createExceptionClasses() {
+    protected List<Class> createExceptionClasses(ClassResolver resolver) throws ClassNotFoundException
{
         List<String> list = getExceptions();
         List<Class> answer = new ArrayList<Class>(list.size());
         for (String name : list) {
-            Class<Throwable> type = CastUtils.cast(ObjectHelper.loadClass(name, getClass().getClassLoader()),
Throwable.class);
-            answer.add(type);
+            Class<?> type = resolver.resolveMandatoryClass(name);
+            answer.add(CastUtils.cast(type, Throwable.class));
         }
         return answer;
     }

Modified: camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/model/dataformat/JibxDataFormat.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/model/dataformat/JibxDataFormat.java?rev=1172723&r1=1172722&r2=1172723&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/model/dataformat/JibxDataFormat.java
(original)
+++ camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/model/dataformat/JibxDataFormat.java
Mon Sep 19 17:41:05 2011
@@ -20,20 +20,23 @@ import javax.xml.bind.annotation.XmlAcce
 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.model.DataFormatDefinition;
 import org.apache.camel.spi.DataFormat;
 import org.apache.camel.spi.RouteContext;
+import org.apache.camel.util.ObjectHelper;
 
 /**
  * Represents the JiBX XML {@link org.apache.camel.spi.DataFormat}
- *
  */
 @XmlRootElement(name = "jibx")
 @XmlAccessorType(XmlAccessType.NONE)
 public class JibxDataFormat extends DataFormatDefinition {
-    @XmlAttribute
-    private Class unmarshallClass;
+    @XmlAttribute(name = "unmarshallClass")
+    private String unmarshallTypeName;
+    @XmlTransient
+    private Class<?> unmarshallClass;
 
     public JibxDataFormat() {
         super("jibx");
@@ -44,15 +47,6 @@ public class JibxDataFormat extends Data
         setUnmarshallClass(unmarshallClass);
     }
 
-    @Override
-    protected DataFormat createDataFormat(RouteContext routeContext) {
-        DataFormat answer = super.createDataFormat(routeContext);
-        if (unmarshallClass != null) {
-            setProperty(answer, "unmarshallClass", unmarshallClass);
-        }
-        return answer;
-    }
-
     public Class getUnmarshallClass() {
         return unmarshallClass;
     }
@@ -61,4 +55,32 @@ public class JibxDataFormat extends Data
         this.unmarshallClass = unmarshallClass;
     }
 
+    public String getUnmarshallTypeName() {
+        return unmarshallTypeName;
+    }
+
+    public void setUnmarshallTypeName(String unmarshallTypeName) {
+        this.unmarshallTypeName = unmarshallTypeName;
+    }
+
+    @Override
+    protected DataFormat createDataFormat(RouteContext routeContext) {
+        if (unmarshallClass == null && unmarshallTypeName != null) {
+            try {
+                unmarshallClass = routeContext.getCamelContext().getClassResolver().resolveMandatoryClass(unmarshallTypeName);
+            } catch (ClassNotFoundException e) {
+                throw ObjectHelper.wrapRuntimeCamelException(e);
+            }
+        }
+
+        return super.createDataFormat(routeContext);
+    }
+
+    @Override
+    protected void configureDataFormat(DataFormat dataFormat) {
+        if (unmarshallClass != null) {
+            setProperty(dataFormat, "unmarshallClass", unmarshallClass);
+        }
+    }
+
 }
\ No newline at end of file

Modified: camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/model/dataformat/TidyMarkupDataFormat.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/model/dataformat/TidyMarkupDataFormat.java?rev=1172723&r1=1172722&r2=1172723&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/model/dataformat/TidyMarkupDataFormat.java
(original)
+++ camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/model/dataformat/TidyMarkupDataFormat.java
Mon Sep 19 17:41:05 2011
@@ -20,11 +20,14 @@ import javax.xml.bind.annotation.XmlAcce
 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.w3c.dom.Node;
 
 import org.apache.camel.model.DataFormatDefinition;
 import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.RouteContext;
+import org.apache.camel.util.ObjectHelper;
 
 /**
  * Represents a wellformed HTML document (XML well Formed) {@link DataFormat}
@@ -32,7 +35,9 @@ import org.apache.camel.spi.DataFormat;
 @XmlRootElement(name = "tidyMarkup")
 @XmlAccessorType(XmlAccessType.FIELD)
 public class TidyMarkupDataFormat extends DataFormatDefinition {
-    @XmlAttribute
+    @XmlAttribute(name = "dataObjectType")
+    private String dataObjectTypeName;
+    @XmlTransient
     private Class<?> dataObjectType;
 
     public TidyMarkupDataFormat() {
@@ -56,14 +61,31 @@ public class TidyMarkupDataFormat extend
         return dataObjectType;
     }
 
-    // Implementation methods
-    //-------------------------------------------------------------------------
+    public String getDataObjectTypeName() {
+        return dataObjectTypeName;
+    }
+
+    public void setDataObjectTypeName(String dataObjectTypeName) {
+        this.dataObjectTypeName = dataObjectTypeName;
+    }
+
+    @Override
+    protected DataFormat createDataFormat(RouteContext routeContext) {
+        if (dataObjectType == null && dataObjectTypeName != null) {
+            try {
+                dataObjectType = routeContext.getCamelContext().getClassResolver().resolveMandatoryClass(dataObjectTypeName);
+            } catch (ClassNotFoundException e) {
+                throw ObjectHelper.wrapRuntimeCamelException(e);
+            }
+        }
+
+        return super.createDataFormat(routeContext);
+    }
 
     @Override
     protected void configureDataFormat(DataFormat dataFormat) {
-        Class<?> type = getDataObjectType();
-        if (type != null) {
-            setProperty(dataFormat, "dataObjectType", type);
+        if (dataObjectType != null) {
+            setProperty(dataFormat, "dataObjectType", dataObjectType);
         }
     }
 

Modified: camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/model/language/MethodCallExpression.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/model/language/MethodCallExpression.java?rev=1172723&r1=1172722&r2=1172723&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/model/language/MethodCallExpression.java
(original)
+++ camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/model/language/MethodCallExpression.java
Mon Sep 19 17:41:05 2011
@@ -50,7 +50,9 @@ public class MethodCallExpression extend
     private String ref;
     @XmlAttribute
     private String method;
-    @XmlAttribute
+    @XmlAttribute(name = "beanType")
+    private String beanTypeName;
+    @XmlTransient
     private Class<?> beanType;
     @XmlTransient
     private Object instance;
@@ -123,6 +125,14 @@ public class MethodCallExpression extend
         this.beanType = beanType;
     }
 
+    public String getBeanTypeName() {
+        return beanTypeName;
+    }
+
+    public void setBeanTypeName(String beanTypeName) {
+        this.beanTypeName = beanTypeName;
+    }
+
     public Object getInstance() {
         return instance;
     }
@@ -134,8 +144,17 @@ public class MethodCallExpression extend
     @Override
     public Expression createExpression(CamelContext camelContext) {
         Expression answer;
+
+        if (beanType == null && beanTypeName != null) {
+            try {
+                beanType = camelContext.getClassResolver().resolveMandatoryClass(beanTypeName);
+            } catch (ClassNotFoundException e) {
+                throw ObjectHelper.wrapRuntimeCamelException(e);
+            }
+        }
+
         if (beanType != null) {
-            instance = ObjectHelper.newInstance(beanType);
+            instance = camelContext.getInjector().newInstance(beanType);
             answer = new BeanExpression(instance, getMethod());
         } else if (instance != null) {
             answer = new BeanExpression(instance, getMethod());

Modified: camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/model/language/SimpleExpression.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/model/language/SimpleExpression.java?rev=1172723&r1=1172722&r2=1172723&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/model/language/SimpleExpression.java
(original)
+++ camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/model/language/SimpleExpression.java
Mon Sep 19 17:41:05 2011
@@ -20,11 +20,13 @@ import javax.xml.bind.annotation.XmlAcce
 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.CamelContext;
 import org.apache.camel.Expression;
 import org.apache.camel.Predicate;
 import org.apache.camel.builder.SimpleBuilder;
+import org.apache.camel.util.ObjectHelper;
 
 /**
  * For expressions and predicates using the
@@ -35,7 +37,9 @@ import org.apache.camel.builder.SimpleBu
 @XmlRootElement(name = "simple")
 @XmlAccessorType(XmlAccessType.FIELD)
 public class SimpleExpression extends ExpressionDefinition {
-    @XmlAttribute
+    @XmlAttribute(name = "resultType")
+    private String resultTypeName;
+    @XmlTransient
     private Class<?> resultType;
 
     public SimpleExpression() {
@@ -57,8 +61,24 @@ public class SimpleExpression extends Ex
         this.resultType = resultType;
     }
 
+    public String getResultTypeName() {
+        return resultTypeName;
+    }
+
+    public void setResultTypeName(String resultTypeName) {
+        this.resultTypeName = resultTypeName;
+    }
+
     @Override
     public Expression createExpression(CamelContext camelContext) {
+        if (resultType == null && resultTypeName != null) {
+            try {
+                resultType = camelContext.getClassResolver().resolveMandatoryClass(resultTypeName);
+            } catch (ClassNotFoundException e) {
+                throw ObjectHelper.wrapRuntimeCamelException(e);
+            }
+        }
+
         SimpleBuilder answer = new SimpleBuilder(getExpression());
         answer.setResultType(resultType);
         return answer;

Modified: camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/model/language/XPathExpression.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/model/language/XPathExpression.java?rev=1172723&r1=1172722&r2=1172723&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/model/language/XPathExpression.java
(original)
+++ camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/model/language/XPathExpression.java
Mon Sep 19 17:41:05 2011
@@ -20,10 +20,12 @@ import javax.xml.bind.annotation.XmlAcce
 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.CamelContext;
 import org.apache.camel.Expression;
 import org.apache.camel.Predicate;
+import org.apache.camel.util.ObjectHelper;
 
 /**
  * For XPath expressions and predicates
@@ -33,7 +35,9 @@ import org.apache.camel.Predicate;
 @XmlRootElement(name = "xpath")
 @XmlAccessorType(XmlAccessType.FIELD)
 public class XPathExpression extends NamespaceAwareExpression {
-    @XmlAttribute
+    @XmlAttribute(name = "resultType")
+    private String resultTypeName;
+    @XmlTransient
     private Class<?> resultType;
 
     public XPathExpression() {
@@ -55,6 +59,27 @@ public class XPathExpression extends Nam
         this.resultType = resultType;
     }
 
+    public String getResultTypeName() {
+        return resultTypeName;
+    }
+
+    public void setResultTypeName(String resultTypeName) {
+        this.resultTypeName = resultTypeName;
+    }
+
+    @Override
+    public Expression createExpression(CamelContext camelContext) {
+        if (resultType == null && resultTypeName != null) {
+            try {
+                resultType = camelContext.getClassResolver().resolveMandatoryClass(resultTypeName);
+            } catch (ClassNotFoundException e) {
+                throw ObjectHelper.wrapRuntimeCamelException(e);
+            }
+        }
+
+        return super.createExpression(camelContext);
+    }
+
     @Override
     protected void configureExpression(CamelContext camelContext, Expression expression)
{
         super.configureExpression(camelContext, expression);

Modified: camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/model/language/XQueryExpression.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/model/language/XQueryExpression.java?rev=1172723&r1=1172722&r2=1172723&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/model/language/XQueryExpression.java
(original)
+++ camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/model/language/XQueryExpression.java
Mon Sep 19 17:41:05 2011
@@ -25,8 +25,7 @@ import javax.xml.bind.annotation.XmlTran
 import org.apache.camel.CamelContext;
 import org.apache.camel.Expression;
 import org.apache.camel.Predicate;
-import org.apache.camel.RuntimeCamelException;
-import org.apache.camel.spi.ClassResolver;
+import org.apache.camel.util.ObjectHelper;
 
 /**
  * For XQuery expressions and predicates
@@ -69,9 +68,21 @@ public class XQueryExpression extends Na
     }
 
     @Override
+    public Expression createExpression(CamelContext camelContext) {
+        if (resultType == null && type != null) {
+            try {
+                resultType = camelContext.getClassResolver().resolveMandatoryClass(type);
+            } catch (ClassNotFoundException e) {
+                throw ObjectHelper.wrapRuntimeCamelException(e);
+            }
+        }
+
+        return super.createExpression(camelContext);
+    }
+
+    @Override
     protected void configureExpression(CamelContext camelContext, Expression expression)
{
         super.configureExpression(camelContext, expression);
-        updateResultType(camelContext.getClassResolver());
         if (resultType != null) {
             setProperty(expression, "resultType", resultType);
         }
@@ -80,19 +91,9 @@ public class XQueryExpression extends Na
     @Override
     protected void configurePredicate(CamelContext camelContext, Predicate predicate) {
         super.configurePredicate(camelContext, predicate);
-        updateResultType(camelContext.getClassResolver());
         if (resultType != null) {
             setProperty(predicate, "resultType", resultType);
         }
     }
 
-    private void updateResultType(ClassResolver resolver) {
-        if (resultType == null && type != null) {
-            try {
-                resultType = resolver.resolveMandatoryClass(type);
-            } catch (ClassNotFoundException e) {
-                throw new RuntimeCamelException(e);
-            }
-        }
-    }
 }

Modified: camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java?rev=1172723&r1=1172722&r2=1172723&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java
(original)
+++ camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java
Mon Sep 19 17:41:05 2011
@@ -716,6 +716,10 @@ public final class ObjectHelper {
         // and these is common as well
         } else if ("java.lang.String".equals(name) || "String".equals(name)) {
             return String.class;
+        } else if ("java.lang.Boolean".equals(name) || "Boolean".equals(name)) {
+            return Boolean.class;
+        } else if ("boolean".equals(name)) {
+            return boolean.class;
         } else if ("java.lang.Integer".equals(name) || "Integer".equals(name)) {
             return Integer.class;
         } else if ("int".equals(name)) {

Modified: camel/branches/camel-2.8.x/camel-core/src/test/java/org/apache/camel/model/StartingRoutesErrorReportedTest.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/camel-core/src/test/java/org/apache/camel/model/StartingRoutesErrorReportedTest.java?rev=1172723&r1=1172722&r2=1172723&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/camel-core/src/test/java/org/apache/camel/model/StartingRoutesErrorReportedTest.java
(original)
+++ camel/branches/camel-2.8.x/camel-core/src/test/java/org/apache/camel/model/StartingRoutesErrorReportedTest.java
Mon Sep 19 17:41:05 2011
@@ -80,7 +80,6 @@ public class StartingRoutesErrorReported
             context.addRoutes(new RouteBuilder() {
                 @Override
                 public void configure() throws Exception {
-                    
                     from("direct:start").routeId("route3")
                         .unmarshal().jaxb()
                         .log("Will never get here");
@@ -88,7 +87,7 @@ public class StartingRoutesErrorReported
             });
             context.start();
         } catch (FailedToCreateRouteException e) {
-            assertTrue(e.getMessage().contains("Ensure that the dataformat is valid and the
associated Camel component is present on the classpath"));
+            assertTrue(e.getMessage().contains("Ensure that the data format is valid and
the associated Camel component is present on the classpath"));
         }
     }
     

Modified: camel/branches/camel-2.8.x/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringSetHeaderXPathResultTypeTest.xml
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringSetHeaderXPathResultTypeTest.xml?rev=1172723&r1=1172722&r2=1172723&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringSetHeaderXPathResultTypeTest.xml
(original)
+++ camel/branches/camel-2.8.x/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringSetHeaderXPathResultTypeTest.xml
Mon Sep 19 17:41:05 2011
@@ -31,7 +31,8 @@
       </setHeader>
       <!-- is there a bye tag in the body -->
       <setHeader headerName="bar">
-        <xpath resultType="java.lang.Boolean">/bye</xpath>
+        <!-- use Boolean shorthand to test we use Camel class resolver, and not JAXB -->
+        <xpath resultType="Boolean">/bye</xpath>
       </setHeader>
       <to uri="mock:result"/>
     </route>

Modified: camel/branches/camel-2.8.x/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/CamelBlueprint4Test.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/CamelBlueprint4Test.java?rev=1172723&r1=1172722&r2=1172723&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/CamelBlueprint4Test.java
(original)
+++ camel/branches/camel-2.8.x/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/CamelBlueprint4Test.java
Mon Sep 19 17:41:05 2011
@@ -86,6 +86,27 @@ public class CamelBlueprint4Test extends
 
     }
 
+    @Test
+    public void testSetHeaderXPathResultType() throws Exception {
+        getInstalledBundle("CamelBlueprintTestBundle21").start();
+        BlueprintContainer ctn = getOsgiService(BlueprintContainer.class, "(osgi.blueprint.container.symbolicname=CamelBlueprintTestBundle21)",
10000);
+        CamelContext ctx = getOsgiService(CamelContext.class, "(camel.context.symbolicname=CamelBlueprintTestBundle21)",
10000);
+
+        ProducerTemplate template = ctx.createProducerTemplate();
+
+        MockEndpoint mock = ctx.getEndpoint("mock:result", MockEndpoint.class);
+        mock.expectedMessageCount(1);
+        mock.message(0).header("foo").isInstanceOf(Boolean.class);
+        mock.message(0).header("foo").isEqualTo(true);
+        mock.message(0).header("bar").isInstanceOf(Boolean.class);
+        mock.message(0).header("bar").isEqualTo(false);
+
+        template.sendBody("direct:start", "<hello>World</hello>");
+
+        mock.assertIsSatisfied();
+        template.stop();
+    }
+
     @Configuration
     public static Option[] configure() throws Exception {
 
@@ -104,12 +125,20 @@ public class CamelBlueprint4Test extends
                         .set(Constants.BUNDLE_SYMBOLICNAME, "CamelBlueprintTestBundle20")
                         .build()).noStart(),
                 
+<<<<<<< .working
                 bundle(newBundle()
                         .add("OSGI-INF/blueprint/test.xml", OSGiBlueprintTestSupport.class.getResource("blueprint-13.xml"))
                         .set(Constants.BUNDLE_SYMBOLICNAME, "CamelBlueprintTestBundle22")
                         .add(TestRouteBuilder.class)
                         .build(withBnd())).noStart(),
 
+=======
+                bundle(newBundle()
+                        .add("OSGI-INF/blueprint/test.xml", OSGiBlueprintTestSupport.class.getResource("blueprint-21.xml"))
+                        .set(Constants.BUNDLE_SYMBOLICNAME, "CamelBlueprintTestBundle21")
+                        .build()).noStart(),
+
+>>>>>>> .merge-right.r1150311
                 // using the features to install the camel components
                 scanFeatures(getCamelKarafFeatureUrl(),
                         "camel-blueprint", "camel-velocity"));



Mime
View raw message