cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1067215 - in /cxf/branches/2.3.x-fixes: ./ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/ rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/ rt/frontend/simple/s...
Date Fri, 04 Feb 2011 16:35:35 GMT
Author: dkulp
Date: Fri Feb  4 16:35:35 2011
New Revision: 1067215

URL: http://svn.apache.org/viewvc?rev=1067215&view=rev
Log:
Merged revisions 1067214 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1067214 | dkulp | 2011-02-04 11:29:38 -0500 (Fri, 04 Feb 2011) | 3 lines
  
  [CXF-3310] Move the configureObject call for the ProxyFactory into the
  proxy factory so the ProxyFactory api's can be used with configured
  objects.
........

Modified:
    cxf/branches/2.3.x-fixes/   (props changed)
    cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientFactoryBean.java
    cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsProxyFactoryBean.java
    cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
    cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/JaxWsProxyFactoryBeanDefinitionParser.java
    cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/SpringBeansTest.java
    cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/clients.xml
    cxf/branches/2.3.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientProxyFactoryBean.java
    cxf/branches/2.3.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/spring/ClientProxyFactoryBeanDefinitionParser.java

Propchange: cxf/branches/2.3.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientFactoryBean.java?rev=1067215&r1=1067214&r2=1067215&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientFactoryBean.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientFactoryBean.java
Fri Feb  4 16:35:35 2011
@@ -25,6 +25,7 @@ import javax.xml.ws.soap.SOAPBinding;
 import org.apache.cxf.binding.soap.SoapBindingConfiguration;
 import org.apache.cxf.frontend.ClientFactoryBean;
 import org.apache.cxf.jaxws.binding.soap.JaxWsSoapBindingConfiguration;
+import org.apache.cxf.jaxws.support.JaxWsImplementorInfo;
 import org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean;
 
 /**
@@ -36,7 +37,14 @@ public class JaxWsClientFactoryBean exte
     public JaxWsClientFactoryBean() {
         super(new JaxWsServiceFactoryBean());
     }
-    
+    public void setServiceClass(Class serviceClass) {
+        super.setServiceClass(serviceClass);
+        if (((JaxWsServiceFactoryBean)getServiceFactory()).getJaxWsImplementorInfo() == null)
{
+            JaxWsImplementorInfo implInfo = new JaxWsImplementorInfo(serviceClass);
+            ((JaxWsServiceFactoryBean)getServiceFactory()).setJaxWsImplementorInfo(implInfo);
+        }
+    }
+
     protected SoapBindingConfiguration createSoapBindingConfig() {
         JaxWsSoapBindingConfiguration bc  
             = new JaxWsSoapBindingConfiguration((JaxWsServiceFactoryBean)getServiceFactory());

Modified: cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsProxyFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsProxyFactoryBean.java?rev=1067215&r1=1067214&r2=1067215&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsProxyFactoryBean.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsProxyFactoryBean.java
Fri Feb  4 16:35:35 2011
@@ -22,6 +22,7 @@ import java.lang.reflect.Proxy;
 import java.util.ArrayList;
 import java.util.List;
 
+import javax.xml.namespace.QName;
 import javax.xml.ws.BindingProvider;
 import javax.xml.ws.handler.Handler;
 
@@ -65,6 +66,14 @@ public class JaxWsProxyFactoryBean exten
     public JaxWsProxyFactoryBean(ClientFactoryBean fact) {
         super(fact);
     }
+    protected String getConfiguredName() {
+        QName name = getEndpointName();
+        if (name == null) {
+            JaxWsServiceFactoryBean sfb = (JaxWsServiceFactoryBean)getClientFactoryBean().getServiceFactory();
+            name = sfb.getJaxWsImplementorInfo().getEndpointName();
+        }
+        return name + ".jaxws-client.proxyFactory";
+    }
 
     /**
      * Specifies a list of JAX-WS Handler implementations that are to be 

Modified: cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java?rev=1067215&r1=1067214&r2=1067215&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
Fri Feb  4 16:35:35 2011
@@ -456,7 +456,7 @@ public class ServiceImpl extends Service
             clientFac.setBindingId(portInfo.getBindingID());
             clientFac.setAddress(portInfo.getAddress());
         }
-        configureObject(portName.toString() + ".jaxws-client.proxyFactory", proxyFac);
+        //configureObject(portName.toString() + ".jaxws-client.proxyFactory", proxyFac);
         if (clazz != ServiceImpl.class) {
             // handlerchain should be on the generated Service object
             proxyFac.setLoadHandlers(false);

Modified: cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/JaxWsProxyFactoryBeanDefinitionParser.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/JaxWsProxyFactoryBeanDefinitionParser.java?rev=1067215&r1=1067214&r2=1067215&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/JaxWsProxyFactoryBeanDefinitionParser.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/JaxWsProxyFactoryBeanDefinitionParser.java
Fri Feb  4 16:35:35 2011
@@ -73,6 +73,10 @@ public class JaxWsProxyFactoryBeanDefini
                 setBus(bus);
             }
         }
+        public Object create() {
+            configured = true;
+            return super.create();
+        }
         public synchronized Object getObject() throws Exception {
             if (obj == null) {
                 obj = create();

Modified: cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/SpringBeansTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/SpringBeansTest.java?rev=1067215&r1=1067214&r2=1067215&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/SpringBeansTest.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/SpringBeansTest.java
Fri Feb  4 16:35:35 2011
@@ -43,6 +43,7 @@ import org.apache.cxf.configuration.spri
 import org.apache.cxf.databinding.DataBinding;
 import org.apache.cxf.databinding.source.SourceDataBinding;
 import org.apache.cxf.endpoint.Client;
+import org.apache.cxf.endpoint.ClientImpl;
 import org.apache.cxf.endpoint.NullConduitSelector;
 import org.apache.cxf.frontend.ClientProxy;
 import org.apache.cxf.interceptor.Interceptor;
@@ -369,5 +370,25 @@ public class SpringBeansTest extends Ass
         Greeter g2 = greeters.getGreet2();
         assertNotSame(g1, g2);
     }
+    @Test
+    public void testClientFromFactory() throws Exception {
+        AbstractFactoryBeanDefinitionParser.setFactoriesAreAbstract(false);
+        ClassPathXmlApplicationContext ctx =
+            new ClassPathXmlApplicationContext(new String[] {"/org/apache/cxf/jaxws/spring/clients.xml"});
+
+        
+        JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
+        
+        Greeter g = factory.create(Greeter.class);
+        ClientImpl c = (ClientImpl)ClientProxy.getClient(g);
+        for (Interceptor<? extends Message> i : c.getInInterceptors()) {
+            if (i instanceof LoggingInInterceptor) {
+                ctx.close();
+                return;
+            }
+        }
+        fail("Did not configure the client");
+    }
 
 }
+

Modified: cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/clients.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/clients.xml?rev=1067215&r1=1067214&r2=1067215&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/clients.xml
(original)
+++ cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/clients.xml
Fri Feb  4 16:35:35 2011
@@ -88,4 +88,14 @@ http://cxf.apache.org/jaxws http://cxf.a
 			<soap:soapBinding mtomEnabled="true" version="1.2" />
 		</jaxws:binding>
 	</jaxws:client>
+
+	<jaxws:client name="{http://apache.org/hello_world_soap_http}GreeterPort"
+        serviceClass="org.apache.hello_world_soap_http.Greeter" serviceName="s:SOAPService"
+        endpointName="s:SoapPort" xmlns:s="http://apache.org/hello_world_soap_http"
+        address="http://localhost:8080/simpleWithAddress" wsdlLocation="wsdl/hello_world.wsdl"

+        createdFromAPI="true">
+        <jaxws:inInterceptors>
+            <bean class="org.apache.cxf.interceptor.LoggingInInterceptor" />
+        </jaxws:inInterceptors>
+    </jaxws:client>
 </beans>

Modified: cxf/branches/2.3.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientProxyFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientProxyFactoryBean.java?rev=1067215&r1=1067214&r2=1067215&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientProxyFactoryBean.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientProxyFactoryBean.java
Fri Feb  4 16:35:35 2011
@@ -27,8 +27,10 @@ import java.util.Map;
 import javax.xml.namespace.QName;
 
 import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
 import org.apache.cxf.binding.BindingConfiguration;
 import org.apache.cxf.common.injection.NoJSR250Annotations;
+import org.apache.cxf.configuration.Configurer;
 import org.apache.cxf.configuration.security.AuthorizationPolicy;
 import org.apache.cxf.databinding.DataBinding;
 import org.apache.cxf.endpoint.Client;
@@ -53,6 +55,7 @@ import org.apache.cxf.service.factory.Re
  */
 @NoJSR250Annotations
 public class ClientProxyFactoryBean extends AbstractBasicInterceptorProvider {
+    protected boolean configured;
     private ClientFactoryBean clientFactoryBean;
     private String username;
     private String password;
@@ -85,6 +88,28 @@ public class ClientProxyFactoryBean exte
         setServiceClass(serviceClass);
         return serviceClass.cast(create());
     }
+    private void configureObject() {
+        if (configured) {
+            return;
+        }
+        if (bus == null) {
+            bus = BusFactory.getThreadDefaultBus();
+        }
+        Configurer configurer = bus.getExtension(Configurer.class);
+        String name = getConfiguredName();
+        if (null != configurer && name != null) {
+            configurer.configureBean(name, this);
+        }
+        configured = true;
+    }
+    
+    protected String getConfiguredName() {
+        QName name = getEndpointName();
+        if (name == null) {
+            return null;
+        }
+        return name.toString() + ".client.proxyFactory";
+    }
 
     /**
      * Creates a proxy object that can be used to make remote invocations.
@@ -92,6 +117,8 @@ public class ClientProxyFactoryBean exte
      * @return the proxy. You must cast the returned object to the appropriate class before
using it.
      */
     public Object create() {
+        configureObject();
+        
         if (properties == null) {
             properties = new HashMap<String, Object>();
         }
@@ -215,7 +242,11 @@ public class ClientProxyFactoryBean exte
     }
 
     public QName getEndpointName() {
-        return clientFactoryBean.getEndpointName();
+        QName qn = clientFactoryBean.getEndpointName();
+        if (qn == null) {
+            qn = clientFactoryBean.getServiceFactory().getEndpointName(false);
+        }
+        return qn;
     }
 
     public void setEndpointName(QName endpointName) {

Modified: cxf/branches/2.3.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/spring/ClientProxyFactoryBeanDefinitionParser.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/spring/ClientProxyFactoryBeanDefinitionParser.java?rev=1067215&r1=1067214&r2=1067215&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/spring/ClientProxyFactoryBeanDefinitionParser.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/spring/ClientProxyFactoryBeanDefinitionParser.java
Fri Feb  4 16:35:35 2011
@@ -111,6 +111,10 @@ public class ClientProxyFactoryBeanDefin
                 setBus(bus);
             }
         }
+        public Object create() {
+            configured = true;
+            return super.create();
+        }
         public synchronized Object getObject() throws Exception {
             if (obj == null) {
                 obj = create();



Mime
View raw message