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-karaf.git
commit 6e53e99e334f02fb398327cf36df0771750a387a Author: Claus Ibsen <[email protected]> AuthorDate: Tue Mar 24 12:17:04 2020 +0100 CAMEL-14775: camel-cxf - Move OSGi blueprint out into camel-cxf-blueprint --- components/camel-cxf-blueprint/pom.xml | 96 +++++++++++ .../services/org/apache/camel/other.properties | 7 + .../src/generated/resources/cxf-blueprint.json | 12 ++ .../blueprint/AbstractBeanDefinitionParser.java | 62 +++++++ .../component/cxf/blueprint/BlueprintSupport.java | 32 ++++ .../cxf/blueprint/CxfBlueprintEndpoint.java | 80 +++++++++ .../cxf/blueprint/CxfNamespaceHandler.java | 75 +++++++++ .../cxf/blueprint/EndpointDefinitionParser.java | 107 ++++++++++++ .../cxf/blueprint/RsClientBlueprintBean.java | 95 +++++++++++ .../cxf/blueprint/RsClientDefinitionParser.java | 93 +++++++++++ .../cxf/blueprint/RsServerBlueprintBean.java | 101 ++++++++++++ .../cxf/blueprint/RsServerDefinitionParser.java | 95 +++++++++++ .../jaxrs/blueprint/CxfRsBlueprintEndpoint.java | 95 +++++++++++ .../CxfRsBlueprintEndpointFactoryBean.java | 30 ++++ .../resources/OSGI-INF/blueprint/camel-cxf.xml | 31 ++++ .../main/resources/schema/blueprint/camel-cxf.xsd | 179 +++++++++++++++++++++ components/pom.xml | 1 + .../karaf/features/src/main/resources/features.xml | 1 + 18 files changed, 1192 insertions(+) diff --git a/components/camel-cxf-blueprint/pom.xml b/components/camel-cxf-blueprint/pom.xml new file mode 100644 index 0000000..6231554 --- /dev/null +++ b/components/camel-cxf-blueprint/pom.xml @@ -0,0 +1,96 @@ +<?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. + +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.camel.karaf</groupId> + <artifactId>components</artifactId> + <version>3.2.0-SNAPSHOT</version> + </parent> + + <artifactId>camel-cxf-blueprint</artifactId> + <packaging>jar</packaging> + <name>Camel Karaf :: CXF Blueprint</name> + <description>Camel CXF for OSGi Blueprint</description> + + <properties> + </properties> + + <dependencies> + + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-cxf</artifactId> + </dependency> + + <!-- OSGi, Blueprint --> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-blueprint</artifactId> + <scope>provided</scope> + <optional>true</optional> + </dependency> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>osgi.core</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>osgi.cmpn</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.apache.aries.blueprint</groupId> + <artifactId>org.apache.aries.blueprint.core</artifactId> + <scope>provided</scope> + </dependency> + + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + <executions> + <execution> + <id>attach-artifacts</id> + <phase>package</phase> + <goals> + <goal>attach-artifact</goal> + </goals> + <configuration> + <artifacts> + <artifact> + <file>./src/main/resources/schema/blueprint/camel-cxf.xsd</file> + <classifier>blueprint</classifier> + <type>xsd</type> + </artifact> + </artifacts> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + +</project> diff --git a/components/camel-cxf-blueprint/src/generated/resources/META-INF/services/org/apache/camel/other.properties b/components/camel-cxf-blueprint/src/generated/resources/META-INF/services/org/apache/camel/other.properties new file mode 100644 index 0000000..c1b4fc4 --- /dev/null +++ b/components/camel-cxf-blueprint/src/generated/resources/META-INF/services/org/apache/camel/other.properties @@ -0,0 +1,7 @@ +# Generated by camel build tools - do NOT edit this file! +name=cxf-blueprint +groupId=org.apache.camel.karaf +artifactId=camel-cxf-blueprint +version=3.2.0-SNAPSHOT +projectName=Camel Karaf :: CXF Blueprint +projectDescription=Camel CXF for OSGi Blueprint diff --git a/components/camel-cxf-blueprint/src/generated/resources/cxf-blueprint.json b/components/camel-cxf-blueprint/src/generated/resources/cxf-blueprint.json new file mode 100644 index 0000000..1037ab4 --- /dev/null +++ b/components/camel-cxf-blueprint/src/generated/resources/cxf-blueprint.json @@ -0,0 +1,12 @@ +{ + "other": { + "kind": "other", + "name": "cxf-blueprint", + "title": "Cxf Blueprint", + "description": "Camel CXF for OSGi Blueprint", + "deprecated": false, + "groupId": "org.apache.camel.karaf", + "artifactId": "camel-cxf-blueprint", + "version": "3.2.0-SNAPSHOT" + } +} diff --git a/components/camel-cxf-blueprint/src/main/java/org/apache/camel/component/cxf/blueprint/AbstractBeanDefinitionParser.java b/components/camel-cxf-blueprint/src/main/java/org/apache/camel/component/cxf/blueprint/AbstractBeanDefinitionParser.java new file mode 100644 index 0000000..84c857b --- /dev/null +++ b/components/camel-cxf-blueprint/src/main/java/org/apache/camel/component/cxf/blueprint/AbstractBeanDefinitionParser.java @@ -0,0 +1,62 @@ +/* + * 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.blueprint; + +import java.util.StringTokenizer; + +import org.w3c.dom.Element; + +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; + +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); + answer.addProperty("blueprintContainer", createRef(context, "blueprintContainer")); + answer.addProperty("bundleContext", createRef(context, "blueprintBundleContext")); + // set the Bean scope to be prototype, so we can get a new instance per looking up + answer.setScope(BeanMetadata.SCOPE_PROTOTYPE); + + if (!StringUtils.isEmpty(getIdOrName(element))) { + answer.setId(getIdOrName(element)); + } else { + // TODO we may need to throw exception for it + answer.setId("camel.cxf.endpoint." + runtimeClass.getSimpleName() + "." + context.generateId()); + } + return answer; + } + +} diff --git a/components/camel-cxf-blueprint/src/main/java/org/apache/camel/component/cxf/blueprint/BlueprintSupport.java b/components/camel-cxf-blueprint/src/main/java/org/apache/camel/component/cxf/blueprint/BlueprintSupport.java new file mode 100644 index 0000000..c6118d6 --- /dev/null +++ b/components/camel-cxf-blueprint/src/main/java/org/apache/camel/component/cxf/blueprint/BlueprintSupport.java @@ -0,0 +1,32 @@ +/* + * 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.blueprint; + +import org.osgi.framework.BundleContext; +import org.osgi.service.blueprint.container.BlueprintContainer; + +public interface BlueprintSupport { + + void setBlueprintContainer(BlueprintContainer blueprintContainer); + + BlueprintContainer getBlueprintContainer(); + + BundleContext getBundleContext(); + + void setBundleContext(BundleContext bundleContext); + +} diff --git a/components/camel-cxf-blueprint/src/main/java/org/apache/camel/component/cxf/blueprint/CxfBlueprintEndpoint.java b/components/camel-cxf-blueprint/src/main/java/org/apache/camel/component/cxf/blueprint/CxfBlueprintEndpoint.java new file mode 100644 index 0000000..205b879 --- /dev/null +++ b/components/camel-cxf-blueprint/src/main/java/org/apache/camel/component/cxf/blueprint/CxfBlueprintEndpoint.java @@ -0,0 +1,80 @@ +/* + * 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.blueprint; + +import org.apache.camel.blueprint.BlueprintCamelContext; +import org.apache.camel.component.cxf.CxfComponent; +import org.apache.camel.component.cxf.CxfEndpoint; +import org.apache.cxf.BusFactory; +import org.osgi.framework.BundleContext; +import org.osgi.service.blueprint.container.BlueprintContainer; + +public class CxfBlueprintEndpoint extends CxfEndpoint { + + private BlueprintContainer blueprintContainer; + private BundleContext bundleContext; + private BlueprintCamelContext blueprintCamelContext; + + public CxfBlueprintEndpoint(String address, BundleContext context) { + super(address, (CxfComponent)null); + bundleContext = context; + } + + public void destroy() { + // Clean up the BusFactory's defaultBus + // This method is not called magically, blueprint + // needs you to set the destroy-method. + BusFactory.setDefaultBus(null); + BusFactory.setThreadDefaultBus(null); + } + + @Override + public void setServiceClass(String n) throws ClassNotFoundException { + setServiceClass(bundleContext.getBundle().loadClass(n)); + } + + // Package private methods + // ------------------------------------------------------------------------- + + public BlueprintContainer getBlueprintContainer() { + return blueprintContainer; + } + + public void setBlueprintContainer(BlueprintContainer blueprintContainer) { + this.blueprintContainer = blueprintContainer; + } + + public BundleContext getBundleContext() { + return bundleContext; + } + + public void setBundleContext(BundleContext bundleContext) { + this.bundleContext = bundleContext; + } + + public BlueprintCamelContext getBlueprintCamelContext() { + return blueprintCamelContext; + } + + public void setBlueprintCamelContext(BlueprintCamelContext blueprintCamelContext) { + this.blueprintCamelContext = blueprintCamelContext; + } + + public CxfBlueprintEndpoint getBean() { + return this; + } +} diff --git a/components/camel-cxf-blueprint/src/main/java/org/apache/camel/component/cxf/blueprint/CxfNamespaceHandler.java b/components/camel-cxf-blueprint/src/main/java/org/apache/camel/component/cxf/blueprint/CxfNamespaceHandler.java new file mode 100644 index 0000000..daf240a --- /dev/null +++ b/components/camel-cxf-blueprint/src/main/java/org/apache/camel/component/cxf/blueprint/CxfNamespaceHandler.java @@ -0,0 +1,75 @@ +/* + * 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.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 CxfNamespaceHandler extends BaseNamespaceHandler { + private static final Logger LOG = LoggerFactory.getLogger(CxfNamespaceHandler.class); + + @Override + public URL getSchemaLocation(String s) { + if ("http://camel.apache.org/schema/blueprint/cxf".equals(s)) { + return getClass().getClassLoader().getResource("schema/blueprint/camel-cxf.xsd"); + } + return super.findCoreSchemaLocation(s); + } + + @Override + @SuppressWarnings({"rawtypes"}) + public Set<Class> getManagedClasses() { + return new HashSet<>(Arrays.asList(CxfNamespaceHandler.class)); + } + + @Override + public Metadata parse(Element element, ParserContext context) { + Metadata answer = null; + String s = element.getLocalName(); + if ("cxfEndpoint".equals(s)) { + LOG.debug("parsing the cxfEndpoint element"); + answer = new EndpointDefinitionParser().parse(element, context); + } + if ("rsClient".equals(s)) { + LOG.debug("parsing the rsClient element"); + answer = new RsClientDefinitionParser().parse(element, context); + } + if ("rsServer".equals(s)) { + LOG.debug("parsing the rsServer element"); + answer = new RsServerDefinitionParser().parse(element, context); + } + + return answer; + } + + @Override + public ComponentMetadata decorate(Node node, ComponentMetadata componentMetadata, ParserContext parserContext) { + return null; + } +} diff --git a/components/camel-cxf-blueprint/src/main/java/org/apache/camel/component/cxf/blueprint/EndpointDefinitionParser.java b/components/camel-cxf-blueprint/src/main/java/org/apache/camel/component/cxf/blueprint/EndpointDefinitionParser.java new file mode 100644 index 0000000..d288f0b --- /dev/null +++ b/components/camel-cxf-blueprint/src/main/java/org/apache/camel/component/cxf/blueprint/EndpointDefinitionParser.java @@ -0,0 +1,107 @@ +/* + * 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.blueprint; + +import javax.xml.namespace.QName; + +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.helpers.DOMUtils; +import org.osgi.framework.BundleContext; +import org.osgi.service.blueprint.reflect.Metadata; + +public class EndpointDefinitionParser extends AbstractBeanDefinitionParser { + + public Metadata parse(Element element, ParserContext context) { + MutableBeanMetadata endpointConfig = createBeanMetadata(element, context, CxfBlueprintEndpoint.class); + + NamedNodeMap atts = element.getAttributes(); + + String bus = null; + String address = null; + + 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 ("bus".equals(name)) { + bus = val; + } else if ("address".equals(name)) { + address = val; + } else if (isAttribute(pre, name)) { + if ("endpointName".equals(name) || "serviceName".equals(name)) { + if (isPlaceHolder(val)) { + endpointConfig.addProperty(name + "String", createValue(context, val)); + } else { + QName q = parseQName(element, val); + endpointConfig.addProperty(name, createValue(context, q)); + } + } else if ("depends-on".equals(name)) { + endpointConfig.addDependsOn(val); + } else if (!"name".equals(name)) { + endpointConfig.addProperty(name, createValue(context, val)); + } + } + } + + Element elem = DOMUtils.getFirstElement(element); + while (elem != null) { + String name = elem.getLocalName(); + if ("properties".equals(name)) { + Metadata map = parseMapData(context, endpointConfig, elem); + endpointConfig.addProperty(name, map); + } else if ("binding".equals(name)) { + setFirstChildAsProperty(elem, context, endpointConfig, "bindingConfig"); + } else if ("inInterceptors".equals(name) || "inFaultInterceptors".equals(name) || "outInterceptors".equals(name) + || "outFaultInterceptors".equals(name) || "features".equals(name) || "schemaLocations".equals(name) || "handlers".equals(name)) { + Metadata list = parseListData(context, endpointConfig, elem); + endpointConfig.addProperty(name, list); + } else { + setFirstChildAsProperty(elem, context, endpointConfig, name); + } + + elem = DOMUtils.getNextElement(elem); + } + if (StringUtils.isEmpty(bus)) { + bus = "cxf"; + } + //Will create a bus if needed... + + endpointConfig.addProperty("bus", getBusRef(context, bus)); + endpointConfig.setDestroyMethod("destroy"); + endpointConfig.addArgument(createValue(context, address), String.class.getName(), 0); + endpointConfig.addArgument(createRef(context, "blueprintBundleContext"), + BundleContext.class.getName(), 1); + + return endpointConfig; + } + + private static boolean isPlaceHolder(String value) { + if (value != null && (value.startsWith("${") && value.endsWith("}") + || value.startsWith("{{") && value.endsWith("}}"))) { + return true; + } + return false; + } + +} diff --git a/components/camel-cxf-blueprint/src/main/java/org/apache/camel/component/cxf/blueprint/RsClientBlueprintBean.java b/components/camel-cxf-blueprint/src/main/java/org/apache/camel/component/cxf/blueprint/RsClientBlueprintBean.java new file mode 100644 index 0000000..5b00526 --- /dev/null +++ b/components/camel-cxf-blueprint/src/main/java/org/apache/camel/component/cxf/blueprint/RsClientBlueprintBean.java @@ -0,0 +1,95 @@ +/* + * 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.blueprint; + +import java.util.HashMap; + +import org.apache.camel.component.cxf.NullFaultListener; +import org.apache.cxf.ext.logging.LoggingFeature; +import org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean; +import org.apache.cxf.logging.FaultListener; +import org.osgi.framework.BundleContext; +import org.osgi.service.blueprint.container.BlueprintContainer; + +public class RsClientBlueprintBean extends JAXRSClientFactoryBean implements BlueprintSupport, Cloneable { + private BlueprintContainer blueprintContainer; + private BundleContext bundleContext; + private int loggingSizeLimit; + private LoggingFeature loggingFeature; + + @Override + public BlueprintContainer getBlueprintContainer() { + return blueprintContainer; + } + + @Override + public void setBlueprintContainer(BlueprintContainer blueprintContainer) { + this.blueprintContainer = blueprintContainer; + } + + @Override + public BundleContext getBundleContext() { + return bundleContext; + } + + @Override + public void setBundleContext(BundleContext bundleContext) { + this.bundleContext = bundleContext; + } + + public boolean isLoggingFeatureEnabled() { + return loggingFeature != null; + } + + public void setLoggingFeatureEnabled(boolean loggingFeatureEnabled) { + if (loggingFeature != null) { + getFeatures().remove(loggingFeature); + loggingFeature = null; + } + if (loggingFeatureEnabled) { + loggingFeature = new LoggingFeature(); + if (getLoggingSizeLimit() > 0) { + loggingFeature.setLimit(getLoggingSizeLimit()); + } + getFeatures().add(loggingFeature); + } + + } + + public int getLoggingSizeLimit() { + return loggingSizeLimit; + } + + public void setLoggingSizeLimit(int loggingSizeLimit) { + this.loggingSizeLimit = loggingSizeLimit; + if (loggingFeature != null) { + if (loggingSizeLimit > 0) { + loggingFeature.setLimit(loggingSizeLimit); + } + } + } + + public void setSkipFaultLogging(boolean skipFaultLogging) { + if (skipFaultLogging) { + if (this.getProperties() == null) { + this.setProperties(new HashMap<String, Object>()); + } + this.getProperties().put(FaultListener.class.getName(), new NullFaultListener()); + } + } + +} diff --git a/components/camel-cxf-blueprint/src/main/java/org/apache/camel/component/cxf/blueprint/RsClientDefinitionParser.java b/components/camel-cxf-blueprint/src/main/java/org/apache/camel/component/cxf/blueprint/RsClientDefinitionParser.java new file mode 100644 index 0000000..52351bc --- /dev/null +++ b/components/camel-cxf-blueprint/src/main/java/org/apache/camel/component/cxf/blueprint/RsClientDefinitionParser.java @@ -0,0 +1,93 @@ +/* + * 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.blueprint; + +import java.util.List; + +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.aries.blueprint.mutable.MutablePassThroughMetadata; +import org.apache.cxf.common.util.StringUtils; +import org.apache.cxf.configuration.blueprint.AbstractBPBeanDefinitionParser; +import org.apache.cxf.helpers.DOMUtils; +import org.apache.cxf.jaxrs.model.UserResource; +import org.apache.cxf.jaxrs.utils.ResourceUtils; +import org.osgi.service.blueprint.reflect.Metadata; + +public class RsClientDefinitionParser extends AbstractBeanDefinitionParser { + + public Metadata parse(Element element, ParserContext context) { + MutableBeanMetadata beanMetadata = createBeanMetadata(element, context, RsClientBlueprintBean.class); + NamedNodeMap atts = element.getAttributes(); + + String bus = null; + 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 ("bus".equals(name)) { + bus = val; + } else if (isAttribute(pre, name)) { + if ("depends-on".equals(name)) { + beanMetadata.addDependsOn(val); + } else if (!"name".equals(name)) { + beanMetadata.addProperty(name, AbstractBPBeanDefinitionParser.createValue(context, val)); + } + } + } + + for (Element elem = DOMUtils.getFirstElement(element); elem != null; elem = DOMUtils.getNextElement(elem)) { + String name = elem.getLocalName(); + if ("properties".equals(name) || "headers".equals(name)) { + Metadata map = parseMapData(context, beanMetadata, elem); + beanMetadata.addProperty(name, map); + } else if ("binding".equals(name)) { + setFirstChildAsProperty(elem, context, beanMetadata, "bindingConfig"); + } else if ("inInterceptors".equals(name) || "inFaultInterceptors".equals(name) || "outInterceptors".equals(name) + || "outFaultInterceptors".equals(name) || "features".equals(name) || "schemaLocations".equals(name) || "handlers".equals(name)) { + Metadata list = parseListData(context, beanMetadata, elem); + beanMetadata.addProperty(name, list); + } else if ("features".equals(name) || "providers".equals(name) + || "schemaLocations".equals(name) || "modelBeans".equals(name)) { + Metadata list = parseListData(context, beanMetadata, elem); + beanMetadata.addProperty(name, list); + } else if ("model".equals(name)) { + List<UserResource> resources = ResourceUtils.getResourcesFromElement(elem); + MutablePassThroughMetadata value = context.createMetadata(MutablePassThroughMetadata.class); + value.setObject(resources); + beanMetadata.addProperty(name, value); + } else { + setFirstChildAsProperty(elem, context, beanMetadata, name); + } + } + + if (StringUtils.isEmpty(bus)) { + bus = "cxf"; + } + //Will create a bus if needed... + + beanMetadata.addProperty("bus", getBusRef(context, bus)); + return beanMetadata; + } + + +} diff --git a/components/camel-cxf-blueprint/src/main/java/org/apache/camel/component/cxf/blueprint/RsServerBlueprintBean.java b/components/camel-cxf-blueprint/src/main/java/org/apache/camel/component/cxf/blueprint/RsServerBlueprintBean.java new file mode 100644 index 0000000..64fb07a --- /dev/null +++ b/components/camel-cxf-blueprint/src/main/java/org/apache/camel/component/cxf/blueprint/RsServerBlueprintBean.java @@ -0,0 +1,101 @@ +/* + * 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.blueprint; + +import java.util.HashMap; + +import org.apache.camel.component.cxf.NullFaultListener; +import org.apache.cxf.feature.LoggingFeature; +import org.apache.cxf.jaxrs.JAXRSServerFactoryBean; +import org.apache.cxf.logging.FaultListener; +import org.osgi.framework.BundleContext; +import org.osgi.service.blueprint.container.BlueprintContainer; + +public class RsServerBlueprintBean extends JAXRSServerFactoryBean implements BlueprintSupport, Cloneable { + + private BlueprintContainer blueprintContainer; + private BundleContext bundleContext; + private LoggingFeature loggingFeature; + private int loggingSizeLimit; + + @Override + public BlueprintContainer getBlueprintContainer() { + return blueprintContainer; + } + + @Override + public void setBlueprintContainer(BlueprintContainer blueprintContainer) { + this.blueprintContainer = blueprintContainer; + } + + @Override + public BundleContext getBundleContext() { + return bundleContext; + } + + @Override + public void setBundleContext(BundleContext bundleContext) { + this.bundleContext = bundleContext; + } + + public boolean isLoggingFeatureEnabled() { + return loggingFeature != null; + } + + public void setLoggingFeatureEnabled(boolean loggingFeatureEnabled) { + if (loggingFeature != null) { + getFeatures().remove(loggingFeature); + loggingFeature = null; + } + if (loggingFeatureEnabled) { + if (getLoggingSizeLimit() > 0) { + loggingFeature = new LoggingFeature(getLoggingSizeLimit()); + } else { + loggingFeature = new LoggingFeature(); + } + getFeatures().add(loggingFeature); + } + + } + + public int getLoggingSizeLimit() { + return loggingSizeLimit; + } + + public void setLoggingSizeLimit(int loggingSizeLimit) { + this.loggingSizeLimit = loggingSizeLimit; + if (loggingFeature != null) { + getFeatures().remove(loggingFeature); + if (loggingSizeLimit > 0) { + loggingFeature = new LoggingFeature(loggingSizeLimit); + } else { + loggingFeature = new LoggingFeature(); + } + getFeatures().add(loggingFeature); + } + } + + public void setSkipFaultLogging(boolean skipFaultLogging) { + if (skipFaultLogging) { + if (this.getProperties() == null) { + this.setProperties(new HashMap<String, Object>()); + } + this.getProperties().put(FaultListener.class.getName(), new NullFaultListener()); + } + } + +} diff --git a/components/camel-cxf-blueprint/src/main/java/org/apache/camel/component/cxf/blueprint/RsServerDefinitionParser.java b/components/camel-cxf-blueprint/src/main/java/org/apache/camel/component/cxf/blueprint/RsServerDefinitionParser.java new file mode 100644 index 0000000..acbc086 --- /dev/null +++ b/components/camel-cxf-blueprint/src/main/java/org/apache/camel/component/cxf/blueprint/RsServerDefinitionParser.java @@ -0,0 +1,95 @@ +/* + * 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.blueprint; + +import java.util.List; + +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.aries.blueprint.mutable.MutablePassThroughMetadata; +import org.apache.cxf.common.util.StringUtils; +import org.apache.cxf.configuration.blueprint.AbstractBPBeanDefinitionParser; +import org.apache.cxf.helpers.DOMUtils; +import org.apache.cxf.jaxrs.model.UserResource; +import org.apache.cxf.jaxrs.utils.ResourceUtils; +import org.osgi.service.blueprint.reflect.Metadata; + +public class RsServerDefinitionParser extends AbstractBeanDefinitionParser { + + public Metadata parse(Element element, ParserContext context) { + MutableBeanMetadata beanMetadata = createBeanMetadata(element, context, RsServerBlueprintBean.class); + NamedNodeMap atts = element.getAttributes(); + + String bus = null; + 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 ("bus".equals(name)) { + bus = val; + } else if (isAttribute(pre, name)) { + if ("depends-on".equals(name)) { + beanMetadata.addDependsOn(val); + } else if (!"name".equals(name)) { + beanMetadata.addProperty(name, AbstractBPBeanDefinitionParser.createValue(context, val)); + } + } + } + + for (Element elem = DOMUtils.getFirstElement(element); elem != null; elem = DOMUtils.getNextElement(elem)) { + String name = elem.getLocalName(); + if ("properties".equals(name) + || "extensionMappings".equals(name) + || "languageMappings".equals(name)) { + Metadata map = parseMapData(context, beanMetadata, elem); + beanMetadata.addProperty(name, map); + } else if ("binding".equals(name)) { + setFirstChildAsProperty(elem, context, beanMetadata, "bindingConfig"); + } else if ("inInterceptors".equals(name) || "inFaultInterceptors".equals(name) || "outInterceptors".equals(name) + || "outFaultInterceptors".equals(name) || "features".equals(name) || "schemaLocations".equals(name) || "handlers".equals(name)) { + Metadata list = parseListData(context, beanMetadata, elem); + beanMetadata.addProperty(name, list); + } else if ("features".equals(name) || "providers".equals(name) + || "schemaLocations".equals(name) || "modelBeans".equals(name) + || "serviceBeans".equals(name)) { + Metadata list = parseListData(context, beanMetadata, elem); + beanMetadata.addProperty(name, list); + } else if ("model".equals(name)) { + List<UserResource> resources = ResourceUtils.getResourcesFromElement(elem); + MutablePassThroughMetadata value = context.createMetadata(MutablePassThroughMetadata.class); + value.setObject(resources); + beanMetadata.addProperty(name, value); + } else { + setFirstChildAsProperty(elem, context, beanMetadata, name); + } + } + + if (StringUtils.isEmpty(bus)) { + bus = "cxf"; + } + //Will create a bus if needed... + + beanMetadata.addProperty("bus", getBusRef(context, bus)); + return beanMetadata; + } + +} diff --git a/components/camel-cxf-blueprint/src/main/java/org/apache/camel/component/cxf/jaxrs/blueprint/CxfRsBlueprintEndpoint.java b/components/camel-cxf-blueprint/src/main/java/org/apache/camel/component/cxf/jaxrs/blueprint/CxfRsBlueprintEndpoint.java new file mode 100644 index 0000000..3ad2478 --- /dev/null +++ b/components/camel-cxf-blueprint/src/main/java/org/apache/camel/component/cxf/jaxrs/blueprint/CxfRsBlueprintEndpoint.java @@ -0,0 +1,95 @@ +/* + * 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.jaxrs.blueprint; + +import org.apache.camel.Component; +import org.apache.camel.blueprint.BlueprintCamelContext; +import org.apache.camel.component.cxf.blueprint.BlueprintSupport; +import org.apache.camel.component.cxf.blueprint.RsClientBlueprintBean; +import org.apache.camel.component.cxf.blueprint.RsServerBlueprintBean; +import org.apache.camel.component.cxf.jaxrs.CxfRsEndpoint; +import org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean; +import org.apache.cxf.jaxrs.JAXRSServerFactoryBean; +import org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean; +import org.osgi.framework.BundleContext; +import org.osgi.service.blueprint.container.BlueprintContainer; +import org.springframework.util.ReflectionUtils; + +public class CxfRsBlueprintEndpoint extends CxfRsEndpoint { + private AbstractJAXRSFactoryBean bean; + private BlueprintContainer blueprintContainer; + private BundleContext bundleContext; + private BlueprintCamelContext blueprintCamelContext; + + public CxfRsBlueprintEndpoint(Component comp, String uri, AbstractJAXRSFactoryBean bean) { + super(uri, comp); + this.bean = bean; + setAddress(bean.getAddress()); + // update the sfb address by resolving the properties + bean.setAddress(getAddress()); + BlueprintSupport support = (BlueprintSupport)bean; + setBlueprintContainer(support.getBlueprintContainer()); + setBundleContext(support.getBundleContext()); + } + + public BlueprintContainer getBlueprintContainer() { + return blueprintContainer; + } + + public void setBlueprintContainer(BlueprintContainer blueprintContainer) { + this.blueprintContainer = blueprintContainer; + } + + public BundleContext getBundleContext() { + return bundleContext; + } + + public void setBundleContext(BundleContext bundleContext) { + this.bundleContext = bundleContext; + } + + public BlueprintCamelContext getBlueprintCamelContext() { + return blueprintCamelContext; + } + + public void setBlueprintCamelContext(BlueprintCamelContext blueprintCamelContext) { + this.blueprintCamelContext = blueprintCamelContext; + } + + @Override + protected JAXRSServerFactoryBean newJAXRSServerFactoryBean() { + checkBeanType(bean, JAXRSServerFactoryBean.class); + return (RsServerBlueprintBean)bean; + } + + @Override + protected JAXRSClientFactoryBean newJAXRSClientFactoryBean() { + checkBeanType(bean, JAXRSClientFactoryBean.class); + return newInstanceWithCommonProperties(); + } + + private RsClientBlueprintBean newInstanceWithCommonProperties() { + RsClientBlueprintBean cfb = new RsClientBlueprintBean(); + + if (bean instanceof RsClientBlueprintBean) { + ReflectionUtils.shallowCopyFieldState(bean, cfb); + } + + return cfb; + } + +} diff --git a/components/camel-cxf-blueprint/src/main/java/org/apache/camel/component/cxf/jaxrs/blueprint/CxfRsBlueprintEndpointFactoryBean.java b/components/camel-cxf-blueprint/src/main/java/org/apache/camel/component/cxf/jaxrs/blueprint/CxfRsBlueprintEndpointFactoryBean.java new file mode 100644 index 0000000..d29cdd8 --- /dev/null +++ b/components/camel-cxf-blueprint/src/main/java/org/apache/camel/component/cxf/jaxrs/blueprint/CxfRsBlueprintEndpointFactoryBean.java @@ -0,0 +1,30 @@ +/* + * 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.jaxrs.blueprint; + +import org.apache.camel.Component; +import org.apache.camel.component.cxf.jaxrs.CxfRsEndpoint; +import org.apache.camel.component.cxf.jaxrs.CxfRsEndpointFactoryBean; +import org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean; + +public class CxfRsBlueprintEndpointFactoryBean implements CxfRsEndpointFactoryBean { + + @Override + public CxfRsEndpoint createEndpoint(Component component, String uri, AbstractJAXRSFactoryBean bean) throws Exception { + return new CxfRsBlueprintEndpoint(component, uri, bean); + } +} diff --git a/components/camel-cxf-blueprint/src/main/resources/OSGI-INF/blueprint/camel-cxf.xml b/components/camel-cxf-blueprint/src/main/resources/OSGI-INF/blueprint/camel-cxf.xml new file mode 100644 index 0000000..ab14595 --- /dev/null +++ b/components/camel-cxf-blueprint/src/main/resources/OSGI-INF/blueprint/camel-cxf.xml @@ -0,0 +1,31 @@ +<?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://camel.apache.org/schema/blueprint/cxf"/> + </service-properties> + <bean class="org.apache.camel.component.cxf.blueprint.CxfNamespaceHandler"/> + </service> +</blueprint> diff --git a/components/camel-cxf-blueprint/src/main/resources/schema/blueprint/camel-cxf.xsd b/components/camel-cxf-blueprint/src/main/resources/schema/blueprint/camel-cxf.xsd new file mode 100644 index 0000000..fe9d99b --- /dev/null +++ b/components/camel-cxf-blueprint/src/main/resources/schema/blueprint/camel-cxf.xsd @@ -0,0 +1,179 @@ +<?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="http://camel.apache.org/schema/blueprint/cxf" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:beans="http://www.osgi.org/xmlns/blueprint/v1.0.0" + xmlns:cxf-beans="http://cxf.apache.org/configuration/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + targetNamespace="http://camel.apache.org/schema/blueprint/cxf" + 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="cxfEndpoint"> + <xsd:complexType> + <xsd:complexContent> + <xsd:extension base="beans:Tcomponent"> + <xsd:all> + <xsd:element name="binding" type="xsd:anyType" minOccurs="0"/> + <xsd:element name="dataBinding" type="xsd:anyType" minOccurs="0"/> + <xsd:element name="features" type="xsd:anyType" minOccurs="0"/> + <xsd:element name="inInterceptors" type="xsd:anyType" minOccurs="0"/> + <xsd:element name="inFaultInterceptors" type="xsd:anyType" minOccurs="0"/> + <xsd:element name="outInterceptors" type="xsd:anyType" minOccurs="0"/> + <xsd:element name="outFaultInterceptors" type="xsd:anyType" minOccurs="0"/> + <xsd:element name="handlers" type="xsd:anyType" minOccurs="0"/> + <xsd:element name="properties" type="beans:Tmap" minOccurs="0"/> + <xsd:element name="schemaLocations" type="schemasType" minOccurs="0"/> + <xsd:element name="serviceBean" type="xsd:anyType" minOccurs="0"/> + <xsd:element name="serviceFactory" type="xsd:anyType" minOccurs="0"/> + </xsd:all> + <!-- xsd:attributeGroup ref="cxf-beans:beanAttributes"/--> + <xsd:attribute name="address" type="xsd:string"/> + <xsd:attribute name="bindingId" type="xsd:string"/> + <xsd:attribute name="bus" type="xsd:string"/> + <xsd:attribute name="serviceClass" type="xsd:string"/> + <xsd:attribute name="transportId" type="xsd:string"/> + <xsd:attribute name="wsdlURL" type="xsd:string"/> + <xsd:attribute name="endpointName" type="xsd:QName"/> + <xsd:attribute name="serviceName" type="xsd:QName"/> + <xsd:attribute name="loggingFeatureEnabled" type="xsd:boolean"/> + <xsd:attribute name="loggingSizeLimit" type="xsd:integer" /> + <xsd:attribute name="continuationTimeout" type="xsd:long" /> + <xsd:attribute name="publishedEndpointUrl" type="xsd:string" /> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + </xsd:element> + + <xsd:element name="rsServer"> + <xsd:complexType> + <xsd:complexContent> + <xsd:extension base="beans:Tcomponent"> + <xsd:all> + <xsd:element name="executor" type="xsd:anyType" minOccurs="0"/> + <xsd:element name="features" type="xsd:anyType" minOccurs="0"/> + <xsd:element name="binding" type="xsd:anyType" minOccurs="0"/> + <xsd:element name="inInterceptors" type="xsd:anyType" minOccurs="0"/> + <xsd:element name="inFaultInterceptors" type="xsd:anyType" minOccurs="0"/> + <xsd:element name="invoker" type="xsd:anyType" minOccurs="0"/> + <xsd:element name="outInterceptors" type="xsd:anyType" minOccurs="0"/> + <xsd:element name="outFaultInterceptors" type="xsd:anyType" minOccurs="0"/> + <xsd:element name="properties" type="beans:Tmap" minOccurs="0"/> + <xsd:element name="serviceBeans" type="xsd:anyType" minOccurs="0"/> + <xsd:element name="modelBeans" type="xsd:anyType" minOccurs="0"/> + <xsd:element name="model" type="model" minOccurs="0"/> + <xsd:element name="providers" type="xsd:anyType" minOccurs="0"/> + <xsd:element name="extensionMappings" type="xsd:anyType" minOccurs="0"/> + <xsd:element name="languageMappings" type="xsd:anyType" minOccurs="0"/> + <xsd:element name="schemaLocations" type="schemasType" minOccurs="0"/> + </xsd:all> + <!-- xsd:attributeGroup ref="cxf-beans:beanAttributes"/--> + <xsd:attribute name="address" type="xsd:string"/> + <xsd:attribute name="bus" type="xsd:string"/> + <xsd:attribute name="serviceClass" type="xsd:string"/> + <xsd:attribute name="transportId" type="xsd:string"/> + <xsd:attribute name="modelRef" type="xsd:string"/> + <xsd:attribute name="bindingId" type="xsd:string"/> + <xsd:attribute name="staticSubresourceResolution" type="xsd:boolean"/> + <xsd:attribute name="loggingFeatureEnabled" type="xsd:boolean"/> + <xsd:attribute name="loggingSizeLimit" type="xsd:integer" /> + <xsd:attribute name="publishedEndpointUrl" type="xsd:string" /> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + </xsd:element> + + <xsd:element name="rsClient"> + <xsd:complexType> + <xsd:complexContent> + <xsd:extension base="beans:Tcomponent"> + <xsd:all> + <xsd:element name="executor" type="xsd:anyType" minOccurs="0"/> + <xsd:element name="features" type="xsd:anyType" minOccurs="0"/> + <xsd:element name="binding" type="xsd:anyType" minOccurs="0"/> + <xsd:element name="inInterceptors" type="xsd:anyType" minOccurs="0"/> + <xsd:element name="inFaultInterceptors" type="xsd:anyType" minOccurs="0"/> + <xsd:element name="outInterceptors" type="xsd:anyType" minOccurs="0"/> + <xsd:element name="outFaultInterceptors" type="xsd:anyType" minOccurs="0"/> + <xsd:element name="properties" type="beans:Tmap" minOccurs="0"/> + <xsd:element name="providers" type="xsd:anyType" minOccurs="0"/> + <xsd:element name="modelBeans" type="xsd:anyType" minOccurs="0"/> + <xsd:element name="model" type="model" minOccurs="0"/> + <xsd:element name="headers" type="xsd:anyType" minOccurs="0"/> + <xsd:element name="schemaLocations" type="schemasType" minOccurs="0"/> + </xsd:all> + <!-- xsd:attributeGroup ref="cxf-beans:beanAttributes"/--> + <xsd:attribute name="address" type="xsd:string"/> + <xsd:attribute name="serviceClass" type="xsd:string"/> + <xsd:attribute name="inheritHeaders" type="xsd:boolean"/> + <xsd:attribute name="bus" type="xsd:string"/> + <xsd:attribute name="transportId" type="xsd:string"/> + <xsd:attribute name="bindingId" type="xsd:string"/> + <xsd:attribute name="modelRef" type="xsd:string"/> + <xsd:attribute name="username" type="xsd:string"/> + <xsd:attribute name="password" type="xsd:string"/> + <xsd:attribute name="loggingFeatureEnabled" type="xsd:boolean"/> + <xsd:attribute name="loggingSizeLimit" type="xsd:integer" /> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + </xsd:element> + + <xsd:complexType name="schemasType"> + <xsd:sequence> + <xsd:element name="schemaLocation" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/> + </xsd:sequence> + </xsd:complexType> + + <xsd:complexType name="model"> + <xsd:sequence> + <xsd:element name="resource" minOccurs="0" maxOccurs="unbounded"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="operation" minOccurs="0" maxOccurs="unbounded"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="param" minOccurs="0" maxOccurs="unbounded"> + <xsd:complexType> + <xsd:attribute name="name" type="xsd:string"/> + <xsd:attribute name="type" type="xsd:string"/> + </xsd:complexType> + </xsd:element> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string"/> + <xsd:attribute name="path" type="xsd:string"/> + <xsd:attribute name="verb" type="xsd:string"/> + <xsd:attribute name="consumes" type="xsd:string"/> + <xsd:attribute name="produces" type="xsd:string"/> + </xsd:complexType> + </xsd:element> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string"/> + <xsd:attribute name="path" type="xsd:string"/> + </xsd:complexType> + </xsd:element> + </xsd:sequence> + <xsd:attribute name="id" type="xsd:string"/> + </xsd:complexType> +</xsd:schema> diff --git a/components/pom.xml b/components/pom.xml index db54e3e..fd4477e 100644 --- a/components/pom.xml +++ b/components/pom.xml @@ -33,6 +33,7 @@ <modules> <module>camel-blueprint</module> + <module>camel-cxf-blueprint</module> <module>camel-kura</module> <module>camel-paxlogging</module> <module>camel-test-blueprint</module> diff --git a/platforms/karaf/features/src/main/resources/features.xml b/platforms/karaf/features/src/main/resources/features.xml index 227f0f3..dbaa535 100644 --- a/platforms/karaf/features/src/main/resources/features.xml +++ b/platforms/karaf/features/src/main/resources/features.xml @@ -798,6 +798,7 @@ <feature version='${cxf-version-range}'>cxf-features-logging</feature> <bundle>mvn:org.apache.camel/camel-attachments/${project.version}</bundle> <bundle>mvn:org.apache.camel/camel-http-base/${project.version}</bundle> + <bundle>mvn:org.apache.camel.karaf/camel-cxf-blueprint/${project.version}</bundle> <bundle>mvn:org.apache.camel/camel-cxf-transport/${project.version}</bundle> <bundle>mvn:org.apache.camel/camel-cxf/${project.version}</bundle> </feature>
