cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dand...@apache.org
Subject svn commit: r570262 - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/service/model/ common/common/src/main/java/org/apache/cxf/configuration/spring/ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ rt/frontend/jaxws/src/main/java/org/ap...
Date Mon, 27 Aug 2007 22:21:45 GMT
Author: dandiep
Date: Mon Aug 27 15:21:44 2007
New Revision: 570262

URL: http://svn.apache.org/viewvc?rev=570262&view=rev
Log:
Add support for <schemaLocations> in XML config.

Added:
    incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/StringBeanDefinitionParser.java
  (with props)
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/SchemaFirstXmlConfigTest.java
  (with props)
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/schemaFirst.xml
  (with props)
Modified:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/BindingInfo.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/EndpointDefinitionParser.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/NamespaceHandler.java
    incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/Messages.properties
    incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java
    incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/spring/NamespaceHandler.java
    incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/spring/ServerFactoryBeanDefinitionParser.java

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/BindingInfo.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/BindingInfo.java?rev=570262&r1=570261&r2=570262&view=diff
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/BindingInfo.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/BindingInfo.java Mon
Aug 27 15:21:44 2007
@@ -123,9 +123,10 @@
 
     public BindingOperationInfo getOperation(OperationInfo oi) {
         for (BindingOperationInfo b : operations.values()) {
-            if (b.getOperationInfo() == oi 
-                || (b.isUnwrappedCapable() && b.getUnwrappedOperation().getOperationInfo()
== oi)) {
+            if (b.getOperationInfo() == oi) {
                 return b;
+            } else if (b.isUnwrappedCapable() && b.getUnwrappedOperation().getOperationInfo()
== oi) {
+                return b.getUnwrappedOperation();
             }
         }
         

Added: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/StringBeanDefinitionParser.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/StringBeanDefinitionParser.java?rev=570262&view=auto
==============================================================================
--- incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/StringBeanDefinitionParser.java
(added)
+++ incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/StringBeanDefinitionParser.java
Mon Aug 27 15:21:44 2007
@@ -0,0 +1,39 @@
+/**
+ * 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.configuration.spring;
+
+import org.w3c.dom.Element;
+
+import org.apache.cxf.helpers.DOMUtils;
+import org.springframework.beans.factory.support.BeanDefinitionBuilder;
+import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser;
+
+public class StringBeanDefinitionParser extends AbstractSingleBeanDefinitionParser {
+
+    @Override
+    protected void doParse(Element element, BeanDefinitionBuilder builder) {
+        builder.addConstructorArg(DOMUtils.getContent(element));
+    }
+
+    @Override
+    protected Class getBeanClass(Element arg0) {
+        return String.class;
+    }
+
+}

Propchange: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/StringBeanDefinitionParser.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/StringBeanDefinitionParser.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/StringBeanDefinitionParser.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java?rev=570262&r1=570261&r2=570262&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java
Mon Aug 27 15:21:44 2007
@@ -77,6 +77,7 @@
     private QName serviceName;
     private Class implementorClass;
     
+    private List<String> schemaLocations;
     private List<AbstractFeature> features;
     private List<Interceptor> in = new ModCountCopyOnWriteArrayList<Interceptor>();
     private List<Interceptor> out = new ModCountCopyOnWriteArrayList<Interceptor>();
@@ -261,6 +262,7 @@
             serverFactory.setBus(bus);
             serverFactory.setFeatures(features);
             serverFactory.setInvoker(invoker);
+            serverFactory.setSchemaLocations(schemaLocations);
             
             // Be careful not to override any serverfactory settings as a user might
             // have supplied their own.
@@ -438,6 +440,14 @@
     
     public BindingConfiguration getBindingConfig() {
         return serverFactory.getBindingConfig();
+    }
+
+    public List<String> getSchemaLocations() {
+        return schemaLocations;
+    }
+
+    public void setSchemaLocations(List<String> schemaLocations) {
+        this.schemaLocations = schemaLocations;
     }
     
     /*

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/EndpointDefinitionParser.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/EndpointDefinitionParser.java?rev=570262&r1=570261&r2=570262&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/EndpointDefinitionParser.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/EndpointDefinitionParser.java
Mon Aug 27 15:21:44 2007
@@ -102,7 +102,7 @@
                     setFirstChildAsProperty((Element) n, ctx, bean, "bindingConfig");
                 } else if ("inInterceptors".equals(name) || "inFaultInterceptors".equals(name)
                     || "outInterceptors".equals(name) || "outFaultInterceptors".equals(name)
-                    || "features".equals(name)) {
+                    || "features".equals(name) || "schemaLocations".equals(name)) {
                     List list = ctx.getDelegate().parseListElement((Element) n, bean.getBeanDefinition());
                     bean.addPropertyValue(name, list);
                 } else if (IMPLEMENTOR.equals(name)) {

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/NamespaceHandler.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/NamespaceHandler.java?rev=570262&r1=570261&r2=570262&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/NamespaceHandler.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/NamespaceHandler.java
Mon Aug 27 15:21:44 2007
@@ -18,6 +18,7 @@
  */
 package org.apache.cxf.jaxws.spring;
 
+import org.apache.cxf.configuration.spring.StringBeanDefinitionParser;
 import org.apache.cxf.frontend.spring.ServerFactoryBeanDefinitionParser;
 import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
 import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
@@ -26,6 +27,7 @@
     public void init() {
         registerBeanDefinitionParser("client", new JaxWsProxyFactoryBeanDefinitionParser());
       
         registerBeanDefinitionParser("endpoint", new EndpointDefinitionParser());
+        registerBeanDefinitionParser("schemaLocation", new StringBeanDefinitionParser());
         
         ServerFactoryBeanDefinitionParser parser = new ServerFactoryBeanDefinitionParser();
         parser.setBeanClass(JaxWsServerFactoryBean.class);

Added: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/SchemaFirstXmlConfigTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/SchemaFirstXmlConfigTest.java?rev=570262&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/SchemaFirstXmlConfigTest.java
(added)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/SchemaFirstXmlConfigTest.java
Mon Aug 27 15:21:44 2007
@@ -0,0 +1,61 @@
+/**
+ * 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;
+
+import org.w3c.dom.Document;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusException;
+import org.junit.Test;
+
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+public class SchemaFirstXmlConfigTest extends AbstractJaxWsTest {
+
+
+    private ClassPathXmlApplicationContext ctx;
+
+    @Override
+    protected Bus createBus() throws BusException {
+        
+        ctx = new ClassPathXmlApplicationContext(new String[] {
+            "classpath:org/apache/cxf/jaxws/schemaFirst.xml"});
+        
+        return (Bus) ctx.getBean("cxf");
+    }
+
+    @Test
+    public void testEndpoint() throws Exception {
+
+        JaxWsServerFactoryBean serverFB = (JaxWsServerFactoryBean) ctx.getBean("helloServer");
+
+        Document d = getWSDLDocument(serverFB.getServer());
+
+        // XmlSchema still isn't preserving all the extra info...
+        assertValid("//xsd:complexType[@name='foo']/xsd:sequence", d);
+        
+        EndpointImpl ep = (EndpointImpl) ctx.getBean("helloEndpoint");
+
+        d = getWSDLDocument(ep.getServer());
+
+        // XmlSchema still isn't preserving all the extra info...
+        assertValid("//xsd:complexType[@name='foo']/xsd:sequence", d);
+    }
+}

Propchange: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/SchemaFirstXmlConfigTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/SchemaFirstXmlConfigTest.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/SchemaFirstXmlConfigTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/schemaFirst.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/schemaFirst.xml?rev=570262&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/schemaFirst.xml
(added)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/schemaFirst.xml
Mon Aug 27 15:21:44 2007
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+	Licensed to the Apache Software Foundation (ASF) under one
+	or more contributor license agreements. See the NOTICE file
+	distributed with this work for additional information
+	regarding copyright ownership. The ASF licenses this file
+	to you under the Apache License, Version 2.0 (the
+	"License"); you may not use this file except in compliance
+	with the License. You may obtain a copy of the License at
+	
+	http://www.apache.org/licenses/LICENSE-2.0
+	
+	Unless required by applicable law or agreed to in writing,
+	software distributed under the License is distributed on an
+	"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+	KIND, either express or implied. See the License for the
+	specific language governing permissions and limitations
+	under the License.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns:foo="http://cxf.apache.org/configuration/foo"
+    xmlns:jaxws="http://cxf.apache.org/jaxws"
+    xsi:schemaLocation="
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
+  <import resource="classpath:META-INF/cxf/cxf.xml"/>
+  <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"/>
+    
+  <bean class="org.apache.cxf.transport.local.LocalTransportFactory" lazy-init="false">
+      <property name="transportIds">
+          <list>
+              <value>http://cxf.apache.org/transports/local</value>
+              <value>http://schemas.xmlsoap.org/soap/http</value>
+              <value>http://schemas.xmlsoap.org/wsdl/soap/http</value>
+          </list>
+      </property>
+  </bean>
+  
+	<jaxws:endpoint id="helloEndpoint"
+	  implementor="org.apache.cxf.jaxws.service.EchoFoo"
+	  address="http://localhost:9000/hello">
+	  <jaxws:schemaLocations>
+	    <jaxws:schemaLocation>/org/apache/cxf/jaxws/service/echoFoo.xsd</jaxws:schemaLocation>
+	  </jaxws:schemaLocations>
+	</jaxws:endpoint>
+
+
+	<jaxws:server id="helloServer"
+	  serviceClass="org.apache.cxf.jaxws.service.EchoFoo"
+	  address="http://localhost:9000/helloServer">
+	  <jaxws:schemaLocations>
+	    <jaxws:schemaLocation>/org/apache/cxf/jaxws/service/echoFoo.xsd</jaxws:schemaLocation>
+	  </jaxws:schemaLocations>
+	</jaxws:server>
+</beans>
\ No newline at end of file

Propchange: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/schemaFirst.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/schemaFirst.xml
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/schemaFirst.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/schemaFirst.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/Messages.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/Messages.properties?rev=570262&r1=570261&r2=570262&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/Messages.properties
(original)
+++ incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/Messages.properties
Mon Aug 27 15:21:44 2007
@@ -18,4 +18,5 @@
 #    under the License.
 #
 #
-COULD.NOT.RESOLVE.BINDING=Could not resolve a binding for {0}
\ No newline at end of file
+COULD.NOT.RESOLVE.BINDING=Could not resolve a binding for {0}
+ERROR_READING_SCHEMA=There was an error reading the schema {0}.
\ No newline at end of file

Modified: incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java?rev=570262&r1=570261&r2=570262&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java
(original)
+++ incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java
Mon Aug 27 15:21:44 2007
@@ -168,7 +168,8 @@
                 try {
                     d = DOMUtils.readXml(url.openStream());
                 } catch (Exception e) {
-                    throw new ServiceConstructionException(e);
+                    throw new ServiceConstructionException(
+                        new Message("ERROR_READING_SCHEMA", LOG, l), e);
                 }
                 schemas.add(new DOMSource(d, url.toString()));
             }

Modified: incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/spring/NamespaceHandler.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/spring/NamespaceHandler.java?rev=570262&r1=570261&r2=570262&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/spring/NamespaceHandler.java
(original)
+++ incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/spring/NamespaceHandler.java
Mon Aug 27 15:21:44 2007
@@ -18,11 +18,13 @@
  */
 package org.apache.cxf.frontend.spring;
 
+import org.apache.cxf.configuration.spring.StringBeanDefinitionParser;
 import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
 
 public class NamespaceHandler extends NamespaceHandlerSupport {
     public void init() {
         registerBeanDefinitionParser("client", new ClientProxyFactoryBeanDefinitionParser());
   
-        registerBeanDefinitionParser("server", new ServerFactoryBeanDefinitionParser());
       
+        registerBeanDefinitionParser("server", new ServerFactoryBeanDefinitionParser());
    
+        registerBeanDefinitionParser("schemaLocation", new StringBeanDefinitionParser());
     }
 }

Modified: incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/spring/ServerFactoryBeanDefinitionParser.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/spring/ServerFactoryBeanDefinitionParser.java?rev=570262&r1=570261&r2=570262&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/spring/ServerFactoryBeanDefinitionParser.java
(original)
+++ incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/spring/ServerFactoryBeanDefinitionParser.java
Mon Aug 27 15:21:44 2007
@@ -54,7 +54,7 @@
             setFirstChildAsProperty(el, ctx, bean, "bindingConfig");
         } else if ("inInterceptors".equals(name) || "inFaultInterceptors".equals(name)
             || "outInterceptors".equals(name) || "outFaultInterceptors".equals(name)
-            || "features".equals(name)) {
+            || "features".equals(name) || "schemaLocations".equals(name)) {
             List list = ctx.getDelegate().parseListElement(el, bean.getBeanDefinition());
             bean.addPropertyValue(name, list);
         } else {



Mime
View raw message