Author: bvahdat Date: Sun Nov 18 18:53:33 2012 New Revision: 1410957 URL: http://svn.apache.org/viewvc?rev=1410957&view=rev Log: Merged revisions 1410955 via svnmerge from https://svn.apache.org/repos/asf/camel/branches/camel-2.10.x
................ r1410955 | bvahdat | 2012-11-18 19:43:22 +0100 (So, 18 Nov 2012) | 9 lines 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.9.x/camel-core/src/test/java/org/apache/camel/processor/intercept/TransactedPropertyPlaceholderIssueTest.java - copied unchanged from r1410955, camel/branches/camel-2.10.x/camel-core/src/test/java/org/apache/camel/processor/intercept/TransactedPropertyPlaceholderIssueTest.java camel/branches/camel-2.9.x/components/camel-spring/src/test/java/org/apache/camel/component/properties/SpringPropertiesAfterTransactedDSLTest.java - copied unchanged from r1410955, camel/branches/camel-2.10.x/components/camel-spring/src/test/java/org/apache/camel/component/properties/SpringPropertiesAfterTransactedDSLTest.java camel/branches/camel-2.9.x/components/camel-spring/src/test/resources/org/apache/camel/component/properties/SpringPropertiesAfterTransactedDSLTest.xml - copied unchanged from r1410955, camel/branches/camel-2.10.x/components/camel-spring/src/test/resources/org/apache/camel/component/properties/SpringPropertiesAfterTransactedDSLTest.xml Modified: camel/branches/camel-2.9.x/ (props changed) camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java camel/branches/camel-2.9.x/components/camel-spring/src/test/resources/org/apache/camel/component/properties/myprop.properties Propchange: camel/branches/camel-2.9.x/ ------------------------------------------------------------------------------ Merged /camel/trunk:r1410952 Merged /camel/branches/camel-2.10.x:r1410955 Propchange: camel/branches/camel-2.9.x/ ------------------------------------------------------------------------------ Binary property 'svnmerge-integrated' - no diff available. Modified: camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java?rev=1410957&r1=1410956&r2=1410957&view=diff ============================================================================== --- camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java (original) +++ camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java Sun Nov 18 18:53:33 2012 @@ -368,9 +368,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) { @@ -473,10 +493,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.9.x/components/camel-spring/src/test/resources/org/apache/camel/component/properties/myprop.properties URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-spring/src/test/resources/org/apache/camel/component/properties/myprop.properties?rev=1410957&r1=1410956&r2=1410957&view=diff ============================================================================== --- camel/branches/camel-2.9.x/components/camel-spring/src/test/resources/org/apache/camel/component/properties/myprop.properties (original) +++ camel/branches/camel-2.9.x/components/camel-spring/src/test/resources/org/apache/camel/component/properties/myprop.properties Sun Nov 18 18:53:33 2012 @@ -22,4 +22,6 @@ result=mock:result mybuilder=simpleRoute +mydsl=transacted + stop=true \ No newline at end of file
