You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by bv...@apache.org on 2012/11/18 19:43:24 UTC

svn commit: r1410955 - in /camel/branches/camel-2.10.x: ./ camel-core/src/main/java/org/apache/camel/model/ camel-core/src/test/java/org/apache/camel/processor/intercept/ components/camel-spring/src/test/java/org/apache/camel/component/properties/ comp...

Author: bvahdat
Date: Sun Nov 18 18:43:22 2012
New Revision: 1410955

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

........
  r1410952 | bvahdat | 2012-11-18 19:39:21 +0100 (So, 18 Nov 2012) | 1 line
  
  CAMEL-5796: Fixed the resolvement of the property placeholder in combination with the transacted DSL. Thanks to Claus Ibsen for providing a better patch as well as the unit-test for the camel-core module. I also added two tests for the camel-spring module using the propertyPlaceholder and bridgePropertyPlaceholder variants, also polished a tiny generics stuff of the ProcessorDefinition.resolvePropertyPlaceholders() method.
........

Added:
    camel/branches/camel-2.10.x/camel-core/src/test/java/org/apache/camel/processor/intercept/TransactedPropertyPlaceholderIssueTest.java
      - copied unchanged from r1410952, camel/trunk/camel-core/src/test/java/org/apache/camel/processor/intercept/TransactedPropertyPlaceholderIssueTest.java
    camel/branches/camel-2.10.x/components/camel-spring/src/test/java/org/apache/camel/component/properties/SpringPropertiesAfterTransactedDSL2Test.java
      - copied unchanged from r1410952, camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/properties/SpringPropertiesAfterTransactedDSL2Test.java
    camel/branches/camel-2.10.x/components/camel-spring/src/test/java/org/apache/camel/component/properties/SpringPropertiesAfterTransactedDSLTest.java
      - copied unchanged from r1410952, camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/properties/SpringPropertiesAfterTransactedDSLTest.java
    camel/branches/camel-2.10.x/components/camel-spring/src/test/resources/org/apache/camel/component/properties/SpringPropertiesAfterTransactedDSL2Test.xml
      - copied unchanged from r1410952, camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/properties/SpringPropertiesAfterTransactedDSL2Test.xml
    camel/branches/camel-2.10.x/components/camel-spring/src/test/resources/org/apache/camel/component/properties/SpringPropertiesAfterTransactedDSLTest.xml
      - copied unchanged from r1410952, camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/properties/SpringPropertiesAfterTransactedDSLTest.xml
Modified:
    camel/branches/camel-2.10.x/   (props changed)
    camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java
    camel/branches/camel-2.10.x/components/camel-spring/src/test/resources/org/apache/camel/component/properties/myprop.properties

Propchange: camel/branches/camel-2.10.x/
------------------------------------------------------------------------------
  Merged /camel/trunk:r1410952

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

Modified: camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java?rev=1410955&r1=1410954&r2=1410955&view=diff
==============================================================================
--- camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java (original)
+++ camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java Sun Nov 18 18:43:22 2012
@@ -369,9 +369,29 @@ public abstract class ProcessorDefinitio
         List<Processor> list = new ArrayList<Processor>();
         for (ProcessorDefinition<?> output : outputs) {
 
+            // allow any custom logic before we create the processor
+            output.preCreateProcessor();
+
             // resolve properties before we create the processor
             resolvePropertyPlaceholders(routeContext, output);
 
+            // resolve constant fields (eg Exchange.FILE_NAME)
+            resolveKnownConstantFields(output);
+
+            // also resolve properties and constant fields on embedded expressions
+            ProcessorDefinition<?> me = (ProcessorDefinition<?>) output;
+            if (me instanceof ExpressionNode) {
+                ExpressionNode exp = (ExpressionNode) me;
+                ExpressionDefinition expressionDefinition = exp.getExpression();
+                if (expressionDefinition != null) {
+                    // resolve properties before we create the processor
+                    resolvePropertyPlaceholders(routeContext, expressionDefinition);
+
+                    // resolve constant fields (eg Exchange.FILE_NAME)
+                    resolveKnownConstantFields(expressionDefinition);
+                }
+            }
+
             Processor processor = null;
             // at first use custom factory
             if (routeContext.getCamelContext().getProcessorFactory() != null) {
@@ -474,10 +494,9 @@ public abstract class ProcessorDefinitio
         // include additional properties which have the Camel placeholder QName
         // and when the definition parameter is this (otherAttributes belong to this)
         if (processorDefinition != null && processorDefinition.getOtherAttributes() != null) {
-            for (Object key : processorDefinition.getOtherAttributes().keySet()) {
-                QName qname = (QName) key;
-                if (Constants.PLACEHOLDER_QNAME.equals(qname.getNamespaceURI())) {
-                    String local = qname.getLocalPart();
+            for (QName key : processorDefinition.getOtherAttributes().keySet()) {
+                if (Constants.PLACEHOLDER_QNAME.equals(key.getNamespaceURI())) {
+                    String local = key.getLocalPart();
                     Object value = processorDefinition.getOtherAttributes().get(key);
                     if (value != null && value instanceof String) {
                         // value must be enclosed with placeholder tokens

Modified: camel/branches/camel-2.10.x/components/camel-spring/src/test/resources/org/apache/camel/component/properties/myprop.properties
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/components/camel-spring/src/test/resources/org/apache/camel/component/properties/myprop.properties?rev=1410955&r1=1410954&r2=1410955&view=diff
==============================================================================
--- camel/branches/camel-2.10.x/components/camel-spring/src/test/resources/org/apache/camel/component/properties/myprop.properties (original)
+++ camel/branches/camel-2.10.x/components/camel-spring/src/test/resources/org/apache/camel/component/properties/myprop.properties Sun Nov 18 18:43:22 2012
@@ -22,4 +22,6 @@ result=mock:result
 
 mybuilder=simpleRoute
 
+mydsl=transacted
+
 stop=true
\ No newline at end of file