cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1510652 - in /cxf/trunk: api/src/main/java/org/apache/cxf/common/jaxb/JAXBUtils.java rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/JAXBDataBindingTest.java
Date Mon, 05 Aug 2013 18:36:30 GMT
Author: dkulp
Date: Mon Aug  5 18:36:30 2013
New Revision: 1510652

URL: http://svn.apache.org/r1510652
Log:
Don't need to special case eclipselink anymore as the schema based version works.  Don't need
to create an RI based context either.

Modified:
    cxf/trunk/api/src/main/java/org/apache/cxf/common/jaxb/JAXBUtils.java
    cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java
    cxf/trunk/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/JAXBDataBindingTest.java

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/common/jaxb/JAXBUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/common/jaxb/JAXBUtils.java?rev=1510652&r1=1510651&r2=1510652&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/common/jaxb/JAXBUtils.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/common/jaxb/JAXBUtils.java Mon Aug  5 18:36:30
2013
@@ -37,8 +37,6 @@ import java.net.URISyntaxException;
 import java.net.URL;
 import java.net.URLClassLoader;
 import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -86,7 +84,6 @@ import org.apache.cxf.common.util.System
 import org.apache.cxf.common.xmlschema.SchemaCollection;
 import org.apache.cxf.helpers.JavaUtils;
 
-
 public final class JAXBUtils {
     
     public enum IdentifierType {
@@ -556,28 +553,6 @@ public final class JAXBUtils {
         return jaxbXjcLoader;
     }
     
-    public static JAXBContext createRIContext(Class<?> clss[], String defaultNS) throws
JAXBException {
-        try {
-            Class<?> cls;
-            Map<String, Object> map = new HashMap<String, Object>();
-            try {
-                cls = Class.forName("com.sun.xml.bind.v2.ContextFactory");
-                if (defaultNS != null) {
-                    map.put("com.sun.xml.bind.defaultNamespaceRemap", defaultNS);
-                }
-            } catch (ClassNotFoundException e) {
-                // TODO Auto-generated catch block
-                cls = Class.forName("com.sun.xml.internal.bind.v2.ContextFactory", true,
getXJCClassLoader());
-                if (defaultNS != null) {
-                    map.put("com.sun.xml.internal.bind.defaultNamespaceRemap", defaultNS);
-                }
-            }
-            Method meth = cls.getMethod("createContext", clss.getClass(), Map.class);
-            return (JAXBContext)meth.invoke(null, clss, map);
-        } catch (Exception e) {
-            throw new JAXBException(e);
-        }
-    }
     public static Object setNamespaceWrapper(final Map<String, String> nspref,
                                            Marshaller marshaller) throws PropertyException
{
         Object mapper = createNamespaceWrapper(marshaller.getClass(), nspref);
@@ -771,7 +746,6 @@ public final class JAXBUtils {
                 return result;
             }
         });
-
         return results;
     }
     
@@ -1150,46 +1124,6 @@ public final class JAXBUtils {
     public static JAXBContextProxy createJAXBContextProxy(final JAXBContext ctx,
                                                           final SchemaCollection collection,
                                                           final String defaultNs) {
-        if (ctx.getClass().getName().contains("eclipse")) {
-            final org.eclipse.persistence.jaxb.JAXBContext c = (org.eclipse.persistence.jaxb.JAXBContext)ctx;
-            return new JAXBContextProxy() {
-                public Object getBeanInfo(Class<?> cls) {
-                    final org.eclipse.persistence.oxm.XMLDescriptor xd 
-                        = (org.eclipse.persistence.oxm.XMLDescriptor)c.getXMLContext().getSession().getDescriptor(cls);
-                    final QName schemaType = xd.getSchemaReference().getSchemaContextAsQName();
-                    if (xd.getDefaultRootElementField() != null) {
-                        return new JAXBBeanInfo() {
-                            public boolean isElement() {
-                                return true;
-                            }
-                            public Collection<QName> getTypeNames() {
-                                return Collections.singletonList(schemaType);
-                            }
-                            public String getElementNamespaceURI(Object object) {
-                                return xd.getDefaultRootElementField().getXPathFragment().getNamespaceURI();
-                            }
-                            public String getElementLocalName(Object object) {
-                                return xd.getDefaultRootElementField().getXPathFragment().getLocalName();
-                            }
-                        };
-                    }
-                    return new JAXBBeanInfo() {
-                        public boolean isElement() {
-                            return false;
-                        }
-                        public Collection<QName> getTypeNames() {
-                            return Collections.singletonList(schemaType);
-                        }
-                        public String getElementNamespaceURI(Object object) {
-                            return null;
-                        }
-                        public String getElementLocalName(Object object) {
-                            return null;
-                        }
-                    };
-                }
-            };
-        }
         if (ctx.getClass().getName().contains("com.sun.")
             || collection == null) {
             return ReflectionInvokationHandler.createProxyWrapper(ctx, JAXBContextProxy.class);

Modified: cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java?rev=1510652&r1=1510651&r2=1510652&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java (original)
+++ cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java Mon
Aug  5 18:36:30 2013
@@ -384,20 +384,7 @@ public class JAXBDataBinding extends Abs
                                   r.getSystemId());
             }
 
-            JAXBContext riContext;
-            if (context.getClass().getName().contains("com.sun.xml.")) {
-                riContext = context;
-            } else {
-                // fall back if we're using another jaxb implementation
-                try {
-                    riContext = JAXBUtils.createRIContext(contextClasses
-                        .toArray(new Class[contextClasses.size()]), tns);
-                } catch (JAXBException e) {
-                    throw new ServiceConstructionException(e);
-                }
-            }
-
-            JAXBSchemaInitializer schemaInit = new JAXBSchemaInitializer(serviceInfo, col,
riContext,
+            JAXBSchemaInitializer schemaInit = new JAXBSchemaInitializer(serviceInfo, col,
context,
                                                                          this.qualifiedSchemas,
tns);
             schemaInit.walk();
             if (cachedContextAndSchemas != null && !schemasFromCache) {

Modified: cxf/trunk/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/JAXBDataBindingTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/JAXBDataBindingTest.java?rev=1510652&r1=1510651&r2=1510652&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/JAXBDataBindingTest.java
(original)
+++ cxf/trunk/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/JAXBDataBindingTest.java
Mon Aug  5 18:36:30 2013
@@ -36,7 +36,6 @@ import javax.wsdl.Definition;
 import javax.wsdl.Service;
 import javax.wsdl.factory.WSDLFactory;
 import javax.wsdl.xml.WSDLReader;
-import javax.xml.bind.JAXBContext;
 import javax.xml.stream.XMLEventReader;
 import javax.xml.stream.XMLEventWriter;
 import javax.xml.stream.XMLOutputFactory;
@@ -47,8 +46,6 @@ import org.w3c.dom.Node;
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.binding.BindingFactoryManager;
-import org.apache.cxf.common.jaxb.JAXBContextProxy;
-import org.apache.cxf.common.jaxb.JAXBUtils;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.databinding.DataReader;
 import org.apache.cxf.databinding.DataWriter;
@@ -57,8 +54,6 @@ import org.apache.cxf.jaxb.fortest.Quali
 import org.apache.cxf.jaxb.fortest.unqualified.UnqualifiedBean;
 import org.apache.cxf.jaxb.io.DataReaderImpl;
 import org.apache.cxf.jaxb.io.DataWriterImpl;
-import org.apache.cxf.jaxb_misc.ObjectFactory;
-import org.apache.cxf.jaxb_misc.TestJAXBClass;
 import org.apache.cxf.transport.DestinationFactoryManager;
 import org.apache.cxf.wsdl11.WSDLServiceBuilder;
 import org.apache.hello_world_soap_http.types.GreetMe;
@@ -180,16 +175,6 @@ public class JAXBDataBindingTest extends
     }
     
     @Test 
-    public void testJaxbIndex() throws Exception {
-        JAXBDataBinding db = new JAXBDataBinding();
-        Set<Class<?>> classes = new HashSet<Class<?>>();
-        classes.add(ObjectFactory.class);
-        JAXBContext ctx = db.createJAXBContext(classes);
-        JAXBContextProxy ctxp = JAXBUtils.createJAXBContextProxy(ctx);
-        assertNotNull(JAXBSchemaInitializer.getBeanInfo(ctxp, TestJAXBClass.class));
-    }
-    
-    @Test 
     public void testContextProperties() throws Exception {
         JAXBDataBinding db = new JAXBDataBinding();
         Map<String, String> nsMap = new HashMap<String, String>();



Mime
View raw message