cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r620390 - in /incubator/cxf/trunk/rt: databinding/jaxb/src/main/java/org/apache/cxf/jaxb/ frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ frontend/simple/src/main/java/org/apache...
Date Mon, 11 Feb 2008 02:59:59 GMT
Author: dkulp
Date: Sun Feb 10 18:59:58 2008
New Revision: 620390

URL: http://svn.apache.org/viewvc?rev=620390&view=rev
Log:
Fix a couple tck issues I caused


Modified:
    incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java
    incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/WrapperClassGenerator.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java
    incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java

Modified: incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java?rev=620390&r1=620389&r2=620390&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java
(original)
+++ incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java
Sun Feb 10 18:59:58 2008
@@ -36,8 +36,11 @@
 import javax.xml.bind.annotation.XmlTransient;
 
 import org.apache.cxf.service.ServiceModelVisitor;
+import org.apache.cxf.service.model.MessageInfo;
 import org.apache.cxf.service.model.MessagePartInfo;
+import org.apache.cxf.service.model.OperationInfo;
 import org.apache.cxf.service.model.ServiceInfo;
+import org.apache.cxf.service.model.UnwrappedOperationInfo;
 
 /**
  * Walks the service model and sets up the classes for the context.
@@ -64,12 +67,32 @@
                              Boolean.TRUE);
         }
         boolean isFromWrapper = part.getMessageInfo().getOperation().isUnwrapped();
+        if (isFromWrapper 
+            && !Boolean.TRUE.equals(part.getProperty("messagepart.isheader"))) {
+            UnwrappedOperationInfo uop = (UnwrappedOperationInfo)part.getMessageInfo().getOperation();
+            OperationInfo op = uop.getWrappedOperation();
+            MessageInfo inf = null;
+            if (uop.getInput() == part.getMessageInfo()) {
+                inf = op.getInput();
+            } else if (uop.getOutput() == part.getMessageInfo()) {
+                inf = op.getOutput();
+            }
+            if (inf != null
+                && inf.getMessagePart(0).getTypeClass() != null) {
+                //if the wrapper has a type class, we don't need t do anything
+                //as everything would have been discovered when walking the
+                //wrapper type (unless it's a header which wouldn't be in the wrapper)
+                return;
+            }
+        }
         if (isFromWrapper
             && clazz.isArray()
             && !Byte.TYPE.equals(clazz.getComponentType())) {
             clazz = clazz.getComponentType();
         }
-
+        
+        
+            
         Type genericType = (Type) part.getProperty("generic.type");
         if (genericType != null) {
             boolean isList = Collection.class.isAssignableFrom(clazz);
@@ -100,7 +123,7 @@
                     clazz = arrayCls;
                     part.setTypeClass(clazz);
                     if (isFromWrapper) {
-                        addType(clazz.getComponentType());
+                        addType(clazz.getComponentType(), true);
                     }
                 } else if (pt.getActualTypeArguments().length > 0
                     && pt.getActualTypeArguments()[0] instanceof GenericArrayType)
{
@@ -111,7 +134,7 @@
                     clazz = Array.newInstance(arrayCls, 0).getClass();
                     part.setTypeClass(clazz);
                     if (isFromWrapper) {
-                        addType(clazz.getComponentType());
+                        addType(clazz.getComponentType(), true);
                     }
                 }
             }
@@ -125,8 +148,15 @@
     }
 
     private void addType(Type cls) {
+        addType(cls, false);
+    }
+    private void addType(Type cls, boolean allowArray) {
         if (cls instanceof Class) {
-            addClass((Class)cls);
+            if (((Class)cls).isArray() && !allowArray) {
+                addClass(((Class)cls).getComponentType());
+            } else {
+                addClass((Class)cls);
+            }
         } else if (cls instanceof ParameterizedType) {
             for (Type t2 : ((ParameterizedType)cls).getActualTypeArguments()) {
                 addType(t2);

Modified: incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java?rev=620390&r1=620389&r2=620390&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java
(original)
+++ incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java
Sun Feb 10 18:59:58 2008
@@ -31,6 +31,7 @@
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
+import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -115,7 +116,7 @@
     }
     
     public JAXBDataBinding(Class<?>...classes) throws JAXBException {
-        contextClasses = new HashSet<Class<?>>();
+        contextClasses = new LinkedHashSet<Class<?>>();
         contextClasses.addAll(Arrays.asList(classes));
         setContext(createJAXBContext(contextClasses));
     }
@@ -217,7 +218,7 @@
             return;
         }
         
-        contextClasses = new HashSet<Class<?>>();
+        contextClasses = new LinkedHashSet<Class<?>>();
         for (ServiceInfo serviceInfo : service.getServiceInfos()) {
             JAXBContextInitializer initializer = 
                 new JAXBContextInitializer(serviceInfo, contextClasses);

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/WrapperClassGenerator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/WrapperClassGenerator.java?rev=620390&r1=620389&r2=620390&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/WrapperClassGenerator.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/WrapperClassGenerator.java
Sun Feb 10 18:59:58 2008
@@ -21,11 +21,13 @@
 
 
 import java.lang.annotation.Annotation;
+import java.lang.reflect.Array;
+import java.lang.reflect.GenericArrayType;
 import java.lang.reflect.Method;
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
 import java.util.Collection;
-import java.util.HashSet;
+import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Set;
 import java.util.logging.Logger;
@@ -56,7 +58,7 @@
 
 public final class WrapperClassGenerator extends ASMHelper {
     private static final Logger LOG = LogUtils.getL7dLogger(WrapperClassGenerator.class);
-    private Set<Class<?>> wrapperBeans = new HashSet<Class<?>>();
+    private Set<Class<?>> wrapperBeans = new LinkedHashSet<Class<?>>();
     private InterfaceInfo interfaceInfo;
     private boolean qualified;
     
@@ -129,6 +131,7 @@
                     MessageInfo messageInfo = opInfo.getUnwrappedOperation().getInput();
                     createWrapperClass(inf,
                                        messageInfo, 
+                                       opInfo,
                                        method, 
                                        true);
                 }
@@ -137,7 +140,8 @@
                     inf = opInfo.getOutput().getMessageParts().get(0);
                     if (inf.getTypeClass() == null) {
                         createWrapperClass(inf,
-                                           messageInfo, 
+                                           messageInfo,
+                                           opInfo,
                                            method, 
                                            false);
                     }
@@ -149,13 +153,15 @@
 
     private void createWrapperClass(MessagePartInfo wrapperPart,
                                         MessageInfo messageInfo,
+                                        OperationInfo op,
                                         Method method, 
                                         boolean isRequest) {
 
         QName wrapperElement = messageInfo.getName();
 
         ClassWriter cw = createClassWriter();
-        String className = getPackageName(method) + ".jaxws." + StringUtils.capitalize(method.getName());
+        String className = getPackageName(method) + ".jaxws." 
+            + StringUtils.capitalize(op.getName().getLocalPart());
         if (!isRequest) {
             className = className + "Response";
         }
@@ -252,8 +258,13 @@
 
             Type[] types = ptype.getActualTypeArguments();
             // TODO: more complex Parameterized type
-            if (types.length > 0 && types[0] instanceof Class) {
-                genericTypeClass = (Class)types[0];
+            if (types.length > 0) {
+                if (types[0] instanceof Class) {
+                    genericTypeClass = (Class)types[0];
+                } else if (types[0] instanceof GenericArrayType) {
+                    genericTypeClass = (Class)((GenericArrayType)types[0]).getGenericComponentType();
+                    genericTypeClass = Array.newInstance(genericTypeClass, 0).getClass();
+                }
             }
         }
         String classCode = getClassCode(clz);

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java?rev=620390&r1=620389&r2=620390&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java
Sun Feb 10 18:59:58 2008
@@ -194,6 +194,7 @@
     protected void initializeWSDLOperation(InterfaceInfo intf, OperationInfo o, Method method)
{
         method = ((JaxWsServiceConfiguration)jaxWsConfiguration).getDeclaredMethod(method);
         o.setProperty(Method.class.getName(), method);
+        o.setProperty(METHOD, method);
         initializeWrapping(o, method);
 
         try {

Modified: incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java?rev=620390&r1=620389&r2=620390&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
(original)
+++ incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
Sun Feb 10 18:59:58 2008
@@ -301,15 +301,13 @@
 
         initializeWSDLOperations();
 
-        if (getDataBinding() != null) {
-            getDataBinding().initialize(getService());
-        }
-        
+        Set<Class<?>> cls = getExtraClass(); 
         for (ServiceInfo si : getService().getServiceInfos()) {
-            if (getExtraClass() != null && !getExtraClass().isEmpty()) {
-                si.setProperty(EXTRA_CLASS, getExtraClass());
+            if (cls != null && !cls.isEmpty()) {
+                si.setProperty(EXTRA_CLASS, cls);
             }
         }
+        getDataBinding().initialize(getService());
     }
 
     protected void buildServiceFromClass() {
@@ -333,8 +331,8 @@
         createInterface(serviceInfo);
 
 
+        Set<?> wrapperClasses = this.getExtraClass();
         for (ServiceInfo si : getService().getServiceInfos()) {
-            Set<?> wrapperClasses = this.getExtraClass();
             if (wrapperClasses != null && !wrapperClasses.isEmpty()) {
                 si.setProperty(EXTRA_CLASS, wrapperClasses);
             }
@@ -536,6 +534,7 @@
         if (initializeClassInfo(o, method, op == null ? null
             : CastUtils.cast(op.getParameterOrdering(), String.class))) {
             getMethodDispatcher().bind(o, method);
+            o.setProperty(ReflectionServiceFactoryBean.METHOD, method);
         } else {
             LOG.log(Level.WARNING, "NO_METHOD_FOR_OP", o.getName());
         }



Mime
View raw message