cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject svn commit: r610665 - in /incubator/cxf/trunk: rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/ rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/action/ tools/javato/ws/sr...
Date Thu, 10 Jan 2008 04:04:32 GMT
Author: mmao
Date: Wed Jan  9 20:04:21 2008
New Revision: 610665

URL: http://svn.apache.org/viewvc?rev=610665&view=rev
Log:
CXF-1364 
   Frontend pass the quolified attribute to the Jaxb Databinding 
      thus in case of jaxws, the unqualified been used


Added:
    incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/action/
    incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/action/AddNumbersException.java
    incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/action/AddNumbersImpl.java
Modified:
    incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java
    incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java
    incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
    incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java

Modified: incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java?rev=610665&r1=610664&r2=610665&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java
(original)
+++ incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java
Wed Jan  9 20:04:21 2008
@@ -104,9 +104,15 @@
     private Map<String, Object> contextProperties = Collections.emptyMap();
     private Map<String, Object> marshallerProperties = Collections.emptyMap();
 
+    private boolean qualifiedSchemas;
+
     
     public JAXBDataBinding() {
     }
+
+    public JAXBDataBinding(boolean q) {
+        this.qualifiedSchemas = q;
+    }
     
     public JAXBDataBinding(Class<?>...classes) throws JAXBException {
         contextClasses = new HashSet<Class<?>>();
@@ -285,7 +291,10 @@
                 }
             }
             
-            JAXBSchemaInitializer schemaInit = new JAXBSchemaInitializer(serviceInfo, col,
riContext);
+            JAXBSchemaInitializer schemaInit = new JAXBSchemaInitializer(serviceInfo, 
+                                                                         col, 
+                                                                         riContext, 
+                                                                         this.qualifiedSchemas);
             schemaInit.walk();
         }
     }

Modified: incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java?rev=610665&r1=610664&r2=610665&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java
(original)
+++ incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java
Wed Jan  9 20:04:21 2008
@@ -58,11 +58,16 @@
 
     private SchemaCollection schemas;
     private JAXBContextImpl context;
+    private final boolean qualifiedSchemas;
     
-    public JAXBSchemaInitializer(ServiceInfo serviceInfo, SchemaCollection col, JAXBContextImpl
context) {
+    public JAXBSchemaInitializer(ServiceInfo serviceInfo, 
+                                 SchemaCollection col, 
+                                 JAXBContextImpl context, 
+                                 boolean q) {
         super(serviceInfo);
         schemas = col;
         this.context = context;
+        this.qualifiedSchemas = q;
     }
 
     @Override
@@ -307,7 +312,10 @@
         XmlSchema schema;
         if (schemaInfo == null) {
             schema = schemas.newXmlSchemaInCollection(part.getElementQName().getNamespaceURI());
-            schema.setElementFormDefault(new XmlSchemaForm(XmlSchemaForm.QUALIFIED));
+
+            if (qualifiedSchemas) {
+                schema.setElementFormDefault(new XmlSchemaForm(XmlSchemaForm.QUALIFIED));
+            }
 
             NamespaceMap nsMap = new NamespaceMap();
             nsMap.add(WSDLConstants.CONVENTIONAL_TNS_PREFIX, schema.getTargetNamespace());

Modified: incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java?rev=610665&r1=610664&r2=610665&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
(original)
+++ incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
Wed Jan  9 20:04:21 2008
@@ -154,7 +154,7 @@
     public ReflectionServiceFactoryBean() {
         getServiceConfigurations().add(0, new DefaultServiceConfiguration());
 
-        setDataBinding(new JAXBDataBinding());
+        setDataBinding(new JAXBDataBinding(getQualifyWrapperSchema()));
 
         ignoredClasses.add("java.lang.Object");
         ignoredClasses.add("java.lang.Throwable");
@@ -864,7 +864,7 @@
         anonymousWrappers = b;
     }
 
-    public boolean getQualifyWrapperSchema() {
+    public final boolean getQualifyWrapperSchema() {
         return qualifiedSchemas;
     }
 
@@ -1195,6 +1195,7 @@
         if (qualified) {
             schema.setElementFormDefault(new XmlSchemaForm(XmlSchemaForm.QUALIFIED));
         }
+
         schemaInfo.setSchema(schema);
 
         Map<String, String> explicitNamespaceMappings = this.getDataBinding().getDeclaredNamespaceMappings();

Added: incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/action/AddNumbersException.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/action/AddNumbersException.java?rev=610665&view=auto
==============================================================================
--- incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/action/AddNumbersException.java
(added)
+++ incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/action/AddNumbersException.java
Wed Jan  9 20:04:21 2008
@@ -0,0 +1,33 @@
+/**
+ * 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.tools.fortest.action;
+
+public class AddNumbersException extends Exception {
+    String detail;
+
+    public AddNumbersException(String message, String detail) {
+        super(message);
+        this.detail = detail;
+    }
+
+    public String getDetail() {
+        return detail;
+    }
+}

Added: incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/action/AddNumbersImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/action/AddNumbersImpl.java?rev=610665&view=auto
==============================================================================
--- incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/action/AddNumbersImpl.java
(added)
+++ incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/action/AddNumbersImpl.java
Wed Jan  9 20:04:21 2008
@@ -0,0 +1,38 @@
+/**
+ * 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.tools.fortest.action;
+
+import javax.jws.WebService;
+import javax.xml.ws.BindingType;
+import javax.xml.ws.soap.SOAPBinding;
+
+@WebService(
+    name = "AddNumbers", 
+    portName = "AddNumbersPort", 
+    targetNamespace = "http://foobar.org/", 
+    serviceName = "AddNumbersService"
+)
+@BindingType(value = SOAPBinding.SOAP11HTTP_BINDING)
+
+public class AddNumbersImpl {
+    public int addNumbersNoAction(int number1, int number2) throws AddNumbersException {
+        return -1;
+    }
+}

Modified: incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java?rev=610665&r1=610664&r2=610665&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java
(original)
+++ incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java
Wed Jan  9 20:04:21 2008
@@ -537,4 +537,23 @@
         String expectedString = "@XmlElement(name  =  \"number2\",  namespace  =  \"http://example.com\")";
         assertTrue(getStringFromFile(requestWrapperClass).indexOf(expectedString) != -1);
     }
+
+    // Generated schema should use unquolified form in the jaxws case
+    @Test
+    public void testAction() throws Exception {
+        env.put(ToolConstants.CFG_OUTPUTFILE, output.getPath() + "/action.wsdl");
+        env.put(ToolConstants.CFG_CLASSNAME, "org.apache.cxf.tools.fortest.action.AddNumbersImpl");
+        env.put(ToolConstants.CFG_VERBOSE, ToolConstants.CFG_VERBOSE);
+        env.put(ToolConstants.CFG_WRAPPERBEAN, ToolConstants.CFG_WRAPPERBEAN);
+        try {
+            processor.setEnvironment(env);
+            processor.process();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        File wsdlFile = new File(output, "action.wsdl");
+        assertTrue(wsdlFile.exists());
+        assertTrue(getStringFromFile(wsdlFile).indexOf("elementFormDefault=\"unqualified\"")
!= -1);
+    }
 }



Mime
View raw message