Author: eglynn
Date: Tue May 1 07:35:44 2007
New Revision: 534104
URL: http://svn.apache.org/viewvc?view=rev&rev=534104
Log:
Added <clustering:failover> feature as a convenient way of enabling failover by
installing the FailoverTargetSelector
Added:
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/clustering/FailoverFeature.java
(with props)
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/clustering/spring/
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/clustering/spring/FailoverBeanDefinitionParser.java
(with props)
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/clustering/spring/NamespaceHandler.java
(with props)
incubator/cxf/trunk/rt/core/src/main/resources/META-INF/spring.handlers
Modified:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/clustering/failover.xml
Added:
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/clustering/FailoverFeature.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/clustering/FailoverFeature.java?view=auto&rev=534104
==============================================================================
---
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/clustering/FailoverFeature.java
(added)
+++
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/clustering/FailoverFeature.java
Tue May 1 07:35:44 2007
@@ -0,0 +1,39 @@
+/**
+ * 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;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.endpoint.Client;
+import org.apache.cxf.feature.AbstractFeature;
+
+/**
+ * This feature may be applied to a Client so as to enable
+ * failover from the initial target endpoint to any other
+ * compatible endpoint for the target service.
+ */
+public class FailoverFeature extends AbstractFeature {
+
+ @Override
+ public void initialize(Client client, Bus bus) {
+ FailoverTargetSelector selector =
+ new FailoverTargetSelector();
+ selector.setEndpoint(client.getEndpoint());
+ client.setConduitSelector(selector);
+ }
+}
Propchange:
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/clustering/FailoverFeature.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/clustering/spring/FailoverBeanDefinitionParser.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/clustering/spring/FailoverBeanDefinitionParser.java?view=auto&rev=534104
==============================================================================
---
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/clustering/spring/FailoverBeanDefinitionParser.java
(added)
+++
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/clustering/spring/FailoverBeanDefinitionParser.java
Tue May 1 07:35:44 2007
@@ -0,0 +1,34 @@
+/**
+ * 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.spring;
+
+import org.w3c.dom.Element;
+
+import org.apache.cxf.clustering.FailoverFeature;
+
+import
org.springframework.beans.factory.xml.AbstractSimpleBeanDefinitionParser;
+
+public class FailoverBeanDefinitionParser extends
AbstractSimpleBeanDefinitionParser {
+
+ @Override
+ protected Class getBeanClass(Element arg0) {
+ return FailoverFeature.class;
+ }
+
+}
Propchange:
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/clustering/spring/FailoverBeanDefinitionParser.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/clustering/spring/NamespaceHandler.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/clustering/spring/NamespaceHandler.java?view=auto&rev=534104
==============================================================================
---
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/clustering/spring/NamespaceHandler.java
(added)
+++
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/clustering/spring/NamespaceHandler.java
Tue May 1 07:35:44 2007
@@ -0,0 +1,28 @@
+/**
+ * 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.spring;
+
+import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
+
+public class NamespaceHandler extends NamespaceHandlerSupport {
+ public void init() {
+ registerBeanDefinitionParser("failover",
+ new FailoverBeanDefinitionParser());
+ }
+}
Propchange:
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/clustering/spring/NamespaceHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/cxf/trunk/rt/core/src/main/resources/META-INF/spring.handlers
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/resources/META-INF/spring.handlers?view=auto&rev=534104
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/resources/META-INF/spring.handlers
(added)
+++ incubator/cxf/trunk/rt/core/src/main/resources/META-INF/spring.handlers Tue
May 1 07:35:44 2007
@@ -0,0 +1 @@
+http\://cxf.apache.org/clustering=org.apache.cxf.clustering.spring.NamespaceHandler
Modified:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/clustering/failover.xml
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/clustering/failover.xml?view=diff&rev=534104&r1=534103&r2=534104
==============================================================================
---
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/clustering/failover.xml
(original)
+++
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/clustering/failover.xml
Tue May 1 07:35:44 2007
@@ -20,27 +20,29 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws"
+ xmlns:clustering="http://cxf.apache.org/clustering"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
-
+
<jaxws:client id="{http://cxf.apache.org/greeter_control}ReplicatedPortA"
createdFromAPI="true">
- <jaxws:conduitSelector>
- <bean class="org.apache.cxf.clustering.FailoverTargetSelector"/>
- </jaxws:conduitSelector>
+ <jaxws:features>
+ <clustering:failover/>
+ </jaxws:features>
</jaxws:client>
<jaxws:client id="{http://cxf.apache.org/greeter_control}ReplicatedPortB"
createdFromAPI="true">
- <jaxws:conduitSelector>
- <bean class="org.apache.cxf.clustering.FailoverTargetSelector"/>
- </jaxws:conduitSelector>
+ <jaxws:features>
+ <clustering:failover/>
+ </jaxws:features>
</jaxws:client>
<jaxws:client id="{http://cxf.apache.org/greeter_control}ReplicatedPortC"
createdFromAPI="true">
- <jaxws:conduitSelector>
- <bean class="org.apache.cxf.clustering.FailoverTargetSelector"/>
- </jaxws:conduitSelector>
+ <jaxws:features>
+ <clustering:failover/>
+ </jaxws:features>
</jaxws:client>
+
</beans>