cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r464472 - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/binding/ api/src/main/java/org/apache/cxf/service/model/ rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/ rt/bindings/soap/src/main/resources/META-INF/ rt/bindin...
Date Mon, 16 Oct 2006 12:54:29 GMT
Author: ningjiang
Date: Mon Oct 16 05:54:27 2006
New Revision: 464472

URL: http://svn.apache.org/viewvc?view=rev&rev=464472
Log:
[JIRA CXF-18] PhaseTow: Implemented BindingInfoFactoryBeanManager to load the BingInfoFactoryBean
just like BingFactoryManager. 
Moved AbstractBindingInfoFactoryBean.java form frontend/simple to api 
Moved SoapBindingInfoFactoryBean.java form frontend/simple to SoapBinding
Added XMLBindingInfoFactoryBean.java for creating XMLBinding in codefirst mode.

Added:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/binding/BindingInfoFactoryBeanManager.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/AbstractBindingInfoFactoryBean.java
  (contents, props changed)
      - copied, changed from r464370, incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/AbstractBindingInfoFactoryBean.java
    incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingInfoFactoryBean.java
  (contents, props changed)
      - copied, changed from r464370, incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/SoapBindingInfoFactoryBean.java
    incubator/cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/XMLBindingInfoFactoryBean.java
  (with props)
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/BindingInfoFactoryBeanManagerImpl.java
Removed:
    incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/AbstractBindingInfoFactoryBean.java
    incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/SoapBindingInfoFactoryBean.java
Modified:
    incubator/cxf/trunk/rt/bindings/soap/src/main/resources/META-INF/bus-extensions.xml
    incubator/cxf/trunk/rt/bindings/soap/src/main/resources/META-INF/cxf/cxf-extension.xml
    incubator/cxf/trunk/rt/bindings/xml/src/main/resources/META-INF/bus-extensions.xml
    incubator/cxf/trunk/rt/bindings/xml/src/main/resources/META-INF/cxf/cxf-extension.xml
    incubator/cxf/trunk/rt/core/src/main/resources/META-INF/bus-extensions.xml
    incubator/cxf/trunk/rt/core/src/main/resources/META-INF/cxf/cxf.xml
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
    incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ServerFactoryBean.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/dispatch/DispatchClientServerTest.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerXMLWrapTest.java

Added: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/binding/BindingInfoFactoryBeanManager.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/binding/BindingInfoFactoryBeanManager.java?view=auto&rev=464472
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/binding/BindingInfoFactoryBeanManager.java
(added)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/binding/BindingInfoFactoryBeanManager.java
Mon Oct 16 05:54:27 2006
@@ -0,0 +1,58 @@
+/**
+ * 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;
+
+import org.apache.cxf.BusException;
+import org.apache.cxf.service.model.AbstractBindingInfoFactoryBean;
+
+/**
+ * The manager interface represents a repository for accessing 
+ * <code>BindingInfoFactoryBean</code>s.
+ *
+ * Provides methods necessary for registering, deregistering or retrieving of
+ * BindingFactoryBean.
+ */
+public interface BindingInfoFactoryBeanManager {
+
+    /**
+     * Registers a BindingInfoFactoryBean using the provided name.
+     *
+     * @param name The BindingURI of the AbstractBindingInfoFactoryBean.
+     * @param bindInfoFactoryBean The instance of the class that implements the
+     * BindingFactory interface.
+     */
+    void registerBindingInfoFactoryBean(String name, AbstractBindingInfoFactoryBean bindInfoFactoryBean);
+    
+    /**
+     * Deregisters the BindingInfoFactoryBean with the provided name.
+     *
+     * @param name The name of the BindingInfoFactoryBean.
+     */
+    void unregisterBindingInfoFactoryBean(String name);
+
+    /**
+     * Retrieves the BindingInfoFactoryBean registered with the given name.
+     *
+     * @param name The name of the BindingInfoFactoryBean.
+     * @return BindingInfoFactoryBean The registered BindingFactory.
+     * @throws BusException If there is an error retrieving the BindingInfoFactoryBean.
+     */
+    AbstractBindingInfoFactoryBean getBindingInfoFactoryBean(String name) throws BusException;
+}

Copied: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/AbstractBindingInfoFactoryBean.java
(from r464370, incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/AbstractBindingInfoFactoryBean.java)
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/AbstractBindingInfoFactoryBean.java?view=diff&rev=464472&p1=incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/AbstractBindingInfoFactoryBean.java&r1=464370&p2=incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/AbstractBindingInfoFactoryBean.java&r2=464472
==============================================================================
--- incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/AbstractBindingInfoFactoryBean.java
(original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/AbstractBindingInfoFactoryBean.java
Mon Oct 16 05:54:27 2006
@@ -16,37 +16,26 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.cxf.service.factory;
+package org.apache.cxf.service.model;
 
-import org.apache.cxf.service.model.BindingInfo;
-import org.apache.cxf.service.model.ServiceInfo;
+import org.apache.cxf.service.Service;
 
 /**
  * An AbstractBindingFactory builds a binding for a Service.
  */
 public abstract class AbstractBindingInfoFactoryBean {
-    private AbstractServiceFactoryBean serviceFactory;
-    private ServiceInfo serviceInfo;
+    //private AbstractServiceFactoryBean serviceFactory;
+    private Service service;
     
     public abstract BindingInfo create();
-
-    public void setServiceFactory(AbstractServiceFactoryBean serviceFactory) {
-        this.serviceFactory = serviceFactory;
-    }
-
-    public AbstractServiceFactoryBean getServiceFactory() {
-        return serviceFactory;
-    }
     
-    public void setServiceInfo(ServiceInfo si) {
-        this.serviceInfo = si;
+    public abstract String getTransportURI();
+       
+    public void setService(Service si) {
+        this.service = si;
     }
 
-    protected ServiceInfo getServiceInfo() {
-        if (null != serviceInfo) {
-            return serviceInfo;
-        } else {
-            return getServiceFactory().getService().getServiceInfo();
-        }    
+    protected ServiceInfo getServiceInfo() {        
+        return service.getServiceInfo();        
     }
 }

Propchange: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/AbstractBindingInfoFactoryBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/AbstractBindingInfoFactoryBean.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Copied: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingInfoFactoryBean.java
(from r464370, incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/SoapBindingInfoFactoryBean.java)
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingInfoFactoryBean.java?view=diff&rev=464472&p1=incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/SoapBindingInfoFactoryBean.java&r1=464370&p2=incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingInfoFactoryBean.java&r2=464472
==============================================================================
--- incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/SoapBindingInfoFactoryBean.java
(original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingInfoFactoryBean.java
Mon Oct 16 05:54:27 2006
@@ -16,14 +16,19 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.cxf.service.factory;
+package org.apache.cxf.binding.soap;
 
+import java.util.Collection;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.Resource;
 import javax.xml.namespace.QName;
 
-import org.apache.cxf.binding.soap.Soap11;
-import org.apache.cxf.binding.soap.SoapVersion;
+import org.apache.cxf.Bus;
+import org.apache.cxf.binding.BindingInfoFactoryBeanManager;
 import org.apache.cxf.binding.soap.model.SoapBindingInfo;
 import org.apache.cxf.binding.soap.model.SoapOperationInfo;
+import org.apache.cxf.service.model.AbstractBindingInfoFactoryBean;
 import org.apache.cxf.service.model.BindingInfo;
 import org.apache.cxf.service.model.BindingOperationInfo;
 import org.apache.cxf.service.model.OperationInfo;
@@ -33,6 +38,31 @@
     private SoapVersion soapVersion = Soap11.getInstance();
     private String style = "document";
     private String use;
+    private Bus bus;
+    private Collection<String> activationNamespaces;    
+    
+    @Resource
+    public void setBus(Bus b) {
+        bus = b;
+    }
+    
+    @Resource
+    public void setActivationNamespaces(Collection<String> ans) {
+        activationNamespaces = ans;
+    }
+    
+    @PostConstruct
+    void register() {
+        if (null == bus) {
+            return;
+        }        
+        BindingInfoFactoryBeanManager bfm = bus.getExtension(BindingInfoFactoryBeanManager.class);
+        if (null != bfm) {
+            for (String ns : activationNamespaces) {
+                bfm.registerBindingInfoFactoryBean(ns, this);
+            }
+        }
+    }
     
     @Override
     public BindingInfo create() {
@@ -63,7 +93,7 @@
         return "";
     }
 
-    protected String getTransportURI() {
+    public String getTransportURI() {
         return "http://schemas.xmlsoap.org/wsdl/soap/http";
     }
 

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

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

Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/resources/META-INF/bus-extensions.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/resources/META-INF/bus-extensions.xml?view=diff&rev=464472&r1=464471&r2=464472
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/main/resources/META-INF/bus-extensions.xml (original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/resources/META-INF/bus-extensions.xml Mon
Oct 16 05:54:27 2006
@@ -20,11 +20,21 @@
 <extensions xmlns="http://cxf.apache.org/bus/extension">
 
     <extension class="org.apache.cxf.binding.soap.SoapBindingFactory" deferred="true">
+        <namespace>http://schemas.xmlsoap.org/soap/</namespace>
         <namespace>http://schemas.xmlsoap.org/wsdl/soap/</namespace>
         <namespace>http://schemas.xmlsoap.org/wsdl/soap/http</namespace>
         <namespace>http://cxf.apache.org/transports/jms</namespace>
         <namespace>http://www.w3.org/2003/05/soap/bindings/HTTP/</namespace>
         <namespace>http://schemas.xmlsoap.org/wsdl/soap12/</namespace>
+    </extension>
+    
+     <extension class="org.apache.cxf.binding.soap.SoapBindingInfoFactoryBean" deferred="true">
+        <namespace>http://schemas.xmlsoap.org/soap/</namespace>
+        <namespace>http://schemas.xmlsoap.org/wsdl/soap/</namespace>      
+        <namespace>http://schemas.xmlsoap.org/wsdl/soap/http</namespace>
+        <namespace>http://cxf.apache.org/transports/jms</namespace>
+        <namespace>http://www.w3.org/2003/05/soap/bindings/HTTP/</namespace>
+        <namespace>http://schemas.xmlsoap.org/wsdl/soap12/</namespace>      
 
     </extension>
     
     <extension class="org.apache.cxf.binding.soap.SoapDestinationFactory" 

Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/resources/META-INF/cxf/cxf-extension.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/resources/META-INF/cxf/cxf-extension.xml?view=diff&rev=464472&r1=464471&r2=464472
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/main/resources/META-INF/cxf/cxf-extension.xml
(original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/resources/META-INF/cxf/cxf-extension.xml
Mon Oct 16 05:54:27 2006
@@ -41,6 +41,19 @@
         </property>
     </bean>
     
+    <bean class="org.apache.cxf.binding.soap.SoapBindingInfoFactoryBean" lazy-init="true">
+    	<property name="bus">
+            <ref bean="cxf"/>
+        </property>
+        <property name="activationNamespaces">
+            <set> 
+                <value>http://schemas.xmlsoap.org/soap/</value>             

+                <value>http://schemas.xmlsoap.org/wsdl/soap/</value>
+                <value>http://schemas.xmlsoap.org/wsdl/soap/http</value>    
          
+            </set>
+        </property>
+    </bean>
+    
     <bean class="org.apache.cxf.binding.soap.SoapDestinationFactory" lazy-init="true">
         <property name="bus">
             <ref bean="cxf"/>

Added: incubator/cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/XMLBindingInfoFactoryBean.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/XMLBindingInfoFactoryBean.java?view=auto&rev=464472
==============================================================================
--- incubator/cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/XMLBindingInfoFactoryBean.java
(added)
+++ incubator/cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/XMLBindingInfoFactoryBean.java
Mon Oct 16 05:54:27 2006
@@ -0,0 +1,87 @@
+/**
+ * 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.xml;
+
+import java.util.Collection;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.Resource;
+import javax.xml.namespace.QName;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.binding.BindingInfoFactoryBeanManager;
+import org.apache.cxf.service.model.AbstractBindingInfoFactoryBean;
+import org.apache.cxf.service.model.BindingInfo;
+import org.apache.cxf.service.model.BindingOperationInfo;
+import org.apache.cxf.service.model.OperationInfo;
+import org.apache.cxf.service.model.ServiceInfo;
+
+public class XMLBindingInfoFactoryBean extends AbstractBindingInfoFactoryBean {
+    private Bus bus;
+    private Collection<String> activationNamespaces; 
+    
+    @Resource
+    public void setBus(Bus b) {
+        bus = b;
+    }
+    
+    @Resource
+    public void setActivationNamespaces(Collection<String> ans) {
+        activationNamespaces = ans;
+    }
+    
+    @PostConstruct
+    void register() {
+        if (null == bus) {
+            return;
+        }
+        BindingInfoFactoryBeanManager bfm = bus.getExtension(BindingInfoFactoryBeanManager.class);
+        if (null != bfm) {
+            for (String ns : activationNamespaces) {
+                bfm.registerBindingInfoFactoryBean(ns, this);
+            }
+        }
+    }
+
+    @Override
+    public BindingInfo create() {
+        ServiceInfo si = getServiceInfo();
+        BindingInfo info = new BindingInfo(si, "http://cxf.apache.org/bindings/xformat");
       
+        info.setName(getBindingName());              
+        for (OperationInfo op : si.getInterface().getOperations()) {                    
  
+            BindingOperationInfo bop = 
+                info.buildOperation(op.getName(), op.getInputName(), op.getOutputName());
+            info.addOperation(bop);
+        }
+        
+        return info;
+    }
+    
+    protected QName getBindingName() {
+        ServiceInfo si = getServiceInfo();
+        return new QName(si.getName().getNamespaceURI(), 
+                         si.getName().getLocalPart() + "XMLBinding");
+    }
+
+    @Override
+    public String getTransportURI() {        
+        return "http://cxf.apache.org/bindings/xformat";
+    }
+
+}

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

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

Modified: incubator/cxf/trunk/rt/bindings/xml/src/main/resources/META-INF/bus-extensions.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/xml/src/main/resources/META-INF/bus-extensions.xml?view=diff&rev=464472&r1=464471&r2=464472
==============================================================================
--- incubator/cxf/trunk/rt/bindings/xml/src/main/resources/META-INF/bus-extensions.xml (original)
+++ incubator/cxf/trunk/rt/bindings/xml/src/main/resources/META-INF/bus-extensions.xml Mon
Oct 16 05:54:27 2006
@@ -23,4 +23,8 @@
         <namespace>http://cxf.apache.org/bindings/xformat</namespace>       
     </extension>
     
+    <extension class="org.apache.cxf.binding.xml.XMLBindingInfoFactoryBean" deferred="true">
+        <namespace>http://cxf.apache.org/bindings/xformat</namespace>       
+    </extension>
+    
 </extensions>

Modified: incubator/cxf/trunk/rt/bindings/xml/src/main/resources/META-INF/cxf/cxf-extension.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/xml/src/main/resources/META-INF/cxf/cxf-extension.xml?view=diff&rev=464472&r1=464471&r2=464472
==============================================================================
--- incubator/cxf/trunk/rt/bindings/xml/src/main/resources/META-INF/cxf/cxf-extension.xml
(original)
+++ incubator/cxf/trunk/rt/bindings/xml/src/main/resources/META-INF/cxf/cxf-extension.xml
Mon Oct 16 05:54:27 2006
@@ -31,4 +31,13 @@
             </set>
         </property>
     </bean>
+    
+    <bean class="org.apache.cxf.binding.xml.XMLBindingInfoFactoryBean" lazy-init="true">
+        <property name="bus" ref="cxf"/>
+        <property name="activationNamespaces">
+            <set>
+                <value>http://cxf.apache.org/bindings/xformat</value>
+            </set>
+        </property>
+    </bean>
 </beans>

Added: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/BindingInfoFactoryBeanManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/BindingInfoFactoryBeanManagerImpl.java?view=auto&rev=464472
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/BindingInfoFactoryBeanManagerImpl.java
(added)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/BindingInfoFactoryBeanManagerImpl.java
Mon Oct 16 05:54:27 2006
@@ -0,0 +1,113 @@
+/**
+ * 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;
+
+import java.util.Map;
+import java.util.Properties;
+import java.util.ResourceBundle;
+import java.util.concurrent.ConcurrentHashMap;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.Resource;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusException;
+import org.apache.cxf.common.i18n.BundleUtils;
+import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.extension.ExtensionManager;
+import org.apache.cxf.service.model.AbstractBindingInfoFactoryBean;
+
+public class BindingInfoFactoryBeanManagerImpl implements BindingInfoFactoryBeanManager {
+    private static final ResourceBundle BUNDLE = 
+        BundleUtils.getBundle(BindingInfoFactoryBeanManagerImpl.class);
+    
+    final Map<String, AbstractBindingInfoFactoryBean> bindingInfoFactoryBeans;
+    Properties factoryNamespaceMappings;       
+    ExtensionManager extensionManager;
+    Bus bus;
+    
+    public BindingInfoFactoryBeanManagerImpl() throws BusException {
+        bindingInfoFactoryBeans = new ConcurrentHashMap<String, AbstractBindingInfoFactoryBean>();
+    }
+    
+    @Resource
+    public void setExtensionManager(ExtensionManager em) {
+        extensionManager = em;
+    }
+    
+    @Resource
+    public void setBus(Bus b) {
+        bus = b;
+    }
+    
+    @PostConstruct
+    public void register() {
+        if (null != bus) {
+            bus.setExtension(this, BindingInfoFactoryBeanManager.class);
+        }
+    }
+    
+    AbstractBindingInfoFactoryBean loadBindingFactory(
+        String className, String ...namespaceURIs) throws BusException {
+        
+        AbstractBindingInfoFactoryBean factory = null;
+        try {
+            Class<? extends AbstractBindingInfoFactoryBean> clazz = 
+                Class.forName(className).asSubclass(AbstractBindingInfoFactoryBean.class);
+
+            factory = clazz.newInstance();
+
+            for (String namespace : namespaceURIs) {
+                registerBindingInfoFactoryBean(namespace, factory);
+            }
+        } catch (ClassNotFoundException cnfe) {
+            throw new BusException(cnfe);
+        } catch (InstantiationException ie) {
+            throw new BusException(ie);
+        } catch (IllegalAccessException iae) {
+            throw new BusException(iae);
+        }
+        return factory;
+    }
+
+    public AbstractBindingInfoFactoryBean getBindingInfoFactoryBean(String namespace) 
+        throws BusException {       
+        AbstractBindingInfoFactoryBean factory = bindingInfoFactoryBeans.get(namespace);
+        if (null == factory) { 
+            extensionManager.activateViaNS(namespace);            
+            factory = bindingInfoFactoryBeans.get(namespace);
+        }
+        if (null == factory) {
+            throw new BusException(new Message("NO_BINDING_INFO_FACTORY_BEAN_EXC", BUNDLE,
namespace));
+        }
+        return factory;
+    }
+
+    public void registerBindingInfoFactoryBean(String name, 
+                                               AbstractBindingInfoFactoryBean factory) {
       
+        bindingInfoFactoryBeans.put(name, factory);
+        
+    }
+
+    public void unregisterBindingInfoFactoryBean(String name) {
+        bindingInfoFactoryBeans.remove(name);        
+    }
+
+}

Modified: incubator/cxf/trunk/rt/core/src/main/resources/META-INF/bus-extensions.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/resources/META-INF/bus-extensions.xml?view=diff&rev=464472&r1=464471&r2=464472
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/resources/META-INF/bus-extensions.xml (original)
+++ incubator/cxf/trunk/rt/core/src/main/resources/META-INF/bus-extensions.xml Mon Oct 16
05:54:27 2006
@@ -35,5 +35,7 @@
        	   interface="org.apache.cxf.buslifecycle.BusLifeCycleManager"/>   	   
     <extension class="org.apache.cxf.endpoint.ServerRegistryImpl"
        	   interface="org.apache.cxf.endpoint.ServerRegistry"/>
-    
+    <extension class="org.apache.cxf.binding.BindingInfoFactoryBeanManagerImpl"
+           interface="org.apache.cxf.binding.BindingInfoFactoryBeanManager"/>
+           
 </extensions>

Modified: incubator/cxf/trunk/rt/core/src/main/resources/META-INF/cxf/cxf.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/resources/META-INF/cxf/cxf.xml?view=diff&rev=464472&r1=464471&r2=464472
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/resources/META-INF/cxf/cxf.xml (original)
+++ incubator/cxf/trunk/rt/core/src/main/resources/META-INF/cxf/cxf.xml Mon Oct 16 05:54:27
2006
@@ -44,6 +44,11 @@
         <property name="bus" ref="cxf"/>
     </bean>
     
+    <bean id="org.apache.cxf.binding.BindingInfoFactoryBeanManager" class="org.apache.cxf.binding.BindingInfoFactoryBeanManagerImpl">
+        <property name="extensionManager" ref="org.apache.cxf.extension.ExtensionManager"/>
+        <property name="bus" ref="cxf"/>
+    </bean>
+    
     <bean id="org.apache.cxf.transport.DestinationFactoryManager" class="org.apache.cxf.transport.DestinationFactoryManagerImpl">
         <property name="extensionManager" ref="org.apache.cxf.extension.ExtensionManager"/>
         <property name="bus" ref="cxf"/>

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java?view=diff&rev=464472&r1=464471&r2=464472
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
Mon Oct 16 05:54:27 2006
@@ -43,6 +43,8 @@
 import javax.xml.ws.spi.ServiceDelegate;
 
 import org.apache.cxf.Bus;
+import org.apache.cxf.BusException;
+import org.apache.cxf.binding.BindingInfoFactoryBeanManager;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.configuration.Configurer;
 import org.apache.cxf.endpoint.Client;
@@ -55,8 +57,7 @@
 import org.apache.cxf.jaxws.support.JaxWsEndpointImpl;
 import org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean;
 import org.apache.cxf.service.Service;
-import org.apache.cxf.service.factory.AbstractBindingInfoFactoryBean;
-import org.apache.cxf.service.factory.SoapBindingInfoFactoryBean;
+import org.apache.cxf.service.model.AbstractBindingInfoFactoryBean;
 import org.apache.cxf.service.model.BindingInfo;
 import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.service.model.ServiceInfo;
@@ -114,7 +115,11 @@
         } else {
             PortInfo portInfo =  getPortInfor(portName);
             if (null != portInfo) {
-                ei = createEndpointInfo(service, portName, portInfo);
+                try {
+                    ei = createEndpointInfo(service, portName, portInfo);
+                } catch (BusException e) {
+                    throw new WebServiceException(e);
+                }
             } else {
                 ei = si.getEndpoint(portName);
             }    
@@ -253,8 +258,12 @@
         } else {
             // first chech the endpointInfo from portInfos
             PortInfo portInfo = portInfos.get(portName);
-            if (null != portInfo) {
-                ei = createEndpointInfo(service, portName, portInfo);                
+            if (null != portInfo) {                
+                try {
+                    ei = createEndpointInfo(service, portName, portInfo);
+                } catch (BusException e) {
+                    throw new WebServiceException(e);
+                }                
             } else {
                 ei = si.getEndpoint(portName);
             }    
@@ -289,18 +298,22 @@
         return serviceEndpointInterface.cast(obj);
     }
 
-    private EndpointInfo createEndpointInfo(Service service, QName portName, PortInfo portInfo)
{        
+    private EndpointInfo createEndpointInfo(Service service, QName portName, PortInfo portInfo)
+        throws BusException {        
+        
         EndpointInfo ei = null;
         String address = portInfo.getAddress();        
         //create bindingInfo from the bindingId
-        //TODO get the different BindingInfoFactoryBean from BindingInfoFactories
-        AbstractBindingInfoFactoryBean bindingFactory = new SoapBindingInfoFactoryBean();
-        bindingFactory.setServiceInfo(service.getServiceInfo());
+        BindingInfoFactoryBeanManager bfm = bus.getExtension(BindingInfoFactoryBeanManager.class);
+       
+        AbstractBindingInfoFactoryBean bindingFactory = 
+            bfm.getBindingInfoFactoryBean(portInfo.getBindingUri());
+        bindingFactory.setService(service);
         
         BindingInfo bindingInfo = bindingFactory.create();
         service.getServiceInfo().addBinding(bindingInfo);
-            
-        ei = new EndpointInfo(service.getServiceInfo(), portInfo.getBindingUri());
+        //TODO we may need to get the transportURI from Address    
+        ei = new EndpointInfo(service.getServiceInfo(), bindingFactory.getTransportURI());
         ei.setName(portName);
         ei.setAddress(address);
         ei.setBinding(bindingInfo);

Modified: incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ServerFactoryBean.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ServerFactoryBean.java?view=diff&rev=464472&r1=464471&r2=464472
==============================================================================
--- incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ServerFactoryBean.java
(original)
+++ incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ServerFactoryBean.java
Mon Oct 16 05:54:27 2006
@@ -24,11 +24,13 @@
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusException;
+import org.apache.cxf.binding.soap.SoapBindingInfoFactoryBean;
 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.service.Service;
+import org.apache.cxf.service.model.AbstractBindingInfoFactoryBean;
 import org.apache.cxf.service.model.BindingInfo;
 import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.transport.ChainInitiationObserver;
@@ -99,7 +101,7 @@
         destinationFactory = dfm.getDestinationFactory(transportId);
         
         // Get the Service from the ServiceFactory if specified        
-        bindingFactory.setServiceFactory(serviceFactory);
+        bindingFactory.setService(serviceFactory.getService());
         BindingInfo bindingInfo = bindingFactory.create();
         service.getServiceInfo().addBinding(bindingInfo);
         

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/dispatch/DispatchClientServerTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/dispatch/DispatchClientServerTest.java?view=diff&rev=464472&r1=464471&r2=464472
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/dispatch/DispatchClientServerTest.java
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/dispatch/DispatchClientServerTest.java
Mon Oct 16 05:54:27 2006
@@ -148,9 +148,9 @@
 
         SOAPService service = new SOAPService(wsdl, serviceName);
         assertNotNull(service);*/
-        SOAPService service = new SOAPService(null, serviceName);
+        Service service = Service.create(serviceName);
         assertNotNull(service);
-        service.addPort(portName, "http://schemas.xmlsoap.org/soap/http", 
+        service.addPort(portName, "http://schemas.xmlsoap.org/soap/", 
                         "http://localhost:9006/SOAPDispatchService/SoapDispatchPort");
 
         Dispatch<DOMSource> disp = service.createDispatch(portName, DOMSource.class,
Service.Mode.MESSAGE);
@@ -212,7 +212,7 @@
         assertNotNull(service);*/
         Service service = Service.create(serviceName);
         assertNotNull(service);
-        service.addPort(portName, "http://schemas.xmlsoap.org/soap/http", 
+        service.addPort(portName, "http://schemas.xmlsoap.org/soap/", 
                         "http://localhost:9006/SOAPDispatchService/SoapDispatchPort");
 
         Dispatch<DOMSource> disp = service.createDispatch(portName, DOMSource.class,
Service.Mode.PAYLOAD);

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java?view=diff&rev=464472&r1=464471&r2=464472
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java
Mon Oct 16 05:54:27 2006
@@ -121,7 +121,7 @@
     
     public void testAddPort() throws Exception {
         Service service = Service.create(serviceName);
-        service.addPort(fakePortName, "http://schemas.xmlsoap.org/soap/http", 
+        service.addPort(fakePortName, "http://schemas.xmlsoap.org/soap/", 
                         "http://localhost:9000/SoapContext/SoapPort");
         Greeter greeter = service.getPort(fakePortName, Greeter.class);
 

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerXMLWrapTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerXMLWrapTest.java?view=diff&rev=464472&r1=464471&r2=464472
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerXMLWrapTest.java
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerXMLWrapTest.java
Mon Oct 16 05:54:27 2006
@@ -23,6 +23,7 @@
 
 import javax.xml.namespace.QName;
 import javax.xml.ws.Endpoint;
+import javax.xml.ws.Service;
 
 import junit.framework.Test;
 import junit.framework.TestCase;
@@ -36,8 +37,12 @@
 
 
 public class ClientServerXMLWrapTest extends TestCase {
-    
-    private final QName portName = new QName("http://apache.org/hello_world_xml_http/wrapped",
"XMLPort");
+    private final QName serviceName = 
+        new QName("http://apache.org/hello_world_xml_http/wrapped", "XMLService");
+    private final QName portName = 
+        new QName("http://apache.org/hello_world_xml_http/wrapped", "XMLPort");
+    private final QName fakePortName = 
+        new QName("http://apache.org/hello_world_xml_http/wrapped", "FackPort");
 
     public static class Server extends TestServerBase {
         
@@ -79,6 +84,35 @@
         String response2 = new String("Bonjour");
         try {
             Greeter greeter = service.getPort(portName, Greeter.class);
+            String username = System.getProperty("user.name");
+            String reply = greeter.greetMe(username);
+
+            assertNotNull("no response received from service", reply);
+            assertEquals(response1 + username, reply);
+
+            reply = greeter.sayHi();
+            assertNotNull("no response received from service", reply);
+            assertEquals(response2, reply);
+
+            greeter.greetMeOneWay(System.getProperty("user.name"));
+
+        } catch (UndeclaredThrowableException ex) {
+            throw (Exception) ex.getCause();
+        }
+    }
+    
+    public void testAddPort() throws Exception {
+
+        Service service = Service.create(serviceName);
+        service.addPort(fakePortName, 
+                        "http://cxf.apache.org/bindings/xformat",
+                        "http://localhost:9032/XMLService/XMLPort");
+        assertNotNull(service);
+
+        String response1 = new String("Hello ");
+        String response2 = new String("Bonjour");
+        try {
+            Greeter greeter = service.getPort(fakePortName, Greeter.class);
             String username = System.getProperty("user.name");
             String reply = greeter.greetMe(username);
 



Mime
View raw message