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