You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2009/10/16 22:00:24 UTC

svn commit: r826058 - in /cxf/branches/2.2.x-fixes: ./ rt/core/src/main/java/org/apache/cxf/service/factory/ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ rt/frontend/jaxws/src/test/...

Author: dkulp
Date: Fri Oct 16 20:00:23 2009
New Revision: 826058

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

........
  r826052 | dkulp | 2009-10-16 15:53:50 -0400 (Fri, 16 Oct 2009) | 5 lines
  
  [CXF-2311] Fix for this by making sure the client factories can be
  called multiple times and return new clients.   This allows the
  factories to not be prototype scope in spring config as well, but
  allows caching of some stuff (like methods and annotations and such)
  so subsequent create() calls are a bit faster.
........

Modified:
    cxf/branches/2.2.x-fixes/   (props changed)
    cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/service/factory/AbstractServiceFactoryBean.java
    cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
    cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java
    cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/AbstractJaxWsTest.java
    cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/CodeFirstTest.java
    cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/JaxWsClientTest.java
    cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/SEIWithJAXBAnnoTest.java
    cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/AnnotationInterceptorTest.java
    cxf/branches/2.2.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientFactoryBean.java
    cxf/branches/2.2.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java
    cxf/branches/2.2.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
    cxf/branches/2.2.x-fixes/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/RountripTest.java
    cxf/branches/2.2.x-fixes/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/ServerFactoryTest.java
    cxf/branches/2.2.x-fixes/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalTransportFactory.java

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

Modified: cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/service/factory/AbstractServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/service/factory/AbstractServiceFactoryBean.java?rev=826058&r1=826057&r2=826058&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/service/factory/AbstractServiceFactoryBean.java (original)
+++ cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/service/factory/AbstractServiceFactoryBean.java Fri Oct 16 20:00:23 2009
@@ -27,6 +27,8 @@
 import org.apache.cxf.service.Service;
 
 public abstract class AbstractServiceFactoryBean {
+    protected boolean dataBindingSet;
+
     private Bus bus;
     private DataBinding dataBinding;
     private Service service;
@@ -68,6 +70,7 @@
 
     public void setDataBinding(DataBinding dataBinding) {
         this.dataBinding = dataBinding;
+        this.dataBindingSet = dataBinding != null;
     }
 
     public Service getService() {

Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java?rev=826058&r1=826057&r2=826058&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java (original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java Fri Oct 16 20:00:23 2009
@@ -69,6 +69,7 @@
 import org.apache.cxf.endpoint.EndpointException;
 import org.apache.cxf.endpoint.ServiceContractResolverRegistry;
 import org.apache.cxf.feature.AbstractFeature;
+import org.apache.cxf.frontend.ClientProxy;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.jaxb.JAXBDataBinding;
 import org.apache.cxf.jaxws.binding.soap.JaxWsSoapBindingConfiguration;
@@ -451,7 +452,7 @@
         configureObject(service);
                 
         // Configure the JaxWsEndpoitnImpl
-        JaxWsEndpointImpl jaxwsEndpoint = (JaxWsEndpointImpl) clientFac.getClient().getEndpoint();
+        JaxWsEndpointImpl jaxwsEndpoint = (JaxWsEndpointImpl) ClientProxy.getClient(obj).getEndpoint();
         configureObject(jaxwsEndpoint);  
         List<Handler> hc = jaxwsEndpoint.getJaxwsBinding().getHandlerChain();
         

Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java?rev=826058&r1=826057&r2=826058&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java (original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java Fri Oct 16 20:00:23 2009
@@ -93,8 +93,9 @@
 
     private JaxWsImplementorInfo implInfo;
 
+    private List<WebServiceFeature> setWsFeatures;
     private List<WebServiceFeature> wsFeatures;
-
+    
     private boolean wrapperBeanGenerated;
     private Set<Class<?>> wrapperClasses;
     
@@ -115,6 +116,13 @@
         this.serviceClass = implInfo.getEndpointClass();
         loadWSFeatureAnnotation(implInfo.getSEIClass(), implInfo.getImplementorClass());
     }
+    
+    @Override
+    public void reset() {
+        super.reset();
+        wrapperBeanGenerated = false;
+        wrapperClasses = null;
+    }
 
     private void initSchemaLocations() {
         this.schemaLocationMapping.put(JAXWSAConstants.NS_WSA, 
@@ -155,6 +163,11 @@
 
         if (features.size() > 0) {
             wsFeatures = features;
+            if (setWsFeatures != null) {
+                wsFeatures.addAll(setWsFeatures);
+            }
+        } else {
+            wsFeatures = setWsFeatures;
         }
     }
 
@@ -428,11 +441,14 @@
     }
 
     public List<WebServiceFeature> getWsFeatures() {
-        return wsFeatures;
+        return setWsFeatures;
     }
 
-    public void setWsFeatures(List<WebServiceFeature> wsFeatures) {
-        this.wsFeatures = wsFeatures;
+    public void setWsFeatures(List<WebServiceFeature> swsFeatures) {
+        this.setWsFeatures = swsFeatures;
+        if (wsFeatures == null) {
+            wsFeatures = setWsFeatures;
+        }
     }
 
     private FaultInfo getFaultInfo(final OperationInfo operation, final Class expClass) {

Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/AbstractJaxWsTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/AbstractJaxWsTest.java?rev=826058&r1=826057&r2=826058&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/AbstractJaxWsTest.java (original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/AbstractJaxWsTest.java Fri Oct 16 20:00:23 2009
@@ -18,6 +18,9 @@
  */
 package org.apache.cxf.jaxws;
 
+import java.util.Arrays;
+import java.util.HashSet;
+
 import org.apache.cxf.BusFactory;
 import org.apache.cxf.binding.BindingFactoryManager;
 import org.apache.cxf.binding.soap.SoapBindingConstants;
@@ -66,6 +69,7 @@
         dfm.registerDestinationFactory("http://cxf.apache.org/transports/local", soapDF);
         
         localTransport = new LocalTransportFactory();
+        localTransport.setUriPrefixes(new HashSet<String>(Arrays.asList("http", "local")));
         dfm.registerDestinationFactory("http://schemas.xmlsoap.org/soap/http", localTransport);
         dfm.registerDestinationFactory("http://schemas.xmlsoap.org/wsdl/soap/http", localTransport);
         dfm.registerDestinationFactory("http://cxf.apache.org/bindings/xformat", localTransport);

Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/CodeFirstTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/CodeFirstTest.java?rev=826058&r1=826057&r2=826058&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/CodeFirstTest.java (original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/CodeFirstTest.java Fri Oct 16 20:00:23 2009
@@ -206,14 +206,14 @@
     public void testRpcClient() throws Exception {
         SayHiImpl serviceImpl = new SayHiImpl();
         EndpointImpl ep = new EndpointImpl(getBus(), serviceImpl, (String) null);
-        ep.publish("http://localhost:9090/hello");
+        ep.publish("local://localhost:9090/hello");
         
         QName serviceName = new QName("http://mynamespace.com/", "SayHiService");
         QName portName = new QName("http://mynamespace.com/", "HelloPort");
         
         // need to set the same bus with service , so use the ServiceImpl
         ServiceImpl service = new ServiceImpl(getBus(), (URL)null, serviceName, null);
-        service.addPort(portName, "http://schemas.xmlsoap.org/soap/", "http://localhost:9090/hello"); 
+        service.addPort(portName, "http://schemas.xmlsoap.org/soap/", "local://localhost:9090/hello"); 
         
         SayHi proxy = service.getPort(portName, SayHi.class);
         long res = proxy.sayHi(3);
@@ -274,7 +274,7 @@
     @Test
     public void testNamespacedWebParamsBare() throws Exception {
         JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();
-        sf.setAddress("http://localhost/test");
+        sf.setAddress("local://localhost/test");
         sf.setServiceClass(FooServiceImpl.class);
         
         Server server = sf.create();
@@ -291,7 +291,7 @@
     @Test
     public void testNamespacedWebParamsWrapped() throws Exception {
         JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();
-        sf.setAddress("http://localhost/test");
+        sf.setAddress("local://localhost/test");
         sf.setServiceBean(new FooServiceImpl());
         sf.getServiceFactory().setWrapped(true);
         

Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/JaxWsClientTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/JaxWsClientTest.java?rev=826058&r1=826057&r2=826058&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/JaxWsClientTest.java (original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/JaxWsClientTest.java Fri Oct 16 20:00:23 2009
@@ -29,7 +29,9 @@
 import javax.xml.ws.BindingProvider;
 import javax.xml.ws.WebServiceException;
 
+import org.apache.cxf.endpoint.Client;
 import org.apache.cxf.endpoint.ClientImpl;
+import org.apache.cxf.frontend.ClientProxy;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.jaxws.support.JaxWsEndpointImpl;
 import org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean;
@@ -215,6 +217,34 @@
 
     }
 
+    @Test
+    public void testClientProxyFactory() {
+        JaxWsProxyFactoryBean cf = new JaxWsProxyFactoryBean(); 
+        cf.setAddress("http://localhost:9000/test");
+        cf.setServiceClass(Greeter.class);
+        Greeter greeter = (Greeter) cf.create();
+        Greeter greeter2 = (Greeter) cf.create();
+        Greeter greeter3 = (Greeter) cf.create();
+        
+        Client c = ClientProxy.getClient(greeter);
+        Client c2 = ClientProxy.getClient(greeter2);
+        Client c3 = ClientProxy.getClient(greeter3);
+        assertNotSame(c, c2);
+        assertNotSame(c, c3);
+        assertNotSame(c3, c2);
+        assertNotSame(c.getEndpoint(), c2.getEndpoint());
+        assertNotSame(c.getEndpoint(), c3.getEndpoint());
+        assertNotSame(c3.getEndpoint(), c2.getEndpoint());
+        
+        ((BindingProvider)greeter).getRequestContext().put("test", "manny"); 
+        ((BindingProvider)greeter2).getRequestContext().put("test", "moe"); 
+        ((BindingProvider)greeter3).getRequestContext().put("test", "jack");
+        
+        assertEquals("manny", ((BindingProvider)greeter).getRequestContext().get("test"));
+        assertEquals("moe", ((BindingProvider)greeter2).getRequestContext().get("test"));
+        assertEquals("jack", ((BindingProvider)greeter3).getRequestContext().get("test"));
+    }
+    
     
     public static class FaultThrower extends AbstractPhaseInterceptor<Message> {
         

Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/SEIWithJAXBAnnoTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/SEIWithJAXBAnnoTest.java?rev=826058&r1=826057&r2=826058&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/SEIWithJAXBAnnoTest.java (original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/SEIWithJAXBAnnoTest.java Fri Oct 16 20:00:23 2009
@@ -26,6 +26,7 @@
 import javax.xml.ws.Endpoint;
 
 import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.apache.cxf.frontend.ClientProxy;
 import org.apache.cxf.interceptor.LoggingOutInterceptor;
 import org.apache.cxf.jaxws.service.AddNumbers;
 import org.apache.cxf.jaxws.service.AddNumbersImpl;
@@ -33,14 +34,14 @@
 
 
 public class SEIWithJAXBAnnoTest extends AbstractJaxWsTest {
-    String address = "http://localhost:9000/Hello";
+    String address = "local://localhost:9000/Hello";
 
     
     @Test
     public void testXMLList() throws Exception {
         
         AddNumbersImpl serviceImpl = new AddNumbersImpl();
-        Endpoint.publish("http://localhost:9000/Hello", serviceImpl);
+        Endpoint.publish("local://localhost:9000/Hello", serviceImpl);
         
         
      
@@ -53,7 +54,7 @@
         AddNumbers proxy = (AddNumbers)factory.create();
         StringWriter strWriter = new StringWriter();
         LoggingOutInterceptor log = new LoggingOutInterceptor(new PrintWriter(strWriter));
-        factory.getClientFactoryBean().getClient().getOutInterceptors().add(log);
+        ClientProxy.getClient(proxy).getOutInterceptors().add(log);
         
         List<String> args = new ArrayList<String>();
         args.add("str1");

Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/AnnotationInterceptorTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/AnnotationInterceptorTest.java?rev=826058&r1=826057&r2=826058&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/AnnotationInterceptorTest.java (original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/AnnotationInterceptorTest.java Fri Oct 16 20:00:23 2009
@@ -45,11 +45,11 @@
     @Before
     public void setUp() {
         fb = new ServerFactoryBean();
-        fb.setAddress("http://localhost");
+        fb.setAddress("local://localhost");
         fb.setBus(getBus());
         
         jfb = new JaxWsServerFactoryBean();
-        jfb.setAddress("http://localhost");
+        jfb.setAddress("local://localhost");
         jfb.setBus(getBus());
     }
     

Modified: cxf/branches/2.2.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientFactoryBean.java?rev=826058&r1=826057&r2=826058&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientFactoryBean.java (original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientFactoryBean.java Fri Oct 16 20:00:23 2009
@@ -22,18 +22,15 @@
 
 import org.apache.cxf.BusException;
 import org.apache.cxf.configuration.security.AuthorizationPolicy;
-import org.apache.cxf.databinding.DataBinding;
 import org.apache.cxf.endpoint.Client;
 import org.apache.cxf.endpoint.ClientImpl;
 import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.endpoint.EndpointException;
 import org.apache.cxf.feature.AbstractFeature;
-import org.apache.cxf.jaxb.JAXBDataBinding;
 import org.apache.cxf.service.factory.ReflectionServiceFactoryBean;
 import org.apache.cxf.service.factory.ServiceConstructionException;
 
 public class ClientFactoryBean extends AbstractWSDLBasedEndpointFactory {
-    private Client client;
 
     public ClientFactoryBean() {
         this(new ReflectionServiceFactoryBean());
@@ -43,30 +40,33 @@
     }
 
     public Client create() {
-
-        if (client != null) {
-            return client;
+        getServiceFactory().reset();
+        if (getServiceFactory().getProperties() == null) {
+            getServiceFactory().setProperties(properties);
+        } else if (properties != null) {
+            getServiceFactory().getProperties().putAll(properties);
         }
-        applyExtraClass();
+        Client client = null;
         try {
             Endpoint ep = createEndpoint();
             applyProperties(ep);
-            createClient(ep);
+            client = createClient(ep);
             initializeAnnotationInterceptors(ep, getServiceClass());
         } catch (EndpointException e) {
             throw new ServiceConstructionException(e);
         } catch (BusException e) {
             throw new ServiceConstructionException(e);
         }
-        applyFeatures();
+        applyFeatures(client);
         return client;
     }
 
-    protected void createClient(Endpoint ep) {
-        client = new ClientImpl(getBus(), ep, getConduitSelector());
+    protected Client createClient(Endpoint ep) {
+        Client client = new ClientImpl(getBus(), ep, getConduitSelector());
+        return client;
     }
 
-    protected void applyFeatures() {
+    protected void applyFeatures(Client client) {
         if (getFeatures() != null) {
             for (AbstractFeature feature : getFeatures()) {
                 feature.initialize(client, getBus());
@@ -74,18 +74,6 @@
         }
     }
 
-    protected void applyExtraClass() {
-        Map props = this.getProperties();
-        if (props != null && props.get("jaxb.additionalContextClasses") != null) {
-            Class[] extraClass = (Class[])this.getProperties().get("jaxb.additionalContextClasses");
-            DataBinding dataBinding = getServiceFactory().getDataBinding();
-            if (dataBinding instanceof JAXBDataBinding) {
-                ((JAXBDataBinding)dataBinding).setExtraClass(extraClass);
-            }
-        }
-    }
-
-
     protected void applyProperties(Endpoint ep) {
         //Apply the AuthorizationPolicy to the endpointInfo
         Map props = this.getProperties();
@@ -95,11 +83,4 @@
         }
     }
 
-    public Client getClient() {
-        return client;
-    }
-
-    public void setClient(Client client) {
-        this.client = client;
-    }
 }

Modified: cxf/branches/2.2.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java?rev=826058&r1=826057&r2=826058&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java (original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java Fri Oct 16 20:00:23 2009
@@ -19,30 +19,19 @@
 package org.apache.cxf.frontend;
 
 import java.io.IOException;
-import java.net.URL;
-import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
-import java.util.logging.Logger;
 
-import javax.xml.transform.dom.DOMSource;
-import org.w3c.dom.Document;
 
 import org.apache.cxf.BusException;
-import org.apache.cxf.common.i18n.Message;
-import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.ClassHelper;
-import org.apache.cxf.databinding.AbstractDataBinding;
 import org.apache.cxf.databinding.DataBinding;
 import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.endpoint.EndpointException;
 import org.apache.cxf.endpoint.Server;
 import org.apache.cxf.endpoint.ServerImpl;
 import org.apache.cxf.feature.AbstractFeature;
-import org.apache.cxf.helpers.DOMUtils;
 import org.apache.cxf.jaxb.JAXBDataBinding;
-import org.apache.cxf.resource.ResourceManager;
-import org.apache.cxf.resource.URIResolver;
 import org.apache.cxf.service.factory.ReflectionServiceFactoryBean;
 import org.apache.cxf.service.factory.ServiceConstructionException;
 import org.apache.cxf.service.invoker.BeanInvoker;
@@ -82,8 +71,6 @@
  * </pre>
  */
 public class ServerFactoryBean extends AbstractWSDLBasedEndpointFactory {
-    private static final Logger LOG = LogUtils.getL7dLogger(ServerFactoryBean.class);
-
     private Server server;
     private boolean start = true;
     private Object serviceBean;
@@ -103,7 +90,11 @@
 
     public Server create() {
         try {
-            applyExtraClass();
+            if (getServiceFactory().getProperties() == null) {
+                getServiceFactory().setProperties(getProperties());
+            } else if (getProperties() != null) {
+                getServiceFactory().getProperties().putAll(getProperties());
+            }
             if (serviceBean != null && getServiceClass() == null) {
                 setServiceClass(ClassHelper.getRealClass(serviceBean));
             }
@@ -155,41 +146,7 @@
     @Override
     protected void initializeServiceFactory() {
         super.initializeServiceFactory();
-
-        DataBinding db = getServiceFactory().getDataBinding();
-        if (db instanceof AbstractDataBinding && schemaLocations != null) {
-            ResourceManager rr = getBus().getExtension(ResourceManager.class);
-
-            List<DOMSource> schemas = new ArrayList<DOMSource>();
-            for (String l : schemaLocations) {
-                URL url = rr.resolveResource(l, URL.class);
-
-                if (url == null) {
-                    URIResolver res;
-                    try {
-                        res = new URIResolver(l);
-                    } catch (IOException e) {
-                        throw new ServiceConstructionException(new Message("INVALID_SCHEMA_URL", LOG), e);
-                    }
-
-                    if (!res.isResolved()) {
-                        throw new ServiceConstructionException(new Message("INVALID_SCHEMA_URL", LOG));
-                    }
-                    url = res.getURL();
-                }
-
-                Document d;
-                try {
-                    d = DOMUtils.readXml(url.openStream());
-                } catch (Exception e) {
-                    throw new ServiceConstructionException(
-                        new Message("ERROR_READING_SCHEMA", LOG, l), e);
-                }
-                schemas.add(new DOMSource(d, url.toString()));
-            }
-
-            ((AbstractDataBinding)db).setSchemas(schemas);
-        }
+        getServiceFactory().setSchemaLocations(schemaLocations);
     }
 
     protected void applyFeatures() {

Modified: cxf/branches/2.2.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java?rev=826058&r1=826057&r2=826058&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java (original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java Fri Oct 16 20:00:23 2009
@@ -19,6 +19,7 @@
 
 package org.apache.cxf.service.factory;
 
+import java.io.IOException;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Array;
 import java.lang.reflect.Field;
@@ -51,9 +52,11 @@
 import javax.xml.bind.annotation.XmlMimeType;
 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
 import javax.xml.namespace.QName;
+import javax.xml.transform.dom.DOMSource;
 
 import org.w3c.dom.DOMError;
 import org.w3c.dom.DOMErrorHandler;
+import org.w3c.dom.Document;
 
 import org.apache.cxf.BusException;
 import org.apache.cxf.binding.BindingFactoryManager;
@@ -66,6 +69,7 @@
 import org.apache.cxf.common.xmlschema.SchemaCollection;
 import org.apache.cxf.common.xmlschema.XmlSchemaUtils;
 import org.apache.cxf.common.xmlschema.XmlSchemaValidationManager;
+import org.apache.cxf.databinding.AbstractDataBinding;
 import org.apache.cxf.databinding.DataBinding;
 import org.apache.cxf.databinding.source.mime.MimeAttribute;
 import org.apache.cxf.databinding.source.mime.MimeSerializer;
@@ -78,12 +82,14 @@
 import org.apache.cxf.frontend.MethodDispatcher;
 import org.apache.cxf.frontend.SimpleMethodDispatcher;
 import org.apache.cxf.helpers.CastUtils;
+import org.apache.cxf.helpers.DOMUtils;
 import org.apache.cxf.helpers.MethodComparator;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.interceptor.FaultOutInterceptor;
 import org.apache.cxf.jaxb.JAXBDataBinding;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.resource.ResourceManager;
+import org.apache.cxf.resource.URIResolver;
 import org.apache.cxf.service.Service;
 import org.apache.cxf.service.ServiceImpl;
 import org.apache.cxf.service.ServiceModelSchemaValidator;
@@ -171,6 +177,7 @@
     private Map<Method, Boolean> isRpcCache = new HashMap<Method, Boolean>();
     private String styleCache;
     private Boolean defWrappedCache;
+    private List<String> schemaLocations;
     
     public ReflectionServiceFactoryBean() {
         getServiceConfigurations().add(0, new DefaultServiceConfiguration());
@@ -186,6 +193,9 @@
     
      
     protected DataBinding createDefaultDataBinding() {
+        
+        DataBinding retVal = null;
+        
         if (getServiceClass() != null) {
             org.apache.cxf.annotations.DataBinding db 
                 = getServiceClass().getAnnotation(org.apache.cxf.annotations.DataBinding.class);
@@ -195,18 +205,67 @@
                         return getBus().getExtension(ResourceManager.class).resolveResource(db.ref(),
                                                                                             db.value());
                     }
-                    return db.value().newInstance();
+                    retVal = db.value().newInstance();
                 } catch (Exception e) {
                     LOG.log(Level.WARNING, "Could not create databinding " 
                             + db.value().getName(), e);
                 }
             }
         }
-        return new JAXBDataBinding(getQualifyWrapperSchema());
+        if (retVal == null) {
+            JAXBDataBinding db = new JAXBDataBinding(getQualifyWrapperSchema());
+            Map props = this.getProperties();
+            if (props != null && props.get("jaxb.additionalContextClasses") != null) {
+                Class[] extraClass = (Class[])this.getProperties().get("jaxb.additionalContextClasses");
+                db.setExtraClass(extraClass);
+            }
+            retVal = db;
+        }
+        if (retVal instanceof AbstractDataBinding && schemaLocations != null) {
+            ResourceManager rr = getBus().getExtension(ResourceManager.class);
+
+            List<DOMSource> schemas = new ArrayList<DOMSource>();
+            for (String l : schemaLocations) {
+                URL url = rr.resolveResource(l, URL.class);
+
+                if (url == null) {
+                    URIResolver res;
+                    try {
+                        res = new URIResolver(l);
+                    } catch (IOException e) {
+                        throw new ServiceConstructionException(new Message("INVALID_SCHEMA_URL", LOG), e);
+                    }
+
+                    if (!res.isResolved()) {
+                        throw new ServiceConstructionException(new Message("INVALID_SCHEMA_URL", LOG));
+                    }
+                    url = res.getURL();
+                }
+
+                Document d;
+                try {
+                    d = DOMUtils.readXml(url.openStream());
+                } catch (Exception e) {
+                    throw new ServiceConstructionException(
+                        new Message("ERROR_READING_SCHEMA", LOG, l), e);
+                }
+                schemas.add(new DOMSource(d, url.toString()));
+            }
+
+            ((AbstractDataBinding)retVal).setSchemas(schemas);
+        }
+        return retVal;
     }
-    
+    public void reset() {
+        if (!dataBindingSet) {
+            setDataBinding(null);
+        }
+        setService(null);
+    }
+
     @Override
     public Service create() {
+        reset();
         initializeServiceConfigurations();
 
         initializeServiceModel();
@@ -235,6 +294,9 @@
         return getService();
     }
 
+
+
+
     /**
      * Code elsewhere in this function will fill in the name of the type of an
      * element but not the reference to the type. This function fills in the
@@ -2385,4 +2447,8 @@
     public void setValidate(boolean validate) {
         this.validate = validate;
     }
+
+    public void setSchemaLocations(List<String> schemaLocations) {
+        this.schemaLocations = schemaLocations;
+    }
 }

Modified: cxf/branches/2.2.x-fixes/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/RountripTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/RountripTest.java?rev=826058&r1=826057&r2=826058&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/RountripTest.java (original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/RountripTest.java Fri Oct 16 20:00:23 2009
@@ -22,6 +22,7 @@
 
 import org.apache.cxf.endpoint.ClientImpl;
 import org.apache.cxf.frontend.ClientFactoryBean;
+import org.apache.cxf.frontend.ClientProxy;
 import org.apache.cxf.frontend.ClientProxyFactoryBean;
 import org.apache.cxf.frontend.ServerFactoryBean;
 import org.apache.cxf.interceptor.LoggingInInterceptor;
@@ -53,7 +54,7 @@
         
         HelloService client = (HelloService) proxyFactory.create();
         
-        ClientImpl c = (ClientImpl) clientBean.getClient();
+        ClientImpl c = (ClientImpl)ClientProxy.getClient(client);
         c.getOutInterceptors().add(new LoggingOutInterceptor());
         c.getInInterceptors().add(new LoggingInInterceptor());
         

Modified: cxf/branches/2.2.x-fixes/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/ServerFactoryTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/ServerFactoryTest.java?rev=826058&r1=826057&r2=826058&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/ServerFactoryTest.java (original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/ServerFactoryTest.java Fri Oct 16 20:00:23 2009
@@ -24,6 +24,7 @@
 import java.util.List;
 import java.util.Map;
 
+import org.apache.cxf.endpoint.Server;
 import org.apache.cxf.endpoint.ServerImpl;
 import org.apache.cxf.frontend.ServerFactoryBean;
 import org.apache.cxf.jaxb.JAXBDataBinding;
@@ -70,8 +71,9 @@
         props.put("jaxb.additionalContextClasses", 
                   new Class[] {GreetMe.class, GreetMeOneWay.class});
         svrBean.setProperties(props);
-        svrBean.create();
-        Class[] extraClass = ((JAXBDataBinding)svrBean.getServiceFactory().getDataBinding()).getExtraClass();
+        Server serv = svrBean.create();
+        Class[] extraClass = ((JAXBDataBinding)serv.getEndpoint().getService()
+                .getDataBinding()).getExtraClass();
         assertEquals(extraClass.length, 2);
         assertEquals(extraClass[0], GreetMe.class);
         assertEquals(extraClass[1], GreetMeOneWay.class);

Modified: cxf/branches/2.2.x-fixes/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalTransportFactory.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalTransportFactory.java?rev=826058&r1=826057&r2=826058&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalTransportFactory.java (original)
+++ cxf/branches/2.2.x-fixes/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalTransportFactory.java Fri Oct 16 20:00:23 2009
@@ -64,6 +64,7 @@
 
     private Set<String> messageFilterProperties;
     private Set<String> messageIncludeProperties;
+    private Set<String> uriPrefixes = URI_PREFIXES;
     
     public LocalTransportFactory() {
         super();
@@ -132,7 +133,10 @@
     }
 
     public Set<String> getUriPrefixes() {
-        return URI_PREFIXES;
+        return uriPrefixes;
+    }
+    public void setUriPrefixes(Set<String> s) {
+        uriPrefixes = s;
     }
 
     public Set<String> getMessageFilterProperties() {