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 2019/12/19 10:15:22 UTC
[camel] branch master updated: CAMEL-14318: camel-blueprint -
in XSD is anyType
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push:
new 52d713d CAMEL-14318: camel-blueprint - <proxy> in XSD is anyType
52d713d is described below
commit 52d713d05432e5af6aa0a69441b9315059383102
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Dec 19 11:13:22 2019 +0100
CAMEL-14318: camel-blueprint - <proxy> in XSD is anyType
---
.../camel-blueprint/src/main/docs/blueprint.adoc | 20 ++++++------
.../camel/blueprint/CamelProxyFactoryBean.java | 2 +-
.../org/apache/camel/test/blueprint/IEcho.java | 23 +++++++++++++
.../org/apache/camel/test/blueprint/ProxyTest.java | 35 ++++++++++++++++++++
.../org/apache/camel/test/blueprint/proxy.xml | 38 ++++++++++++++++++++++
docs/components/modules/ROOT/pages/blueprint.adoc | 20 ++++++------
6 files changed, 117 insertions(+), 21 deletions(-)
diff --git a/components/camel-blueprint/src/main/docs/blueprint.adoc b/components/camel-blueprint/src/main/docs/blueprint.adoc
index dc091e3..9b45aed 100644
--- a/components/camel-blueprint/src/main/docs/blueprint.adoc
+++ b/components/camel-blueprint/src/main/docs/blueprint.adoc
@@ -6,13 +6,13 @@ implementation, which is the one used by Apache Karaf.
== Overview
-The XML schema is mostly the same as the one for Spring, so all the xml snippets throughout the documentation
+The XML schema is mostly the same as the one for Spring, so all the XML snippets throughout the documentation
referring to Spring XML also apply to Blueprint routes.
-Here is a very simple route definition using blueprint:
+Here is a very simple route definition using Blueprint:
[source,xml]
-------------------------------------------------------------
+----
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
<camelContext xmlns="http://camel.apache.org/schema/blueprint">
@@ -23,16 +23,16 @@ Here is a very simple route definition using blueprint:
</camelContext>
</blueprint>
-------------------------------------------------------------
+----
-There are a few limitations at this point about the supported xml elements (compared to the Spring xml syntax):
+There are a few limitations at this point about the supported xml elements (compared to the Spring XML syntax):
-- beanPostProcessor are specific to Spring and aren't allowed
+- `beanPostProcessor` and `<export>` are specific to Spring and are not in use
-However, using blueprint when you deploy your applications in an OSGi enviroment has several advantages:
+However, using Blueprint when you deploy your applications in an OSGi environment has several advantages:
-- when upgrading to a new camel version, you don't have to change the namespace, as the correct version will be
- selected based on the camel packages that are imported by your bundle
+- when upgrading to a new Camel version, you don't have to change the namespace, as the correct version will be
+ selected based on the Camel packages that are imported by your bundle
- no startup ordering issue with respect to the custom namespaces and your bundles
- you can use Blueprint property placeholders
@@ -40,6 +40,6 @@ However, using blueprint when you deploy your applications in an OSGi enviroment
== Using camel-blueprint
To leverage camel-blueprint in OSGi, you only need the Aries Blueprint bundle and the camel-blueprint bundle,
-in addition to camel-core and its dependencies.
+in addition to camel-core-xml and its dependencies.
If you use Karaf, you can use the feature named camel-blueprint which will install all the required bundles.
\ No newline at end of file
diff --git a/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelProxyFactoryBean.java b/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelProxyFactoryBean.java
index cd42c74d..8358c66 100644
--- a/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelProxyFactoryBean.java
+++ b/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelProxyFactoryBean.java
@@ -36,7 +36,7 @@ import org.apache.camel.support.service.ServiceHelper;
/**
* A factory to create a Proxy to a a Camel Pojo Endpoint.
*/
-@XmlRootElement(name = "proxy")
+@XmlRootElement(name = "proxyFactoryBean")
@XmlAccessorType(XmlAccessType.FIELD)
public class CamelProxyFactoryBean extends AbstractCamelFactoryBean<Object> {
diff --git a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/IEcho.java b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/IEcho.java
new file mode 100644
index 0000000..79a869c
--- /dev/null
+++ b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/IEcho.java
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.test.blueprint;
+
+public interface IEcho {
+
+ String echo(String hello);
+
+}
diff --git a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ProxyTest.java b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ProxyTest.java
new file mode 100644
index 0000000..8bc59d4
--- /dev/null
+++ b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ProxyTest.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.test.blueprint;
+
+import org.junit.Test;
+
+public class ProxyTest extends CamelBlueprintTestSupport {
+
+ @Override
+ protected String getBlueprintDescriptor() {
+ return "org/apache/camel/test/blueprint/proxy.xml";
+ }
+
+ @Test
+ public void testProxy() throws Exception {
+ IEcho my = context.getRegistry().lookupByNameAndType("myProxy", IEcho.class);
+ String out = my.echo("Camel");
+ assertEquals("Bye Camel", out);
+ }
+
+}
diff --git a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/proxy.xml b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/proxy.xml
new file mode 100644
index 0000000..556a4d6
--- /dev/null
+++ b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/proxy.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://www.osgi.org/xmlns/blueprint/v1.0.0 https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
+
+
+ <camelContext xmlns="http://camel.apache.org/schema/blueprint">
+
+ <proxy id="myProxy" serviceInterface="org.apache.camel.test.blueprint.IEcho" serviceUrl="direct:start"/>
+
+ <route>
+ <from uri="direct:start"/>
+ <setBody>
+ <simple>Bye ${body}</simple>
+ </setBody>
+ </route>
+ </camelContext>
+
+</blueprint>
diff --git a/docs/components/modules/ROOT/pages/blueprint.adoc b/docs/components/modules/ROOT/pages/blueprint.adoc
index 73491e5..d40d96c 100644
--- a/docs/components/modules/ROOT/pages/blueprint.adoc
+++ b/docs/components/modules/ROOT/pages/blueprint.adoc
@@ -7,13 +7,13 @@ implementation, which is the one used by Apache Karaf.
== Overview
-The XML schema is mostly the same as the one for Spring, so all the xml snippets throughout the documentation
+The XML schema is mostly the same as the one for Spring, so all the XML snippets throughout the documentation
referring to Spring XML also apply to Blueprint routes.
-Here is a very simple route definition using blueprint:
+Here is a very simple route definition using Blueprint:
[source,xml]
-------------------------------------------------------------
+----
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
<camelContext xmlns="http://camel.apache.org/schema/blueprint">
@@ -24,16 +24,16 @@ Here is a very simple route definition using blueprint:
</camelContext>
</blueprint>
-------------------------------------------------------------
+----
-There are a few limitations at this point about the supported xml elements (compared to the Spring xml syntax):
+There are a few limitations at this point about the supported xml elements (compared to the Spring XML syntax):
-- beanPostProcessor are specific to Spring and aren't allowed
+- `beanPostProcessor` and `<export>` are specific to Spring and are not in use
-However, using blueprint when you deploy your applications in an OSGi enviroment has several advantages:
+However, using Blueprint when you deploy your applications in an OSGi environment has several advantages:
-- when upgrading to a new camel version, you don't have to change the namespace, as the correct version will be
- selected based on the camel packages that are imported by your bundle
+- when upgrading to a new Camel version, you don't have to change the namespace, as the correct version will be
+ selected based on the Camel packages that are imported by your bundle
- no startup ordering issue with respect to the custom namespaces and your bundles
- you can use Blueprint property placeholders
@@ -41,6 +41,6 @@ However, using blueprint when you deploy your applications in an OSGi enviroment
== Using camel-blueprint
To leverage camel-blueprint in OSGi, you only need the Aries Blueprint bundle and the camel-blueprint bundle,
-in addition to camel-core and its dependencies.
+in addition to camel-core-xml and its dependencies.
If you use Karaf, you can use the feature named camel-blueprint which will install all the required bundles.
\ No newline at end of file