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 2016/05/13 05:52:51 UTC

[3/7] camel git commit: CAMEL-9963: camel-blueprint - Namespace parser should skip placeholders for component dependencies

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/ccbe49cf
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/ccbe49cf
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/ccbe49cf

Branch: refs/heads/camel-2.17.x
Commit: ccbe49cfacfd60520ccce5686b3d4778b522ad22
Parents: 9181bb9
Author: Claus Ibsen <da...@apache.org>
Authored: Fri May 13 07:46:28 2016 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri May 13 07:49:43 2016 +0200

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


http://git-wip-us.apache.org/repos/asf/camel/blob/ccbe49cf/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();