camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [4/4] git commit: CAMEL-6700: Fixed camel-blueprint namespace parser to work with camel:sslContextParameters and others which is defined outside camelContext.
Date Tue, 03 Sep 2013 10:22:23 GMT
CAMEL-6700: Fixed camel-blueprint namespace parser to work with camel:sslContextParameters
and others which is defined outside camelContext.

Conflicts:
	components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java


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

Branch: refs/heads/camel-2.10.x
Commit: b368b05e5513dd05935392a9e1d3d44ea9ea5f66
Parents: d66ffae
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Tue Sep 3 12:09:17 2013 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Tue Sep 3 12:22:08 2013 +0200

----------------------------------------------------------------------
 .../handler/CamelNamespaceHandler.java          | 29 ++++++++++++++++----
 1 file changed, 24 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/b368b05e/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 98a29e6..cbce067 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
@@ -80,6 +80,10 @@ import org.apache.camel.util.ObjectHelper;
 import org.apache.camel.util.blueprint.KeyStoreParametersFactoryBean;
 import org.apache.camel.util.blueprint.SSLContextParametersFactoryBean;
 import org.apache.camel.util.blueprint.SecureRandomParametersFactoryBean;
+import org.apache.camel.util.jsse.KeyStoreParameters;
+import org.apache.camel.util.jsse.SSLContextParameters;
+import org.apache.camel.util.jsse.SecureRandomParameters;
+
 import org.osgi.framework.Bundle;
 import org.osgi.service.blueprint.container.BlueprintContainer;
 import org.osgi.service.blueprint.container.ComponentDefinitionException;
@@ -90,9 +94,13 @@ import org.osgi.service.blueprint.reflect.RefMetadata;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import static org.osgi.service.blueprint.reflect.ComponentMetadata.ACTIVATION_LAZY;
 import static org.osgi.service.blueprint.reflect.ServiceReferenceMetadata.AVAILABILITY_MANDATORY;
 import static org.osgi.service.blueprint.reflect.ServiceReferenceMetadata.AVAILABILITY_OPTIONAL;
 
+/**
+ * Camel {@link NamespaceHandler} to parse the Camel related namespaces.
+ */
 public class CamelNamespaceHandler implements NamespaceHandler {
 
     private static final String CAMEL_CONTEXT = "camelContext";
@@ -133,7 +141,10 @@ public class CamelNamespaceHandler implements NamespaceHandler {
 
     public Metadata parse(Element element, ParserContext context) {
         LOG.trace("Parsing element {}", element);
+
+        // make sure namespace is blueprint
         renameNamespaceRecursive(element);
+
         if (element.getLocalName().equals(CAMEL_CONTEXT)) {
             return parseCamelContextNode(element, context);
         }
@@ -303,6 +314,8 @@ public class CamelNamespaceHandler implements NamespaceHandler {
         ctx.setRuntimeClass(List.class);
         ctx.setFactoryComponent(factory2);
         ctx.setFactoryMethod("getRoutes");
+        // must be lazy as we want CamelContext to be activated first
+        ctx.setActivation(ACTIVATION_LAZY);
 
         // lets inject the namespaces into any namespace aware POJOs
         injectNamespaces(element, binder);
@@ -342,9 +355,11 @@ public class CamelNamespaceHandler implements NamespaceHandler {
 
         MutableBeanMetadata ctx = context.createMetadata(MutableBeanMetadata.class);
         ctx.setId(id);
-        ctx.setRuntimeClass(List.class);
+        ctx.setRuntimeClass(KeyStoreParameters.class);
         ctx.setFactoryComponent(factory2);
         ctx.setFactoryMethod("getObject");
+        // must be lazy as we want CamelContext to be activated first
+        ctx.setActivation(ACTIVATION_LAZY);
 
         LOG.trace("Parsing KeyStoreParameters done, returning {}", ctx);
         return ctx;
@@ -381,9 +396,11 @@ public class CamelNamespaceHandler implements NamespaceHandler {
 
         MutableBeanMetadata ctx = context.createMetadata(MutableBeanMetadata.class);
         ctx.setId(id);
-        ctx.setRuntimeClass(List.class);
+        ctx.setRuntimeClass(SecureRandomParameters.class);
         ctx.setFactoryComponent(factory2);
         ctx.setFactoryMethod("getObject");
+        // must be lazy as we want CamelContext to be activated first
+        ctx.setActivation(ACTIVATION_LAZY);
 
         LOG.trace("Parsing SecureRandomParameters done, returning {}", ctx);
         return ctx;
@@ -420,9 +437,11 @@ public class CamelNamespaceHandler implements NamespaceHandler {
 
         MutableBeanMetadata ctx = context.createMetadata(MutableBeanMetadata.class);
         ctx.setId(id);
-        ctx.setRuntimeClass(List.class);
+        ctx.setRuntimeClass(SSLContextParameters.class);
         ctx.setFactoryComponent(factory2);
         ctx.setFactoryMethod("getObject");
+        // must be lazy as we want CamelContext to be activated first
+        ctx.setActivation(ACTIVATION_LAZY);
 
         LOG.trace("Parsing SSLContextParameters done, returning {}", ctx);
         return ctx;
@@ -804,8 +823,8 @@ public class CamelNamespaceHandler implements NamespaceHandler {
                     getDataformatResolverReference(context, dataformat);
                 }
             } catch (UnsupportedOperationException e) {
-                LOG.warn("Unable to add dependencies on to camel components OSGi services.
 "
-                    + "The Apache Aries blueprint implementation used it too old and the
blueprint bundle can not see the org.apache.camel.spi package.");
+                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.");
                 components.clear();
                 languages.clear();
                 dataformats.clear();


Mime
View raw message