CAMEL-9963: camel-blueprint - Namespace parser should skip placeholders for 
component dependencies


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/8f1e045a
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/8f1e045a
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/8f1e045a

Branch: refs/heads/kube-lb
Commit: 8f1e045a83cbd0e1cecfc97c1f82b3f7917dbded
Parents: 7a705e1
Author: Claus Ibsen <davscl...@apache.org>
Authored: Fri May 13 07:46:28 2016 +0200
Committer: Claus Ibsen <davscl...@apache.org>
Committed: Mon May 16 09:59:33 2016 +0200

----------------------------------------------------------------------
 .../blueprint/handler/CamelNamespaceHandler.java   | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/8f1e045a/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java
----------------------------------------------------------------------
diff --git 
a/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java
 
b/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java
index 00ce974..67501bf 100644
--- 
a/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java
+++ 
b/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java
@@ -32,6 +32,7 @@ import javax.xml.bind.Binder;
 import javax.xml.bind.JAXBContext;
 import javax.xml.bind.JAXBException;
 
+import org.apache.camel.model.ToDynamicDefinition;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.NamedNodeMap;
@@ -649,6 +650,10 @@ public class CamelNamespaceHandler implements 
NamespaceHandler {
     }
 
     private static ComponentMetadata 
getDataformatResolverReference(ParserContext context, String dataformat) {
+        // we cannot resolve dataformat names using property placeholders at 
this point in time
+        if (dataformat.startsWith(PropertiesComponent.DEFAULT_PREFIX_TOKEN)) {
+            return null;
+        }
         ComponentDefinitionRegistry componentDefinitionRegistry = 
context.getComponentDefinitionRegistry();
         ComponentMetadata cm = 
componentDefinitionRegistry.getComponentDefinition(".camelBlueprint.dataformatResolver."
 + dataformat);
         if (cm == null) {
@@ -679,6 +684,10 @@ public class CamelNamespaceHandler implements 
NamespaceHandler {
     }
 
     private static ComponentMetadata 
getLanguageResolverReference(ParserContext context, String language) {
+        // we cannot resolve language names using property placeholders at 
this point in time
+        if (language.startsWith(PropertiesComponent.DEFAULT_PREFIX_TOKEN)) {
+            return null;
+        }
         ComponentDefinitionRegistry componentDefinitionRegistry = 
context.getComponentDefinitionRegistry();
         ComponentMetadata cm = 
componentDefinitionRegistry.getComponentDefinition(".camelBlueprint.languageResolver."
 + language);
         if (cm == null) {
@@ -709,6 +718,10 @@ public class CamelNamespaceHandler implements 
NamespaceHandler {
     }
 
     private static ComponentMetadata 
getComponentResolverReference(ParserContext context, String component) {
+        // we cannot resolve component names using property placeholders at 
this point in time
+        if (component.startsWith(PropertiesComponent.DEFAULT_PREFIX_TOKEN)) {
+            return null;
+        }
         ComponentDefinitionRegistry componentDefinitionRegistry = 
context.getComponentDefinitionRegistry();
         ComponentMetadata cm = 
componentDefinitionRegistry.getComponentDefinition(".camelBlueprint.componentResolver."
 + component);
         if (cm == null) {
@@ -987,6 +1000,8 @@ public class CamelNamespaceHandler implements 
NamespaceHandler {
                         findOutputComponents(route.getOutputs(), components, 
languages, dataformats);
                     } else if (o instanceof ToDefinition) {
                         findUriComponent(((ToDefinition) o).getUri(), 
components);
+                    } else if (o instanceof ToDynamicDefinition) {
+                        findUriComponent(((ToDynamicDefinition) o).getUri(), 
components);
                     }
                 }
             }
@@ -1040,7 +1055,7 @@ public class CamelNamespaceHandler implements 
NamespaceHandler {
                 }
             } catch (UnsupportedOperationException e) {
                 LOG.warn("Unable to add dependencies to Camel components OSGi 
services. "
-                    + "The Apache Aries blueprint implementation used is too 
old and the blueprint bundle can not see the org.apache.camel.spi package.");
+                    + "The Apache Aries blueprint implementation used is too 
old and the blueprint bundle cannot see the org.apache.camel.spi package.");
                 components.clear();
                 languages.clear();
                 dataformats.clear();

Reply via email to