cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ajaypai...@apache.org
Subject svn commit: r532442 - in /incubator/cxf/trunk: rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/ rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/feature/ rt/bindings/coloc/src/test/java/org/apache/cxf/binding/coloc/ systests/sr...
Date Wed, 25 Apr 2007 19:13:37 GMT
Author: ajaypaibir
Date: Wed Apr 25 12:13:36 2007
New Revision: 532442

URL: http://svn.apache.org/viewvc?view=rev&rev=532442
Log:
Adding ColocFeature to configure the coloc out interceptors on a client.

Added:
    incubator/cxf/trunk/rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/feature/
    incubator/cxf/trunk/rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/feature/ColocFeature.java
  (with props)
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/coloc/coloc_rpc.xml
  (with props)
Modified:
    incubator/cxf/trunk/rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/ColocMessageObserver.java
    incubator/cxf/trunk/rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/ColocOutInterceptor.java
    incubator/cxf/trunk/rt/bindings/coloc/src/test/java/org/apache/cxf/binding/coloc/ColocMessageObserverTest.java
    incubator/cxf/trunk/rt/bindings/coloc/src/test/java/org/apache/cxf/binding/coloc/ColocOutInterceptorTest.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/coloc/ColocHeaderRpcLitTest.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/coloc/cxf.xml

Modified: incubator/cxf/trunk/rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/ColocMessageObserver.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/ColocMessageObserver.java?view=diff&rev=532442&r1=532441&r2=532442
==============================================================================
--- incubator/cxf/trunk/rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/ColocMessageObserver.java
(original)
+++ incubator/cxf/trunk/rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/ColocMessageObserver.java
Wed Apr 25 12:13:36 2007
@@ -28,6 +28,7 @@
 import org.apache.cxf.Bus;
 import org.apache.cxf.binding.Binding;
 import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.interceptor.Interceptor;
 import org.apache.cxf.interceptor.InterceptorChain;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.ExchangeImpl;
@@ -82,6 +83,7 @@
         List<Phase> phases = new ArrayList<Phase>(bus.getExtension(PhaseManager.class).getInPhases());
         ColocUtil.setPhases(phases, Phase.USER_LOGICAL, Phase.INVOKE);
         InterceptorChain chain = ColocUtil.getInInterceptorChain(ex, phases);
+        chain.add(addColocInterceptors());
         inMsg.setInterceptorChain(chain);
 
         chain.doIntercept(inMsg);
@@ -115,5 +117,11 @@
         exchange.put(BindingInfo.class, bi);
         exchange.put(BindingOperationInfo.class, boi);
         exchange.put(OperationInfo.class, boi.getOperationInfo());
+    }
+    
+    protected List<Interceptor> addColocInterceptors() {
+        List<Interceptor> list = new ArrayList<Interceptor>();
+        list.add(new ColocInInterceptor());
+        return list;
     }
 }

Modified: incubator/cxf/trunk/rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/ColocOutInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/ColocOutInterceptor.java?view=diff&rev=532442&r1=532441&r2=532442
==============================================================================
--- incubator/cxf/trunk/rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/ColocOutInterceptor.java
(original)
+++ incubator/cxf/trunk/rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/ColocOutInterceptor.java
Wed Apr 25 12:13:36 2007
@@ -53,16 +53,23 @@
     private static final Logger LOG = LogUtils.getL7dLogger(ClientImpl.class);
     private static final String COLOCATED = Message.class.getName() + ".COLOCATED";
     private MessageObserver colocObserver;
+    private Bus bus; 
     
     public ColocOutInterceptor() {
         super();
         setPhase(Phase.POST_LOGICAL);
     }
 
+    public void setBus(Bus bus) {
+        this.bus = bus; 
+    }
+    
     public void handleMessage(Message message) throws Fault {
-        Bus bus = BusFactory.getDefaultBus(false);
         if (bus == null) {
-            throw new Fault(new org.apache.cxf.common.i18n.Message("BUS_NOT_FOUND", BUNDLE));
+            bus = BusFactory.getDefaultBus(false);
+            if (bus == null) {
+                throw new Fault(new org.apache.cxf.common.i18n.Message("BUS_NOT_FOUND", BUNDLE));
+            }
         }
         
         ServerRegistry registry = bus.getExtension(ServerRegistry.class);
@@ -99,7 +106,7 @@
             message.put(COLOCATED, Boolean.TRUE);
             message.put(Message.WSDL_OPERATION, boi.getName());
             message.put(Message.WSDL_INTERFACE, boi.getBinding().getInterface().getName());
-            invokeColocObserver(message, srv.getEndpoint(), bus);
+            invokeColocObserver(message, srv.getEndpoint());
             if (!exchange.isOneWay()) {
                 invokeInboundChain(exchange, senderEndpoint);
             }
@@ -112,7 +119,7 @@
         }
     }
     
-    protected void invokeColocObserver(Message outMsg, Endpoint inboundEndpoint, Bus bus)
{
+    protected void invokeColocObserver(Message outMsg, Endpoint inboundEndpoint) {
         if (colocObserver == null) {
             colocObserver = new ColocMessageObserver(inboundEndpoint, bus);
         }
@@ -136,7 +143,6 @@
         inMsg.put(Message.INBOUND_MESSAGE, Boolean.TRUE);
         inMsg.setExchange(ex);
         
-        Bus bus = ex.get(Bus.class);        
         Exception exc = inMsg.getContent(Exception.class);
         if (exc != null) {
             ex.setInFaultMessage(inMsg);

Added: incubator/cxf/trunk/rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/feature/ColocFeature.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/feature/ColocFeature.java?view=auto&rev=532442
==============================================================================
--- incubator/cxf/trunk/rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/feature/ColocFeature.java
(added)
+++ incubator/cxf/trunk/rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/feature/ColocFeature.java
Wed Apr 25 12:13:36 2007
@@ -0,0 +1,37 @@
+/**
+ * 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.binding.coloc.feature;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.binding.coloc.ColocInInterceptor;
+import org.apache.cxf.binding.coloc.ColocOutInterceptor;
+import org.apache.cxf.feature.AbstractFeature;
+import org.apache.cxf.interceptor.InterceptorProvider;
+
+public class ColocFeature extends AbstractFeature {
+    private static final ColocOutInterceptor COLOC_OUT = new ColocOutInterceptor();
+    private static final ColocInInterceptor COLOC_IN = new ColocInInterceptor();
+    
+    @Override
+    protected void initializeProvider(InterceptorProvider provider, Bus bus) {
+        COLOC_OUT.setBus(bus);
+        provider.getInInterceptors().add(COLOC_IN);
+        provider.getOutInterceptors().add(COLOC_OUT);
+    }
+}

Propchange: incubator/cxf/trunk/rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/feature/ColocFeature.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/feature/ColocFeature.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/cxf/trunk/rt/bindings/coloc/src/test/java/org/apache/cxf/binding/coloc/ColocMessageObserverTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/coloc/src/test/java/org/apache/cxf/binding/coloc/ColocMessageObserverTest.java?view=diff&rev=532442&r1=532441&r2=532442
==============================================================================
--- incubator/cxf/trunk/rt/bindings/coloc/src/test/java/org/apache/cxf/binding/coloc/ColocMessageObserverTest.java
(original)
+++ incubator/cxf/trunk/rt/bindings/coloc/src/test/java/org/apache/cxf/binding/coloc/ColocMessageObserverTest.java
Wed Apr 25 12:13:36 2007
@@ -19,6 +19,7 @@
 package org.apache.cxf.binding.coloc;
 
 import java.util.ArrayList;
+import java.util.List;
 
 import javax.xml.namespace.QName;
 
@@ -160,6 +161,10 @@
             exchange.put(Endpoint.class, ep);
             exchange.put(Service.class, srv);
             exchange.put(OperationInfo.class, oi);
+        }
+        
+        protected List<Interceptor> addColocInterceptors() {
+            return new ArrayList<Interceptor>();
         }
     }
 }

Modified: incubator/cxf/trunk/rt/bindings/coloc/src/test/java/org/apache/cxf/binding/coloc/ColocOutInterceptorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/coloc/src/test/java/org/apache/cxf/binding/coloc/ColocOutInterceptorTest.java?view=diff&rev=532442&r1=532441&r2=532442
==============================================================================
--- incubator/cxf/trunk/rt/bindings/coloc/src/test/java/org/apache/cxf/binding/coloc/ColocOutInterceptorTest.java
(original)
+++ incubator/cxf/trunk/rt/bindings/coloc/src/test/java/org/apache/cxf/binding/coloc/ColocOutInterceptorTest.java
Wed Apr 25 12:13:36 2007
@@ -70,6 +70,7 @@
 
     @After
     public void tearDown() throws Exception {
+        colocOut.setBus(null);
         BusFactory.setDefaultBus(null);
     }
 
@@ -217,6 +218,7 @@
         //Reset Exchange on msg
         msg.setExchange(null);
         Bus bus = setupBus();
+        colocOut.setBus(bus);
         PhaseManager pm = new PhaseManagerImpl();
         EasyMock.expect(bus.getExtension(PhaseManager.class)).andReturn(pm).times(2);
 
@@ -416,7 +418,7 @@
     }
     
     class TestColocOutInterceptor1 extends ColocOutInterceptor {
-        public void invokeColocObserver(Message outMsg, Endpoint inboundEndpoint, Bus bus)
{
+        public void invokeColocObserver(Message outMsg, Endpoint inboundEndpoint) {
             //No Op
         }
         

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/coloc/ColocHeaderRpcLitTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/coloc/ColocHeaderRpcLitTest.java?view=diff&rev=532442&r1=532441&r2=532442
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/coloc/ColocHeaderRpcLitTest.java
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/coloc/ColocHeaderRpcLitTest.java
Wed Apr 25 12:13:36 2007
@@ -29,6 +29,10 @@
 
     private Log logger = LogFactory.getLog(ColocHeaderRpcLitTest.class);
 
+    protected String getCxfConfig() {
+        return "org/apache/cxf/systest/coloc/coloc_rpc.xml";
+    }
+
     protected Log getLogger() {
         return logger;
     }

Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/coloc/coloc_rpc.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/coloc/coloc_rpc.xml?view=auto&rev=532442
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/coloc/coloc_rpc.xml
(added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/coloc/coloc_rpc.xml
Wed Apr 25 12:13:36 2007
@@ -0,0 +1,62 @@
+<?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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:http="http://cxf.apache.org/transports/http/configuration"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:jaxws="http://cxf.apache.org/jaxws"
+       xsi:schemaLocation="
+http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schema/transports/http.xsd
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
+<!--
+    <bean id="org.apache.cxf.ws.policy.PolicyEngine" class="org.apache.cxf.ws.policy.spring.InitializingPolicyEngine">
+        <property name="bus" ref="cxf"/>
+        <property name="enabled" value="true"/>
+    </bean>
+    <wsp:Policy wsu:Id="AddressingPolicy"
+    xmlns:wsp="http://www.w3.org/2006/07/ws-policy"
+    xmlns:coloc="http://cxf.apache.org/binding/coloc">
+    <coloc:EnableColoc wsp:Optional="true">
+     </wsp:Policy>
+    <bean class="org.apache.cxf.ws.policy.attachment.external.ExternalAttachmentProvider">
+        <constructor-arg ref="cxf"/>
+        <property name="location" value="org/apache/cxf/systest/coloc/coloc-external.xml"/>
+    </bean>
+-->
+    <bean id="faultOutbound" class="org.apache.cxf.systest.coloc.ThrowFaultInterceptor"/>
+
+    <!-- Adding interceptors to the bus will add it to all services/endpoints-->
+    <bean id="cxf" class="org.apache.cxf.bus.CXFBusImpl">
+        <property name="outInterceptors">
+            <list>
+                <ref bean="faultOutbound"/>
+            </list>
+        </property>
+    </bean>
+
+    <jaxws:client id="{http://apache.org/headers/rpc_lit}SoapPort"
+                  createdFromAPI="true">
+        <jaxws:features>
+            <bean class="org.apache.cxf.binding.coloc.feature.ColocFeature"/>
+        </jaxws:features>
+        <jaxws:conduitSelector>
+            <bean class="org.apache.cxf.endpoint.DeferredConduitSelector"/>
+        </jaxws:conduitSelector>
+    </jaxws:client>
+</beans>
\ No newline at end of file

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/coloc/coloc_rpc.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/coloc/coloc_rpc.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/coloc/coloc_rpc.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/coloc/cxf.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/coloc/cxf.xml?view=diff&rev=532442&r1=532441&r2=532442
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/coloc/cxf.xml (original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/coloc/cxf.xml Wed Apr
25 12:13:36 2007
@@ -62,51 +62,29 @@
     </http:conduit>
     -->
 
-    <!-- Logging Interceptor-->
-    <bean id="logInbound" class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
-    <bean id="logOutbound" class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
-
     <!-- Coloc Interceptor-->
-    <bean id="colocInbound" class="org.apache.cxf.binding.coloc.ColocInInterceptor"/>
     <bean id="colocOutbound" class="org.apache.cxf.binding.coloc.ColocOutInterceptor"/>
     <bean id="faultOutbound" class="org.apache.cxf.systest.coloc.ThrowFaultInterceptor"/>
 
     <!-- Adding interceptors to the bus will add it to all services/endpoints-->
     <bean id="cxf" class="org.apache.cxf.bus.CXFBusImpl">
-        <property name="inInterceptors">
-            <list>
-                <ref bean="logInbound"/>
-                <ref bean="colocInbound"/>
-            </list>
-        </property>
-        <property name="inFaultInterceptors">
-            <list>
-                <ref bean="logInbound"/>
-            </list>
-        </property>
         <property name="outInterceptors">
             <list>
-                <ref bean="logOutbound"/>
                 <ref bean="colocOutbound"/>
                 <ref bean="faultOutbound"/>
             </list>
         </property>
-        <property name="outFaultInterceptors">
-            <list>
-                <ref bean="logOutbound"/>
-            </list>
-        </property>
     </bean>
 
     <!-- Avoid upfront Conduit creation, as client-side transport resources
          are not required in the coloc case -->
-    <jaxws:client id="{http://apache.org/headers/rpc_lit}SoapPort" 
+    <jaxws:client id="{http://apache.org/headers/rpc_lit}SoapPort"
                   createdFromAPI="true">
         <jaxws:conduitSelector>
             <bean class="org.apache.cxf.endpoint.DeferredConduitSelector"/>
         </jaxws:conduitSelector>
     </jaxws:client>
-    <jaxws:client id="{http://apache.org/headers/doc_lit}SoapPort9000" 
+    <jaxws:client id="{http://apache.org/headers/doc_lit}SoapPort9000"
                   createdFromAPI="true">
         <jaxws:conduitSelector>
             <bean class="org.apache.cxf.endpoint.DeferredConduitSelector"/>



Mime
View raw message