cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject svn commit: r553415 [1/2] - in /incubator/cxf/trunk: common/common/src/main/java/org/apache/cxf/helpers/ maven-plugins/eclipse-plugin-generator/src/main/java/org/apache/cxf/maven_plugin/eclipse/3.2/ tools/common/src/main/java/org/apache/cxf/tools/commo...
Date Thu, 05 Jul 2007 08:28:51 GMT
Author: mmao
Date: Thu Jul  5 01:28:47 2007
New Revision: 553415

URL: http://svn.apache.org/viewvc?view=rev&rev=553415
Log:
Tools update
* If there is java.util.Date or java.util.Calendar in the SEI, 
     Java2Wsdl will generate a jaxws binding file which contains the DataTypeConverter
     Support both the imported schema or the inline schema
* Fix if the jaxb declaration is embeded in the jaxws customization bindings
* Sperate the NamespaceContext from the xpath util class
* Simplifier the CustomizationParser, and make it more unit testable

Update Eclipse plugin
* Remove extra lines in the manifest
* Add extra dependencies


Added:
    incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/MapNamespaceContext.java
    incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/DataTypeAdapter.java
    incubator/cxf/trunk/tools/javato/core/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/DateTypeCustomGenerator.java
    incubator/cxf/trunk/tools/javato/core/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/date_type_cust.vm
    incubator/cxf/trunk/tools/javato/core/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/date_type_cust_embed.vm
    incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/fortest/date/
    incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/fortest/date/EchoCalendar.java
    incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/fortest/date/EchoDate.java
    incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/DateTypeCustomGeneratorTest.java
    incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/expected/calendar.xjb
    incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/expected/calendar_embed.xml
    incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/expected/date.xjb
    incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/expected/date_embed.xml
    incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/echo_calendar.xjb
    incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/echo_date.xjb
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customiztion/CustomNodeSelector.java
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customiztion/
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customiztion/CustomizationParserTest.java
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customiztion/expected/
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customiztion/expected/inline_jaxws.wsdl
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customiztion/resources/
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customiztion/resources/embeded_jaxb.xjb
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customiztion/resources/external_jaxws.xml
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customiztion/resources/external_jaxws_embed_jaxb.xml
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customiztion/resources/external_jaxws_embed_jaxb_date.xml
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customiztion/resources/test.wsdl
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customiztion/resources/test.xsd
Modified:
    incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/XMLUtils.java
    incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/XPathUtils.java
    incubator/cxf/trunk/maven-plugins/eclipse-plugin-generator/src/main/java/org/apache/cxf/maven_plugin/eclipse/3.2/MANIFEST.vm
    incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/ProcessorTestBase.java
    incubator/cxf/trunk/tools/eclipse-plugin/pom.xml
    incubator/cxf/trunk/tools/javato/core/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/WSDL11Generator.java
    incubator/cxf/trunk/tools/javato/core/src/main/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessor.java
    incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/FaultBeanGeneratorTest.java
    incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java
    incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JaxwsServiceBuilderNoAnnoTest.java
    incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/pom.xml
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customiztion/CustomizationParser.java
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customiztion/Messages.properties
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilderTest.java
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/resources/binding3.xml

Added: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/MapNamespaceContext.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/MapNamespaceContext.java?view=auto&rev=553415
==============================================================================
--- incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/MapNamespaceContext.java (added)
+++ incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/MapNamespaceContext.java Thu Jul  5 01:28:47 2007
@@ -0,0 +1,83 @@
+/**
+ * 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.helpers;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import javax.xml.namespace.NamespaceContext;
+import org.w3c.dom.Node;
+
+public  final class MapNamespaceContext implements NamespaceContext {
+    private Map<String, String> namespaces = new HashMap<String, String>();
+    private Node targetNode;
+
+    public MapNamespaceContext() {
+        super();
+    }
+
+    public MapNamespaceContext(final Map<String, String> ns) {
+        this();
+        this.namespaces = ns;
+    }
+
+    public MapNamespaceContext(final Node node) {
+        this();
+        this.targetNode = node;
+    }
+
+    public void setTargetNode(final Node node) {
+        this.targetNode = node;
+    }
+
+    public void addNamespace(final String prefix, final String namespaceURI) {
+        this.namespaces.put(prefix, namespaceURI);
+    }
+
+    public void addNamespaces(final Map<String, String> ns) {
+        this.namespaces.putAll(ns);
+    }
+
+    public String getNamespaceURI(String prefix) {
+        if (targetNode != null) {
+            String s = targetNode.lookupNamespaceURI(prefix);
+            if (prefix != null && s != null) {
+                namespaces.put(prefix, s);
+            }
+        }
+        return namespaces.get(prefix);
+    }
+
+    public String getPrefix(String namespaceURI) {
+        for (Map.Entry<String, String> e : namespaces.entrySet()) {
+            if (e.getValue().equals(namespaceURI)) {
+                return e.getKey();
+            }
+        }
+        return null;
+    }
+
+    public Iterator getPrefixes(String namespaceURI) {
+        return null;
+    }
+
+    public Map<String, String> getUsedNamespaces() {
+        return namespaces;
+    }
+}

Modified: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/XMLUtils.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/XMLUtils.java?view=diff&rev=553415&r1=553414&r2=553415
==============================================================================
--- incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/XMLUtils.java (original)
+++ incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/XMLUtils.java Thu Jul  5 01:28:47 2007
@@ -95,7 +95,7 @@
         IOException {
         return getParser().parse(is.getSystemId());
     }
-    
+
     public static Document parse(File is) throws ParserConfigurationException, SAXException,
         IOException {
         return getParser().parse(is);
@@ -329,12 +329,12 @@
         }
         return ret;
     }
-    
-    public static QName getQName(String value, Node node) {        
+
+    public static QName getQName(String value, Node node) {
         if (value == null) {
             return null;
         }
-        
+
         int index = value.indexOf(":");
 
         if (index == -1) {
@@ -349,9 +349,9 @@
             throw new RuntimeException("Invalid QName in mapping: " + value);
         }
 
-        return new QName(ns, localName, prefix);        
+        return new QName(ns, localName, prefix);
     }
-    
+
     public static Node  fromSource(Source src) throws Exception {
 
         Transformer trans = TransformerFactory.newInstance().newTransformer();

Modified: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/XPathUtils.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/XPathUtils.java?view=diff&rev=553415&r1=553414&r2=553415
==============================================================================
--- incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/XPathUtils.java (original)
+++ incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/XPathUtils.java Thu Jul  5 01:28:47 2007
@@ -19,7 +19,6 @@
 
 package org.apache.cxf.helpers;
 
-import java.util.Iterator;
 import java.util.Map;
 
 import javax.xml.namespace.NamespaceContext;
@@ -32,55 +31,33 @@
 public class XPathUtils {
 
     XPath xpath;
-    
-    public XPathUtils() {   
-        this(null);
-    }
-    
-    public XPathUtils(Map<String, String> ns) {
+
+    public XPathUtils() {
         xpath = XPathFactory.newInstance().newXPath();
+    }
+
+    public XPathUtils(final Map<String, String> ns) {
+        this();
 
         if (ns != null) {
             xpath.setNamespaceContext(new MapNamespaceContext(ns));
-        }         
+        }
     }
-    
-    public Object getValue(String xpathExpression, Node node, QName type) {    
+
+    public XPathUtils(final NamespaceContext ctx) {
+        this();
+        xpath.setNamespaceContext(ctx);
+    }
+
+    public Object getValue(String xpathExpression, Node node, QName type) {
         try {
             return xpath.evaluate(xpathExpression, node, type);
         } catch (Exception e) {
-            return null;    
+            return null;
         }
     }
 
     public boolean isExist(String xpathExpression, Node node, QName type) {
         return getValue(xpathExpression, node, type) != null;
-    }
-    
-    class MapNamespaceContext implements NamespaceContext {
-        private Map<String, String> namespaces;
-
-        public MapNamespaceContext(Map<String, String> namespaces) {
-            super();
-            this.namespaces = namespaces;
-        }
-
-        public String getNamespaceURI(String prefix) {
-            return namespaces.get(prefix);
-        }
-
-        public String getPrefix(String namespaceURI) {
-            for (Map.Entry<String, String> e : namespaces.entrySet()) {
-                if (e.getValue().equals(namespaceURI)) {
-                    return e.getKey();
-                }
-            }
-            return null;
-        }
-
-        public Iterator getPrefixes(String namespaceURI) {
-            return null;
-        }
-
     }
 }

Modified: incubator/cxf/trunk/maven-plugins/eclipse-plugin-generator/src/main/java/org/apache/cxf/maven_plugin/eclipse/3.2/MANIFEST.vm
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/maven-plugins/eclipse-plugin-generator/src/main/java/org/apache/cxf/maven_plugin/eclipse/3.2/MANIFEST.vm?view=diff&rev=553415&r1=553414&r2=553415
==============================================================================
--- incubator/cxf/trunk/maven-plugins/eclipse-plugin-generator/src/main/java/org/apache/cxf/maven_plugin/eclipse/3.2/MANIFEST.vm (original)
+++ incubator/cxf/trunk/maven-plugins/eclipse-plugin-generator/src/main/java/org/apache/cxf/maven_plugin/eclipse/3.2/MANIFEST.vm Thu Jul  5 01:28:47 2007
@@ -29,5 +29,3 @@
 
 #end
 Eclipse-LazyStart: true
-Eclipse-RegisterBuddy: org.eclipse.stp.sc.common
-Require-Bundle: org.eclipse.stp.sc.common
\ No newline at end of file

Added: incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/DataTypeAdapter.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/DataTypeAdapter.java?view=auto&rev=553415
==============================================================================
--- incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/DataTypeAdapter.java (added)
+++ incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/DataTypeAdapter.java Thu Jul  5 01:28:47 2007
@@ -0,0 +1,55 @@
+/**
+ * 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.common;
+
+import java.util.Calendar;
+import java.util.Date;
+import javax.xml.bind.DatatypeConverter;
+
+public final class DataTypeAdapter {
+    private DataTypeAdapter() {
+    }
+
+    public static Date parseDate(String s) {
+        return DatatypeConverter.parseDate(s).getTime();
+    }
+    public static String printDate(Date dt) {
+        Calendar c = Calendar.getInstance();
+        c.setTime(dt);
+        return DatatypeConverter.printDate(c);
+    }
+
+    public static Date parseTime(String s) {
+        return DatatypeConverter.parseTime(s).getTime();
+    }
+    public static String printTime(Date dt) {
+        Calendar c = Calendar.getInstance();
+        c.setTime(dt);
+        return DatatypeConverter.printTime(c);
+    }
+
+    public static Date parseDateTime(String s) {
+        return DatatypeConverter.parseDateTime(s).getTime();
+    }
+    public static String printDateTime(Date dt) {
+        Calendar c = Calendar.getInstance();
+        c.setTime(dt);
+        return DatatypeConverter.printDateTime(c);
+    }
+}
\ No newline at end of file

Modified: incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/ProcessorTestBase.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/ProcessorTestBase.java?view=diff&rev=553415&r1=553414&r2=553415
==============================================================================
--- incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/ProcessorTestBase.java (original)
+++ incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/ProcessorTestBase.java Thu Jul  5 01:28:47 2007
@@ -45,11 +45,11 @@
     public void setUp() throws Exception {
         URL url = getClass().getResource(".");
         output = new File(url.toURI());
-        output = new File(output, "/resources");
+        output = new File(output, "/generated");
         FileUtils.mkDir(output);
     }
 
-    
+
     @After
     public void tearDown() {
         FileUtils.removeDir(output);
@@ -62,10 +62,10 @@
         StringBuffer classPath = new StringBuffer();
         if (loader instanceof URLClassLoader) {
             URLClassLoader urlLoader = (URLClassLoader)loader;
-            for (URL url : urlLoader.getURLs()) {               
+            for (URL url : urlLoader.getURLs()) {
                 File file;
                 file = new File(url.toURI());
-                String filename = file.getAbsolutePath();                
+                String filename = file.getAbsolutePath();
                 if (filename.indexOf("junit") == -1) {
                     classPath.append(filename);
                     classPath.append(System.getProperty("path.separator"));
@@ -74,7 +74,7 @@
         }
         return classPath.toString();
     }
-    
+
     protected String getLocation(String wsdlFile) throws URISyntaxException {
         return getClass().getResource(wsdlFile).toString();
     }
@@ -82,11 +82,11 @@
     protected void assertFileEquals(String f1, String f2) {
         assertFileEquals(new File(f1), new File(f2));
     }
-    
+
     protected void assertFileEquals(File location1, File location2) {
         String str1 = getStringFromFile(location1);
         String str2 = getStringFromFile(location2);
-        
+
         StringTokenizer st1 = new StringTokenizer(str1, " \t\n\r\f(),");
         StringTokenizer st2 = new StringTokenizer(str2, " \t\n\r\f(),");
 
@@ -112,7 +112,7 @@
                     unmatched.add(tok2);
                 }
             }
-            assertEquals("Compare failed " + location1.getAbsolutePath() 
+            assertEquals("Compare failed " + location1.getAbsolutePath()
                          + " != " + location2.getAbsolutePath(), tok1, tok2);
         }
 
@@ -142,7 +142,7 @@
 
         return result;
     }
-    
+
     private String normalizeCRLF(InputStream instream) {
         BufferedReader in = new BufferedReader(new InputStreamReader(instream));
         StringBuffer result = new StringBuffer();

Modified: incubator/cxf/trunk/tools/eclipse-plugin/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/eclipse-plugin/pom.xml?view=diff&rev=553415&r1=553414&r2=553415
==============================================================================
--- incubator/cxf/trunk/tools/eclipse-plugin/pom.xml (original)
+++ incubator/cxf/trunk/tools/eclipse-plugin/pom.xml Thu Jul  5 01:28:47 2007
@@ -80,6 +80,12 @@
 
         <dependency>
             <groupId>${pom.groupId}</groupId>
+            <artifactId>cxf-rt-transports-http</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>${pom.groupId}</groupId>
             <artifactId>cxf-tools-java2wsdl</artifactId>
             <version>${project.version}</version>
             <exclusions>

Added: incubator/cxf/trunk/tools/javato/core/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/DateTypeCustomGenerator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/core/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/DateTypeCustomGenerator.java?view=auto&rev=553415
==============================================================================
--- incubator/cxf/trunk/tools/javato/core/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/DateTypeCustomGenerator.java (added)
+++ incubator/cxf/trunk/tools/javato/core/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/DateTypeCustomGenerator.java Thu Jul  5 01:28:47 2007
@@ -0,0 +1,137 @@
+/**
+ * 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.java2wsdl.generator.wsdl11;
+
+import java.io.File;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Collection;
+import java.util.Date;
+import java.util.List;
+
+import org.apache.cxf.service.model.OperationInfo;
+import org.apache.cxf.service.model.SchemaInfo;
+import org.apache.cxf.tools.common.VelocityGenerator;
+import org.apache.cxf.tools.java2wsdl.generator.AbstractGenerator;
+import org.apache.cxf.tools.util.FileWriterUtil;
+
+public final class DateTypeCustomGenerator extends AbstractGenerator<File> {
+
+    private static final String TEMPLATE_BASE = "org/apache/cxf/tools/java2wsdl/generator/wsdl11/";
+    private static final String TEMPLATE_EXT = TEMPLATE_BASE + "date_type_cust.vm";
+    private static final String TEMPLATE_EMB = TEMPLATE_BASE + "date_type_cust_embed.vm";
+
+    private static final String DATE_ADAPTER = "org.apache.cxf.tools.common.DataTypeAdapter";
+    private static final String CALENDAR_ADAPTER = "javax.xml.bind.DatatypeConverter";
+
+    private String wsdlName;
+    private List<String> schemaFiles = new ArrayList<String>();
+
+    public void addSchemaFiles(final Collection<String> s) {
+        this.schemaFiles.addAll(s);
+    }
+
+    public void setWSDLName(final String ws) {
+        this.wsdlName = ws;
+    }
+
+    private String getTemplate() {
+        if (allowImports()) {
+            return TEMPLATE_EXT;
+        }
+        return TEMPLATE_EMB;
+    }
+
+    public List<String> getSchemaNamespaces() {
+        List<String> ns = new ArrayList<String>();
+        for (SchemaInfo schema : getServiceModel().getSchemas()) {
+            ns.add(schema.getNamespaceURI());
+        }
+        return ns;
+    }
+
+    public File generate(File outputdir) {
+        Class dateType = getDateType();
+        File xjb = getJAXBCustFile(outputdir);
+
+        if (dateType != null) {
+            VelocityGenerator generator = new VelocityGenerator();
+
+            generator.setCommonAttributes();
+            generator.setAttributes("parseMethod", getAdapterMethod(dateType, ".parseDateTime"));
+            generator.setAttributes("printMethod", getAdapterMethod(dateType, ".printDateTime"));
+            generator.setAttributes("datetype", dateType.getName());
+
+            if (allowImports()) {
+                if (schemaFiles.size() == 0) {
+                    return null;
+                }
+                generator.setAttributes("schemaFiles", schemaFiles);
+            } else {
+                generator.setAttributes("wsdlName", wsdlName);
+                List<String> ns = getSchemaNamespaces();
+                if (ns.size() == 0) {
+                    return null;
+                }
+                generator.setAttributes("targetNamespaces", ns);
+            }
+
+            try {
+                generator.doWrite(getTemplate(), FileWriterUtil.getWriter(xjb));
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+
+            generator.clearAttributes();
+        }
+        return xjb;
+    }
+
+    protected File getJAXBCustFile(File outputdir) {
+        return new File(outputdir, wsdlName + ".xjb");
+    }
+
+    protected String getAdapterMethod(final Class clz, final String methodName) {
+        if (clz == Date.class) {
+            return DATE_ADAPTER + methodName;
+        }
+        return CALENDAR_ADAPTER + methodName;
+    }
+
+    protected Class getDateType() {
+        if (getServiceModel() == null) {
+            return null;
+        }
+
+        for (OperationInfo op : getServiceModel().getInterface().getOperations()) {
+            Method m = (Method) op.getProperty("operation.method");
+            for (Class clz : m.getParameterTypes()) {
+                if (clz == Date.class || clz == Calendar.class) {
+                    return clz;
+                }
+            }
+            if (m.getReturnType() == Date.class
+                || m.getReturnType() == Calendar.class) {
+                return m.getReturnType();
+            }
+        }
+        return null;
+    }
+}

Modified: incubator/cxf/trunk/tools/javato/core/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/WSDL11Generator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/core/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/WSDL11Generator.java?view=diff&rev=553415&r1=553414&r2=553415
==============================================================================
--- incubator/cxf/trunk/tools/javato/core/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/WSDL11Generator.java (original)
+++ incubator/cxf/trunk/tools/javato/core/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/WSDL11Generator.java Thu Jul  5 01:28:47 2007
@@ -27,6 +27,7 @@
 import java.io.OutputStream;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.Set;
 import javax.wsdl.Definition;
 import javax.wsdl.Import;
 import javax.wsdl.WSDLException;
@@ -41,7 +42,7 @@
 import org.apache.cxf.wsdl11.WSDLDefinitionBuilder;
 
 public class WSDL11Generator extends AbstractGenerator<Definition> {
-    
+
     public Definition generate(final File dir) {
         File file = getOutputBase();
         if (file == null && dir != null) {
@@ -61,7 +62,7 @@
             WSDLWriter wsdlWriter = WSDLFactory.newInstance().newWSDLWriter();
             ServiceWSDLBuilder builder = new ServiceWSDLBuilder(getBus(), getServiceModel());
             builder.setUseSchemaImports(this.allowImports());
-            
+
             String name = file.getName();
             if (name.endsWith(".wsdl")) {
                 name = name.substring(0, name.lastIndexOf(".wsdl"));
@@ -86,13 +87,15 @@
                     wsdlOs.close();
                 }
             }
-            
+
             for (Map.Entry<String, SchemaInfo> imp : imports.entrySet()) {
                 File impfile = new File(file.getParentFile(), imp.getKey());
                 os = new BufferedOutputStream(new FileOutputStream(impfile));
                 imp.getValue().getSchema().write(os);
                 os.close();
             }
+
+            customizing(outputdir, name, imports.keySet());
         } catch (WSDLException wex) {
             wex.printStackTrace();
         } catch (FileNotFoundException fnfe) {
@@ -101,6 +104,19 @@
             e.printStackTrace();
         }
         return def;
+    }
+
+    private void customizing(final File outputdir,
+                             final String wsdlName,
+                             final Set<String> imports) {
+        DateTypeCustomGenerator generator = new DateTypeCustomGenerator();
+
+        generator.setWSDLName(wsdlName);
+        generator.setServiceModel(getServiceModel());
+        generator.setAllowImports(allowImports());
+        generator.addSchemaFiles(imports);
+
+        generator.generate(outputdir);
     }
 }
 

Added: incubator/cxf/trunk/tools/javato/core/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/date_type_cust.vm
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/core/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/date_type_cust.vm?view=auto&rev=553415
==============================================================================
--- incubator/cxf/trunk/tools/javato/core/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/date_type_cust.vm (added)
+++ incubator/cxf/trunk/tools/javato/core/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/date_type_cust.vm Thu Jul  5 01:28:47 2007
@@ -0,0 +1,41 @@
+## 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.
+<!--
+    * This is a jaxb external customization binding file
+    * was generated by the CXF $version
+    * $currentdate
+    * Generated source version: $version
+    *
+    * The reason we generate this file is that
+    * we detected java.util.Date or java.util.Calendar classes in your SEI
+    *
+    * Useage:
+    *   wsdl2java [-b <the path of this file>] wsdl
+    * To customize the generated date types
+-->
+
+<jxb:bindings version="1.0"
+              xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
+              xmlns:xs="http://www.w3.org/2001/XMLSchema">
+#foreach ($schemaFile in $schemaFiles)
+  <jxb:bindings schemaLocation="$schemaFile" node="/xs:schema">
+    <jxb:globalBindings>
+      <jxb:javaType name="$datetype" xmlType="xs:dateTime" parseMethod="$parseMethod" printMethod="$printMethod"/>
+    </jxb:globalBindings>
+  </jxb:bindings>
+#end
+</jxb:bindings>
\ No newline at end of file

Added: incubator/cxf/trunk/tools/javato/core/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/date_type_cust_embed.vm
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/core/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/date_type_cust_embed.vm?view=auto&rev=553415
==============================================================================
--- incubator/cxf/trunk/tools/javato/core/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/date_type_cust_embed.vm (added)
+++ incubator/cxf/trunk/tools/javato/core/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/date_type_cust_embed.vm Thu Jul  5 01:28:47 2007
@@ -0,0 +1,45 @@
+## 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.
+<!--
+    * This is a jaxb external customization binding file
+    * was generated by the CXF $version
+    * $currentdate
+    * Generated source version: $version
+    *
+    * The reason we generate this file is that
+    * we detected java.util.Date or java.util.Calendar classes in your SEI
+    *
+    * Useage:
+    *   wsdl2java [-b <the path of this file>] wsdl
+    * To customize the generated date types
+-->
+
+<jaxws:bindings wsdlLocation="${wsdlName}.wsdl"
+          xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
+          xmlns:xs="http://www.w3.org/2001/XMLSchema"
+          xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
+          xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+#foreach ($targetNamespace in $targetNamespaces)
+  <jaxws:bindings  node="wsdl:definitions/wsdl:types/xs:schema[@targetNamespace='$targetNamespace']">
+      <jxb:globalBindings>
+        <jxb:javaType name="$datetype" xmlType="xs:dateTime"
+                      parseMethod="$parseMethod"
+                      printMethod="$printMethod"/>
+      </jxb:globalBindings>
+  </jaxws:bindings>
+#end
+</jaxws:bindings>
\ No newline at end of file

Modified: incubator/cxf/trunk/tools/javato/core/src/main/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/core/src/main/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessor.java?view=diff&rev=553415&r1=553414&r2=553415
==============================================================================
--- incubator/cxf/trunk/tools/javato/core/src/main/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessor.java (original)
+++ incubator/cxf/trunk/tools/javato/core/src/main/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessor.java Thu Jul  5 01:28:47 2007
@@ -60,11 +60,11 @@
             String ns = (String)context.get(ToolConstants.CFG_TNS);
             service.setTargetNamespace(ns);
         }
-        
+
         if (context.containsKey(ToolConstants.CFG_PORT)) {
             String portName = (String)context.get(ToolConstants.CFG_PORT);
             EndpointInfo einfo = service.getEndpoints().iterator().next();
-            QName qn = new QName(einfo.getName().getNamespaceURI(), portName); 
+            QName qn = new QName(einfo.getName().getNamespaceURI(), portName);
             einfo.setName(qn);
         }
 
@@ -74,7 +74,7 @@
         }
     }
 
-    public void process() throws ToolException {        
+    public void process() throws ToolException {
         String oldClassPath = System.getProperty(JAVA_CLASS_PATH);
         LOG.log(Level.INFO, "OLD_CP", oldClassPath);
         if (context.get(ToolConstants.CFG_CLASSPATH) != null) {
@@ -92,23 +92,32 @@
                                       service.getName().getLocalPart() + ".wsdl");
 
         File outputDir = getOutputDir(wsdlFile);
-        
+
         generators.add(getWSDLGenerator(wsdlFile));
         generators.add(getWrapperBeanGenerator());
         generators.add(getFaultBeanGenerator());
-        
+        //generators.add(getDateTypeCustGenerator(wsdlFile));
+
         generate(service, outputDir);
         System.setProperty(JAVA_CLASS_PATH, oldClassPath);
         LOG.log(Level.INFO, "RESUME_CP", oldClassPath);
     }
 
+//     private AbstractGenerator getDateTypeCustGenerator(final File wsdlFile) {
+//         DateTypeCustomGenerator generator = new DateTypeCustomGenerator();
+//         generator.setAllowImports(context.containsKey(ToolConstants.CFG_CREATE_XSD_IMPORTS));
+//         generator.setWSDLFile(wsdlFile);
+//         generator.setServiceClass(getServiceClass());
+//         return generator;
+//     }
+
     private AbstractGenerator getWrapperBeanGenerator() {
         WrapperBeanGenerator generator = new WrapperBeanGenerator();
         generator.setOutputBase(getSourceDir());
         generator.setCompileToDir(getClassesDir());
         return generator;
     }
-    
+
     private AbstractGenerator getFaultBeanGenerator() {
         FaultBeanGenerator generator = new FaultBeanGenerator();
         generator.setOutputBase(getSourceDir());
@@ -135,7 +144,7 @@
     }
 
     public ServiceBuilder getServiceBuilder() throws ToolException {
-        
+
         ServiceBuilderFactory builderFactory = ServiceBuilderFactory.getInstance();
         builderFactory.setServiceClass(getServiceClass());
         // TODO check if user specify the style from cli arguments
@@ -143,7 +152,7 @@
         ServiceBuilder builder = builderFactory.newBuilder();
 
         builder.validate();
-        
+
         if (context.get(ToolConstants.CFG_ADDRESS) != null) {
             String address = (String)context.get(ToolConstants.CFG_ADDRESS);
             builder.setAddress(address);
@@ -171,7 +180,7 @@
             return WSDLConstants.SOAP11_NAMESPACE;
         }
     }
-    
+
     protected boolean isSOAP12() {
         if (!this.context.optionSet(ToolConstants.CFG_SOAP12)) {
             BindingType bType = getServiceClass().getAnnotation(BindingType.class);
@@ -194,14 +203,14 @@
         }
         return new File(dir);
     }
-    
+
     protected File getOutputFile(File nameFromClz, String defaultOutputFile) {
         String output = (String) context.get(ToolConstants.CFG_OUTPUTFILE);
         String dir = (String)context.get(ToolConstants.CFG_OUTPUTDIR);
         if (dir == null) {
             dir = "./";
         }
-        
+
         File result;
         if (output != null) {
             result = new File(output);
@@ -214,7 +223,7 @@
         if (nameFromClz != null) {
             result = nameFromClz;
         }
-        
+
         // rename the exising wsdl file
         if (result.exists()
             && !result.renameTo(new File(result.getParent(), result.getName()))) {
@@ -255,7 +264,7 @@
         }
         return new File(dir);
     }
-    
+
     public Bus getBus() {
         return BusFactory.getDefaultBus();
     }

Added: incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/fortest/date/EchoCalendar.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/fortest/date/EchoCalendar.java?view=auto&rev=553415
==============================================================================
--- incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/fortest/date/EchoCalendar.java (added)
+++ incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/fortest/date/EchoCalendar.java Thu Jul  5 01:28:47 2007
@@ -0,0 +1,30 @@
+/**
+ * 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.date;
+
+import java.util.Calendar;
+import javax.jws.WebService;
+
+@WebService
+public class EchoCalendar {
+    public Calendar echoCalendar(Calendar c) {
+        return Calendar.getInstance();
+    }
+}

Added: incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/fortest/date/EchoDate.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/fortest/date/EchoDate.java?view=auto&rev=553415
==============================================================================
--- incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/fortest/date/EchoDate.java (added)
+++ incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/fortest/date/EchoDate.java Thu Jul  5 01:28:47 2007
@@ -0,0 +1,31 @@
+/**
+ * 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.date;
+
+import java.util.Date;
+import javax.jws.WebService;
+
+@WebService
+public class EchoDate {
+    public Date echoDate(Date d) {
+        return new Date();
+    }
+}
+

Added: incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/DateTypeCustomGeneratorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/DateTypeCustomGeneratorTest.java?view=auto&rev=553415
==============================================================================
--- incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/DateTypeCustomGeneratorTest.java (added)
+++ incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/DateTypeCustomGeneratorTest.java Thu Jul  5 01:28:47 2007
@@ -0,0 +1,112 @@
+/**
+ * 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.java2wsdl.generator.wsdl11;
+
+import java.io.File;
+import java.util.Arrays;
+import java.util.Calendar;
+import java.util.Date;
+
+import org.apache.cxf.service.model.ServiceInfo;
+import org.apache.cxf.tools.common.ProcessorTestBase;
+import org.apache.cxf.tools.common.ToolConstants;
+import org.apache.cxf.tools.fortest.date.EchoCalendar;
+import org.apache.cxf.tools.fortest.date.EchoDate;
+import org.apache.cxf.tools.java2wsdl.processor.JavaToProcessor;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class DateTypeCustomGeneratorTest extends ProcessorTestBase {
+    DateTypeCustomGenerator gen = new DateTypeCustomGenerator();
+    JavaToProcessor processor = new JavaToProcessor();
+
+    @Before
+    public void setUp() throws Exception {
+        super.setUp();
+        processor.setEnvironment(env);
+    }
+
+    @After
+    public void tearDown() {
+        super.tearDown();
+    }
+
+    @Test
+    public void testGetJAXBCustFile() {
+        gen.setWSDLName("demo");
+        assertTrue(gen.getJAXBCustFile(new File(".")).toString().endsWith("demo.xjb"));
+    }
+
+    private ServiceInfo getServiceInfo(Class clz) {
+        env.put(ToolConstants.CFG_CLASSNAME, clz.getName());
+        return processor.getServiceBuilder().createService();
+    }
+
+    @Test
+    public void getGetDateType() {
+        assertNull(gen.getDateType());
+        gen.setServiceModel(getServiceInfo(org.apache.cxf.tools.fortest.jaxws.rpc.GreeterFault.class));
+        assertNull(gen.getDateType());
+
+        gen.setServiceModel(getServiceInfo(EchoDate.class));
+        assertEquals(Date.class, gen.getDateType());
+
+        gen.setServiceModel(getServiceInfo(EchoCalendar.class));
+        assertEquals(Calendar.class, gen.getDateType());
+    }
+
+    @Test
+    public void testGenerateEmbedStyle() {
+        gen.setWSDLName("date_embed");
+        gen.setServiceModel(getServiceInfo(EchoDate.class));
+        assertEquals(Date.class, gen.getDateType());
+
+        String expectedFile = getClass().getResource("expected/date_embed.xml").getFile();
+        assertFileEquals(new File(expectedFile), gen.generate(output));
+
+        gen.setWSDLName("calendar_embed");
+        gen.setServiceModel(getServiceInfo(EchoCalendar.class));
+        assertEquals(Calendar.class, gen.getDateType());
+
+        expectedFile = getClass().getResource("expected/calendar_embed.xml").getFile();
+        assertFileEquals(new File(expectedFile), gen.generate(output));
+    }
+
+    @Test
+    public void testGenerateExternalStyle() {
+        gen.setAllowImports(true);
+        gen.addSchemaFiles(Arrays.asList(new String[]{"hello_schema1.xsd", "hello_schema2.xsd"}));
+
+        gen.setWSDLName("date_external");
+        gen.setServiceModel(getServiceInfo(EchoDate.class));
+        assertEquals(Date.class, gen.getDateType());
+
+        String expectedFile = getClass().getResource("expected/date.xjb").getFile();
+        assertFileEquals(new File(expectedFile), gen.generate(output));
+
+        gen.setWSDLName("calendar_external");
+        gen.setServiceModel(getServiceInfo(EchoCalendar.class));
+        assertEquals(Calendar.class, gen.getDateType());
+
+        expectedFile = getClass().getResource("expected/calendar.xjb").getFile();
+        assertFileEquals(new File(expectedFile), gen.generate(output));
+    }
+}
\ No newline at end of file

Modified: incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/FaultBeanGeneratorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/FaultBeanGeneratorTest.java?view=diff&rev=553415&r1=553414&r2=553415
==============================================================================
--- incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/FaultBeanGeneratorTest.java (original)
+++ incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/FaultBeanGeneratorTest.java Thu Jul  5 01:28:47 2007
@@ -45,22 +45,22 @@
 
     @After
     public void tearDown() {
-        //super.tearDown();
+        super.tearDown();
         System.setProperty("java.class.path", classPath);
     }
-    
+
     private ServiceInfo getServiceInfo() {
         return processor.getServiceBuilder().createService();
     }
-    
+
     @Test
     public void testGenFaultBean() throws Exception {
         String testingClass = "org.apache.cxf.tools.fortest.cxf523.Database";
         env.put(ToolConstants.CFG_CLASSNAME, testingClass);
-        
+
         FaultBeanGenerator generator = new FaultBeanGenerator();
         generator.setServiceModel(getServiceInfo());
-        
+
         generator.generate(output);
 
         String pkgBase = "org/apache/cxf/tools/fortest/cxf523/jaxws";
@@ -76,10 +76,10 @@
     public void testGenFaultBeanWithCustomization() throws Exception {
         String testingClass = "org.apache.cxf.tools.fortest.jaxws.rpc.GreeterFault";
         env.put(ToolConstants.CFG_CLASSNAME, testingClass);
-        
+
         FaultBeanGenerator generator = new FaultBeanGenerator();
         generator.setServiceModel(getServiceInfo());
-        
+
         generator.generate(output);
 
         String pkgBase = "org/apache/cxf/tools/fortest/jaxws/rpc/types";
@@ -102,7 +102,7 @@
         assertEquals(0, classes.size());
 
         classes.clear();
-        
+
         seiClass = Class.forName("org.apache.cxf.tools.fortest.cxf523.Database");
         for (Method method : seiClass.getMethods()) {
             classes.addAll(generator.getExceptionClasses(method));

Added: incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/expected/calendar.xjb
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/expected/calendar.xjb?view=auto&rev=553415
==============================================================================
--- incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/expected/calendar.xjb (added)
+++ incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/expected/calendar.xjb Thu Jul  5 01:28:47 2007
@@ -0,0 +1,32 @@
+<!--
+        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.
+-->
+<jxb:bindings version="1.0"
+              xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
+              xmlns:xs="http://www.w3.org/2001/XMLSchema">
+  <jxb:bindings schemaLocation="hello_schema1.xsd" node="/xs:schema">
+    <jxb:globalBindings>
+      <jxb:javaType name="java.util.Calendar" xmlType="xs:dateTime" parseMethod="javax.xml.bind.DatatypeConverter.parseDateTime" printMethod="javax.xml.bind.DatatypeConverter.printDateTime"/>
+    </jxb:globalBindings>
+  </jxb:bindings>
+  <jxb:bindings schemaLocation="hello_schema2.xsd" node="/xs:schema">
+    <jxb:globalBindings>
+      <jxb:javaType name="java.util.Calendar" xmlType="xs:dateTime" parseMethod="javax.xml.bind.DatatypeConverter.parseDateTime" printMethod="javax.xml.bind.DatatypeConverter.printDateTime"/>
+    </jxb:globalBindings>
+  </jxb:bindings>
+</jxb:bindings>
\ No newline at end of file

Added: incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/expected/calendar_embed.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/expected/calendar_embed.xml?view=auto&rev=553415
==============================================================================
--- incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/expected/calendar_embed.xml (added)
+++ incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/expected/calendar_embed.xml Thu Jul  5 01:28:47 2007
@@ -0,0 +1,31 @@
+<!--
+        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.
+-->
+<jaxws:bindings wsdlLocation="calendar_embed.wsdl"
+          xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
+          xmlns:xs="http://www.w3.org/2001/XMLSchema"
+          xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
+          xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+  <jaxws:bindings  node="wsdl:definitions/wsdl:types/xs:schema[@targetNamespace='http://date.fortest.tools.cxf.apache.org/']">
+      <jxb:globalBindings>
+        <jxb:javaType name="java.util.Calendar" xmlType="xs:dateTime"
+                      parseMethod="javax.xml.bind.DatatypeConverter.parseDateTime"
+                      printMethod="javax.xml.bind.DatatypeConverter.printDateTime"/>
+      </jxb:globalBindings>
+  </jaxws:bindings>
+</jaxws:bindings>
\ No newline at end of file

Added: incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/expected/date.xjb
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/expected/date.xjb?view=auto&rev=553415
==============================================================================
--- incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/expected/date.xjb (added)
+++ incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/expected/date.xjb Thu Jul  5 01:28:47 2007
@@ -0,0 +1,32 @@
+<!--
+        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.
+-->
+<jxb:bindings version="1.0"
+              xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
+              xmlns:xs="http://www.w3.org/2001/XMLSchema">
+  <jxb:bindings schemaLocation="hello_schema1.xsd" node="/xs:schema">
+    <jxb:globalBindings>
+      <jxb:javaType name="java.util.Date" xmlType="xs:dateTime" parseMethod="org.apache.cxf.tools.common.DataTypeAdapter.parseDateTime" printMethod="org.apache.cxf.tools.common.DataTypeAdapter.printDateTime"/>
+    </jxb:globalBindings>
+  </jxb:bindings>
+  <jxb:bindings schemaLocation="hello_schema2.xsd" node="/xs:schema">
+    <jxb:globalBindings>
+      <jxb:javaType name="java.util.Date" xmlType="xs:dateTime" parseMethod="org.apache.cxf.tools.common.DataTypeAdapter.parseDateTime" printMethod="org.apache.cxf.tools.common.DataTypeAdapter.printDateTime"/>
+    </jxb:globalBindings>
+  </jxb:bindings>
+</jxb:bindings>
\ No newline at end of file

Added: incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/expected/date_embed.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/expected/date_embed.xml?view=auto&rev=553415
==============================================================================
--- incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/expected/date_embed.xml (added)
+++ incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/expected/date_embed.xml Thu Jul  5 01:28:47 2007
@@ -0,0 +1,31 @@
+<!--
+        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.
+-->
+<jaxws:bindings wsdlLocation="date_embed.wsdl"
+          xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
+          xmlns:xs="http://www.w3.org/2001/XMLSchema"
+          xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
+          xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+  <jaxws:bindings  node="wsdl:definitions/wsdl:types/xs:schema[@targetNamespace='http://date.fortest.tools.cxf.apache.org/']">
+      <jxb:globalBindings>
+        <jxb:javaType name="java.util.Date" xmlType="xs:dateTime"
+                      parseMethod="org.apache.cxf.tools.common.DataTypeAdapter.parseDateTime"
+                      printMethod="org.apache.cxf.tools.common.DataTypeAdapter.printDateTime"/>
+      </jxb:globalBindings>
+  </jaxws:bindings>
+</jaxws:bindings>
\ No newline at end of file

Modified: incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java?view=diff&rev=553415&r1=553414&r2=553415
==============================================================================
--- incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java (original)
+++ incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java Thu Jul  5 01:28:47 2007
@@ -50,11 +50,11 @@
         System.setProperty("java.class.path", getClassPath());
     }
     @After
-    public void tearDown() {      
+    public void tearDown() {
         super.tearDown();
         System.setProperty("java.class.path", classPath);
     }
-        
+
     @Test
     public void testGetWSDLVersion() {
         processor.setEnvironment(new ToolContext());
@@ -111,22 +111,22 @@
         env.put(ToolConstants.CFG_CLASSNAME, "org.apache.hello_world_soap12_http.Greeter");
         env.put(ToolConstants.CFG_SOAP12, "soap12");
         env.put(ToolConstants.CFG_OUTPUTFILE, output.getPath() + "/hello_soap12.wsdl");
-        
+
         processor.setEnvironment(env);
         processor.process();
 
         String expectedFile = getClass().getResource("expected/hello_soap12.wsdl").getFile();
         assertFileEquals(new File(expectedFile), new File(output, "hello_soap12.wsdl"));
     }
-    
+
     @Test
     public void testDocLitUseClassPathFlag() throws Exception {
         File classFile = new java.io.File(output.getCanonicalPath() + "/classes");
         classFile.mkdir();
-        
+
         System.setProperty("java.class.path", getClassPath() + classFile.getCanonicalPath()
                            + File.separatorChar);
-        
+
         env.put(ToolConstants.CFG_COMPILE, ToolConstants.CFG_COMPILE);
         env.put(ToolConstants.CFG_CLASSDIR, output.getCanonicalPath() + "/classes");
         env.put(FrontEndProfile.class, PluginLoader.getInstance().getFrontEndProfile("jaxws"));
@@ -138,14 +138,14 @@
         JAXWSContainer w2jProcessor = new JAXWSContainer(null);
         w2jProcessor.setContext(env);
         w2jProcessor.execute();
-        
-        
+
+
         String tns = "http://apache.org/sepecifiedTns";
         String serviceName = "cxfService";
         String portName = "cxfPort";
 
         System.setProperty("java.class.path", "");
-        
+
         //      test flag
         String[] args = new String[] {"-o",
                                       "java2wsdl.wsdl",
@@ -167,17 +167,17 @@
         Definition def = wsdlHelper.getDefinition(wsdlFile);
         Service wsdlService = def.getService(new QName(tns, serviceName));
         assertNotNull("Generate WSDL Service Error", wsdlService);
-        
+
         Port wsdlPort = wsdlService.getPort(portName);
         assertNotNull("Generate service port error ", wsdlPort);
-        
+
     }
 
     @Test
     public void testDataBase() throws Exception {
         env.put(ToolConstants.CFG_CLASSNAME, "org.apache.cxf.tools.fortest.cxf523.Database");
         env.put(ToolConstants.CFG_OUTPUTFILE, output.getPath() + "/db.wsdl");
-        
+
         processor.setEnvironment(env);
         processor.process();
 
@@ -201,7 +201,7 @@
         env.put(ToolConstants.CFG_SOAP12, "soap12");
         env.put(ToolConstants.CFG_OUTPUTFILE, output.getPath() + "/my_hello_soap12.wsdl");
         env.put(ToolConstants.CFG_SERVICENAME, "MyService");
-        
+
         processor.setEnvironment(env);
         processor.process();
 
@@ -213,7 +213,7 @@
         env.put(ToolConstants.CFG_CLASSNAME,
                 "org.apache.cxf.tools.fortest.classnoanno.docwrapped.Calculator");
         env.put(ToolConstants.CFG_OUTPUTFILE, output.getPath() + "/my_calculator.wsdl");
-        
+
         processor.setEnvironment(env);
         processor.process();
 
@@ -228,7 +228,7 @@
     public void testNoNeedGenWrapperBeanClasses() throws Exception {
         env.put(ToolConstants.CFG_CLASSNAME, "org.apache.cxf.tools.fortest.withannotation.doc.Stock");
         env.put(ToolConstants.CFG_OUTPUTFILE, output.getPath() + "/my_stock.wsdl");
-        
+
         processor.setEnvironment(env);
         processor.process();
 
@@ -245,7 +245,7 @@
                 "org.apache.cxf.tools.fortest.classnoanno.docwrapped.Calculator");
         env.put(ToolConstants.CFG_OUTPUTFILE, output.getPath() + "/my_stock.wsdl");
         env.put(ToolConstants.CFG_SOURCEDIR, output.getPath() + "/beans");
-        
+
         processor.setEnvironment(env);
         processor.process();
 
@@ -255,8 +255,8 @@
         assertTrue(requestWrapperClass.exists());
         assertTrue(responseWrapperClass.exists());
     }
-    
-    
+
+
     @Test
     //test for CXF-704 and CXF-705
     public void testHello() throws Exception {
@@ -264,7 +264,7 @@
         env.put(ToolConstants.CFG_CLASSNAME, "org.apache.cxf.tools.fortest.Hello");
         processor.setEnvironment(env);
         processor.process();
-        
+
         File wsdlFile = new File(output, "hello.wsdl");
         assertTrue("Generate Wsdl Fail", wsdlFile.exists());
 
@@ -276,64 +276,64 @@
         env.put(ToolConstants.CFG_CLASSNAME, "HelloNoPackage");
         processor.setEnvironment(env);
         processor.process();
-        
+
         File wsdlFile = new File(output, "hello-no-package.wsdl");
         assertTrue("Generate Wsdl Fail", wsdlFile.exists());
-        
-        
+
+
         String pkgBase = "defaultnamespace";
         File requestWrapperClass = new File(output, pkgBase + "/jaxws/SayHi.java");
         File responseWrapperClass = new File(output, pkgBase + "/jaxws/SayHiResponse.java");
         assertTrue(requestWrapperClass.exists());
         assertTrue(responseWrapperClass.exists());
     }
-    
+
     @Test
     public void testRPCHello() throws Exception {
         env.put(ToolConstants.CFG_OUTPUTFILE, output.getPath() + "/rpc-hello.wsdl");
         env.put(ToolConstants.CFG_CLASSNAME, "org.apache.cxf.tools.fortest.RPCHello");
         processor.setEnvironment(env);
         processor.process();
-        
+
         File wsdlFile = new File(output, "rpc-hello.wsdl");
         assertTrue("Generate Wsdl Fail", wsdlFile.exists());
         String expectedFile = getClass().getResource("expected/rpc-hello-expected.wsdl").getFile();
         assertFileEquals(new File(expectedFile), new File(output, "rpc-hello.wsdl"));
 
     }
-    
-    
+
+
     @Test
     public void testXMlBare() {
         env.put(ToolConstants.CFG_OUTPUTFILE, output.getPath() + "/xml-bare.wsdl");
         env.put(ToolConstants.CFG_CLASSNAME, "org.apache.xml_bare.Greeter");
         processor.setEnvironment(env);
         processor.process();
-        
+
         File wsdlFile = new File(output, "xml-bare.wsdl");
         assertTrue("Generate Wsdl Fail", wsdlFile.exists());
         String expectedFile = getClass().getResource("expected/xml-bare-expected.wsdl").getFile();
         assertFileEquals(new File(expectedFile), new File(output, "/xml-bare.wsdl"));
-               
+
     }
-    
-    
+
+
     @Test
     public void testFault() throws Exception {
         env.put(ToolConstants.CFG_OUTPUTFILE, output.getPath() + "/fault.wsdl");
         env.put(ToolConstants.CFG_CLASSNAME, "org.apache.fault.Greeter");
         processor.setEnvironment(env);
         processor.process();
-        
+
         File wsdlFile = new File(output, "fault.wsdl");
         assertTrue("Generate Wsdl Fail", wsdlFile.exists());
-        
+
         String expectedFile = getClass().getResource("expected/hello_world_fault_expected.wsdl").getFile();
         assertFileEquals(new File(expectedFile), new File(output, "/fault.wsdl"));
 
     }
-    
-    
+
+
 
     @Test
     public void testResumeClasspath() throws Exception {
@@ -350,7 +350,7 @@
 
         assertEquals(oldCP, newCP);
     }
-    
+
     @Test
     public void testWrongInterface() throws Exception {
         env.put(ToolConstants.CFG_CLASSNAME, "org.apache.cxf.tools.java2wsdl.processor.Hello");
@@ -360,5 +360,37 @@
         } catch (RuntimeException e) {
             assertEquals("JAXWS SEIs may not implement the java.rmi.Remote interface.", e.getMessage());
         }
+    }
+
+    @Test
+    public void testDateAdapter() throws Exception {
+        env.put(ToolConstants.CFG_CLASSNAME, "org.apache.cxf.tools.fortest.date.EchoDate");
+        env.put(ToolConstants.CFG_OUTPUTFILE, output.getPath() + "/echo_date.wsdl");
+        processor.setEnvironment(env);
+        processor.process();
+
+        File wsdlFile = new File(output, "echo_date.wsdl");
+        assertTrue("Generate Wsdl Fail", wsdlFile.exists());
+        File bindingFile = new File(output, "echo_date.xjb");
+        assertTrue(bindingFile.exists());
+
+        String expectedFile = getClass().getResource("expected/echo_date.xjb").getFile();
+        assertFileEquals(new File(expectedFile), bindingFile);
+    }
+
+    @Test
+    public void testCalendarAdapter() throws Exception {
+        env.put(ToolConstants.CFG_CLASSNAME, "org.apache.cxf.tools.fortest.date.EchoCalendar");
+        env.put(ToolConstants.CFG_OUTPUTFILE, output.getPath() + "/echo_calendar.wsdl");
+        processor.setEnvironment(env);
+        processor.process();
+
+        File wsdlFile = new File(output, "echo_calendar.wsdl");
+        assertTrue("Generate Wsdl Fail", wsdlFile.exists());
+        File bindingFile = new File(output, "echo_calendar.xjb");
+        assertTrue(bindingFile.exists());
+
+        String expectedFile = getClass().getResource("expected/echo_calendar.xjb").getFile();
+        assertFileEquals(new File(expectedFile), bindingFile);
     }
 }

Added: incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/echo_calendar.xjb
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/echo_calendar.xjb?view=auto&rev=553415
==============================================================================
--- incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/echo_calendar.xjb (added)
+++ incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/echo_calendar.xjb Thu Jul  5 01:28:47 2007
@@ -0,0 +1,32 @@
+<!--
+  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.
+-->
+
+<jaxws:bindings wsdlLocation="echo_calendar.wsdl"
+          xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
+          xmlns:xs="http://www.w3.org/2001/XMLSchema"
+          xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
+          xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+  <jaxws:bindings  node="wsdl:definitions/wsdl:types/xs:schema[@targetNamespace='http://date.fortest.tools.cxf.apache.org/']">
+      <jxb:globalBindings>
+        <jxb:javaType name="java.util.Calendar" xmlType="xs:dateTime"
+                      parseMethod="javax.xml.bind.DatatypeConverter.parseDateTime"
+                      printMethod="javax.xml.bind.DatatypeConverter.printDateTime"/>
+      </jxb:globalBindings>
+  </jaxws:bindings>
+</jaxws:bindings>
\ No newline at end of file

Added: incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/echo_date.xjb
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/echo_date.xjb?view=auto&rev=553415
==============================================================================
--- incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/echo_date.xjb (added)
+++ incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/echo_date.xjb Thu Jul  5 01:28:47 2007
@@ -0,0 +1,31 @@
+<!--
+  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.
+-->
+<jaxws:bindings wsdlLocation="echo_date.wsdl"
+          xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
+          xmlns:xs="http://www.w3.org/2001/XMLSchema"
+          xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
+          xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+  <jaxws:bindings  node="wsdl:definitions/wsdl:types/xs:schema[@targetNamespace='http://date.fortest.tools.cxf.apache.org/']">
+      <jxb:globalBindings>
+        <jxb:javaType name="java.util.Date" xmlType="xs:dateTime"
+                      parseMethod="org.apache.cxf.tools.common.DataTypeAdapter.parseDateTime"
+                      printMethod="org.apache.cxf.tools.common.DataTypeAdapter.printDateTime"/>
+      </jxb:globalBindings>
+  </jaxws:bindings>
+</jaxws:bindings>
\ No newline at end of file

Modified: incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JaxwsServiceBuilderNoAnnoTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JaxwsServiceBuilderNoAnnoTest.java?view=diff&rev=553415&r1=553414&r2=553415
==============================================================================
--- incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JaxwsServiceBuilderNoAnnoTest.java (original)
+++ incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JaxwsServiceBuilderNoAnnoTest.java Thu Jul  5 01:28:47 2007
@@ -32,8 +32,8 @@
 public class JaxwsServiceBuilderNoAnnoTest extends ProcessorTestBase {
     JaxwsServiceBuilder builder = new JaxwsServiceBuilder();
     WSDL11Generator generator = new WSDL11Generator();
-    
-    
+
+
     @Before
     public void setUp() throws Exception {
         super.setUp();
@@ -42,9 +42,9 @@
     }
 
     public void tearDown() {
-        
+
     }
-    
+
     @Test
     public void testGeneratedWithElementryClass() throws Exception {
         builder.setServiceClass(org.apache.cxf.tools.fortest.classnoanno.docbare.Stock.class);
@@ -54,7 +54,7 @@
         File output = getOutputFile("stock_noanno_bare.wsdl");
         generator.generate(output);
         assertTrue(output.exists());
-        
+
         String expectedFile = getClass().getResource("expected/stock_noanno_bare.wsdl").getFile();
         assertFileEquals(expectedFile, output.getAbsolutePath());
     }
@@ -76,7 +76,6 @@
 
     // Revisit:
     // * Missing wsdl:types
-    // * Binding style should be RPC not Document (FIXED CXF-522)
     // * input message of binding operation "getPrice" MUST specify a value for the "namespace" attribute
     // * output message of binding operation "getPrice" MUST specify a value for the "namespace" attribute
     // CXF-527

Modified: incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java?view=diff&rev=553415&r1=553414&r2=553415
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java (original)
+++ incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java Thu Jul  5 01:28:47 2007
@@ -68,7 +68,7 @@
 
 
 public class WSDLToJavaContainer extends AbstractCXFToolContainer {
-    
+
     protected static final Logger LOG = LogUtils.getL7dLogger(WSDLToJavaContainer.class);
     private static final String DEFAULT_NS2PACKAGE = "http://www.w3.org/2005/08/addressing";
     private static final String SERVICE_VALIDATOR = "META-INF/service.validator.xml";
@@ -159,9 +159,9 @@
                 for (ServiceInfo service : serviceList) {
 
                     context.put(ServiceInfo.class, service);
-                    
+
                     ((ClassNameProcessor)processor).processClassNames();
-                    
+
                     context.put(ServiceInfo.class, null);
                 }
             }
@@ -397,7 +397,7 @@
         if (!context.containsKey(ToolConstants.CFG_WSDL_VERSION)) {
             context.put(ToolConstants.CFG_WSDL_VERSION, WSDLConstants.WSDL11);
         }
-        
+
         loadDefaultNSPackageMapping(context);
         setPackageAndNamespaces(context);
         setExcludePackageAndNamespaces(context);
@@ -494,7 +494,7 @@
 
     public List<ServiceValidator> getServiceValidators() {
         List<ServiceValidator> validators = new ArrayList<ServiceValidator>();
-        
+
         Properties initialExtensions = null;
         try {
             initialExtensions = PropertiesLoaderUtils.loadAllProperties(SERVICE_VALIDATOR, Thread

Modified: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/pom.xml?view=diff&rev=553415&r1=553414&r2=553415
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/pom.xml (original)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/pom.xml Thu Jul  5 01:28:47 2007
@@ -6,9 +6,9 @@
     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
@@ -68,8 +68,8 @@
         <connection>scm:svn:http://svn.apache.org/repos/asf/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws</connection>
         <developerConnection>scm:svn:https://svn.apache.org/repos/asf/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws</developerConnection>
       <url>http://svn.apache.org/viewvc/incubator/cxf/trunk/cxf-parent/cxf-tools-wsdlto-frontend-jaxws</url>
-  </scm>   
+  </scm>
+
 
-    
 
 </project>

Added: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customiztion/CustomNodeSelector.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customiztion/CustomNodeSelector.java?view=auto&rev=553415
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customiztion/CustomNodeSelector.java (added)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customiztion/CustomNodeSelector.java Thu Jul  5 01:28:47 2007
@@ -0,0 +1,73 @@
+/**
+ * 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.wsdlto.frontend.jaxws.customiztion;
+
+import java.util.HashMap;
+import java.util.Map;
+import javax.xml.xpath.XPathConstants;
+
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+
+import org.apache.cxf.helpers.MapNamespaceContext;
+import org.apache.cxf.helpers.XPathUtils;
+import org.apache.cxf.tools.common.ToolConstants;
+
+public final class CustomNodeSelector {
+    private static final Map<String, String> BINDING_NS_MAP = new HashMap<String, String>();
+
+    private MapNamespaceContext context = new MapNamespaceContext();
+
+    static {
+        BINDING_NS_MAP.put("jaxws", ToolConstants.NS_JAXWS_BINDINGS);
+        BINDING_NS_MAP.put("jaxb", ToolConstants.NS_JAXB_BINDINGS);
+        BINDING_NS_MAP.put("wsdl", ToolConstants.WSDL_NAMESPACE_URI);
+        BINDING_NS_MAP.put("xsd", ToolConstants.SCHEMA_URI);
+    }
+
+    public CustomNodeSelector() {
+        context.addNamespaces(BINDING_NS_MAP);
+    }
+
+    public MapNamespaceContext getNamespaceContext() {
+        return context;
+    }
+
+    public void addNamespaces(final Node targetNode) {
+        NamedNodeMap attributes = targetNode.getAttributes();
+        for (int i = 0; i < attributes.getLength(); i++) {
+            Node a = attributes.item(i);
+            String prefix = a.getLocalName();
+            String ns = a.getNodeValue();
+            if (prefix != null
+                && !context.getUsedNamespaces().containsKey(prefix)
+                && targetNode.lookupPrefix(ns) != null) {
+                context.addNamespace(prefix, ns);
+            }
+        }
+    }
+
+    public Node queryNode(final Node target, final String expression) {
+        XPathUtils xpath = new XPathUtils(context);
+
+        Node node = (Node) xpath.getValue(expression, target, XPathConstants.NODE);
+
+        return node;
+    }
+}
\ No newline at end of file



Mime
View raw message