cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r803056 - in /cxf/trunk: rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/ systests/ systests/src/test/java/org/apache/cxf/systest/jaxrs/ systests/src/test/java/org...
Date Tue, 11 Aug 2009 10:23:15 GMT
Author: sergeyb
Date: Tue Aug 11 10:23:15 2009
New Revision: 803056

URL: http://svn.apache.org/viewvc?rev=803056&view=rev
Log:
JAXRS : adding DataBindingJSONProvider

Added:
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/DataBindingJSONProvider.java   (with props)
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JSONUtils.java   (with props)
    cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/DataBindingJSONProviderTest.java   (with props)
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/sdo/
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/sdo/SDOResource.java   (with props)
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/sdo/SdoFactory.java   (with props)
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/sdo/Structure.java   (with props)
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/sdo/impl/
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/sdo/impl/SdoFactoryImpl.java   (with props)
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/sdo/impl/StructureImpl.java   (with props)
Modified:
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AegisJSONProvider.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/DataBindingProvider.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JSONProvider.java
    cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/AegisJSONProviderTest.java
    cxf/trunk/systests/pom.xml
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSDataBindingTest.java
    cxf/trunk/systests/src/test/resources/jaxrs_databinding/WEB-INF/beans.xml

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java?rev=803056&r1=803055&r2=803056&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java Tue Aug 11 10:23:15 2009
@@ -143,7 +143,7 @@
             }
         }
         
-        return isSupported(type, genericType, anns);
+        return unmarshalAsJaxbElement || isSupported(type, genericType, anns);
     }
     
     protected JAXBContext getCollectionContext(Class<?> type) throws JAXBException {
@@ -329,6 +329,9 @@
     }
     
     protected boolean isSupported(Class<?> type, Type genericType, Annotation[] anns) {
+        if (jaxbElementClassMap != null && jaxbElementClassMap.containsKey(type.getName())) {
+            return true;
+        }
         return type.getAnnotation(XmlRootElement.class) != null
             || JAXBElement.class.isAssignableFrom(type)
             || objectFactoryForClass(type)

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AegisJSONProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AegisJSONProvider.java?rev=803056&r1=803055&r2=803056&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AegisJSONProvider.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AegisJSONProvider.java Tue Aug 11 10:23:15 2009
@@ -22,11 +22,8 @@
 
 import java.io.InputStream;
 import java.io.OutputStream;
-import java.io.OutputStreamWriter;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Type;
-import java.util.Collections;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
@@ -35,18 +32,11 @@
 import javax.ws.rs.Produces;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.ext.Provider;
-import javax.xml.namespace.NamespaceContext;
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamWriter;
 
 import org.apache.cxf.jaxrs.utils.JAXRSUtils;
-import org.apache.cxf.staxutils.DepthXMLStreamReader;
-import org.codehaus.jettison.AbstractXMLStreamWriter;
-import org.codehaus.jettison.mapped.Configuration;
-import org.codehaus.jettison.mapped.MappedNamespaceConvention;
-import org.codehaus.jettison.mapped.MappedXMLInputFactory;
-import org.codehaus.jettison.mapped.MappedXMLStreamWriter;
 
 @Provider
 @Produces({"application/json" })
@@ -70,7 +60,7 @@
     
     @Override
     public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mt) {
-        return false;
+        return true;
     }
     
     public void setNamespaceMap(Map<String, String> nsMap) {
@@ -80,35 +70,14 @@
     @Override
     protected XMLStreamWriter createStreamWriter(Class<?> type, OutputStream os) throws Exception {
         QName qname = getQName(type);
-        if (writeXsiType) {
-            namespaceMap.putIfAbsent("http://www.w3.org/2001/XMLSchema-instance", "xsins");
-        }
-        Configuration c = new Configuration(namespaceMap);
-        MappedNamespaceConvention convention = new MappedNamespaceConvention(c);
-        AbstractXMLStreamWriter xsw = new MappedXMLStreamWriter(
-                                            convention, 
-                                            new OutputStreamWriter(os, "UTF-8"));
-        if (serializeAsArray) {
-            if (arrayKeys != null) {
-                for (String key : arrayKeys) {
-                    xsw.seriliazeAsArray(key);
-                }
-            } else {
-                String key = getKey(convention, qname);
-                xsw.seriliazeAsArray(key);
-            }
-        }
-        return xsw;
+        return JSONUtils.createStreamWriter(os, qname, writeXsiType, namespaceMap, 
+                                                           serializeAsArray, arrayKeys);
     }
     
     @Override
     protected XMLStreamReader createStreamReader(Class<?> type, InputStream is) throws Exception {
-        if (readXsiType) {
-            namespaceMap.putIfAbsent("http://www.w3.org/2001/XMLSchema-instance", "xsins");
-        }
         getQName(type);
-        MappedXMLInputFactory factory = new MappedXMLInputFactory(namespaceMap);
-        return new NamespaceContextReader(factory.createXMLStreamReader(is));
+        return JSONUtils.createStreamReader(is, readXsiType, namespaceMap);
     }
     
     private QName getQName(Class<?> type) {
@@ -116,42 +85,4 @@
         namespaceMap.putIfAbsent(qname.getNamespaceURI(), "ns1");
         return qname;
     }
-    
-    private String getKey(MappedNamespaceConvention convention, QName qname) throws Exception {
-        return convention.createKey(qname.getPrefix(), 
-                                    qname.getNamespaceURI(),
-                                    qname.getLocalPart());
-    }
-    
-    private class NamespaceContextReader extends DepthXMLStreamReader {
-        public NamespaceContextReader(XMLStreamReader reader) {
-            super(reader);
-        }
-        
-        @Override
-        public NamespaceContext getNamespaceContext() {
-            return new NamespaceContext() {
-
-                public String getNamespaceURI(String prefix) {
-                    for (Map.Entry<String, String> entry : namespaceMap.entrySet()) {
-                        if (entry.getValue().equals(prefix)) {
-                            return entry.getKey();
-                        }
-                    }
-                    return null;
-                }
-
-                public String getPrefix(String ns) {
-                    return namespaceMap.get(ns);
-                }
-
-                public Iterator getPrefixes(String ns) {
-                    String prefix = getPrefix(ns);
-                    return prefix == null ? null : Collections.singletonList(prefix).iterator();
-                }
-                
-            };
-        }
-    }
-    
 }

Added: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/DataBindingJSONProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/DataBindingJSONProvider.java?rev=803056&view=auto
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/DataBindingJSONProvider.java (added)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/DataBindingJSONProvider.java Tue Aug 11 10:23:15 2009
@@ -0,0 +1,101 @@
+/**
+ * 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.jaxrs.provider;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.ext.Provider;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.cxf.jaxrs.utils.JAXRSUtils;
+
+@Provider
+@Produces("application/json")
+@Consumes("application/json")
+public class DataBindingJSONProvider extends DataBindingProvider {
+    
+    private List<String> arrayKeys;
+    private boolean serializeAsArray;
+    private ConcurrentHashMap<String, String> namespaceMap = new ConcurrentHashMap<String, String>();
+    private boolean writeXsiType = true;
+    private boolean readXsiType = true;
+    
+    public void setWriteXsiType(boolean write) {
+        writeXsiType = write;
+    }
+    
+    public void setReadXsiType(boolean read) {
+        readXsiType = read;
+    }
+    
+    public void setArrayKeys(List<String> keys) {
+        this.arrayKeys = keys;
+    }
+    
+    public void setSerializeAsArray(boolean asArray) {
+        this.serializeAsArray = asArray;
+    }
+    
+    @Override
+    public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mt) {
+        return true;
+    }
+    
+    public void setNamespaceMap(Map<String, String> nsMap) {
+        this.namespaceMap = new ConcurrentHashMap<String, String>(nsMap);
+    }
+    
+    @Override
+    protected XMLStreamWriter createWriter(Class<?> type, OutputStream os) throws Exception {
+        QName qname = getQName(type);
+        return JSONUtils.createStreamWriter(os, qname, writeXsiType, namespaceMap, 
+                                            serializeAsArray, arrayKeys);
+    }
+    
+    @Override
+    protected void writeToWriter(XMLStreamWriter writer, Object o) throws Exception {
+        writer.writeStartDocument();
+        super.writeToWriter(writer, o);
+        writer.writeEndDocument();
+    }
+    
+    @Override
+    protected XMLStreamReader createReader(Class<?> type, InputStream is) throws Exception {
+        getQName(type);
+        return JSONUtils.createStreamReader(is, readXsiType, namespaceMap);
+    }
+    
+    private QName getQName(Class<?> type) {
+        QName qname = JAXRSUtils.getClassQName(type); 
+        namespaceMap.putIfAbsent(qname.getNamespaceURI(), "ns1");
+        return qname;
+    }
+    
+}

Propchange: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/DataBindingJSONProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/DataBindingJSONProvider.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/DataBindingProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/DataBindingProvider.java?rev=803056&r1=803055&r2=803056&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/DataBindingProvider.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/DataBindingProvider.java Tue Aug 11 10:23:15 2009
@@ -26,6 +26,7 @@
 
 import javax.ws.rs.Consumes;
 import javax.ws.rs.Produces;
+import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.ext.MessageBodyReader;
@@ -64,12 +65,16 @@
     public Object readFrom(Class<Object> clazz, Type genericType, Annotation[] annotations, MediaType type, 
                        MultivaluedMap<String, String> headers, InputStream is)
         throws IOException {
-        XMLStreamReader reader = createReader(clazz, is);
-        DataReader<XMLStreamReader> dataReader = binding.createReader(XMLStreamReader.class);
-        return dataReader.read(null, reader, clazz);
+        try {
+            XMLStreamReader reader = createReader(clazz, is);
+            DataReader<XMLStreamReader> dataReader = binding.createReader(XMLStreamReader.class);
+            return dataReader.read(null, reader, clazz);
+        } catch (Exception ex) {
+            throw new WebApplicationException(ex);
+        }
     }
 
-    protected XMLStreamReader createReader(Class<?> clazz, InputStream is) {
+    protected XMLStreamReader createReader(Class<?> clazz, InputStream is) throws Exception {
         return StaxUtils.createXMLStreamReader(is);
     }
     
@@ -87,20 +92,22 @@
     public void writeTo(Object o, Class<?> clazz, Type genericType, Annotation[] annotations, 
                         MediaType type, MultivaluedMap<String, Object> headers, OutputStream os)
         throws IOException {
-        XMLStreamWriter writer = createWriter(clazz, os);
-        DataWriter<XMLStreamWriter> dataWriter = binding.createWriter(XMLStreamWriter.class);
-        
-        dataWriter.write(o, writer);
         try {
-            writer.flush();
+            XMLStreamWriter writer = createWriter(clazz, os);
+            writeToWriter(writer, o);
         } catch (Exception ex) {
-            // ignore
+            throw new WebApplicationException(ex);
         }
     }
     
-    protected XMLStreamWriter createWriter(Class<?> clazz, OutputStream os) {
-        return StaxUtils.createXMLStreamWriter(os);
+    protected void writeToWriter(XMLStreamWriter writer, Object o) throws Exception {
+        DataWriter<XMLStreamWriter> dataWriter = binding.createWriter(XMLStreamWriter.class);
+        dataWriter.write(o, writer);
+        writer.flush();
     }
     
+    protected XMLStreamWriter createWriter(Class<?> clazz, OutputStream os) throws Exception {
+        return StaxUtils.createXMLStreamWriter(os);
+    }
 }
 

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JSONProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JSONProvider.java?rev=803056&r1=803055&r2=803056&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JSONProvider.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JSONProvider.java Tue Aug 11 10:23:15 2009
@@ -24,7 +24,6 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
-import java.io.OutputStreamWriter;
 import java.io.SequenceInputStream;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Type;
@@ -57,11 +56,7 @@
 import org.apache.cxf.jaxrs.utils.InjectionUtils;
 import org.apache.cxf.jaxrs.utils.schemas.SchemaHandler;
 import org.apache.cxf.staxutils.DelegatingXMLStreamWriter;
-import org.codehaus.jettison.AbstractXMLStreamWriter;
-import org.codehaus.jettison.mapped.Configuration;
-import org.codehaus.jettison.mapped.MappedNamespaceConvention;
 import org.codehaus.jettison.mapped.MappedXMLInputFactory;
-import org.codehaus.jettison.mapped.MappedXMLStreamWriter;
 
 @Produces("application/json")
 @Consumes("application/json")
@@ -314,22 +309,9 @@
     protected XMLStreamWriter createWriter(Object actualObject, Class<?> actualClass, 
         Type genericType, String enc, OutputStream os, boolean isCollection) throws Exception {
         QName qname = getQName(actualClass, genericType, actualObject, true);
-        Configuration c = new Configuration(namespaceMap);
-        MappedNamespaceConvention convention = new MappedNamespaceConvention(c);
-        AbstractXMLStreamWriter xsw = new MappedXMLStreamWriter(
-                                            convention, 
-                                            new OutputStreamWriter(os, enc));
-        if (serializeAsArray) {
-            if (arrayKeys != null) {
-                for (String key : arrayKeys) {
-                    xsw.seriliazeAsArray(key);
-                }
-            } else {
-                String key = getKey(convention, qname);
-                xsw.seriliazeAsArray(key);
-            }
-        }
-
+        XMLStreamWriter xsw = JSONUtils.createStreamWriter(os, qname, false, 
+                                                           namespaceMap, serializeAsArray, arrayKeys);
+        
         return isCollection || dropRootElement ? new JSONCollectionWriter(xsw, qname) : xsw; 
     }
     
@@ -345,14 +327,6 @@
         marshal(ms, actualObject, actualClass, genericType, enc, os, false);
     }
     
-    private String getKey(MappedNamespaceConvention convention, QName qname) throws Exception {
-        return convention.createKey(qname.getPrefix(), 
-                                    qname.getNamespaceURI(),
-                                    qname.getLocalPart());
-            
-        
-    }
-    
     private QName getQName(Class<?> cls, Type type, Object object, boolean allocatePrefix) 
         throws Exception {
         QName qname = getJaxbQName(cls, type, object, false);

Added: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JSONUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JSONUtils.java?rev=803056&view=auto
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JSONUtils.java (added)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JSONUtils.java Tue Aug 11 10:23:15 2009
@@ -0,0 +1,133 @@
+/**
+ * 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.jaxrs.provider;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.cxf.staxutils.DepthXMLStreamReader;
+import org.codehaus.jettison.AbstractXMLStreamWriter;
+import org.codehaus.jettison.mapped.Configuration;
+import org.codehaus.jettison.mapped.MappedNamespaceConvention;
+import org.codehaus.jettison.mapped.MappedXMLInputFactory;
+import org.codehaus.jettison.mapped.MappedXMLStreamWriter;
+
+public final class JSONUtils {
+
+    private JSONUtils() {
+    }
+    
+    public static XMLStreamWriter createStreamWriter(OutputStream os, 
+                                                     QName qname, boolean writeXsiType,
+                                                     Map<String, String> namespaceMap,
+                                                     boolean serializeAsArray,
+                                                     List<String> arrayKeys) throws Exception {
+        if (writeXsiType) {
+            namespaceMap.put("http://www.w3.org/2001/XMLSchema-instance", "xsi");
+        }
+        Configuration c = new Configuration(namespaceMap);
+        MappedNamespaceConvention convention = new MappedNamespaceConvention(c);
+        AbstractXMLStreamWriter xsw = new MappedXMLStreamWriter(
+                                            convention, 
+                                            new OutputStreamWriter(os, "UTF-8"));
+        if (serializeAsArray) {
+            if (arrayKeys != null) {
+                for (String key : arrayKeys) {
+                    xsw.seriliazeAsArray(key);
+                }
+            } else {
+                String key = getKey(convention, qname);
+                xsw.seriliazeAsArray(key);
+            }
+        }
+        return xsw;
+    }    
+    
+    private static String getKey(MappedNamespaceConvention convention, QName qname) throws Exception {
+        return convention.createKey(qname.getPrefix(), 
+                                    qname.getNamespaceURI(),
+                                    qname.getLocalPart());
+            
+        
+    }
+    
+    public static XMLStreamReader createStreamReader(InputStream is, boolean readXsiType,
+                                               Map<String, String> namespaceMap) throws Exception {
+        if (readXsiType) {
+            namespaceMap.put("http://www.w3.org/2001/XMLSchema-instance", "xsi");
+        }
+        MappedXMLInputFactory factory = new MappedXMLInputFactory(namespaceMap);
+        return new JettisonReader(namespaceMap, factory.createXMLStreamReader(is));
+    }
+    
+    private static class JettisonReader extends DepthXMLStreamReader {
+        private Map<String, String> namespaceMap;
+        public JettisonReader(Map<String, String> nsMap,
+                                      XMLStreamReader reader) {
+            super(reader);
+            this.namespaceMap = nsMap;
+        }
+        
+        @Override
+        public String getAttributePrefix(int n) {
+            QName name = getAttributeName(n);
+            if (name != null 
+                && "http://www.w3.org/2001/XMLSchema-instance".equals(name.getNamespaceURI())) {
+                return "xsi";
+            } else {
+                return super.getAttributePrefix(n);
+            }
+        }
+        
+        @Override
+        public NamespaceContext getNamespaceContext() {
+            return new NamespaceContext() {
+
+                public String getNamespaceURI(String prefix) {
+                    for (Map.Entry<String, String> entry : namespaceMap.entrySet()) {
+                        if (entry.getValue().equals(prefix)) {
+                            return entry.getKey();
+                        }
+                    }
+                    return null;
+                }
+
+                public String getPrefix(String ns) {
+                    return namespaceMap.get(ns);
+                }
+
+                public Iterator getPrefixes(String ns) {
+                    String prefix = getPrefix(ns);
+                    return prefix == null ? null : Collections.singletonList(prefix).iterator();
+                }
+                
+            };
+        }
+    }
+}

Propchange: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JSONUtils.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JSONUtils.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/AegisJSONProviderTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/AegisJSONProviderTest.java?rev=803056&r1=803055&r2=803056&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/AegisJSONProviderTest.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/AegisJSONProviderTest.java Tue Aug 11 10:23:15 2009
@@ -48,7 +48,7 @@
     @Test
     public void testIsReadable() {
         MessageBodyReader<Object> p = new AegisJSONProvider();
-        assertFalse(p.isReadable(AegisTestBean.class, null, null, null));
+        assertTrue(p.isReadable(AegisTestBean.class, null, null, null));
     }
     
     
@@ -69,10 +69,10 @@
         if (setNsMap) {
             Map<String, String> namespaceMap = new HashMap<String, String>();
             namespaceMap.put("http://fortest.jaxrs.cxf.apache.org", "ns1");
-            namespaceMap.put("http://www.w3.org/2001/XMLSchema-instance", "xsins");
+            namespaceMap.put("http://www.w3.org/2001/XMLSchema-instance", "xsi");
             p.setNamespaceMap(namespaceMap);
         }
-        String data = "{\"ns1.AegisTestBean\":{\"@xsins.type\":\"ns1:AegisTestBean\","
+        String data = "{\"ns1.AegisTestBean\":{\"@xsi.type\":\"ns1:AegisTestBean\","
             + "\"ns1.boolValue\":true,\"ns1.strValue\":\"hovercraft\"}}";
         
         byte[] simpleBytes = data.getBytes("utf-8");
@@ -85,14 +85,14 @@
     
     @Test
     public void testWriteToWithXsiType() throws Exception {
-        String data = "{\"ns1.AegisTestBean\":{\"@ns2.type\":\"ns1:AegisTestBean\","
+        String data = "{\"ns1.AegisTestBean\":{\"@xsi.type\":\"ns1:AegisTestBean\","
             + "\"ns1.boolValue\":true,\"ns1.strValue\":\"hovercraft\"}}";
         doTestWriteTo(data, true, true);
     }
     
     @Test
     public void testWriteToWithXsiTypeNoNamespaces() throws Exception {
-        String data = "{\"ns1.AegisTestBean\":{\"@xsins.type\":\"ns1:AegisTestBean\","
+        String data = "{\"ns1.AegisTestBean\":{\"@xsi.type\":\"ns1:AegisTestBean\","
             + "\"ns1.boolValue\":true,\"ns1.strValue\":\"hovercraft\"}}";
         doTestWriteTo(data, true, false);
     }
@@ -112,7 +112,7 @@
         if (setNsMap) {
             Map<String, String> namespaceMap = new HashMap<String, String>();
             namespaceMap.put("http://fortest.jaxrs.cxf.apache.org", "ns1");
-            namespaceMap.put("http://www.w3.org/2001/XMLSchema-instance", "ns2");
+            namespaceMap.put("http://www.w3.org/2001/XMLSchema-instance", "xsi");
             p.setNamespaceMap(namespaceMap);
         }    
         ByteArrayOutputStream os = new ByteArrayOutputStream();

Added: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/DataBindingJSONProviderTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/DataBindingJSONProviderTest.java?rev=803056&view=auto
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/DataBindingJSONProviderTest.java (added)
+++ cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/DataBindingJSONProviderTest.java Tue Aug 11 10:23:15 2009
@@ -0,0 +1,210 @@
+/**
+ * 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.jaxrs.provider;
+
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.lang.annotation.Annotation;
+import java.util.Collections;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.core.MediaType;
+
+import org.apache.cxf.aegis.databinding.AegisDatabinding;
+import org.apache.cxf.databinding.DataBinding;
+import org.apache.cxf.jaxb.JAXBDataBinding;
+import org.apache.cxf.jaxrs.JAXRSServiceImpl;
+import org.apache.cxf.jaxrs.impl.MetadataMap;
+import org.apache.cxf.jaxrs.model.ClassResourceInfo;
+import org.apache.cxf.jaxrs.resources.Book;
+import org.apache.cxf.jaxrs.resources.sdo.Structure;
+import org.apache.cxf.jaxrs.resources.sdo.impl.StructureImpl;
+import org.apache.cxf.jaxrs.utils.ResourceUtils;
+import org.apache.cxf.sdo.SDODataBinding;
+import org.apache.cxf.service.Service;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class DataBindingJSONProviderTest extends Assert {
+
+    private ClassResourceInfo c;
+    private ClassResourceInfo c2;
+    
+    @Before
+    public void setUp() {
+        c = ResourceUtils.createClassResourceInfo(TheBooks.class, TheBooks.class, true, true);
+        c2 = ResourceUtils.createClassResourceInfo(TheSDOBooks.class, TheSDOBooks.class, true, true);
+    }
+    
+    @SuppressWarnings("unchecked")
+    @Test
+    public void testSDOWrite() throws Exception {
+        Service s = new JAXRSServiceImpl(Collections.singletonList(c2));
+        DataBinding binding = new SDODataBinding();
+        binding.initialize(s);
+        DataBindingJSONProvider p = new DataBindingJSONProvider();
+        p.setDataBinding(binding);
+        p.setNamespaceMap(Collections.singletonMap("http://apache.org/structure/types", "p0"));
+        Structure struct = new StructureImpl();
+        struct.getTexts().add("text1");
+        struct.setText("sdo");
+        struct.setInt(3);
+        struct.setDbl(123.5);
+        ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        p.writeTo(struct, Structure.class, Structure.class,
+            new Annotation[0], MediaType.APPLICATION_JSON_TYPE, new MetadataMap<String, Object>(), bos);
+        String data = "{\"p0.Structure\":{\"@xsi.type\":\"p0:Structure\",\"p0.text\":\"sdo\",\"p0.int\":3"
+            + ",\"p0.dbl\":123.5,\"p0.texts\":\"text1\"}}";
+        assertEquals(bos.toString(), data);
+    }
+    
+    @SuppressWarnings("unchecked")
+    @Test
+    public void testSDORead() throws Exception {
+        String data = "{\"p0.Structure\":{\"@xsi.type\":\"p0:Structure\",\"p0.text\":\"sdo\",\"p0.int\":3"
+            + ",\"p0.dbl\":123.5,\"p0.texts\":\"text1\"}}";
+        Service s = new JAXRSServiceImpl(Collections.singletonList(c2));
+        DataBinding binding = new SDODataBinding();
+        binding.initialize(s);
+        DataBindingJSONProvider p = new DataBindingJSONProvider();
+        p.setDataBinding(binding);
+        p.setNamespaceMap(Collections.singletonMap("http://apache.org/structure/types", "p0"));
+        ByteArrayInputStream is = new ByteArrayInputStream(data.getBytes());
+        Structure struct = (Structure)p.readFrom((Class)Structure.class, Structure.class,
+                                      new Annotation[0], MediaType.APPLICATION_JSON_TYPE, 
+                                      new MetadataMap<String, String>(), is);
+        assertEquals("sdo", struct.getText());
+        assertEquals(123.5, struct.getDbl(), 0.01);
+        assertEquals(3, struct.getInt());
+    }
+    
+    @Test
+    public void testJAXBWrite() throws Exception {
+        Service s = new JAXRSServiceImpl(Collections.singletonList(c));
+        DataBinding binding = new JAXBDataBinding();
+        binding.initialize(s);
+        DataBindingJSONProvider p = new DataBindingJSONProvider();
+        p.setDataBinding(binding);
+        Book b = new Book("CXF", 127L);
+        ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        p.writeTo(b, Book.class, Book.class,
+            new Annotation[0], MediaType.APPLICATION_JSON_TYPE, new MetadataMap<String, Object>(), bos);
+        String data = "{\"Book\":{\"id\":127,\"name\":\"CXF\",\"state\":\"\"}}";
+        assertEquals(bos.toString(), data);
+    }
+    
+    @SuppressWarnings("unchecked")
+    @Test
+    public void testJAXBRead() throws Exception {
+        String data = "{\"Book\":{\"id\":127,\"name\":\"CXF\",\"state\":\"\"}}";
+        Service s = new JAXRSServiceImpl(Collections.singletonList(c));
+        DataBinding binding = new JAXBDataBinding();
+        binding.initialize(s);
+        DataBindingJSONProvider p = new DataBindingJSONProvider();
+        p.setDataBinding(binding);
+        ByteArrayInputStream is = new ByteArrayInputStream(data.getBytes());
+        Book book = (Book)p.readFrom((Class)Book.class, Book.class,
+                                      new Annotation[0], MediaType.APPLICATION_JSON_TYPE, 
+                                      new MetadataMap<String, String>(), is);
+        assertEquals("CXF", book.getName());
+        assertEquals(127L, book.getId());
+    }
+    
+    @Test
+    public void testAegisWrite() throws Exception {
+        Service s = new JAXRSServiceImpl(Collections.singletonList(c));
+        s.put("writeXsiType", true);
+        AegisDatabinding binding = new AegisDatabinding();
+        binding.initialize(s);
+        DataBindingJSONProvider p = new DataBindingJSONProvider();
+        p.setDataBinding(binding);
+        Book b = new Book("CXF", 127L);
+        ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        p.writeTo(b, Book.class, Book.class,
+            new Annotation[0], MediaType.APPLICATION_JSON_TYPE, new MetadataMap<String, Object>(), bos);
+        doTestAegisRead(bos.toString());
+    }
+    
+    @Test
+    public void testAegisRead() throws Exception {
+        String data = "{\"ns1.Book\":{\"@xsi.type\":\"ns1:Book\",\"ns1.id\":127,"
+            + "\"ns1.name\":\"CXF\",\"ns1.state\":\"\"}}";
+        doTestAegisRead(data);
+    }
+    
+    @SuppressWarnings("unchecked")
+    public void doTestAegisRead(String data) throws Exception {
+        Service s = new JAXRSServiceImpl(Collections.singletonList(c));
+        s.put("readXsiType", true);
+        AegisDatabinding binding = new AegisDatabinding();
+        binding.initialize(s);
+        DataBindingJSONProvider p = new DataBindingJSONProvider();
+        p.setDataBinding(binding);
+        ByteArrayInputStream is = new ByteArrayInputStream(data.getBytes());
+        Book book = (Book)p.readFrom((Class)Book.class, Book.class,
+                                      new Annotation[0], MediaType.APPLICATION_XML_TYPE, 
+                                      new MetadataMap<String, String>(), is);
+        assertEquals("CXF", book.getName());
+        assertEquals(127L, book.getId());
+    }
+    
+    @Path("/")
+    @Ignore
+    public static class TheBooks {
+
+        @Path("/books/{bookId}/{new}")
+        public Book getNewBook(Book b) {
+            return new Book();
+        }
+        
+        @Path("/books/{bookId}/{new}")
+        public Book getNewBook2() {
+            return new Book();
+        }
+        
+        @POST
+        public void setNewBook(Book b) {
+        }
+        
+        @Path("/books/{bookId}/{new}")
+        @POST
+        public void setNewBook2(@PathParam("new") String id, Book b) {
+        }
+    }
+    
+    @Path("/")
+    @Ignore
+    public static class TheSDOBooks {
+
+        @GET
+        @Path("/books/{bookId}/{new}")
+        public Structure getStructure() {
+            return null;
+        }
+        
+    }
+}

Propchange: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/DataBindingJSONProviderTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/DataBindingJSONProviderTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: cxf/trunk/systests/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/pom.xml?rev=803056&r1=803055&r2=803056&view=diff
==============================================================================
--- cxf/trunk/systests/pom.xml (original)
+++ cxf/trunk/systests/pom.xml Tue Aug 11 10:23:15 2009
@@ -503,6 +503,13 @@
         
 
         <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-databinding-sdo</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
             <groupId>org.springframework.security</groupId>
             <artifactId>spring-security-acl</artifactId>
             <version>2.0.4</version>

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSDataBindingTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSDataBindingTest.java?rev=803056&r1=803055&r2=803056&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSDataBindingTest.java (original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSDataBindingTest.java Tue Aug 11 10:23:15 2009
@@ -19,10 +19,20 @@
 
 package org.apache.cxf.systest.jaxrs;
 
+import java.util.ArrayList;
 import java.util.Collections;
+import java.util.List;
 
+import org.apache.cxf.databinding.DataBinding;
+import org.apache.cxf.interceptor.Interceptor;
+import org.apache.cxf.interceptor.LoggingInInterceptor;
+import org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean;
 import org.apache.cxf.jaxrs.client.WebClient;
 import org.apache.cxf.jaxrs.provider.AegisElementProvider;
+import org.apache.cxf.jaxrs.provider.DataBindingJSONProvider;
+import org.apache.cxf.sdo.SDODataBinding;
+import org.apache.cxf.systest.jaxrs.sdo.SDOResource;
+import org.apache.cxf.systest.jaxrs.sdo.Structure;
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
 
 import org.junit.BeforeClass;
@@ -56,5 +66,39 @@
         assertEquals("CXF in Action", book.getName());
     }
     
+    @Test
+    public void testSDOStructure() throws Exception {
+        JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
+        bean.setDataBinding(new SDODataBinding());
+        bean.setAddress("http://localhost:9080/databinding/sdo");
+        bean.setResourceClass(SDOResource.class);
+        SDOResource client = bean.create(SDOResource.class);
+        Structure struct = client.getStructure();
+        assertEquals("sdo", struct.getText());
+        assertEquals(123.5, struct.getDbl(), 0.01);
+        assertEquals(3, struct.getInt());
+    }
+    
+    @Test
+    public void testSDOStructureJSON() throws Exception {
+        JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
+        DataBinding db = new SDODataBinding();
+        bean.setDataBinding(db);
+        DataBindingJSONProvider provider = new DataBindingJSONProvider();
+        provider.setNamespaceMap(Collections.singletonMap("http://apache.org/structure/types", "p0"));
+        provider.setDataBinding(db);
+        bean.setProvider(provider);
+        bean.setAddress("http://localhost:9080/databinding/sdo");
+        bean.setResourceClass(SDOResource.class);
+        List<Interceptor> list = new ArrayList<Interceptor>();
+        list.add(new LoggingInInterceptor());
+        bean.setInInterceptors(list);
+        SDOResource client = bean.create(SDOResource.class);
+        WebClient.client(client).accept("application/json");
+        Structure struct = client.getStructure();
+        assertEquals("sdo", struct.getText());
+        assertEquals(123.5, struct.getDbl(), 0.01);
+        assertEquals(3, struct.getInt());
+    }
     
 }

Added: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/sdo/SDOResource.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/sdo/SDOResource.java?rev=803056&view=auto
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/sdo/SDOResource.java (added)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/sdo/SDOResource.java Tue Aug 11 10:23:15 2009
@@ -0,0 +1,46 @@
+/**
+ * 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.systest.jaxrs.sdo;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+
+import org.apache.cxf.systest.jaxrs.sdo.impl.StructureImpl;
+
+
+@Path("/structures")
+public class SDOResource {
+    
+    @SuppressWarnings("unchecked")
+    @GET
+    @Path("/structure")
+    @Produces({"application/xml", "application/json" })
+    public Structure getStructure() {
+        Structure struct = new StructureImpl();
+        struct.getTexts().add("text1");
+        struct.setText("sdo");
+        struct.setInt(3);
+        struct.setDbl(123.5);
+        return struct;
+    }
+        
+    
+}

Propchange: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/sdo/SDOResource.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/sdo/SDOResource.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/sdo/SdoFactory.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/sdo/SdoFactory.java?rev=803056&view=auto
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/sdo/SdoFactory.java (added)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/sdo/SdoFactory.java Tue Aug 11 10:23:15 2009
@@ -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.systest.jaxrs.sdo;
+
+import commonj.sdo.helper.HelperContext;
+
+public interface SdoFactory {
+
+    SdoFactory INSTANCE = org.apache.cxf.systest.jaxrs.sdo.impl.SdoFactoryImpl.init();
+    Structure createStructure();
+    
+    void register(HelperContext scope);
+}
+

Propchange: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/sdo/SdoFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/sdo/SdoFactory.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/sdo/Structure.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/sdo/Structure.java?rev=803056&view=auto
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/sdo/Structure.java (added)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/sdo/Structure.java Tue Aug 11 10:23:15 2009
@@ -0,0 +1,58 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/**
+ * 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.systest.jaxrs.sdo;
+
+import java.io.Serializable;
+
+import java.util.List;
+
+public interface Structure extends Serializable {
+    String getText();
+    void setText(String value);
+    void unsetText();
+    boolean isSetText();
+    int getInt();
+    void setInt(int value);
+    void unsetInt();
+    boolean isSetInt();
+    double getDbl();
+    void setDbl(double value);
+    void unsetDbl();
+    boolean isSetDbl();
+    List getTexts();
+}
+

Propchange: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/sdo/Structure.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/sdo/Structure.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/sdo/impl/SdoFactoryImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/sdo/impl/SdoFactoryImpl.java?rev=803056&view=auto
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/sdo/impl/SdoFactoryImpl.java (added)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/sdo/impl/SdoFactoryImpl.java Tue Aug 11 10:23:15 2009
@@ -0,0 +1,185 @@
+/**
+ * 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.systest.jaxrs.sdo.impl;
+
+import org.apache.cxf.systest.jaxrs.sdo.SdoFactory;
+import org.apache.cxf.systest.jaxrs.sdo.Structure;
+import org.apache.tuscany.sdo.helper.HelperContextImpl;
+import org.apache.tuscany.sdo.impl.FactoryBase;
+import org.apache.tuscany.sdo.model.ModelFactory;
+import org.apache.tuscany.sdo.model.impl.ModelFactoryImpl;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.Property;
+import commonj.sdo.Type;
+import commonj.sdo.helper.HelperContext;
+
+//CHECKSTYLE:OFF
+public class SdoFactoryImpl extends FactoryBase implements SdoFactory {
+    public static final String NAMESPACE_URI = "http://apache.org/structure/types";
+    public static final String NAMESPACE_PREFIX = "tns";
+    public static final String PATTERN_VERSION = "1.2";
+    public static final int STRUCTURE = 1;      
+    private static SdoFactoryImpl instance = null;
+    protected Type structureType = null;
+    private boolean isCreated = false;
+    private boolean isInitialized = false;
+  
+    public SdoFactoryImpl() {
+        super(NAMESPACE_URI, NAMESPACE_PREFIX, "org.apache.cxf.systest.jaxrs.sdo");
+    }
+    
+    public void register(HelperContext scope) {
+    if(scope == null) {
+            throw new IllegalArgumentException("Scope can not be null");
+    }
+    
+    if (((HelperContextImpl)scope).getExtendedMetaData().getPackage(NAMESPACE_URI) != null) {
+            return;
+        }
+    // Register this package with provided scope   
+    ((HelperContextImpl)scope).getExtendedMetaData().putPackage(NAMESPACE_URI, this);
+    
+    //Register dependent packages with provided scope
+        ModelFactory.INSTANCE.register(scope);
+        }
+        
+        public DataObject create(int typeNumber) {
+            switch (typeNumber) {
+            case STRUCTURE : 
+                    return (DataObject)createStructure();
+            default :
+                return super.create(typeNumber);
+            }
+        }
+    
+        public Structure createStructure() {
+            return new StructureImpl();
+        }
+        
+        public Type getStructure() {
+        return structureType;
+        }
+                
+        public static SdoFactoryImpl init() {
+            if (instance != null) {
+                return instance;
+            }
+            instance = new SdoFactoryImpl();
+    
+            instance.createMetaData();
+            instance.initializeMetaData();
+            return instance;
+        }
+      
+        public void createMetaData() {
+            if (isCreated) {
+                return;
+            }
+            isCreated = true;   
+    
+            structureType = createType(false, STRUCTURE);
+            createProperty(true, structureType,StructureImpl._INTERNAL_TEXT); 
+            createProperty(true, structureType,StructureImpl._INTERNAL_INT); 
+            createProperty(true, structureType,StructureImpl._INTERNAL_DBL); 
+            createProperty(true, structureType,StructureImpl._INTERNAL_TEXTS); 
+        }
+        
+        public void initializeMetaData() {
+            if (isInitialized) {
+                return;
+            }
+            isInitialized = true;
+        
+            ModelFactoryImpl theModelPackageImpl = (ModelFactoryImpl)ModelFactoryImpl.init();
+                Property property = null;
+        
+                // Add supertypes to types
+    
+    
+        initializeType(structureType, Structure.class, "Structure", false);
+        property = getLocalProperty(structureType, 0);
+        initializeProperty(property, theModelPackageImpl.getString(), "text", null, 1, 1, 
+                           Structure.class, false, true, false);
+    
+        property = getLocalProperty(structureType, 1);
+        initializeProperty(property, theModelPackageImpl.getInt(), "int", null, 1, 1, 
+                           Structure.class, false, true, false);
+    
+        property = getLocalProperty(structureType, 2);
+        initializeProperty(property, theModelPackageImpl.getDouble(), "dbl", null, 1, 1, 
+                           Structure.class, false, true, false);
+    
+        property = getLocalProperty(structureType, 3);
+        initializeProperty(property, theModelPackageImpl.getString(), "texts", null, 1, -1, 
+                           Structure.class, false, false, false);
+    
+    
+        createXSDMetaData(theModelPackageImpl);
+    }
+      
+    protected void createXSDMetaData(ModelFactoryImpl theModelPackageImpl)
+    {
+        super.initXSD();
+        
+        addXSDMapping
+          (structureType,
+                 new String[] {
+                     "name", "Structure",
+                     "kind", "elementOnly"
+                 });
+    
+        addXSDMapping
+                (getLocalProperty(structureType, 0),
+                 new String[] {
+                     "kind", "element",
+                     "name", "text",
+                     "namespace", "##targetNamespace"
+                 });
+    
+        addXSDMapping
+                (getLocalProperty(structureType, 1),
+                 new String[] {
+                     "kind", "element",
+                     "name", "int",
+                     "namespace", "##targetNamespace"
+                 });
+    
+        addXSDMapping
+                (getLocalProperty(structureType, 2),
+                 new String[] {
+                     "kind", "element",
+                     "name", "dbl",
+                     "namespace", "##targetNamespace"
+                 });
+    
+        addXSDMapping
+                (getLocalProperty(structureType, 3),
+                 new String[] {
+                     "kind", "element",
+                     "name", "texts",
+                     "namespace", "##targetNamespace"
+                 });
+      }
+    
+    
+    
+} //SdoFactoryImpl
+//CHECKSTYLE:ON
\ No newline at end of file

Propchange: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/sdo/impl/SdoFactoryImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/sdo/impl/SdoFactoryImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/sdo/impl/StructureImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/sdo/impl/StructureImpl.java?rev=803056&view=auto
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/sdo/impl/StructureImpl.java (added)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/sdo/impl/StructureImpl.java Tue Aug 11 10:23:15 2009
@@ -0,0 +1,495 @@
+/**
+ * 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.systest.jaxrs.sdo.impl;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.cxf.systest.jaxrs.sdo.SdoFactory;
+import org.apache.cxf.systest.jaxrs.sdo.Structure;
+import org.apache.tuscany.sdo.impl.DataObjectBase;
+
+import commonj.sdo.Type;
+
+//CHECKSTYLE:OFF
+public class StructureImpl extends DataObjectBase implements Structure {
+
+    public final static int TEXT = 0;
+    
+    public final static int INT = 1;
+    
+    public final static int DBL = 2;
+    
+    public final static int TEXTS = 3;
+    
+    public final static int SDO_PROPERTY_COUNT = 4;
+    
+    public final static int EXTENDED_PROPERTY_COUNT = 0;
+
+
+    /**
+     * The internal feature id for the '<em><b>Text</b></em>' attribute.
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     * @generated
+     * @ordered
+     */ 
+    public final static int _INTERNAL_TEXT = 0;
+    
+    /**
+     * The internal feature id for the '<em><b>Int</b></em>' attribute.
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     * @generated
+     * @ordered
+     */ 
+    public final static int _INTERNAL_INT = 1;
+    
+    /**
+     * The internal feature id for the '<em><b>Dbl</b></em>' attribute.
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     * @generated
+     * @ordered
+     */ 
+    public final static int _INTERNAL_DBL = 2;
+    
+    /**
+     * The internal feature id for the '<em><b>Texts</b></em>' attribute list.
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     * @generated
+     * @ordered
+     */ 
+    public final static int _INTERNAL_TEXTS = 3;
+    
+    /**
+     * The number of properties for this type.
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     * @generated
+     * @ordered
+     */
+    public final static int INTERNAL_PROPERTY_COUNT = 4;
+    
+    /**
+     * The default value of the '{@link #getText() <em>Text</em>}' attribute.
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     * @see #getText()
+     * @generated
+     * @ordered
+     */
+    protected static final String TEXT_DEFAULT_ = null;
+    
+    /**
+     * The cached value of the '{@link #getText() <em>Text</em>}' attribute.
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     * @see #getText()
+     * @generated
+     * @ordered
+     */
+    protected String text = TEXT_DEFAULT_;
+    
+    /**
+     * This is true if the Text attribute has been set.
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     * @generated
+     * @ordered
+     */
+    protected boolean text_set_ = false;
+    
+    /**
+     * The default value of the '{@link #getInt() <em>Int</em>}' attribute.
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     * @see #getInt()
+     * @generated
+     * @ordered
+     */
+    protected static final int INT_DEFAULT_ = 0;
+    
+    /**
+     * The cached value of the '{@link #getInt() <em>Int</em>}' attribute.
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     * @see #getInt()
+     * @generated
+     * @ordered
+     */
+    protected int int_ = INT_DEFAULT_;
+    
+    /**
+     * This is true if the Int attribute has been set.
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     * @generated
+     * @ordered
+     */
+    protected boolean int_set_ = false;
+    
+    /**
+     * The default value of the '{@link #getDbl() <em>Dbl</em>}' attribute.
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     * @see #getDbl()
+     * @generated
+     * @ordered
+     */
+    protected static final double DBL_DEFAULT_ = 0.0;
+    
+    /**
+     * The cached value of the '{@link #getDbl() <em>Dbl</em>}' attribute.
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     * @see #getDbl()
+     * @generated
+     * @ordered
+     */
+    protected double dbl = DBL_DEFAULT_;
+    
+    /**
+     * This is true if the Dbl attribute has been set.
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     * @generated
+     * @ordered
+     */
+    protected boolean dbl_set_ = false;
+    
+    /**
+     * The cached value of the '{@link #getTexts() <em>Texts</em>}' attribute list.
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     * @see #getTexts()
+     * @generated
+     * @ordered
+     */
+    
+    protected List texts = null;
+    
+    
+    /**
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     * @generated
+     */
+    public StructureImpl() {
+        super();
+    }
+    
+    
+    protected int internalConvertIndex(int internalIndex) {
+        switch (internalIndex) {
+            case _INTERNAL_TEXT: 
+                return TEXT;
+            case _INTERNAL_INT: 
+                return INT;
+            case _INTERNAL_DBL: 
+                return DBL;
+            case _INTERNAL_TEXTS: 
+                return TEXTS;
+        }
+        return super.internalConvertIndex(internalIndex);
+    }
+    
+    
+    /**
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     * @generated
+     */
+    public Type getStaticType() {
+        return ((SdoFactoryImpl)SdoFactory.INSTANCE).getStructure();
+    }
+    
+    /**
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     * @generated
+     */
+    public int getStaticPropertyCount() {
+        return INTERNAL_PROPERTY_COUNT;
+    }
+    
+    /**
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     * @generated
+     */
+    public String getText() {
+        return text;
+    }
+    /**
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     * @generated
+     */
+    public void setText(String newText) {
+        String oldText = text;
+        text = newText;
+        boolean oldText_set_ = text_set_;
+        text_set_ = true;
+        if (isNotifying()) {
+            notify(ChangeKind.SET, _INTERNAL_TEXT, oldText, text, !oldText_set_);
+        }
+    }
+    
+    /**
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     * @generated
+     */
+    public void unsetText() {
+        String oldText = text;
+        boolean oldText_set_ = text_set_;
+        text = TEXT_DEFAULT_;
+        text_set_ = false;
+        if (isNotifying()) {
+            notify(ChangeKind.UNSET, _INTERNAL_TEXT, oldText, TEXT_DEFAULT_, oldText_set_);
+        }
+    }
+    
+    /**
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     * @generated
+     */
+    public boolean isSetText() {
+        return text_set_;
+    }
+    
+    /**
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     * @generated
+     */
+    public int getInt() {
+        return int_;
+    }
+    /**
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     * @generated
+     */
+    public void setInt(int newInt) {
+        int oldInt = int_;
+        int_ = newInt;
+        boolean oldInt_set_ = int_set_;
+        int_set_ = true;
+        if (isNotifying()) {
+            notify(ChangeKind.SET, _INTERNAL_INT, oldInt, int_, !oldInt_set_);
+        }
+    }
+    
+    /**
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     * @generated
+     */
+    public void unsetInt() {
+        int oldInt = int_;
+        boolean oldInt_set_ = int_set_;
+        int_ = INT_DEFAULT_;
+        int_set_ = false;
+        if (isNotifying()) {
+            notify(ChangeKind.UNSET, _INTERNAL_INT, oldInt, INT_DEFAULT_, oldInt_set_);
+        }
+    }
+    
+    /**
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     * @generated
+     */
+    public boolean isSetInt() {
+        return int_set_;
+    }
+    
+    /**
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     * @generated
+     */
+    public double getDbl() {
+        return dbl;
+    }
+    /**
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     * @generated
+     */
+    public void setDbl(double newDbl) {
+        double oldDbl = dbl;
+        dbl = newDbl;
+        boolean oldDbl_set_ = dbl_set_;
+        dbl_set_ = true;
+        if (isNotifying()) {
+            notify(ChangeKind.SET, _INTERNAL_DBL, oldDbl, dbl, !oldDbl_set_);
+        }
+    }
+    
+    /**
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     * @generated
+     */
+    public void unsetDbl() {
+        double oldDbl = dbl;
+        boolean oldDbl_set_ = dbl_set_;
+        dbl = DBL_DEFAULT_;
+        dbl_set_ = false;
+        if (isNotifying()) {
+            notify(ChangeKind.UNSET, _INTERNAL_DBL, oldDbl, DBL_DEFAULT_, oldDbl_set_);
+        }
+    }
+    
+    /**
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     * @generated
+     */
+    public boolean isSetDbl() {
+        return dbl_set_;
+    }
+    
+    /**
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     * @generated
+     */
+    public List getTexts() {
+        if (texts == null) {
+          texts = createPropertyList(ListKind.DATATYPE, String.class, TEXTS, 0);
+        }
+        return texts;
+    }
+    /**
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     * @generated
+     */
+    public Object get(int propertyIndex, boolean resolve) {
+        switch (propertyIndex) {
+            case TEXT :
+                return getText();
+            case INT :
+                return new Integer(getInt());
+            case DBL :
+                return new Double(getDbl());
+            case TEXTS :
+                return getTexts();
+        }
+        return super.get(propertyIndex, resolve);
+    }
+    
+    /**
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     * @generated
+     */
+    @SuppressWarnings("unchecked")
+    public void set(int propertyIndex, Object newValue) {
+        switch (propertyIndex) {
+            case TEXT :
+                setText((String)newValue);
+                return;
+            case INT :
+                setInt(((Integer)newValue).intValue());
+                return;
+            case DBL :
+                setDbl(((Double)newValue).doubleValue());
+                return;
+            case TEXTS :
+                getTexts().clear();
+                getTexts().addAll((Collection)newValue);
+            return;
+        }
+        super.set(propertyIndex, newValue);
+    }
+    
+    /**
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     * @generated
+     */
+    public void unset(int propertyIndex) {
+        switch (propertyIndex) {
+            case TEXT :
+                unsetText();
+                return;
+            case INT :
+                unsetInt();
+                return;
+            case DBL :
+                unsetDbl();
+                return;
+            case TEXTS :
+                getTexts().clear();
+                return;
+        }
+        super.unset(propertyIndex);
+    }
+    
+    /**
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     * @generated
+     */
+    public boolean isSet(int propertyIndex) {
+        switch (propertyIndex) {
+            case TEXT :
+                return isSetText();
+            case INT :
+                return isSetInt();
+            case DBL :
+                return isSetDbl();
+            case TEXTS :
+                return texts != null && !texts.isEmpty();
+        }
+        return super.isSet(propertyIndex);
+    }
+    
+    /**
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     * @generated
+     */
+    public String toString() {
+        if (isProxy(this)) {
+            return super.toString();
+        }
+    
+        StringBuffer result = new StringBuffer(super.toString());
+        result.append(" (text: ");
+        if (text_set_) result.append(text); else result.append("<unset>");
+        result.append(", int: ");
+        if (int_set_) result.append(int_); else result.append("<unset>");
+        result.append(", dbl: ");
+        if (dbl_set_) result.append(dbl); else result.append("<unset>");
+        result.append(", texts: ");
+        result.append(texts);
+        result.append(')');
+        return result.toString();
+    }
+
+}
+//CHECKSTYLE:ON
\ No newline at end of file

Propchange: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/sdo/impl/StructureImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/sdo/impl/StructureImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: cxf/trunk/systests/src/test/resources/jaxrs_databinding/WEB-INF/beans.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/resources/jaxrs_databinding/WEB-INF/beans.xml?rev=803056&r1=803055&r2=803056&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/resources/jaxrs_databinding/WEB-INF/beans.xml (original)
+++ cxf/trunk/systests/src/test/resources/jaxrs_databinding/WEB-INF/beans.xml Tue Aug 11 10:23:15 2009
@@ -45,6 +45,8 @@
 
   <bean class="org.apache.cxf.systest.jaxrs.BookStoreSpring" id="serviceBean"/>
   
+  <bean class="org.apache.cxf.systest.jaxrs.sdo.SDOResource" id="sdoBean"/>
+  
   <jaxrs:server id="jaxbbook" address="/jaxb">
     <jaxrs:serviceBeans>
       <ref bean="serviceBean" />
@@ -67,7 +69,29 @@
         </bean> 
     </jaxrs:dataBinding> 
   </jaxrs:server>
+  
+  
+  <jaxrs:server id="sdo" address="/sdo">
+    <jaxrs:serviceBeans>
+      <ref bean="sdoBean" />
+    </jaxrs:serviceBeans>		   
+    <jaxrs:dataBinding> 
+      <ref bean="sdoDatabinding"/>
+    </jaxrs:dataBinding> 
+    <jaxrs:providers>
+      <ref bean="jsonSdoBean" />
+    </jaxrs:providers>
+  </jaxrs:server>
+
+  <bean id="sdoDatabinding" class="org.apache.cxf.sdo.SDODataBinding"/>
+  <bean id="jsonSdoBean" class="org.apache.cxf.jaxrs.provider.DataBindingJSONProvider">
+      <property name="dataBinding" ref="sdoDatabinding"/>
+      <property name="namespaceMap" ref="jsonNamespaceMap"/>
+  </bean>
 
+  <util:map id="jsonNamespaceMap" map-class="java.util.Hashtable">
+       <entry key="http://apache.org/structure/types" value="p0"/>
+  </util:map>
 
 </beans>
 <!-- END SNIPPET: beans -->



Mime
View raw message