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 2013/09/03 12:22:20 UTC

[1/4] git commit: CAMEL-6700: Fixed camel-blueprint namespace parser to work with camel:sslContextParameters and others which is defined outside camelContext.

Updated Branches:
  refs/heads/camel-2.10.x d66ffae17 -> b368b05e5
  refs/heads/camel-2.11.x 80d24a15e -> 8384cfff8
  refs/heads/camel-2.12.x 61e4948ce -> 02d34848e


CAMEL-6700: Fixed camel-blueprint namespace parser to work with camel:sslContextParameters and others which is defined outside camelContext.


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

Branch: refs/heads/camel-2.12.x
Commit: 02d34848e996a2d0c68d29674c4aa16a56ea7d72
Parents: 20f0646
Author: Claus Ibsen <da...@apache.org>
Authored: Tue Sep 3 12:09:17 2013 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Sep 3 12:21:50 2013 +0200

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


http://git-wip-us.apache.org/repos/asf/camel/blob/02d34848/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 e488519..9ec79ff 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
@@ -82,6 +82,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;
@@ -92,10 +96,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";
@@ -135,7 +142,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);
         }
@@ -305,6 +315,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);
@@ -344,9 +356,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;
@@ -383,9 +397,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;
@@ -422,9 +438,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;
@@ -833,8 +851,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();


[3/4] git commit: CAMEL-6700: Fixed camel-blueprint namespace parser to work with camel:sslContextParameters and others which is defined outside camelContext.

Posted by da...@apache.org.
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/8384cfff
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/8384cfff
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/8384cfff

Branch: refs/heads/camel-2.11.x
Commit: 8384cfff83ebdca89f56c05f56d727ce1f231c59
Parents: 80d24a1
Author: Claus Ibsen <da...@apache.org>
Authored: Tue Sep 3 12:09:17 2013 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Sep 3 12:22:00 2013 +0200

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


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


[4/4] git commit: CAMEL-6700: Fixed camel-blueprint namespace parser to work with camel:sslContextParameters and others which is defined outside camelContext.

Posted by da...@apache.org.
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 <da...@apache.org>
Authored: Tue Sep 3 12:09:17 2013 +0200
Committer: Claus Ibsen <da...@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();


[2/4] git commit: Polished

Posted by da...@apache.org.
Polished


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

Branch: refs/heads/camel-2.12.x
Commit: 20f06460ab0dc550d2278667f20d8806d922eb60
Parents: 61e4948
Author: Claus Ibsen <da...@apache.org>
Authored: Tue Sep 3 11:15:18 2013 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Sep 3 12:21:50 2013 +0200

----------------------------------------------------------------------
 .../org/apache/camel/spring/handler/CamelNamespaceHandler.java  | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/20f06460/components/camel-spring/src/main/java/org/apache/camel/spring/handler/CamelNamespaceHandler.java
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/main/java/org/apache/camel/spring/handler/CamelNamespaceHandler.java b/components/camel-spring/src/main/java/org/apache/camel/spring/handler/CamelNamespaceHandler.java
index 837c365..5c25414 100644
--- a/components/camel-spring/src/main/java/org/apache/camel/spring/handler/CamelNamespaceHandler.java
+++ b/components/camel-spring/src/main/java/org/apache/camel/spring/handler/CamelNamespaceHandler.java
@@ -66,7 +66,6 @@ import org.springframework.beans.factory.support.BeanDefinitionBuilder;
 import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
 import org.springframework.beans.factory.xml.ParserContext;
 
-
 /**
  * Camel namespace for the spring XML configuration file.
  */
@@ -128,7 +127,7 @@ public class CamelNamespaceHandler extends NamespaceHandlerSupport {
         boolean osgi = false;
         Class<?> cl = CamelContextFactoryBean.class;
         // These code will try to detected if we are in the OSGi environment.
-        // If so, camel will use the OSGi version of CamelContenxtFactoryBean to create the camel context.
+        // If so, camel will use the OSGi version of CamelContextFactoryBean to create the CamelContext.
         try {
             // Try to load the BundleActivator first
             Class.forName("org.osgi.framework.BundleActivator");
@@ -140,7 +139,7 @@ public class CamelNamespaceHandler extends NamespaceHandlerSupport {
                 osgi = true;
             }
         } catch (Throwable t) {
-            // not running with camel-osgi so we fallback to the regular factory bean
+            // not running with camel-core-osgi so we fallback to the regular factory bean
             LOG.trace("Cannot find class so assuming not running in OSGi container: " + t.getMessage());
         }
         if (osgi) {