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 2020/03/24 12:27:37 UTC
[camel] branch master updated: CAMEL-14775: camel-cxf-transport -
Move OSGi blueprint out into camel-cxf-transport-blueprint
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 99a5bf8 CAMEL-14775: camel-cxf-transport - Move OSGi blueprint out into camel-cxf-transport-blueprint
99a5bf8 is described below
commit 99a5bf8a91e8afcd2dea7eb0e31ed273498a4f68
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Mar 24 13:27:13 2020 +0100
CAMEL-14775: camel-cxf-transport - Move OSGi blueprint out into camel-cxf-transport-blueprint
---
components/camel-cxf-transport/pom.xml | 1 +
.../blueprint/AbstractBeanDefinitionParser.java | 80 ----------------------
.../blueprint/CamelConduitDefinitionParser.java | 30 --------
.../CamelDestinationDefinitionParser.java | 31 ---------
.../blueprint/CamelTransportNameSpaceHandler.java | 71 -------------------
.../OSGI-INF/blueprint/camel-transport.xml | 31 ---------
.../src/main/resources/schema/blueprint/camel.xsd | 56 ---------------
7 files changed, 1 insertion(+), 299 deletions(-)
diff --git a/components/camel-cxf-transport/pom.xml b/components/camel-cxf-transport/pom.xml
index ad8f0a3..4beadcc 100644
--- a/components/camel-cxf-transport/pom.xml
+++ b/components/camel-cxf-transport/pom.xml
@@ -42,6 +42,7 @@
!META-INF.cxf.camel,
javax.servlet.*;version="${servlet-version-range}",
org.apache.camel.*;${camel.osgi.import.camel.version},
+ org.apache.camel.component.cxf.transport.blueprint;${camel.osgi.import.camel.version};resolution:=optional,
org.springframework*;version="${spring-version-range}";resolution:=optional,
org.apache.cxf.*;version="${cxf-version-range}",
${camel.osgi.import.defaults},
diff --git a/components/camel-cxf-transport/src/main/java/org/apache/camel/component/cxf/transport/blueprint/AbstractBeanDefinitionParser.java b/components/camel-cxf-transport/src/main/java/org/apache/camel/component/cxf/transport/blueprint/AbstractBeanDefinitionParser.java
deleted file mode 100644
index ef76e53..0000000
--- a/components/camel-cxf-transport/src/main/java/org/apache/camel/component/cxf/transport/blueprint/AbstractBeanDefinitionParser.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * 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.component.cxf.transport.blueprint;
-
-import java.util.StringTokenizer;
-
-import org.w3c.dom.Attr;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-
-import org.apache.aries.blueprint.ParserContext;
-import org.apache.aries.blueprint.mutable.MutableBeanMetadata;
-import org.apache.cxf.common.util.StringUtils;
-import org.apache.cxf.configuration.blueprint.AbstractBPBeanDefinitionParser;
-import org.osgi.service.blueprint.reflect.BeanMetadata;
-import org.osgi.service.blueprint.reflect.Metadata;
-
-public class AbstractBeanDefinitionParser extends AbstractBPBeanDefinitionParser {
-
- public static String getIdOrName(Element elem) {
- String id = elem.getAttribute("id");
-
- if (null == id || "".equals(id)) {
- String names = elem.getAttribute("name");
- if (null != names) {
- StringTokenizer st = new StringTokenizer(names, ",");
- if (st.countTokens() > 0) {
- id = st.nextToken();
- }
- }
- }
- return id;
- }
-
- public MutableBeanMetadata createBeanMetadata(Element element, ParserContext context, Class<?> runtimeClass) {
- MutableBeanMetadata answer = context.createMetadata(MutableBeanMetadata.class);
- answer.setRuntimeClass(runtimeClass);
- if (!StringUtils.isEmpty(getIdOrName(element))) {
- answer.setId(getIdOrName(element));
- } else {
- // TODO we may need to throw exception for it
- answer.setId("camel.cxf.transport." + runtimeClass.getSimpleName() + "." + context.generateId());
- }
- return answer;
- }
-
- public Metadata parse(Element element, ParserContext context, Class<?> runtime) {
- MutableBeanMetadata config = createBeanMetadata(element, context, runtime);
- config.setScope(BeanMetadata.SCOPE_PROTOTYPE);
- String camelContextId = "camelContext";
- NamedNodeMap atts = element.getAttributes();
- for (int i = 0; i < atts.getLength(); i++) {
- Attr node = (Attr) atts.item(i);
- String val = node.getValue();
- //String pre = node.getPrefix();
- String name = node.getLocalName();
- if ("camelContextId".equals(name)) {
- camelContextId = val;
- }
- }
- config.addDependsOn(camelContextId);
- config.addProperty("camelContext", createRef(context, camelContextId));
- return config;
- }
-
-}
diff --git a/components/camel-cxf-transport/src/main/java/org/apache/camel/component/cxf/transport/blueprint/CamelConduitDefinitionParser.java b/components/camel-cxf-transport/src/main/java/org/apache/camel/component/cxf/transport/blueprint/CamelConduitDefinitionParser.java
deleted file mode 100644
index cd34e64..0000000
--- a/components/camel-cxf-transport/src/main/java/org/apache/camel/component/cxf/transport/blueprint/CamelConduitDefinitionParser.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * 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.component.cxf.transport.blueprint;
-
-import org.w3c.dom.Element;
-
-import org.apache.aries.blueprint.ParserContext;
-import org.apache.camel.component.cxf.transport.CamelConduit;
-import org.osgi.service.blueprint.reflect.Metadata;
-
-public class CamelConduitDefinitionParser extends AbstractBeanDefinitionParser {
- public Metadata parse(Element element, ParserContext context) {
- return parse(element, context, CamelConduit.class);
- }
-
-}
diff --git a/components/camel-cxf-transport/src/main/java/org/apache/camel/component/cxf/transport/blueprint/CamelDestinationDefinitionParser.java b/components/camel-cxf-transport/src/main/java/org/apache/camel/component/cxf/transport/blueprint/CamelDestinationDefinitionParser.java
deleted file mode 100644
index 6278687..0000000
--- a/components/camel-cxf-transport/src/main/java/org/apache/camel/component/cxf/transport/blueprint/CamelDestinationDefinitionParser.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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.component.cxf.transport.blueprint;
-
-import org.w3c.dom.Element;
-
-import org.apache.aries.blueprint.ParserContext;
-import org.apache.camel.component.cxf.transport.CamelDestination;
-import org.osgi.service.blueprint.reflect.Metadata;
-
-public class CamelDestinationDefinitionParser extends AbstractBeanDefinitionParser {
- public Metadata parse(Element element, ParserContext context) {
- return parse(element, context, CamelDestination.class);
- }
-
-
-}
diff --git a/components/camel-cxf-transport/src/main/java/org/apache/camel/component/cxf/transport/blueprint/CamelTransportNameSpaceHandler.java b/components/camel-cxf-transport/src/main/java/org/apache/camel/component/cxf/transport/blueprint/CamelTransportNameSpaceHandler.java
deleted file mode 100644
index a9482ad..0000000
--- a/components/camel-cxf-transport/src/main/java/org/apache/camel/component/cxf/transport/blueprint/CamelTransportNameSpaceHandler.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * 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.component.cxf.transport.blueprint;
-
-import java.net.URL;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-import org.apache.aries.blueprint.ParserContext;
-import org.apache.cxf.helpers.BaseNamespaceHandler;
-import org.osgi.service.blueprint.reflect.ComponentMetadata;
-import org.osgi.service.blueprint.reflect.Metadata;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class CamelTransportNameSpaceHandler extends BaseNamespaceHandler {
- private static final Logger LOG = LoggerFactory.getLogger(CamelTransportNameSpaceHandler.class);
-
- @Override
- public ComponentMetadata decorate(Node node, ComponentMetadata componentMetadata, ParserContext parserContext) {
- return null;
- }
-
- @Override
- @SuppressWarnings("rawtypes")
- public Set<Class> getManagedClasses() {
- return new HashSet<>(Arrays.asList(CamelTransportNameSpaceHandler.class));
- }
-
- @Override
- public URL getSchemaLocation(String s) {
- if ("http://cxf.apache.org/transports/camel/blueprint".equals(s)) {
- return getClass().getClassLoader().getResource("schema/blueprint/camel.xsd");
- }
- return super.findCoreSchemaLocation(s);
- }
-
- @Override
- public Metadata parse(Element element, ParserContext context) {
- Metadata answer = null;
- String s = element.getLocalName();
- if ("conduit".equals(s)) {
- LOG.debug("parsing the conduit element");
- answer = new CamelConduitDefinitionParser().parse(element, context);
- }
- if ("destination".equals(s)) {
- LOG.debug("parsing the detination element");
- answer = new CamelDestinationDefinitionParser().parse(element, context);
- }
- return answer;
- }
-
-}
diff --git a/components/camel-cxf-transport/src/main/resources/OSGI-INF/blueprint/camel-transport.xml b/components/camel-cxf-transport/src/main/resources/OSGI-INF/blueprint/camel-transport.xml
deleted file mode 100644
index 8b06f03..0000000
--- a/components/camel-cxf-transport/src/main/resources/OSGI-INF/blueprint/camel-transport.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?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"
- xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
- xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
-
- <service interface="org.apache.aries.blueprint.NamespaceHandler">
- <service-properties>
- <entry key="osgi.service.blueprint.namespace" value="http://cxf.apache.org/transports/camel/blueprint"/>
- </service-properties>
- <bean class="org.apache.camel.component.cxf.transport.blueprint.CamelTransportNameSpaceHandler"/>
- </service>
-</blueprint>
diff --git a/components/camel-cxf-transport/src/main/resources/schema/blueprint/camel.xsd b/components/camel-cxf-transport/src/main/resources/schema/blueprint/camel.xsd
deleted file mode 100644
index 43b224f..0000000
--- a/components/camel-cxf-transport/src/main/resources/schema/blueprint/camel.xsd
+++ /dev/null
@@ -1,56 +0,0 @@
-<?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.
-
--->
-<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:camel="http://cxf.apache.org/transports/camel"
- xmlns:beans="http://www.osgi.org/xmlns/blueprint/v1.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:cxf-beans="http://cxf.apache.org/configuration/beans"
- xmlns:camel-blueprint="http://camel.apache.org/schema/blueprint"
- targetNamespace="http://cxf.apache.org/transports/camel/blueprint"
- elementFormDefault="qualified" attributeFormDefault="unqualified"
- xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
-
- <xsd:import namespace="http://www.osgi.org/xmlns/blueprint/v1.0.0" schemaLocation="https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd"/>
- <xsd:import namespace="http://cxf.apache.org/configuration/beans" schemaLocation="http://cxf.apache.org/schemas/configuration/cxf-beans.xsd"/>
-
- <xsd:element name="destination">
- <xsd:complexType>
- <xsd:complexContent>
- <xsd:extension base="beans:Tcomponent">
- <!-- here we need to specify the CamelContext reference -->
- <xsd:attribute name="camelContextId" type="xsd:string" />
- </xsd:extension>
- </xsd:complexContent>
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="conduit">
- <xsd:complexType>
- <xsd:complexContent>
- <xsd:extension base="beans:Tcomponent">
- <!-- here we need to specify the CamelContext reference -->
- <xsd:attribute name="camelContextId" type="xsd:string" />
- </xsd:extension>
- </xsd:complexContent>
- </xsd:complexType>
- </xsd:element>
-
-
-</xsd:schema>