cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cschnei...@apache.org
Subject svn commit: r1236626 - in /cxf/trunk/rt/databinding/jaxb-adapter: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/cxf/ src/main/java/org/apache/cxf/jaxb/ src/main/java/org/apache/cxf/jaxb/adapter/ ...
Date Fri, 27 Jan 2012 10:32:46 GMT
Author: cschneider
Date: Fri Jan 27 10:32:45 2012
New Revision: 1236626

URL: http://svn.apache.org/viewvc?rev=1236626&view=rev
Log:
CXF-4069 Add a new module for just the JAXB Adapter so people using it have minimal dependencies

Added:
    cxf/trunk/rt/databinding/jaxb-adapter/   (with props)
    cxf/trunk/rt/databinding/jaxb-adapter/pom.xml
    cxf/trunk/rt/databinding/jaxb-adapter/src/
    cxf/trunk/rt/databinding/jaxb-adapter/src/main/
    cxf/trunk/rt/databinding/jaxb-adapter/src/main/java/
    cxf/trunk/rt/databinding/jaxb-adapter/src/main/java/org/
    cxf/trunk/rt/databinding/jaxb-adapter/src/main/java/org/apache/
    cxf/trunk/rt/databinding/jaxb-adapter/src/main/java/org/apache/cxf/
    cxf/trunk/rt/databinding/jaxb-adapter/src/main/java/org/apache/cxf/jaxb/
    cxf/trunk/rt/databinding/jaxb-adapter/src/main/java/org/apache/cxf/jaxb/adapter/
    cxf/trunk/rt/databinding/jaxb-adapter/src/main/java/org/apache/cxf/jaxb/adapter/DataTypeAdapter.java
    cxf/trunk/rt/databinding/jaxb-adapter/src/test/
    cxf/trunk/rt/databinding/jaxb-adapter/src/test/resources/
    cxf/trunk/rt/databinding/jaxb-adapter/src/test/resources/binding.xml

Propchange: cxf/trunk/rt/databinding/jaxb-adapter/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Jan 27 10:32:45 2012
@@ -0,0 +1,7 @@
+.checkstyle
+.classpath
+.pmd
+.project
+.ruleset
+.settings
+target

Added: cxf/trunk/rt/databinding/jaxb-adapter/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/jaxb-adapter/pom.xml?rev=1236626&view=auto
==============================================================================
--- cxf/trunk/rt/databinding/jaxb-adapter/pom.xml (added)
+++ cxf/trunk/rt/databinding/jaxb-adapter/pom.xml Fri Jan 27 10:32:45 2012
@@ -0,0 +1,34 @@
+<!--
+  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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>cxf-rt-databinding-jaxb-adapter</artifactId>
+    <packaging>jar</packaging>
+    <name>Apache CXF Runtime JAXB DataBinding Adapters</name>
+    <description>Apache CXF Runtime JAXB DataBinding Adapters</description>
+    <url>http://cxf.apache.org</url>
+
+    <parent>
+        <groupId>org.apache.cxf</groupId>
+        <artifactId>cxf-parent</artifactId>
+        <version>2.6.0-SNAPSHOT</version>
+        <relativePath>../../../parent/pom.xml</relativePath>
+    </parent>
+
+</project>

Added: cxf/trunk/rt/databinding/jaxb-adapter/src/main/java/org/apache/cxf/jaxb/adapter/DataTypeAdapter.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/jaxb-adapter/src/main/java/org/apache/cxf/jaxb/adapter/DataTypeAdapter.java?rev=1236626&view=auto
==============================================================================
--- cxf/trunk/rt/databinding/jaxb-adapter/src/main/java/org/apache/cxf/jaxb/adapter/DataTypeAdapter.java
(added)
+++ cxf/trunk/rt/databinding/jaxb-adapter/src/main/java/org/apache/cxf/jaxb/adapter/DataTypeAdapter.java
Fri Jan 27 10:32:45 2012
@@ -0,0 +1,75 @@
+/**
+ * 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.jaxb.adapter;
+
+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) {
+        if (s == null) {
+            return null;
+        }
+        return DatatypeConverter.parseDate(s).getTime();
+    }
+    public static String printDate(Date dt) {
+        if (dt == null) {
+            return null;
+        }
+        Calendar c = Calendar.getInstance();
+        c.setTime(dt);
+        return DatatypeConverter.printDate(c);
+    }
+
+    public static Date parseTime(String s) {
+        if (s == null) {
+            return null;
+        }
+        return DatatypeConverter.parseTime(s).getTime();
+    }
+    public static String printTime(Date dt) {
+        if (dt == null) {
+            return null;
+        }
+        Calendar c = Calendar.getInstance();
+        c.setTime(dt);
+        return DatatypeConverter.printTime(c);
+    }
+
+    public static Date parseDateTime(String s) {
+        if (s == null) {
+            return null;
+        }
+        return DatatypeConverter.parseDateTime(s).getTime();
+    }
+    public static String printDateTime(Date dt) {
+        if (dt == null) {
+            return null;
+        }
+        Calendar c = Calendar.getInstance();
+        c.setTime(dt);
+        return DatatypeConverter.printDateTime(c);
+    }
+}
\ No newline at end of file

Added: cxf/trunk/rt/databinding/jaxb-adapter/src/test/resources/binding.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/jaxb-adapter/src/test/resources/binding.xml?rev=1236626&view=auto
==============================================================================
--- cxf/trunk/rt/databinding/jaxb-adapter/src/test/resources/binding.xml (added)
+++ cxf/trunk/rt/databinding/jaxb-adapter/src/test/resources/binding.xml Fri Jan 27 10:32:45
2012
@@ -0,0 +1,42 @@
+<!--
+  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.
+-->
+
+<!-- 
+    Sample JAX-WS / JAXB binding config to be used by CXF users
+ 
+    Create Date for xs:date or xs:dateTime types instead of XmlGregorianCalendar 
+-->
+<jaxws:bindings wsdlLocation="CustomerService.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:enableAsyncMapping>true</jaxws:enableAsyncMapping> -->
+  <jaxws:bindings  node="wsdl:definitions/wsdl:types/xs:schema">
+   
+      <jxb:globalBindings>
+        <jxb:javaType name="java.util.Date" xmlType="xs:dateTime"
+                      parseMethod="org.apache.cxf.jaxb.adapter.DataTypeAdapter.parseDateTime"
+                      printMethod="org.apache.cxf.jaxb.adapter.DataTypeAdapter.printDateTime"/>
+        <jxb:javaType name="java.util.Date" xmlType="xs:date"
+                      parseMethod="org.apache.cxf.jaxb.adapter.DataTypeAdapter.parseDate"
+                      printMethod="org.apache.cxf.jaxb.adapter.DataTypeAdapter.printDate"/>
+      </jxb:globalBindings>
+  </jaxws:bindings>
+</jaxws:bindings>
\ No newline at end of file



Mime
View raw message