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

svn commit: r659686 - in /cxf/trunk/rt: core/src/main/java/org/apache/cxf/endpoint/ databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/ frontend/jaxws/src/main/java/org/apache/cxf/jaxws/endpoint/ frontend/jaxws/src/main/java/org/apache/cxf/...

Author: bimargulies
Date: Fri May 23 15:10:21 2008
New Revision: 659686

URL: http://svn.apache.org/viewvc?rev=659686&view=rev
Log:
Add a dynamic client that is full JAX-WS.

Added:
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/EndpointImplFactory.java   (with props)
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/SimpleEndpointImplFactory.java   (with props)
    cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/endpoint/
    cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/endpoint/dynamic/
    cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/endpoint/dynamic/DynamicClientFactory.java   (with props)
    cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImplFactory.java   (with props)
    cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/endpoint/
    cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/endpoint/dynamic/
Modified:
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
    cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java?rev=659686&r1=659685&r2=659686&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java Fri May 23 15:10:21 2008
@@ -94,14 +94,34 @@
     }
 
     public ClientImpl(URL wsdlUrl) {
-        this(BusFactory.getThreadDefaultBus(), wsdlUrl, null, null);
+        this(BusFactory.getThreadDefaultBus(), wsdlUrl, null, null, SimpleEndpointImplFactory.getSingleton());
     }
     
     public ClientImpl(URL wsdlUrl, QName port) {
-        this(BusFactory.getThreadDefaultBus(), wsdlUrl, null, port);
+        this(BusFactory.getThreadDefaultBus(), wsdlUrl, null, port, SimpleEndpointImplFactory.getSingleton());
     }
 
+    /**
+     * Create a Client that uses the default EndpointImpl.
+     * @param bus
+     * @param wsdlUrl
+     * @param service
+     * @param port
+     */
     public ClientImpl(Bus bus, URL wsdlUrl, QName service, QName port) {
+        this(bus, wsdlUrl, service, port, SimpleEndpointImplFactory.getSingleton());
+    }
+
+    /**
+     * Create a Client that uses a specific EndpointImpl.
+     * @param bus
+     * @param wsdlUrl
+     * @param service
+     * @param port
+     * @param endpointImplFactory
+     */
+    public ClientImpl(Bus bus, URL wsdlUrl, QName service, 
+                      QName port, EndpointImplFactory endpointImplFactory) {
         this.bus = bus;
         
         WSDLServiceFactory sf = (service == null)

Added: cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/EndpointImplFactory.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/EndpointImplFactory.java?rev=659686&view=auto
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/EndpointImplFactory.java (added)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/EndpointImplFactory.java Fri May 23 15:10:21 2008
@@ -0,0 +1,40 @@
+/**
+ * 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.endpoint;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.service.Service;
+import org.apache.cxf.service.model.EndpointInfo;
+
+/**
+ * This interface defines an object that can create EndpointImpl
+ * objects. 
+ */
+public interface EndpointImplFactory {
+    /**
+     * Create an EndpointImpl from a bus, service, and endpoint info.
+     * @param bus
+     * @param service
+     * @param endpointInfo
+     * @return
+     */
+    EndpointImpl newEndpointImpl(Bus bus, Service service, 
+                                 EndpointInfo endpointInfo) throws EndpointException;
+}

Propchange: cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/EndpointImplFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/EndpointImplFactory.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/SimpleEndpointImplFactory.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/SimpleEndpointImplFactory.java?rev=659686&view=auto
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/SimpleEndpointImplFactory.java (added)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/SimpleEndpointImplFactory.java Fri May 23 15:10:21 2008
@@ -0,0 +1,51 @@
+/**
+ * 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.endpoint;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.service.Service;
+import org.apache.cxf.service.model.EndpointInfo;
+
+/**
+ * Create ordinary EndpointImpl objects.
+ */
+public class SimpleEndpointImplFactory implements EndpointImplFactory {
+    
+    private static EndpointImplFactory singleton 
+        = new SimpleEndpointImplFactory();
+
+    /** {@inheritDoc}
+     */
+    public EndpointImpl newEndpointImpl(Bus bus, 
+                                        Service service, EndpointInfo endpointInfo) throws EndpointException {
+        return new EndpointImpl(bus, service, endpointInfo);
+    }
+
+    /**
+     * Avoid the need to contruct these objects over and over
+     * in cases where the code knows that it needs the basic
+     * case.
+     * @return
+     */
+    public static EndpointImplFactory getSingleton() {
+        return singleton;
+    }
+    
+}

Propchange: cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/SimpleEndpointImplFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/SimpleEndpointImplFactory.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java?rev=659686&r1=659685&r2=659686&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java (original)
+++ cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java Fri May 23 15:10:21 2008
@@ -65,6 +65,8 @@
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.endpoint.Client;
 import org.apache.cxf.endpoint.ClientImpl;
+import org.apache.cxf.endpoint.EndpointImplFactory;
+import org.apache.cxf.endpoint.SimpleEndpointImplFactory;
 import org.apache.cxf.helpers.FileUtils;
 import org.apache.cxf.jaxb.JAXBDataBinding;
 import org.apache.cxf.resource.URIResolver;
@@ -76,7 +78,7 @@
  * 
  *
  */
-public final class DynamicClientFactory {
+public class DynamicClientFactory {
 
     private static final Logger LOG = LogUtils.getL7dLogger(DynamicClientFactory.class);
 
@@ -88,9 +90,13 @@
     
     private Map<String, Object> jaxbContextProperties;
     
-    private DynamicClientFactory(Bus bus) {
+    protected DynamicClientFactory(Bus bus) {
         this.bus = bus;
     }
+    
+    protected EndpointImplFactory getEndpointImplFactory() {
+        return SimpleEndpointImplFactory.getSingleton();
+    }
 
     public void setTemporaryDirectory(String dir) {
         tmpdir = dir;
@@ -156,7 +162,8 @@
         }
         URL u = composeUrl(wsdlUrl);
         LOG.log(Level.FINE, "Creating client from URL " + u.toString());
-        ClientImpl client = new ClientImpl(bus, u, service, port);
+        ClientImpl client = new ClientImpl(bus, u, service, port,
+                                           getEndpointImplFactory());
 
         Service svc = client.getEndpoint().getService();
         //all SI's should have the same schemas

Added: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/endpoint/dynamic/DynamicClientFactory.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/endpoint/dynamic/DynamicClientFactory.java?rev=659686&view=auto
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/endpoint/dynamic/DynamicClientFactory.java (added)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/endpoint/dynamic/DynamicClientFactory.java Fri May 23 15:10:21 2008
@@ -0,0 +1,62 @@
+/**
+ * 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.jaxws.endpoint.dynamic;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.bus.CXFBusFactory;
+import org.apache.cxf.endpoint.EndpointImplFactory;
+import org.apache.cxf.jaxws.support.JaxWsEndpointImplFactory;
+
+/**
+ * This class creates dynamic clients with JAX-WS endpoints.
+ */
+public class DynamicClientFactory extends org.apache.cxf.endpoint.dynamic.DynamicClientFactory {
+
+    protected DynamicClientFactory(Bus bus) {
+        super(bus);
+    }
+
+    @Override
+    protected EndpointImplFactory getEndpointImplFactory() {
+        return JaxWsEndpointImplFactory.getSingleton();
+    }
+    
+    /**
+     * Create a new instance using a specific <tt>Bus</tt>.
+     * 
+     * @param b the <tt>Bus</tt> to use in subsequent operations with the
+     *            instance
+     * @return the new instance
+     */
+    public static DynamicClientFactory newInstance(Bus b) {
+        return new DynamicClientFactory(b);
+    }
+
+    /**
+     * Create a new instance using a default <tt>Bus</tt>.
+     * 
+     * @return the new instance
+     * @see CXFBusFactory#getDefaultBus()
+     */
+    public static DynamicClientFactory newInstance() {
+        Bus bus = CXFBusFactory.getThreadDefaultBus();
+        return new DynamicClientFactory(bus);
+    }
+}

Propchange: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/endpoint/dynamic/DynamicClientFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/endpoint/dynamic/DynamicClientFactory.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImplFactory.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImplFactory.java?rev=659686&view=auto
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImplFactory.java (added)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImplFactory.java Fri May 23 15:10:21 2008
@@ -0,0 +1,46 @@
+/**
+ * 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.jaxws.support;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.endpoint.EndpointException;
+import org.apache.cxf.endpoint.EndpointImpl;
+import org.apache.cxf.endpoint.EndpointImplFactory;
+import org.apache.cxf.service.Service;
+import org.apache.cxf.service.model.EndpointInfo;
+
+/**
+ * 
+ */
+public class JaxWsEndpointImplFactory implements EndpointImplFactory {
+    
+    private static JaxWsEndpointImplFactory singleton = new JaxWsEndpointImplFactory();
+
+    /** {@inheritDoc}*/
+    public EndpointImpl newEndpointImpl(Bus bus, Service service, EndpointInfo endpointInfo)
+        throws EndpointException {
+        return new JaxWsEndpointImpl(bus, service, endpointInfo);
+    }
+
+    public static EndpointImplFactory getSingleton() {
+        return singleton;
+    }
+
+}

Propchange: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImplFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImplFactory.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date