cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r451169 [1/6] - in /incubator/cxf/trunk: common/common/src/main/java/org/apache/cxf/jaxb/ rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ rt/frontend/jaxws/src/main/java/org/apach...
Date Fri, 29 Sep 2006 08:49:34 GMT
Author: ema
Date: Fri Sep 29 01:49:33 2006
New Revision: 451169

URL: http://svn.apache.org/viewvc?view=rev&rev=451169
Log:
[CXF-66] Fixed issues and added document-lit type test.  
Removed primitive type array for initializing JAXBContext.
Fixed getWrappedPart null issue in WrapperClassInInterceptor     

Added:
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/type_test/
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/type_test/AbstractTypeTestClient.java
  (with props)
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/type_test/AbstractTypeTestClient2.java
  (with props)
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/type_test/AbstractTypeTestClient3.java
  (with props)
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/type_test/AbstractTypeTestClient4.java
  (with props)
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/type_test/AbstractTypeTestClient5.java
  (with props)
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/type_test/I18NStrings.java
  (with props)
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/type_test/soap/
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/type_test/soap/SOAPDocLitClientTypeTest.java
  (with props)
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/type_test/soap/SOAPDocLitServerImpl.java
  (with props)
Modified:
    incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/jaxb/WrapperHelper.java
    incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JAXWSMethodInvoker.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WrapperClassInInterceptor.java
    incubator/cxf/trunk/testutils/pom.xml

Modified: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/jaxb/WrapperHelper.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/jaxb/WrapperHelper.java?view=diff&rev=451169&r1=451168&r2=451169
==============================================================================
--- incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/jaxb/WrapperHelper.java
(original)
+++ incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/jaxb/WrapperHelper.java
Fri Sep 29 01:49:33 2006
@@ -51,15 +51,16 @@
             
             XmlElement el = null;
             for (Field field : wrapperType.getClass().getDeclaredFields()) {
+              
                 if (field.getName().equals(fieldName)) {
                     //JAXB Type get XmlElement Annotation
                     el = field.getAnnotation(XmlElement.class);
-                    assert el != null;
+                   // assert el != null;
                 } 
             }
             
             if (part == null) {
-                if (!el.nillable()) {
+                if (el != null && !el.nillable()) {
                     throw new IllegalArgumentException("null value for field not permitted.");
                 }
                 return;
@@ -123,6 +124,26 @@
         return null;
     }
 
+    public static Object getWrappedPart(String partName, Object wrapperType, String elementType)
+        throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {
+
+        String accessor = JAXBUtils.nameToIdentifier(partName, JAXBUtils.IdentifierType.GETTER);
+
+        if ("boolean".equals(elementType.toLowerCase())) {
+            // JAXB Exception to get the Boolean property
+            accessor = accessor.replaceFirst("get", "is");
+        }
+
+        for (Method method : wrapperType.getClass().getMethods()) {
+            if (method.getParameterTypes().length == 0 && accessor.equals(method.getName()))
{
+
+                return method.invoke(wrapperType);
+            }
+        }
+        return null;
+    }
+
+    
 
     public static Object getWrappedPart(String partName, Object wrapperType)
         throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {

Modified: incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java?view=diff&rev=451169&r1=451168&r2=451169
==============================================================================
--- incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java
(original)
+++ incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java
Fri Sep 29 01:49:33 2006
@@ -88,6 +88,7 @@
                 // maybe add a way to allow interceptors to add stuff to the
                 // context?
             }
+           
             context = JAXBContext.newInstance(classes.toArray(new Class[classes.size()]));
             contextMap.put(cls, context);
         }
@@ -121,7 +122,8 @@
 
     private static void addClass(Class<?> cls, Set<Class<?>> classes) {
         if (cls.isArray()) {
-            classes.add(cls);
+            // REVISIT-- add java primitive type array will cause jaxb exception
+            //classes.add(cls);
             return;
         }
         cls = getValidClass(cls);

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JAXWSMethodInvoker.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JAXWSMethodInvoker.java?view=diff&rev=451169&r1=451168&r2=451169
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JAXWSMethodInvoker.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JAXWSMethodInvoker.java
Fri Sep 29 01:49:33 2006
@@ -50,10 +50,10 @@
     @SuppressWarnings("unchecked")
     public Object invoke(Exchange exchange, Object o) {
         BindingOperationInfo bop = exchange.get(BindingOperationInfo.class);
-
         MethodDispatcher md = (MethodDispatcher) exchange.get(Service.class).get(
                         MethodDispatcher.class.getName());
         Method m = md.getMethod(bop);
+        
         List<Object> params = (List<Object>) o;
 
         checkHolder(m, params, exchange);
@@ -92,28 +92,34 @@
         if (method != null) {
 
             Type[] para = method.getGenericParameterTypes();
-            for (int i = 0; i < para.length; i++) {
+            for (int i = 0; i < para.length; i++) {               
                 if (para[i] instanceof ParameterizedType) {
                     Object param = null;
                     ParameterizedType paramType = (ParameterizedType) para[i];
                     if (((Class) paramType.getRawType()).getName().equals("javax.xml.ws.Holder"))
{
+                        
                         Object rawType = paramType.getActualTypeArguments()[0];
-                        Class rawClass;
+                        Class rawClass = null;
                         if (rawType instanceof GenericArrayType) {
                             rawClass = (Class) ((GenericArrayType) rawType).getGenericComponentType();
                             rawClass = Array.newInstance(rawClass, 0).getClass();
-                        } else {
+                        } else if (rawType instanceof Class) {     
                             rawClass = (Class) rawType;
+                        } else if (rawType instanceof ParameterizedType) {
+                            rawClass = (Class)((ParameterizedType)rawType).getRawType();
                         }
-                        param = new Holder((Class) rawClass);
+                       // param = new Holder((Class) rawClass);
+                        
+                        
                         if (i >= params.size()) {
-                            params.add(param);
+                            params.add(new Holder());
                         } else {
                             params.set(i, new Holder(params.get(i)));
                         }
                     }
 
-                }
+                } 
+                
             }
 
         }

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WrapperClassInInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WrapperClassInInterceptor.java?view=diff&rev=451169&r1=451168&r2=451169
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WrapperClassInInterceptor.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WrapperClassInInterceptor.java
Fri Sep 29 01:49:33 2006
@@ -47,7 +47,7 @@
         if (boi == null) {
             return;
         }
-        
+                
         Method method = message.getExchange().get(Method.class);
 
         if (method != null && method.getName().endsWith("Async")) {
@@ -58,13 +58,26 @@
             }
         }        
 
+        
+        if (method != null && method.getName().endsWith("Async")) {
+            Class<?> retType = method.getReturnType();
+            if (retType.getName().equals("java.util.concurrent.Future") 
+                || retType.getName().equals("javax.xml.ws.Response")) {
+                return;
+            }
+
+        }
+      
+
+
         if (boi != null && boi.isUnwrappedCapable()) {
             BindingOperationInfo boi2 = boi.getUnwrappedOperation();
             
             // Sometimes, an uperation can be unwrapped according to WSDLServiceFactory,
             // but not according to JAX-WS. We should unify these at some point, but
             // for now check for the wrapper class.
-            if (boi2.getOperationInfo().getInput().getProperty(WrappedInInterceptor.WRAPPER_CLASS)
== null) {
+            if (boi2.getOperationInfo().getInput().getProperty(WrappedInInterceptor.WRAPPER_CLASS)

+                == null) {
                 return;
             }
             
@@ -95,8 +108,15 @@
                     
                     for (MessagePartInfo part : messageInfo.getMessageParts()) {
                         try {
-                            Object obj = WrapperHelper.getWrappedPart(part.getName().getLocalPart(),
-                                                                  wrappedObject);
+                            String elementType = null;
+                            if (part.isElement()) {
+                                elementType = part.getElementQName().getLocalPart();
+                            } else {
+                                elementType = part.getTypeQName().getLocalPart();
+                            }
+                            Object obj = WrapperHelper.getWrappedPart(part.getName().getLocalPart(),

+                                                                      wrappedObject,
+                                                                      elementType);
                         
                             CastUtils.cast(lst, Object.class).add(obj);
                         } catch (Exception e) {



Mime
View raw message