Willem,
Can we do this without having separate Blueprint and Spring schemas? Since this is effectively a new schema for both, I'd hate to have 2 schemas when one could do. The configuration/wsrm-manager.xsd did something similar at one point and ended up defining a very small "identifiedType" complexType to stick the attributes that are required instead of pulling them from Spring or Blueprint. Also: the blueprint xsd is invalid. There is a missing closing element and the Apache header is missing. But if you get rid of it... problem solved. :-) Thanks! Dan On Monday, May 21, 2012 07:00:00 AM ningji...@apache.org wrote: > Author: ningjiang > Date: Mon May 21 06:59:59 2012 > New Revision: 1340905 > > URL: http://svn.apache.org/viewvc?rev=1340905&view=rev > Log: > CXF-4326 CXF-4327 add blueprint support on the cxf clustering > > Added: > > cxf/trunk/rt/features/clustering/src/main/java/org/apache/cxf/clustering/ > blueprint/ > cxf/trunk/rt/features/clustering/src/main/java/org/apache/cxf/clustering/ > blueprint/ClusteringBPNamespaceHandler.java > cxf/trunk/rt/features/clustering/src/main/resources/META-INF/spring.schem > as cxf/trunk/rt/features/clustering/src/main/resources/OSGI-INF/ > cxf/trunk/rt/features/clustering/src/main/resources/OSGI-INF/blueprint/ > cxf/trunk/rt/features/clustering/src/main/resources/OSGI-INF/blueprint/cx > f-clustering.xml > cxf/trunk/rt/features/clustering/src/main/resources/schemas/ > cxf/trunk/rt/features/clustering/src/main/resources/schemas/blueprint/ > cxf/trunk/rt/features/clustering/src/main/resources/schemas/blueprint/clu > stering.xsd > cxf/trunk/rt/features/clustering/src/main/resources/schemas/clustering.xs > d Modified: > cxf/trunk/rt/features/clustering/pom.xml > > Modified: cxf/trunk/rt/features/clustering/pom.xml > URL: > http://svn.apache.org/viewvc/cxf/trunk/rt/features/clustering/pom.xml?rev > =1340905&r1=1340904&r2=1340905&view=diff > ========================================================================= > ===== --- cxf/trunk/rt/features/clustering/pom.xml (original) > +++ cxf/trunk/rt/features/clustering/pom.xml Mon May 21 06:59:59 2012 > @@ -55,6 +55,12 @@ > <version>${project.version}</version> > </dependency> > <dependency> > + <groupId>org.apache.aries.blueprint</groupId> > + <artifactId>org.apache.aries.blueprint.core</artifactId> > + <scope>provided</scope> > + <optional>true</optional> > + </dependency> > + <dependency> > <groupId>org.springframework</groupId> > <artifactId>spring-core</artifactId> > <scope>provided</scope> > > Added: > cxf/trunk/rt/features/clustering/src/main/java/org/apache/cxf/clustering/ > blueprint/ClusteringBPNamespaceHandler.java URL: > http://svn.apache.org/viewvc/cxf/trunk/rt/features/clustering/src/main/ja > va/org/apache/cxf/clustering/blueprint/ClusteringBPNamespaceHandler.java?r > ev=1340905&view=auto > ========================================================================= > ===== --- > cxf/trunk/rt/features/clustering/src/main/java/org/apache/cxf/clustering/ > blueprint/ClusteringBPNamespaceHandler.java (added) +++ > cxf/trunk/rt/features/clustering/src/main/java/org/apache/cxf/clustering/ > blueprint/ClusteringBPNamespaceHandler.java Mon May 21 06:59:59 2012 @@ > -0,0 +1,59 @@ > +/** > + * 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.cxf.clustering.blueprint; > + > +import java.net.URL; > +import java.util.Set; > + > +import org.w3c.dom.Element; > +import org.w3c.dom.Node; > + > +import org.apache.aries.blueprint.NamespaceHandler; > +import org.apache.aries.blueprint.ParserContext; > +import org.apache.cxf.clustering.FailoverFeature; > +import org.apache.cxf.clustering.LoadDistributorTargetSelector; > +import > org.apache.cxf.configuration.blueprint.SimpleBPBeanDefinitionParser; > +import org.osgi.service.blueprint.reflect.ComponentMetadata; > +import org.osgi.service.blueprint.reflect.Metadata; > + > +public class ClusteringBPNamespaceHandler implements NamespaceHandler { > + public ComponentMetadata decorate(Node node, ComponentMetadata > component, ParserContext context) { + return null; > + } > + > + public Metadata parse(Element element, ParserContext context) { > + String s = element.getLocalName(); > + if ("failover".equals(s)) { > + return new > SimpleBPBeanDefinitionParser(FailoverFeature.class).parse(element, > context); + } else if ("loadDistributor".equals(s)) { > + return new > SimpleBPBeanDefinitionParser(LoadDistributorTargetSelector.class).parse(e > lement, context); + } > + return null; > + } > + > + public Set<Class> getManagedClasses() { > + //probably should have the various stuff in cxf-api in here? > + return null; > + } > + > + public URL getSchemaLocation(String namespace) { > + return > getClass().getClassLoader().getResource("/schemas/blueprint/clustering.xs > d"); + } > + > +} > > Added: > cxf/trunk/rt/features/clustering/src/main/resources/META-INF/spring.schem > as URL: > http://svn.apache.org/viewvc/cxf/trunk/rt/features/clustering/src/main/re > sources/META-INF/spring.schemas?rev=1340905&view=auto > ========================================================================= > ===== --- > cxf/trunk/rt/features/clustering/src/main/resources/META-INF/spring.schem > as (added) +++ > cxf/trunk/rt/features/clustering/src/main/resources/META-INF/spring.schem > as Mon May 21 06:59:59 2012 @@ -0,0 +1,21 @@ > +# > +# > +# 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. > +# > +# > +http\://cxf.apache.org/schemas/clustering.xsd=schemas/clustering.xsd > \ No newline at end of file > > Added: > cxf/trunk/rt/features/clustering/src/main/resources/OSGI-INF/blueprint/cx > f-clustering.xml URL: > http://svn.apache.org/viewvc/cxf/trunk/rt/features/clustering/src/main/re > sources/OSGI-INF/blueprint/cxf-clustering.xml?rev=1340905&view=auto > ========================================================================= > ===== --- > cxf/trunk/rt/features/clustering/src/main/resources/OSGI-INF/blueprint/cx > f-clustering.xml (added) +++ > cxf/trunk/rt/features/clustering/src/main/resources/OSGI-INF/blueprint/cx > f-clustering.xml Mon May 21 06:59:59 2012 @@ -0,0 +1,31 @@ > +<!-- > + ~ /** > + ~ * 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 > http://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/blueprint/clustering"/> + > </service-properties> > + <bean > class="org.apache.cxf.clustering.blueprint.ClusteringBPNamespaceHandler"/ > > + </service> > +</blueprint> > \ No newline at end of file > > Added: > cxf/trunk/rt/features/clustering/src/main/resources/schemas/blueprint/clu > stering.xsd URL: > http://svn.apache.org/viewvc/cxf/trunk/rt/features/clustering/src/main/re > sources/schemas/blueprint/clustering.xsd?rev=1340905&view=auto > ========================================================================= > ===== --- > cxf/trunk/rt/features/clustering/src/main/resources/schemas/blueprint/clu > stering.xsd (added) +++ > cxf/trunk/rt/features/clustering/src/main/resources/schemas/blueprint/clu > stering.xsd Mon May 21 06:59:59 2012 @@ -0,0 +1,57 @@ > +<xsd:schema xmlns="http://cxf.apache.org/blueprint/clustering" > + xmlns:xsd="http://www.w3.org/2001/XMLSchema" > + xmlns:beans="http://www.osgi.org/xmlns/blueprint/v1.0.0" > + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > + targetNamespace="http://cxf.apache.org/blueprint/clustering" > + elementFormDefault="qualified" > + attributeFormDefault="unqualified" > > + > + <xsd:import namespace="http://www.osgi.org/xmlns/blueprint/v1.0.0" > schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd" > /> + > + <xsd:element name="failover"> > + <xsd:annotation> > + <xsd:documentation>Configures the failover feature. This element is > associated with the org.apache.cxf.clustering.FailoverFeature > object.</xsd:documentation> + </xsd:annotation> > + <xsd:complexType> > + <xsd:complexContent> > + <xsd:extension base="beans:Tcomponent"> > + <xsd:all> > + <xsd:element name="strategy" type="xsd:anyType" > minOccurs="0"> + <xsd:annotation> > + <xsd:documentation>Configures the strategy that the > failover feature will be used. The Strategy object instance need to be > implemented the > org.apache.cxf.clustering.FailoverStrategy.</xsd:documentation> + > </xsd:annotation> > + </xsd:element> > + <xsd:element name="targetSelector" type="xsd:anyType" > minOccurs="0"> + <xsd:annotation> > + <xsd:documentation>Configures the the targetSelector > which will be used in the failover feature.</xsd:documentation> + > </xsd:annotation> > + </xsd:all> > + </xsd:complexContent> > + </xsd:complexType> > + </xsd:element> > + > + <xsd:element name="loadDistributor"> > + <xsd:annotation> > + <xsd:documentation>Configures the loadDistributor feature. This > element is associated with the org.apache.cxf.clustering.FailoverFeature > object.</xsd:documentation> + </xsd:annotation> > + <xsd:complexType> > + <xsd:complexContent> > + <xsd:extension base="beans:Tcomponent"> > + <xsd:all> > + <xsd:element name="strategy" type="xsd:anyType" > minOccurs="0"> + <xsd:annotation> > + <xsd:documentation>Configures the strategy that the > loadDistributor feature will be used. The Strategy object instance need > to be implemented the > org.apache.cxf.clustering.FailoverStrategy.</xsd:documentation> + > </xsd:annotation> > + </xsd:element> > + <xsd:element name="targetSelector" type="xsd:anyType" > minOccurs="0"> + <xsd:annotation> > + <xsd:documentation>Configures the the targetSelector > which will be used in the loadDistributor feature.</xsd:documentation> + > </xsd:annotation> > + </xsd:element> > + </xsd:all> > + </xsd:extension> > + </xsd:complexContent> > + </xsd:complexType> > + </xsd:element> > + > +</xsd:schema> > \ No newline at end of file > > Added: > cxf/trunk/rt/features/clustering/src/main/resources/schemas/clustering.xs > d URL: > http://svn.apache.org/viewvc/cxf/trunk/rt/features/clustering/src/main/re > sources/schemas/clustering.xsd?rev=1340905&view=auto > ========================================================================= > ===== --- > cxf/trunk/rt/features/clustering/src/main/resources/schemas/clustering.xs > d (added) +++ > cxf/trunk/rt/features/clustering/src/main/resources/schemas/clustering.xs > d Mon May 21 06:59:59 2012 @@ -0,0 +1,77 @@ > +<?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://cxf.apache.org/clustering" > + xmlns:xsd="http://www.w3.org/2001/XMLSchema" > + xmlns:beans="http://www.springframework.org/schema/beans" > + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > + targetNamespace="http://cxf.apache.org/clustering" > + elementFormDefault="qualified" > + attributeFormDefault="unqualified" > > + > + <xsd:import namespace="http://www.springframework.org/schema/beans" > schemaLocation="http://www.springframework.org/schema/beans/spring-beans. > xsd"/> + > + <xsd:element name="failover"> > + <xsd:annotation> > + <xsd:documentation>Configures the failover feature. This element is > associated with the org.apache.cxf.clustering.FailoverFeature > object.</xsd:documentation> + </xsd:annotation> > + <xsd:complexType> > + <xsd:complexContent> > + <xsd:extension base="beans:identifiedType"> > + <xsd:all> > + <xsd:element name="strategy" type="xsd:anyType" > minOccurs="0"> + <xsd:annotation> > + <xsd:documentation>Configures the strategy that the > failover feature will be used. The Strategy object instance need to be > implemented the > org.apache.cxf.clustering.FailoverStrategy.</xsd:documentation> + > </xsd:annotation> > + </xsd:element> > + <xsd:element name="targetSelector" type="xsd:anyType" > minOccurs="0"> + <xsd:annotation> > + <xsd:documentation>Configures the targetSelector which > will be used in the failover feature.</xsd:documentation> + > </xsd:annotation> > + </xsd:element> > + </xsd:all> > + </xsd:complexContent> > + </xsd:complexType> > + </xsd:element> > + > + <xsd:element name="loadDistributor"> > + <xsd:annotation> > + <xsd:documentation>Configures the loadDistributor feature. This > element is associated with the org.apache.cxf.clustering.FailoverFeature > object.</xsd:documentation> + </xsd:annotation> > + <xsd:complexType> > + <xsd:complexContent> > + <xsd:extension base="beans:identifiedType"> > + <xsd:all> > + <xsd:element name="strategy" type="xsd:anyType" > minOccurs="0"> + <xsd:annotation> > + <xsd:documentation>Configures the strategy that the > loadDistributor feature will be used. The Strategy object instance need > to be implemented the > org.apache.cxf.clustering.FailoverStrategy.</xsd:documentation> + > </xsd:annotation> > + </xsd:element> > + <xsd:element name="targetSelector" type="xsd:anyType" > minOccurs="0"> + <xsd:annotation> > + <xsd:documentation>Configures the the targetSelector > which will be used in the loadDistributor feature.</xsd:documentation> + > </xsd:annotation> > + </xsd:element> > + </xsd:all> > + </xsd:extension> > + </xsd:complexContent> > + </xsd:complexType> > + </xsd:element> > + > +</xsd:schema> > \ No newline at end of file -- Daniel Kulp dk...@apache.org - http://dankulp.com/blog Talend Community Coder - http://coders.talend.com