cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r761789 - in /cxf/trunk: common/common/src/main/java/org/apache/cxf/common/util/ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/ tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/process...
Date Fri, 03 Apr 2009 20:50:24 GMT
Author: dkulp
Date: Fri Apr  3 20:50:23 2009
New Revision: 761789

URL: http://svn.apache.org/viewvc?rev=761789&view=rev
Log:
[CXF-2148, CXF-2147, CXF-2149, CXF-2152]
Fix problems of not generating all the required @XmlXXXX annotations on the params for doc/lit/wrapped.
 (patch from Alessio Soldano applied)
Fix problems with different types spring aop proxies (patch from Gyorgy Orban applied)
Fix a class cast type thing in the SOAPMessageContext.

Added:
    cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/XmlJavaTypeAdapterAnnotator.java
  (with props)
Modified:
    cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/SpringAopClassHelper.java
    cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPMessageContextImpl.java
    cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ParameterProcessor.java
    cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/mapper/ParameterMapper.java

Modified: cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/SpringAopClassHelper.java
URL: http://svn.apache.org/viewvc/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/SpringAopClassHelper.java?rev=761789&r1=761788&r2=761789&view=diff
==============================================================================
--- cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/SpringAopClassHelper.java
(original)
+++ cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/SpringAopClassHelper.java
Fri Apr  3 20:50:23 2009
@@ -34,11 +34,14 @@
     protected Class getRealClassInternal(Object o) {
         if (AopUtils.isAopProxy(o)) {
             Advised advised = (Advised)o;
-            if (advised == null) {
-                return AopUtils.getTargetClass(o);
-            }
             try {
-                return getRealClassInternal(advised.getTargetSource().getTarget());
+                Object target = advised.getTargetSource().getTarget();
+                
+                if (target == null) {
+                    return AopUtils.getTargetClass(o);
+                } else {
+                    return getRealClassInternal(target); 
+                }
             } catch (Exception ex) {
                 // ignore
             }

Modified: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPMessageContextImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPMessageContextImpl.java?rev=761789&r1=761788&r2=761789&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPMessageContextImpl.java
(original)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPMessageContextImpl.java
Fri Apr  3 20:50:23 2009
@@ -82,7 +82,6 @@
         return message;
     }
 
-    // TODO: handle the boolean parameter
     public Object[] getHeaders(QName name, JAXBContext context, boolean allRoles) {
         SOAPMessage msg = getMessage();
         SOAPHeader header;
@@ -103,7 +102,7 @@
                     
                 }
             }
-            return ret.toArray(new SOAPHeaderElement[ret.size()]);
+            return ret.toArray(new Object[ret.size()]);
         } catch (SOAPException e) {
             throw new WebServiceException(e);
         } catch (JAXBException e) {

Modified: cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ParameterProcessor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ParameterProcessor.java?rev=761789&r1=761788&r2=761789&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ParameterProcessor.java
(original)
+++ cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ParameterProcessor.java
Fri Apr  3 20:50:23 2009
@@ -27,6 +27,7 @@
 import java.util.logging.Level;
 
 import javax.wsdl.OperationType;
+import javax.xml.bind.annotation.adapters.HexBinaryAdapter;
 import javax.xml.namespace.QName;
 
 import org.apache.cxf.common.i18n.Message;
@@ -43,10 +44,13 @@
 import org.apache.cxf.tools.common.model.JavaType;
 import org.apache.cxf.tools.wsdlto.core.DataBindingProfile;
 import org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.annotator.WebParamAnnotator;
+import org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.annotator.XmlJavaTypeAdapterAnnotator;
 import org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.annotator.XmlListAnotator;
 import org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.mapper.ParameterMapper;
+import org.apache.ws.commons.schema.XmlSchemaElement;
 import org.apache.ws.commons.schema.XmlSchemaSimpleType;
 import org.apache.ws.commons.schema.XmlSchemaSimpleTypeList;
+import org.apache.ws.commons.schema.constants.Constants;
 
 public class ParameterProcessor extends AbstractProcessor {
     public static final String HEADER = "messagepart.isheader";
@@ -131,14 +135,28 @@
         }
         
         if (part != null && part.getXmlSchema() instanceof XmlSchemaSimpleType) {
-            XmlSchemaSimpleType simpleType = (XmlSchemaSimpleType)part.getXmlSchema();
-            if (simpleType.getContent() instanceof XmlSchemaSimpleTypeList && !part.isElement())
{
-                method.annotate(new XmlListAnotator(method.getInterface()));
+            processXmlSchemaSimpleType((XmlSchemaSimpleType)part.getXmlSchema(), method,
part);
+        } else if (part != null && part.getXmlSchema() instanceof XmlSchemaElement)
{
+            XmlSchemaElement element = (XmlSchemaElement)part.getXmlSchema();
+            if (element.getSchemaType() instanceof XmlSchemaSimpleType) {
+                processXmlSchemaSimpleType((XmlSchemaSimpleType)element.getSchemaType(),
method, part);
             }
         }
         
         method.setReturn(returnType);
     }
+    
+    private static void processXmlSchemaSimpleType(XmlSchemaSimpleType xmlSchema, JavaMethod
method,
+                                                   MessagePartInfo part) {
+        if (xmlSchema.getContent() instanceof XmlSchemaSimpleTypeList
+            && (!part.isElement() || !method.isWrapperStyle())) {
+            method.annotate(new XmlListAnotator(method.getInterface()));
+        }
+        if (Constants.XSD_HEXBIN.equals(xmlSchema.getQName())
+            && (!part.isElement() || !method.isWrapperStyle())) {
+            method.annotate(new XmlJavaTypeAdapterAnnotator(method.getInterface(), HexBinaryAdapter.class));
+        }
+    }
 
     private boolean isOutOfBandHeader(final MessagePartInfo part) {
         return Boolean.TRUE.equals(part.getProperty(OUT_OF_BAND_HEADER));

Added: cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/XmlJavaTypeAdapterAnnotator.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/XmlJavaTypeAdapterAnnotator.java?rev=761789&view=auto
==============================================================================
--- cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/XmlJavaTypeAdapterAnnotator.java
(added)
+++ cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/XmlJavaTypeAdapterAnnotator.java
Fri Apr  3 20:50:23 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.
+ */
+package org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.annotator;
+
+import javax.xml.bind.annotation.adapters.XmlAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
+import org.apache.cxf.tools.common.model.Annotator;
+import org.apache.cxf.tools.common.model.JAnnotation;
+import org.apache.cxf.tools.common.model.JAnnotationElement;
+import org.apache.cxf.tools.common.model.JavaAnnotatable;
+import org.apache.cxf.tools.common.model.JavaInterface;
+import org.apache.cxf.tools.common.model.JavaMethod;
+import org.apache.cxf.tools.common.model.JavaParameter;
+
+public class XmlJavaTypeAdapterAnnotator implements Annotator {
+    private JavaInterface jf;
+    private Class<? extends XmlAdapter> adapter;
+
+    public XmlJavaTypeAdapterAnnotator(JavaInterface intf, Class<? extends XmlAdapter>
adapter) {
+        this.jf = intf;
+        this.adapter = adapter;
+    }
+
+    public void annotate(JavaAnnotatable jn) {
+
+        JAnnotation jaxbAnnotation = new JAnnotation(XmlJavaTypeAdapter.class);
+        jaxbAnnotation.addElement(new JAnnotationElement("value", adapter));
+        if (jn instanceof JavaParameter) {
+            JavaParameter jp = (JavaParameter)jn;
+            jp.addAnnotation("XmlJavaTypeAdapter", jaxbAnnotation);
+        } else if (jn instanceof JavaMethod) {
+            JavaMethod jm = (JavaMethod)jn;
+            jm.addAnnotation("XmlJavaTypeAdapter", jaxbAnnotation);
+        } else {
+            throw new RuntimeException("Annotation of " + jn.getClass() + " not supported.");
+        }
+        jf.addImport(XmlJavaTypeAdapter.class.getName());
+        jf.addImport(adapter.getName());
+    }
+
+}

Propchange: cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/XmlJavaTypeAdapterAnnotator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/XmlJavaTypeAdapterAnnotator.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/mapper/ParameterMapper.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/mapper/ParameterMapper.java?rev=761789&r1=761788&r2=761789&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/mapper/ParameterMapper.java
(original)
+++ cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/mapper/ParameterMapper.java
Fri Apr  3 20:50:23 2009
@@ -19,6 +19,8 @@
 
 package org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.mapper;
 
+import javax.xml.bind.annotation.adapters.HexBinaryAdapter;
+
 import org.apache.cxf.jaxb.JAXBUtils;
 import org.apache.cxf.service.model.MessagePartInfo;
 import org.apache.cxf.tools.common.ToolContext;
@@ -26,9 +28,12 @@
 import org.apache.cxf.tools.common.model.JavaParameter;
 import org.apache.cxf.tools.common.model.JavaType;
 import org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.ProcessorUtil;
+import org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.annotator.XmlJavaTypeAdapterAnnotator;
 import org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.annotator.XmlListAnotator;
+import org.apache.ws.commons.schema.XmlSchemaElement;
 import org.apache.ws.commons.schema.XmlSchemaSimpleType;
 import org.apache.ws.commons.schema.XmlSchemaSimpleTypeList;
+import org.apache.ws.commons.schema.constants.Constants;
 
 
 public final class ParameterMapper {
@@ -45,9 +50,11 @@
         JavaParameter parameter = new JavaParameter(name, type, namespace);
         parameter.setPartName(part.getName().getLocalPart());
         if (part.getXmlSchema() instanceof XmlSchemaSimpleType) {
-            XmlSchemaSimpleType simpleType = (XmlSchemaSimpleType)part.getXmlSchema();
-            if (simpleType.getContent() instanceof XmlSchemaSimpleTypeList && !part.isElement())
{
-                parameter.annotate(new XmlListAnotator(jm.getInterface()));
+            processXmlSchemaSimpleType((XmlSchemaSimpleType)part.getXmlSchema(), jm, parameter,
part);
+        } else if (part.getXmlSchema() instanceof XmlSchemaElement) {
+            XmlSchemaElement element = (XmlSchemaElement)part.getXmlSchema();
+            if (element.getSchemaType() instanceof XmlSchemaSimpleType) {
+                processXmlSchemaSimpleType((XmlSchemaSimpleType)element.getSchemaType(),
jm, parameter, part);
             }
         }
         parameter.setQName(ProcessorUtil.getElementName(part));
@@ -70,5 +77,16 @@
         return parameter;
     }
 
+    private static void processXmlSchemaSimpleType(XmlSchemaSimpleType xmlSchema, JavaMethod
jm,
+                                                   JavaParameter parameter, MessagePartInfo
part) {
+        if (xmlSchema.getContent() instanceof XmlSchemaSimpleTypeList
+            && (!part.isElement() || !jm.isWrapperStyle())) {
+            parameter.annotate(new XmlListAnotator(jm.getInterface()));
+        }
+        if (Constants.XSD_HEXBIN.equals(xmlSchema.getQName()) 
+            && (!part.isElement() || !jm.isWrapperStyle())) {
+            parameter.annotate(new XmlJavaTypeAdapterAnnotator(jm.getInterface(), HexBinaryAdapter.class));
+        }
+    }
    
 }



Mime
View raw message