You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by ni...@apache.org on 2012/05/22 10:49:40 UTC

svn commit: r1341353 - in /cxf/branches/2.5.x-fixes: rt/core/src/main/java/org/apache/cxf/clustering/blueprint/ rt/core/src/main/resources/META-INF/ rt/core/src/main/resources/OSGI-INF/blueprint/ rt/core/src/main/resources/schemas/ systests/uncategoriz...

Author: ningjiang
Date: Tue May 22 08:49:40 2012
New Revision: 1341353

URL: http://svn.apache.org/viewvc?rev=1341353&view=rev
Log:
CXF-4326, CXF-4327 added blueprint support on the cxf clustering

Added:
    cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/clustering/blueprint/
    cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/clustering/blueprint/ClusteringBPNamespaceHandler.java
    cxf/branches/2.5.x-fixes/rt/core/src/main/resources/OSGI-INF/blueprint/cxf-clustering.xml
    cxf/branches/2.5.x-fixes/rt/core/src/main/resources/schemas/clustering.xsd
Modified:
    cxf/branches/2.5.x-fixes/rt/core/src/main/resources/META-INF/spring.schemas
    cxf/branches/2.5.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/failover.xml
    cxf/branches/2.5.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/failover_address_override.xml
    cxf/branches/2.5.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/load_distributor.xml
    cxf/branches/2.5.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/load_distributor_address_override.xml

Added: cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/clustering/blueprint/ClusteringBPNamespaceHandler.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/clustering/blueprint/ClusteringBPNamespaceHandler.java?rev=1341353&view=auto
==============================================================================
--- cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/clustering/blueprint/ClusteringBPNamespaceHandler.java (added)
+++ cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/clustering/blueprint/ClusteringBPNamespaceHandler.java Tue May 22 08:49:40 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(element, context);
+        }
+        return null;
+    }
+    
+    @SuppressWarnings("rawtypes")
+    public Set<Class> getManagedClasses() {
+        return null;
+    }
+    
+    public URL getSchemaLocation(String namespace) {
+        return getClass().getClassLoader().getResource("/schemas/clustering.xsd");
+    }
+
+}

Modified: cxf/branches/2.5.x-fixes/rt/core/src/main/resources/META-INF/spring.schemas
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/core/src/main/resources/META-INF/spring.schemas?rev=1341353&r1=1341352&r2=1341353&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/rt/core/src/main/resources/META-INF/spring.schemas (original)
+++ cxf/branches/2.5.x-fixes/rt/core/src/main/resources/META-INF/spring.schemas Tue May 22 08:49:40 2012
@@ -18,4 +18,5 @@
 #    under the License.
 #
 #
-http\://cxf.apache.org/schemas/core.xsd=schemas/core.xsd
\ No newline at end of file
+http\://cxf.apache.org/schemas/core.xsd=schemas/core.xsd
+http\://cxf.apache.org/schemas/clustering.xsd=schemas/clustering.xsd
\ No newline at end of file

Added: cxf/branches/2.5.x-fixes/rt/core/src/main/resources/OSGI-INF/blueprint/cxf-clustering.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/core/src/main/resources/OSGI-INF/blueprint/cxf-clustering.xml?rev=1341353&view=auto
==============================================================================
--- cxf/branches/2.5.x-fixes/rt/core/src/main/resources/OSGI-INF/blueprint/cxf-clustering.xml (added)
+++ cxf/branches/2.5.x-fixes/rt/core/src/main/resources/OSGI-INF/blueprint/cxf-clustering.xml Tue May 22 08:49:40 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/branches/2.5.x-fixes/rt/core/src/main/resources/schemas/clustering.xsd
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/core/src/main/resources/schemas/clustering.xsd?rev=1341353&view=auto
==============================================================================
--- cxf/branches/2.5.x-fixes/rt/core/src/main/resources/schemas/clustering.xsd (added)
+++ cxf/branches/2.5.x-fixes/rt/core/src/main/resources/schemas/clustering.xsd Tue May 22 08:49:40 2012
@@ -0,0 +1,80 @@
+<?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:tns="http://cxf.apache.org/clustering"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  targetNamespace="http://cxf.apache.org/clustering" 
+  elementFormDefault="qualified"
+  attributeFormDefault="unqualified"  >
+
+ <xsd:complexType name="identifiedType" abstract="true">
+    <xsd:attribute name="id" type="xsd:ID"/>
+  </xsd:complexType>
+  
+  <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="tns: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:extension>   
+      </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="tns: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

Modified: cxf/branches/2.5.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/failover.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/failover.xml?rev=1341353&r1=1341352&r2=1341353&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/failover.xml (original)
+++ cxf/branches/2.5.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/failover.xml Tue May 22 08:49:40 2012
@@ -23,6 +23,7 @@
        xmlns:clustering="http://cxf.apache.org/clustering"
        xsi:schemaLocation="
 http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
+http://cxf.apache.org/clustering http://cxf.apache.org/schemas/clustering.xsd
 http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
     
     <bean id="Sequential" class="org.apache.cxf.clustering.SequentialStrategy"/>

Modified: cxf/branches/2.5.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/failover_address_override.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/failover_address_override.xml?rev=1341353&r1=1341352&r2=1341353&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/failover_address_override.xml (original)
+++ cxf/branches/2.5.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/failover_address_override.xml Tue May 22 08:49:40 2012
@@ -24,6 +24,7 @@
        xmlns:util="http://www.springframework.org/schema/util"
        xsi:schemaLocation="
 http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
+http://cxf.apache.org/clustering http://cxf.apache.org/schemas/clustering.xsd
 http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
 http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
     <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>

Modified: cxf/branches/2.5.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/load_distributor.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/load_distributor.xml?rev=1341353&r1=1341352&r2=1341353&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/load_distributor.xml (original)
+++ cxf/branches/2.5.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/load_distributor.xml Tue May 22 08:49:40 2012
@@ -23,6 +23,7 @@
        xmlns:clustering="http://cxf.apache.org/clustering"
        xsi:schemaLocation="
 http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
+http://cxf.apache.org/clustering http://cxf.apache.org/schemas/clustering.xsd
 http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
     
     <bean id="Sequential" class="org.apache.cxf.systest.clustering.LoadDistributorSequentialStrategy"/>

Modified: cxf/branches/2.5.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/load_distributor_address_override.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/load_distributor_address_override.xml?rev=1341353&r1=1341352&r2=1341353&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/load_distributor_address_override.xml (original)
+++ cxf/branches/2.5.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/load_distributor_address_override.xml Tue May 22 08:49:40 2012
@@ -24,6 +24,7 @@
        xmlns:util="http://www.springframework.org/schema/util"
        xsi:schemaLocation="
 http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
+http://cxf.apache.org/clustering http://cxf.apache.org/schemas/clustering.xsd
 http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
 http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">