You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by mm...@apache.org on 2007/10/19 12:05:11 UTC

svn commit: r586360 [1/2] - in /incubator/cxf/trunk/tools: common/ common/src/main/java/org/apache/cxf/tools/common/model/ common/src/test/java/org/apache/cxf/tools/common/model/ javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/a...

Author: mmao
Date: Fri Oct 19 03:05:03 2007
New Revision: 586360

URL: http://svn.apache.org/viewvc?rev=586360&view=rev
Log:
CXF-1069 Part of JAXWS 2.1

* Refactoring the JavaAnnotation Model, 
   support primitive, String, annotation, enum and arrays of above as the elements in the annotation
* WSDL2Java support wsaw:Action in the wsdl:input/wsdl:output/wsdl:fault in the portType
   We support the latest version of wsaw in tools


Added:
    incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JAnnotation.java
    incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JAnnotationElement.java
    incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/model/A.java
    incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/model/JAnnotationTest.java
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WSActionAnnotator.java
    incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/wsdl_addr.wsdl
Modified:
    incubator/cxf/trunk/tools/common/pom.xml
    incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaField.java
    incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaInterface.java
    incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaMethod.java
    incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaParameter.java
    incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaType.java
    incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/annotator/WrapperBeanAnnotator.java
    incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/annotator/WrapperBeanFieldAnnotator.java
    incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/annotator/WrapperBeanAnnotatorTest.java
    incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/annotator/WrapperBeanFieldAnnotatorTest.java
    incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/HandlerConfigGenerator.java
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/SEIGenerator.java
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ServiceGenerator.java
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/OperationProcessor.java
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ServiceProcessor.java
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/BindingAnnotator.java
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/SoapBindingAnnotator.java
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebMethodAnnotator.java
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebParamAnnotator.java
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebResultAnnotator.java
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebServiceAnnotator.java
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WrapperAnnotator.java
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/XmlSeeAlsoAnnotator.java
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/sei.vm
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebMethodAnnotatorTest.java
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebParamAnnotatorTest.java
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/XmlSeeAlsoAnnotatorTest.java
    incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
    incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
    incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/expected/expected_hello_mime

Modified: incubator/cxf/trunk/tools/common/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/common/pom.xml?rev=586360&r1=586359&r2=586360&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/common/pom.xml (original)
+++ incubator/cxf/trunk/tools/common/pom.xml Fri Oct 19 03:05:03 2007
@@ -89,6 +89,12 @@
 	    <version>${project.version}</version>
 	</dependency>	
 
+	<dependency>
+                <groupId>javax.xml.ws</groupId>
+                <artifactId>jaxws-api</artifactId>
+		<scope>test</scope>
+	</dependency>
+
     </dependencies>
 
 

Added: incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JAnnotation.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JAnnotation.java?rev=586360&view=auto
==============================================================================
--- incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JAnnotation.java (added)
+++ incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JAnnotation.java Fri Oct 19 03:05:03 2007
@@ -0,0 +1,106 @@
+/**
+ * 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.common.model;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+public final class JAnnotation {
+
+    private Class type;
+    private List<JAnnotationElement> elements = new ArrayList<JAnnotationElement>();
+    private Set<String> imports = new HashSet<String>();
+
+    public JAnnotation() {
+        // empty
+    }
+
+    public JAnnotation(Class t) {
+        setType(t);
+    }
+
+    public Set<String> getImports() {
+        prompt();
+        for (JAnnotationElement element : elements) {
+            imports.addAll(element.getImports());
+        }
+        return imports;
+    }
+
+    private void prompt() {
+        toString();        
+    }
+
+    public List<JAnnotationElement> getElements() {
+        return elements;
+    }
+
+    public void addElement(JAnnotationElement element) {
+        if (elements.contains(element)) {
+            return;
+        }
+        JAnnotationElement e = getElementByName(element.getName());
+        if (e != null) {
+            elements.remove(e);
+        }
+        elements.add(element);
+    }
+
+    private JAnnotationElement getElementByName(String name) {
+        if (name != null) {
+            for (JAnnotationElement e : elements) {
+                if (name.equals(e.getName())) {
+                    return e;
+                }
+            }
+        }
+        return null;
+    }
+
+    public Class getType() {
+        return type;
+    }
+
+    public void setType(final Class newType) {
+        this.type = newType;
+        imports.add(type.getName());
+    }
+
+    public String toString() {
+        StringBuffer sb = new StringBuffer();
+        sb.append("@");
+        sb.append(type.getSimpleName());
+        if (getElements().isEmpty()) {
+            return sb.toString();
+        }
+
+        sb.append("(");
+        for (int i = 0; i < elements.size(); i++) {
+            sb.append(elements.get(i));
+            if (i < elements.size() - 1) {
+                sb.append(", ");
+            }
+        }
+        sb.append(")");
+        return sb.toString();
+    }
+}

Added: incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JAnnotationElement.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JAnnotationElement.java?rev=586360&view=auto
==============================================================================
--- incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JAnnotationElement.java (added)
+++ incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JAnnotationElement.java Fri Oct 19 03:05:03 2007
@@ -0,0 +1,156 @@
+/**
+ * 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.common.model;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+public final class JAnnotationElement {
+    private String name;
+    private Object value;
+    private boolean isPrimitive;
+
+    private Set<String> imports = new HashSet<String>();
+
+    public JAnnotationElement() {
+    }
+
+    public JAnnotationElement(String n, Object v) {
+        this(n, v, false);
+    }
+
+    public JAnnotationElement(String n, Object v, boolean primitive) {
+        this.name = n;
+        this.value = v;
+        this.isPrimitive = primitive;
+    }
+
+    public Set<String> getImports() {
+        return imports;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(final String newName) {
+        this.name = newName;
+    }
+
+    public Object getValue() {
+        return value;
+    }
+
+    public void setValue(final Object newValue) {
+        this.value = newValue;
+    }
+
+    public String toString() {
+        StringBuffer sb = new StringBuffer();
+        if (name != null) {
+            sb.append(name);
+        }
+        if (value != null) {
+            if (name != null) {
+                sb.append(" = ");
+            }
+            if (value instanceof List) {
+                List list = (List) value;
+                sb.append("{");
+                for (int i = 0; i < list.size(); i++) {
+                    appendValue(sb, list.get(i));
+                    if (i < list.size() - 1) {
+                        sb.append(",");
+                    }
+                }
+                sb.append("}");
+            } else {
+                appendValue(sb, value);
+            }
+        }
+        return sb.toString();
+    }
+
+    private void appendValue(final StringBuffer sb, final Object obj) {
+        if (obj instanceof String) {
+            getStringValue(sb, obj);
+        } else if (obj instanceof Class) {
+            Class clz = (Class) obj;
+            if (containsSameClassName(clz) && !imports.contains(clz.getName())) {
+                sb.append(clz.getName());
+            } else {
+                sb.append(clz.getSimpleName());
+                imports.add(clz.getName());
+            }
+            sb.append(".class");
+        } else if (obj instanceof JAnnotation) {
+            sb.append(obj);
+            imports.addAll(((JAnnotation)obj).getImports());
+        } else if (obj instanceof Enum) {
+            appendEnumValue(sb, obj);
+        } else if (obj instanceof JavaType) {
+            JavaType type = (JavaType)obj;
+            sb.append(type.getClassName());
+            sb.append(".class");
+        } else if (isPrimitive) {
+            sb.append(obj);
+        }
+    }
+
+    private void appendEnumValue(final StringBuffer sb, final Object obj) {
+        Enum e = (Enum) obj;
+
+        String clzName = e.getClass().getName();
+        
+        imports.add(obj.getClass().getName().replace("$", "."));
+
+        sb.append(clzName.substring(clzName.lastIndexOf(".") + 1).replace("$", "."));
+        sb.append(".");
+        sb.append(e.name());
+    }
+
+    private void getStringValue(final StringBuffer sb, final Object obj) {
+        sb.append("\"");
+        sb.append(obj);
+        sb.append("\"");
+    }
+
+    private boolean containsSameClassName(Class clz) {
+        return imports.contains(clz.getName());
+    }
+
+    public int hashCode() {
+        return this.toString().hashCode();
+    }
+
+    public boolean equals(Object obj) {
+        if (obj == null) {
+            return false;
+        }
+
+        if (!(obj instanceof JAnnotationElement)) {
+            return false;
+        }
+
+        JAnnotationElement element = (JAnnotationElement) obj;
+        return element.toString().equals(this.toString());
+    }
+}

Modified: incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaField.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaField.java?rev=586360&r1=586359&r2=586360&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaField.java (original)
+++ incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaField.java Fri Oct 19 03:05:03 2007
@@ -23,7 +23,7 @@
 
 public class JavaField extends JavaType implements JavaAnnotatable {
     private String modifier;
-    private JavaAnnotation annotation;
+    private JAnnotation annotation;
 
     public JavaField() {
     }
@@ -41,11 +41,14 @@
         this.modifier = modi;
     }
 
-    public void setAnnotation(JavaAnnotation anno) {
+    public void setAnnotation(JAnnotation anno) {
         this.annotation = anno;
+        for (String importClz : annotation.getImports()) {
+            getOwner().addImport(importClz);
+        }        
     }
 
-    public JavaAnnotation getAnnotation() {
+    public JAnnotation getAnnotation() {
         return this.annotation;
     }
 

Modified: incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaInterface.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaInterface.java?rev=586360&r1=586359&r2=586360&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaInterface.java (original)
+++ incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaInterface.java Fri Oct 19 03:05:03 2007
@@ -38,7 +38,7 @@
     private SOAPBinding.ParameterStyle soapParameterStyle;
     
     private final List<JavaMethod> methods = new ArrayList<JavaMethod>();
-    private final List<String> annotations = new ArrayList<String>();
+    private final List<JAnnotation> annotations = new ArrayList<JAnnotation>();
     private final Set<String> imports = new TreeSet<String>();
 
     private String webserviceName;
@@ -168,17 +168,30 @@
         this.namespace = ns;
     }
 
-    public void addAnnotation(String annotation) {
+    public void addAnnotation(JAnnotation annotation) {
         this.annotations.add(annotation);
+        for (String importClz : annotation.getImports()) {
+            addImport(importClz);
+        }        
     }
 
-    public List<String> getAnnotations() {
+    public List<JAnnotation> getAnnotations() {
         return this.annotations;
     }
 
     public void addImport(String i) {
+        if (i != null && i.lastIndexOf(".") != -1 && getPackageName() != null
+            && getPackageName().equals(i.substring(0, i.lastIndexOf(".")))) {
+            return;
+        }
         imports.add(i);
     }
+    
+    public void addImports(Collection<String> ii) {
+        for (String i : ii) {
+            imports.add(i);
+        }
+    }
 
     public Iterator<String> getImports() {
         return imports.iterator();
@@ -216,7 +229,7 @@
 
     public String toString() {
         StringBuffer sb = new StringBuffer();
-        for (String anno : annotations) {
+        for (JAnnotation anno : annotations) {
             sb.append(anno);
             sb.append("\n");
         }

Modified: incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaMethod.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaMethod.java?rev=586360&r1=586359&r2=586360&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaMethod.java (original)
+++ incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaMethod.java Fri Oct 19 03:05:03 2007
@@ -47,7 +47,7 @@
     private JavaInterface javaInterface;
     private final List<JavaParameter> parameters = new ArrayList<JavaParameter>();
     private final List<JavaException> exceptions = new ArrayList<JavaException>();
-    private final Map<String, JavaAnnotation> annotations = new HashMap<String, JavaAnnotation>();
+    private final Map<String, JAnnotation> annotations = new HashMap<String, JAnnotation>();
 
     private JavaCodeBlock block;
 
@@ -154,7 +154,7 @@
             Message msg = new Message("FAIL_TO_CREATE_JAVA_PARAMETER", LOG, param.name, this.getName());
             throw new ToolException(msg);
         }
-        
+        param.setMethod(this);
         parameters.add(param);
     }
 
@@ -245,18 +245,22 @@
         return this.soapUse;
     }
 
-    public void addAnnotation(String tag, JavaAnnotation annotation) {
+    public void addAnnotation(String tag, JAnnotation annotation) {
         if (annotation == null) {
             return;
         }
         this.annotations.put(tag, annotation);
+        
+        for (String importClz : annotation.getImports()) {
+            getInterface().addImport(importClz);
+        }
     }
 
-    public Collection<JavaAnnotation> getAnnotations() {
+    public Collection<JAnnotation> getAnnotations() {
         return this.annotations.values();
     }
 
-    public Map<String, JavaAnnotation> getAnnotationMap() {
+    public Map<String, JAnnotation> getAnnotationMap() {
         return this.annotations;
     }
 

Modified: incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaParameter.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaParameter.java?rev=586360&r1=586359&r2=586360&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaParameter.java (original)
+++ incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaParameter.java Fri Oct 19 03:05:03 2007
@@ -24,7 +24,7 @@
 
     private boolean holder;
     private String holderName;
-    private JavaAnnotation annotation;
+    private JAnnotation annotation;
     private String partName;
 
     private JavaMethod javaMethod;
@@ -57,11 +57,14 @@
         this.holderName = hn;
     }
 
-    public void setAnnotation(JavaAnnotation anno) {
+    public void setAnnotation(JAnnotation anno) {
         this.annotation = anno;
+        for (String importClz : annotation.getImports()) {
+            getMethod().getInterface().addImport(importClz);
+        }        
     }
 
-    public JavaAnnotation getAnnotation() {
+    public JAnnotation getAnnotation() {
         return this.annotation;
     }
 

Modified: incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaType.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaType.java?rev=586360&r1=586359&r2=586360&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaType.java (original)
+++ incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaType.java Fri Oct 19 03:05:03 2007
@@ -63,6 +63,7 @@
     private JavaInterface owner;
     private DefaultValueWriter dvw;
 
+
     public JavaType() {
     }
 
@@ -71,7 +72,7 @@
         this.type = t;
         this.targetNamespace = tns;
         this.className = t;
-    }
+    }    
 
     public void setDefaultValueWriter(DefaultValueWriter w) {
         dvw = w;

Added: incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/model/A.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/model/A.java?rev=586360&view=auto
==============================================================================
--- incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/model/A.java (added)
+++ incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/model/A.java Fri Oct 19 03:05:03 2007
@@ -0,0 +1,24 @@
+/**
+ * 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.common.model;
+
+public class A {
+    
+}

Added: incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/model/JAnnotationTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/model/JAnnotationTest.java?rev=586360&view=auto
==============================================================================
--- incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/model/JAnnotationTest.java (added)
+++ incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/model/JAnnotationTest.java Fri Oct 19 03:05:03 2007
@@ -0,0 +1,107 @@
+/**
+ * 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.common.model;
+
+import java.util.Arrays;
+import javax.jws.WebParam;
+import javax.jws.WebParam.Mode;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+import javax.xml.bind.annotation.XmlSeeAlso;
+import javax.xml.ws.Action;
+import javax.xml.ws.FaultAction;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class JAnnotationTest extends Assert {
+    @Test
+    public void testList() throws Exception {
+        JAnnotation annotation = new JAnnotation(XmlSeeAlso.class);
+        annotation.addElement(new JAnnotationElement(null, 
+                                                            Arrays.asList(new Class[]{XmlSeeAlso.class})));
+        assertEquals("@XmlSeeAlso({XmlSeeAlso.class})", annotation.toString());
+        assertEquals("javax.xml.bind.annotation.XmlSeeAlso", annotation.getImports().iterator().next());
+    }
+
+    @Test
+    public void testSimpleForm() {
+        JAnnotation annotation = new JAnnotation(WebService.class);
+        assertEquals("@WebService", annotation.toString());
+    }
+
+    @Test
+    public void testStringForm() {
+        JAnnotation annotation = new JAnnotation(WebService.class);
+        annotation.addElement(new JAnnotationElement("name", "AddNumbersPortType"));
+        annotation.addElement(new JAnnotationElement("targetNamespace", "http://example.com/"));
+        assertEquals("@WebService(name = \"AddNumbersPortType\", targetNamespace = \"http://example.com/\")", 
+                     annotation.toString());
+    }
+
+    @Test
+    public void testEnum() {
+        JAnnotation annotation = new JAnnotation(SOAPBinding.class);
+        annotation.addElement(new JAnnotationElement("parameterStyle", 
+                                                            SOAPBinding.ParameterStyle.BARE));
+        assertEquals("@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)", annotation.toString());
+    }
+    
+    @Test
+    public void testCombination() {
+        JAnnotation annotation = new JAnnotation(Action.class);
+        annotation.addElement(new JAnnotationElement("input", "3in"));
+        annotation.addElement(new JAnnotationElement("output", "3out"));
+        
+        
+        JAnnotation faultAction = new JAnnotation(FaultAction.class);
+        faultAction.addElement(new JAnnotationElement("className", A.class));
+        faultAction.addElement(new JAnnotationElement("value", "3fault"));
+        
+        annotation.addElement(new JAnnotationElement("fault", 
+                                                            Arrays.asList(new JAnnotation[]{faultAction})));
+
+        String expected = "@Action(input = \"3in\", output = \"3out\", " 
+            + "fault = {@FaultAction(className = A.class, value = \"3fault\")})";
+        assertEquals(expected, annotation.toString());
+
+        assertTrue(annotation.getImports().contains("javax.xml.ws.FaultAction"));
+        assertTrue(annotation.getImports().contains("javax.xml.ws.Action"));
+        assertTrue(annotation.getImports().contains("org.apache.cxf.tools.common.model.A"));
+    }
+
+    @Test
+    public void testPrimitive() {
+        JAnnotation annotation = new JAnnotation(WebParam.class);
+        annotation.addElement(new JAnnotationElement("header", true, true));
+        annotation.addElement(new JAnnotationElement("mode", Mode.INOUT));
+        assertEquals("@WebParam(header = true, mode = WebParam.Mode.INOUT)", annotation.toString());
+    }
+
+    @Test
+    public void testAddSame() {
+        JAnnotation annotation = new JAnnotation(WebParam.class);
+        annotation.addElement(new JAnnotationElement("header", true, true));
+        annotation.addElement(new JAnnotationElement("header", false, true));
+        annotation.addElement(new JAnnotationElement("mode", Mode.INOUT));
+        annotation.addElement(new JAnnotationElement("mode", Mode.OUT));
+        assertEquals("@WebParam(header = false, mode = WebParam.Mode.OUT)", annotation.toString());
+    }
+}

Modified: incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/annotator/WrapperBeanAnnotator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/annotator/WrapperBeanAnnotator.java?rev=586360&r1=586359&r2=586360&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/annotator/WrapperBeanAnnotator.java (original)
+++ incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/annotator/WrapperBeanAnnotator.java Fri Oct 19 03:05:03 2007
@@ -19,39 +19,44 @@
 
 package org.apache.cxf.tools.java2wsdl.generator.wsdl11.annotator;
 
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
 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.JavaAnnotation;
 import org.apache.cxf.tools.java2wsdl.generator.wsdl11.model.WrapperBeanClass;
 public class WrapperBeanAnnotator implements Annotator {
 
     public void annotate(final JavaAnnotatable clz) {
-        WrapperBeanClass wrapperBeanClass = null;
+        WrapperBeanClass beanClass = null;
         if (clz instanceof WrapperBeanClass) {
-            wrapperBeanClass = (WrapperBeanClass) clz;
+            beanClass = (WrapperBeanClass) clz;
         } else {
             throw new RuntimeException("WrapperBeanAnnotator expect JavaClass as input");
         }
 
-        JavaAnnotation xmlRootElement = new JavaAnnotation("XmlRootElement");
-        xmlRootElement.addArgument("name", wrapperBeanClass.getElementName().getLocalPart());
-        xmlRootElement.addArgument("namespace", wrapperBeanClass.getElementName().getNamespaceURI());
-
-        JavaAnnotation xmlAccessorType = new JavaAnnotation("XmlAccessorType");
-        xmlAccessorType.addArgument("XmlAccessType.FIELD", "null", "");
+        JAnnotation xmlRootElement = new JAnnotation(XmlRootElement.class);
+        xmlRootElement.addElement(new JAnnotationElement("name", 
+                                                         beanClass.getElementName().getLocalPart()));
+        xmlRootElement.addElement(new JAnnotationElement("namespace", 
+                                                         beanClass.getElementName().getNamespaceURI()));
+        
+        JAnnotation xmlAccessorType = new JAnnotation(XmlAccessorType.class);
+        xmlAccessorType.addElement(new JAnnotationElement(null, XmlAccessType.FIELD));
 
-        JavaAnnotation xmlType = new JavaAnnotation("XmlType");
-        //xmlType.addArgument("name", wrapperBeanClass.getElementName().getLocalPart());
-        xmlType.addArgument("name", wrapperBeanClass.getElementName().getLocalPart());
-        xmlType.addArgument("namespace", wrapperBeanClass.getElementName().getNamespaceURI());
+        JAnnotation xmlType = new JAnnotation(XmlType.class);
+        xmlType.addElement(new JAnnotationElement("name", 
+                                                  beanClass.getElementName().getLocalPart()));
+        xmlType.addElement(new JAnnotationElement("namespace", 
+                                                  beanClass.getElementName().getNamespaceURI()));
+        
         // Revisit: why annotation is string?
-        wrapperBeanClass.addAnnotation(xmlRootElement.toString());
-        wrapperBeanClass.addAnnotation(xmlAccessorType.toString());
-        wrapperBeanClass.addAnnotation(xmlType.toString());
-
-        wrapperBeanClass.addImport("javax.xml.bind.annotation.XmlAccessType");
-        wrapperBeanClass.addImport("javax.xml.bind.annotation.XmlAccessorType");
-        wrapperBeanClass.addImport("javax.xml.bind.annotation.XmlRootElement");
-        wrapperBeanClass.addImport("javax.xml.bind.annotation.XmlType");
+        beanClass.addAnnotation(xmlRootElement);
+        beanClass.addAnnotation(xmlAccessorType);
+        beanClass.addAnnotation(xmlType);
     }
 }

Modified: incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/annotator/WrapperBeanFieldAnnotator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/annotator/WrapperBeanFieldAnnotator.java?rev=586360&r1=586359&r2=586360&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/annotator/WrapperBeanFieldAnnotator.java (original)
+++ incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/annotator/WrapperBeanFieldAnnotator.java Fri Oct 19 03:05:03 2007
@@ -19,9 +19,13 @@
 
 package org.apache.cxf.tools.java2wsdl.generator.wsdl11.annotator;
 
+import javax.xml.bind.annotation.XmlElement;
+
+import org.apache.cxf.common.util.StringUtils;
 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.JavaAnnotation;
 import org.apache.cxf.tools.common.model.JavaField;
 
 public class WrapperBeanFieldAnnotator implements Annotator {
@@ -34,12 +38,13 @@
             throw new RuntimeException("WrapperBeanFiledAnnotator expect JavaField as input");
         }
         String rawName = jField.getRawName();
-        JavaAnnotation xmlElementAnnotation = new JavaAnnotation("XmlElement");
-        
-        xmlElementAnnotation.addArgument("name", rawName);
-        xmlElementAnnotation.addArgIgnoreEmpty("namespace", jField.getTargetNamespace(), "\"");
+        JAnnotation xmlElementAnnotation = new JAnnotation(XmlElement.class);
+        xmlElementAnnotation.addElement(new JAnnotationElement("name", rawName));
+        if (!StringUtils.isEmpty(jField.getTargetNamespace())) {
+            xmlElementAnnotation.addElement(new JAnnotationElement("namespace", 
+                                                                          jField.getTargetNamespace()));
+        }
 
         jField.setAnnotation(xmlElementAnnotation);
-        jField.getOwner().addImport("javax.xml.bind.annotation.XmlElement");
     }
 }

Modified: incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/annotator/WrapperBeanAnnotatorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/annotator/WrapperBeanAnnotatorTest.java?rev=586360&r1=586359&r2=586360&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/annotator/WrapperBeanAnnotatorTest.java (original)
+++ incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/annotator/WrapperBeanAnnotatorTest.java Fri Oct 19 03:05:03 2007
@@ -23,6 +23,7 @@
 import javax.xml.namespace.QName;
 
 
+import org.apache.cxf.tools.common.model.JAnnotation;
 import org.apache.cxf.tools.java2wsdl.generator.wsdl11.model.WrapperBeanClass;
 import org.junit.Assert;
 import org.junit.Test;
@@ -37,29 +38,44 @@
         clz.setElementName(new QName("http://doc.withannotation.fortest.tools.cxf.apache.org/", "sayHi"));
 
         clz.annotate(new WrapperBeanAnnotator());
-        List<String> annotations = clz.getAnnotations();
+        List<JAnnotation> annotations = clz.getAnnotations();
         
         String expectedNamespace = "http://doc.withannotation.fortest.tools.cxf.apache.org/";
+                
+        JAnnotation rootElementAnnotation = annotations.get(0);
+        assertEquals("@XmlRootElement(name = \"sayHi\", " 
+                     + "namespace = \"" + expectedNamespace + "\")", 
+                     rootElementAnnotation.toString());
         
-        assertTrue(annotations.contains("@XmlRootElement(namespace = \""
-                                        + expectedNamespace + "\", name = \"sayHi\")"));
-        assertTrue(annotations.contains("@XmlType(namespace = \""
-                                        + expectedNamespace + "\", name = \"sayHi\")"));
-        assertTrue(annotations.contains("@XmlAccessorType(XmlAccessType.FIELD)"));
-
+        JAnnotation xmlTypeAnnotation = annotations.get(2);
+        assertEquals("@XmlType(name = \"sayHi\", "
+                     + "namespace = \"" + expectedNamespace + "\")", 
+                     xmlTypeAnnotation.toString());
+        
+        JAnnotation accessorTypeAnnotation = annotations.get(1);
+        assertEquals("@XmlAccessorType(XmlAccessType.FIELD)", 
+                     accessorTypeAnnotation.toString());
         
         WrapperBeanClass resWrapperClass = new WrapperBeanClass();
         resWrapperClass.setFullClassName(pkgName + ".SayHiResponse");
-        resWrapperClass.setElementName(new QName("http://doc.withannotation.fortest.tools.cxf.apache.org/",
+        resWrapperClass.setElementName(new QName(expectedNamespace,
                                      "sayHiResponse"));
         
         resWrapperClass.annotate(new WrapperBeanAnnotator());
         annotations = resWrapperClass.getAnnotations();
         
-        assertTrue(annotations.contains("@XmlRootElement(namespace = \""
-                                        + expectedNamespace + "\", name = \"sayHiResponse\")"));
-        assertTrue(annotations.contains("@XmlType(namespace = \""
-                                        + expectedNamespace + "\", name = \"sayHiResponse\")"));
-        assertTrue(annotations.contains("@XmlAccessorType(XmlAccessType.FIELD)"));
+        rootElementAnnotation = annotations.get(0);
+        assertEquals("@XmlRootElement(name = \"sayHiResponse\", " 
+                     + "namespace = \"" + expectedNamespace + "\")", 
+                     rootElementAnnotation.toString());
+        
+        accessorTypeAnnotation = annotations.get(1);
+        assertEquals("@XmlAccessorType(XmlAccessType.FIELD)", 
+                     accessorTypeAnnotation.toString());
+        
+        xmlTypeAnnotation = annotations.get(2);
+        assertEquals("@XmlType(name = \"sayHiResponse\", "
+                     + "namespace = \"" + expectedNamespace + "\")",
+                     xmlTypeAnnotation.toString());
     }
 }

Modified: incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/annotator/WrapperBeanFieldAnnotatorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/annotator/WrapperBeanFieldAnnotatorTest.java?rev=586360&r1=586359&r2=586360&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/annotator/WrapperBeanFieldAnnotatorTest.java (original)
+++ incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/annotator/WrapperBeanFieldAnnotatorTest.java Fri Oct 19 03:05:03 2007
@@ -20,7 +20,7 @@
 package org.apache.cxf.tools.java2wsdl.generator.wsdl11.annotator;
 
 
-import org.apache.cxf.tools.common.model.JavaAnnotation;
+import org.apache.cxf.tools.common.model.JAnnotation;
 import org.apache.cxf.tools.common.model.JavaClass;
 import org.apache.cxf.tools.common.model.JavaField;
 import org.junit.Assert;
@@ -38,14 +38,14 @@
                                            "http://doc.withannotation.fortest.tools.cxf.apache.org/");
 
         reqField.setOwner(clz);
-        JavaAnnotation annotation = reqField.getAnnotation();
+        JAnnotation annotation = reqField.getAnnotation();
         assertNull(annotation);
         
         reqField.annotate(new WrapperBeanFieldAnnotator());
         annotation = reqField.getAnnotation();
 
         String expectedNamespace = "http://doc.withannotation.fortest.tools.cxf.apache.org/";
-        assertEquals("@XmlElement(namespace = \"" + expectedNamespace + "\", name = \"array\")",
+        assertEquals("@XmlElement(name = \"array\", namespace = \"" + expectedNamespace + "\")",
                      annotation.toString());
 
         clz.setFullClassName("org.apache.cxf.tools.fortest.withannotation.doc.jaxws.SayHiResponse");
@@ -55,7 +55,7 @@
         resField.setOwner(clz);
         resField.annotate(new WrapperBeanFieldAnnotator());
         annotation = resField.getAnnotation();
-        assertEquals("@XmlElement(namespace = \"" + expectedNamespace + "\", name = \"return\")",
+        assertEquals("@XmlElement(name = \"return\", namespace = \"" + expectedNamespace + "\")",
                      annotation.toString());
     }
 }

Modified: incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java?rev=586360&r1=586359&r2=586360&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java (original)
+++ incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java Fri Oct 19 03:05:03 2007
@@ -443,7 +443,7 @@
         env.put(ToolConstants.CFG_VERBOSE, ToolConstants.CFG_VERBOSE);
         try {
             processor.setEnvironment(env);
-            processor.process();                  
+            processor.process();
         } catch (Exception e) {
             e.printStackTrace();
         }

Modified: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/HandlerConfigGenerator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/HandlerConfigGenerator.java?rev=586360&r1=586359&r2=586360&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/HandlerConfigGenerator.java (original)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/HandlerConfigGenerator.java Fri Oct 19 03:05:03 2007
@@ -22,6 +22,8 @@
 import java.io.IOException;
 import java.io.Writer;
 
+import javax.jws.HandlerChain;
+
 import org.w3c.dom.Element;
 import org.w3c.dom.NodeList;
 
@@ -29,7 +31,8 @@
 import org.apache.cxf.tools.common.ToolConstants;
 import org.apache.cxf.tools.common.ToolContext;
 import org.apache.cxf.tools.common.ToolException;
-import org.apache.cxf.tools.common.model.JavaAnnotation;
+import org.apache.cxf.tools.common.model.JAnnotation;
+import org.apache.cxf.tools.common.model.JAnnotationElement;
 import org.apache.cxf.tools.common.model.JavaInterface;
 import org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.ProcessorUtil;
 
@@ -37,13 +40,13 @@
 
     private static final String HANDLER_CHAIN_NAME = "";
     private JavaInterface intf;
-    private JavaAnnotation handlerChainAnnotation;
+    private JAnnotation handlerChainAnnotation;
 
     public HandlerConfigGenerator() {
         this.name = ToolConstants.HANDLER_GENERATOR;
     }
 
-    public JavaAnnotation getHandlerAnnotation() {
+    public JAnnotation getHandlerAnnotation() {
         return handlerChainAnnotation;
     }
 
@@ -73,9 +76,10 @@
                                                ToolConstants.HANDLER_CHAIN);
         if (nl.getLength() > 0) {
             String fName = ProcessorUtil.getHandlerConfigFileName(this.intf.getName());
-            handlerChainAnnotation = new JavaAnnotation("HandlerChain");
-            handlerChainAnnotation.addArgument("name", HANDLER_CHAIN_NAME);
-            handlerChainAnnotation.addArgument("file", fName + ".xml");
+            handlerChainAnnotation = new JAnnotation(HandlerChain.class);
+            handlerChainAnnotation.addElement(new JAnnotationElement("name", 
+                                                                     HANDLER_CHAIN_NAME));
+            handlerChainAnnotation.addElement(new JAnnotationElement("file", fName + ".xml"));           
             generateHandlerChainFile(e, parseOutputName(this.intf.getPackageName(),
                                                         fName,
                                                         ".xml"));

Modified: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/SEIGenerator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/SEIGenerator.java?rev=586360&r1=586359&r2=586360&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/SEIGenerator.java (original)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/SEIGenerator.java Fri Oct 19 03:05:03 2007
@@ -26,6 +26,7 @@
 import org.apache.cxf.tools.common.ToolConstants;
 import org.apache.cxf.tools.common.ToolContext;
 import org.apache.cxf.tools.common.ToolException;
+import org.apache.cxf.tools.common.model.JAnnotation;
 import org.apache.cxf.tools.common.model.JavaInterface;
 import org.apache.cxf.tools.common.model.JavaModel;
 import org.apache.cxf.tools.util.ClassCollector;
@@ -87,7 +88,7 @@
                 handlerGen.setJavaInterface(intf);
                 handlerGen.generate(getEnvironment());
 
-                String annot = handlerGen.getHandlerAnnotation().toString();
+                JAnnotation annot = handlerGen.getHandlerAnnotation();
                 if (handlerGen.getHandlerAnnotation() != null
                     && !intf.getAnnotations().contains(annot)) {
                     intf.addAnnotation(annot);

Modified: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ServiceGenerator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ServiceGenerator.java?rev=586360&r1=586359&r2=586360&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ServiceGenerator.java (original)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ServiceGenerator.java Fri Oct 19 03:05:03 2007
@@ -26,6 +26,7 @@
 import org.apache.cxf.tools.common.ToolConstants;
 import org.apache.cxf.tools.common.ToolContext;
 import org.apache.cxf.tools.common.ToolException;
+import org.apache.cxf.tools.common.model.JAnnotation;
 import org.apache.cxf.tools.common.model.JavaModel;
 import org.apache.cxf.tools.common.model.JavaPort;
 import org.apache.cxf.tools.common.model.JavaServiceClass;
@@ -81,11 +82,10 @@
                 handlerGen.setJavaInterface(js);
                 handlerGen.generate(getEnvironment());
 
-                String annot = handlerGen.getHandlerAnnotation().toString();
+                JAnnotation annot = handlerGen.getHandlerAnnotation();
                 if (handlerGen.getHandlerAnnotation() != null
                     && !js.getAnnotations().contains(annot)) {
                     js.addAnnotation(annot);
-                    js.addImport("javax.jws.HandlerChain");
                 }
             }
 

Modified: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/OperationProcessor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/OperationProcessor.java?rev=586360&r1=586359&r2=586360&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/OperationProcessor.java (original)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/OperationProcessor.java Fri Oct 19 03:05:03 2007
@@ -24,6 +24,8 @@
 import java.util.List;
 import java.util.logging.Level;
 
+import javax.jws.WebParam;
+
 import org.apache.cxf.service.model.FaultInfo;
 import org.apache.cxf.service.model.MessageInfo;
 import org.apache.cxf.service.model.MessagePartInfo;
@@ -31,7 +33,8 @@
 import org.apache.cxf.tools.common.ToolConstants;
 import org.apache.cxf.tools.common.ToolContext;
 import org.apache.cxf.tools.common.ToolException;
-import org.apache.cxf.tools.common.model.JavaAnnotation;
+import org.apache.cxf.tools.common.model.JAnnotation;
+import org.apache.cxf.tools.common.model.JAnnotationElement;
 import org.apache.cxf.tools.common.model.JavaInterface;
 import org.apache.cxf.tools.common.model.JavaMethod;
 import org.apache.cxf.tools.common.model.JavaParameter;
@@ -39,6 +42,7 @@
 import org.apache.cxf.tools.common.model.JavaType;
 import org.apache.cxf.tools.wsdlto.frontend.jaxws.customization.JAXWSBinding;
 import org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.annotator.SoapBindingAnnotator;
+import org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.annotator.WSActionAnnotator;
 import org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.annotator.WebMethodAnnotator;
 import org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.annotator.WebResultAnnotator;
 import org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.annotator.WrapperAnnotator;
@@ -59,6 +63,9 @@
         Collection<FaultInfo> faults = operation.getFaults();
         FaultProcessor faultProcessor = new FaultProcessor(context);
         faultProcessor.process(method, faults);
+
+        method.annotate(new WSActionAnnotator(operation));
+
         intf.addMethod(method);
     }
 
@@ -93,7 +100,7 @@
         }
 
         method.annotate(new WebResultAnnotator());
-        method.annotate(new SoapBindingAnnotator());
+        method.annotate(new SoapBindingAnnotator());                
 
         JAXWSBinding opBinding = (JAXWSBinding)operation.getExtensor(JAXWSBinding.class);
 
@@ -187,16 +194,18 @@
         }
 
         JavaParameter asyncHandler = new JavaParameter();
+        
         asyncHandler.setName("asyncHandler");
         asyncHandler.setCallback(true);
         asyncHandler.setClassName(getAsyncClassName(method, "AsyncHandler"));
-        JavaAnnotation asyncHandlerAnnotation = new JavaAnnotation("WebParam");
-        asyncHandlerAnnotation.addArgument("name", "asyncHandler");
-        asyncHandlerAnnotation.addArgument("targetNamespace", "");
-        asyncHandler.setAnnotation(asyncHandlerAnnotation);
         asyncHandler.setStyle(JavaType.Style.IN);
-
+        
         callbackMethod.addParameter(asyncHandler);
+        
+        JAnnotation asyncHandlerAnnotation = new JAnnotation(WebParam.class);
+        asyncHandlerAnnotation.addElement(new JAnnotationElement("name", "asyncHandler"));
+        asyncHandlerAnnotation.addElement(new JAnnotationElement("targetNamespace", ""));
+        asyncHandler.setAnnotation(asyncHandlerAnnotation);                
 
         method.getInterface().addMethod(callbackMethod);
     }

Modified: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ServiceProcessor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ServiceProcessor.java?rev=586360&r1=586359&r2=586360&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ServiceProcessor.java (original)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ServiceProcessor.java Fri Oct 19 03:05:03 2007
@@ -25,6 +25,7 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+
 import javax.wsdl.extensions.ExtensibilityElement;
 import javax.wsdl.extensions.http.HTTPBinding;
 import javax.wsdl.extensions.mime.MIMEContent;
@@ -52,7 +53,8 @@
 import org.apache.cxf.tools.common.extensions.soap.SoapBody;
 import org.apache.cxf.tools.common.extensions.soap.SoapHeader;
 import org.apache.cxf.tools.common.extensions.soap.SoapOperation;
-import org.apache.cxf.tools.common.model.JavaAnnotation;
+import org.apache.cxf.tools.common.model.JAnnotation;
+import org.apache.cxf.tools.common.model.JAnnotationElement;
 import org.apache.cxf.tools.common.model.JavaInterface;
 import org.apache.cxf.tools.common.model.JavaMethod;
 import org.apache.cxf.tools.common.model.JavaModel;
@@ -377,9 +379,9 @@
                 }
 
                 if (headerType == this.resultHeader) {
-                    JavaAnnotation resultAnno = jm.getAnnotationMap().get("WebResult");
+                    JAnnotation resultAnno = jm.getAnnotationMap().get("WebResult");
                     if (resultAnno != null) {
-                        resultAnno.addArgument("header", "true", "");
+                        resultAnno.addElement(new JAnnotationElement("header", true, true));
                     }
                 }
                 processParameter(jm, bop);
@@ -389,9 +391,12 @@
 
     private void setParameterAsHeader(JavaParameter parameter) {
         parameter.setHeader(true);
-        parameter.getAnnotation().addArgument("header", "true", "");
-        parameter.getAnnotation().addArgument("name", parameter.getQName().getLocalPart());
-        parameter.getAnnotation().addArgument("targetNamespace", parameter.getTargetNamespace());
+        JAnnotation parameterAnnotation = parameter.getAnnotation();
+        parameterAnnotation.addElement(new JAnnotationElement("header", true, true));
+        parameterAnnotation.addElement(new JAnnotationElement("name", 
+                                                                     parameter.getQName().getLocalPart()));
+        parameterAnnotation.addElement(new JAnnotationElement("targetNamespace", 
+                                                                     parameter.getTargetNamespace()));
     }
 
     private void processParameter(JavaMethod jm, BindingOperationInfo operation) throws ToolException {

Modified: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/BindingAnnotator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/BindingAnnotator.java?rev=586360&r1=586359&r2=586360&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/BindingAnnotator.java (original)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/BindingAnnotator.java Fri Oct 19 03:05:03 2007
@@ -19,15 +19,14 @@
 
 package org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.annotator;
 
-import java.util.*;
 import javax.jws.soap.SOAPBinding;
 
 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.JavaAnnotation;
 import org.apache.cxf.tools.common.model.JavaInterface;
 import org.apache.cxf.tools.common.model.JavaMethod;
-import org.apache.cxf.tools.util.SOAPBindingUtil;
 
 public final class BindingAnnotator implements Annotator {
     
@@ -40,22 +39,18 @@
         }
         
         if (processBinding(intf)) {
-            JavaAnnotation bindingAnnotation = new JavaAnnotation("SOAPBinding");
+            JAnnotation bindingAnnotation = new JAnnotation(SOAPBinding.class);
             if (!SOAPBinding.Style.DOCUMENT.equals(intf.getSOAPStyle())) {
-                String style = SOAPBindingUtil.getBindingAnnotation(intf.getSOAPStyle().toString());
-                bindingAnnotation.addArgument("style", style, "");                
+                bindingAnnotation.addElement(new JAnnotationElement("style", intf.getSOAPStyle()));
             }
             if (!SOAPBinding.Use.LITERAL.equals(intf.getSOAPUse())) {
-                String use = SOAPBindingUtil.getBindingAnnotation(intf.getSOAPUse().toString());
-                bindingAnnotation.addArgument("use", use, "");
+                bindingAnnotation.addElement(new JAnnotationElement("use", intf.getSOAPUse()));
             }            
             if (intf.getSOAPStyle() == SOAPBinding.Style.DOCUMENT) {
-                String parameterStyle = SOAPBindingUtil.getBindingAnnotation(intf.
-                                                                             getSOAPParameterStyle().
-                                                                             toString());
-                bindingAnnotation.addArgument("parameterStyle", parameterStyle, "");
+                bindingAnnotation.addElement(new JAnnotationElement("parameterStyle", 
+                                                                           intf.getSOAPParameterStyle()));
             }
-            intf.addAnnotation(bindingAnnotation.toString());
+            intf.addAnnotation(bindingAnnotation);
         }
     }
     

Modified: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/SoapBindingAnnotator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/SoapBindingAnnotator.java?rev=586360&r1=586359&r2=586360&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/SoapBindingAnnotator.java (original)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/SoapBindingAnnotator.java Fri Oct 19 03:05:03 2007
@@ -20,11 +20,12 @@
 package org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.annotator;
 
 import javax.jws.soap.SOAPBinding;
+
 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.JavaAnnotation;
 import org.apache.cxf.tools.common.model.JavaMethod;
-import org.apache.cxf.tools.util.SOAPBindingUtil;
 
 public class SoapBindingAnnotator implements Annotator {
 
@@ -39,15 +40,15 @@
             if (!method.isWrapperStyle()
                 && !SOAPBinding.ParameterStyle.BARE.equals(method.getInterface().getSOAPParameterStyle())) {
             
-                JavaAnnotation bindingAnnotation = new JavaAnnotation("SOAPBinding");
-                bindingAnnotation.addArgument("parameterStyle",
-                                              SOAPBindingUtil.getBindingAnnotation("BARE"), "");
+                JAnnotation bindingAnnotation = new JAnnotation(SOAPBinding.class);
+                bindingAnnotation.addElement(new JAnnotationElement("parameterStyle", 
+                                                                           SOAPBinding.ParameterStyle.BARE));
                 method.addAnnotation("SOAPBinding", bindingAnnotation);
             } else if (method.isWrapperStyle()
                 && SOAPBinding.ParameterStyle.BARE.equals(method.getInterface().getSOAPParameterStyle())) {
-                JavaAnnotation bindingAnnotation = new JavaAnnotation("SOAPBinding");
-                bindingAnnotation.addArgument("parameterStyle",
-                                              SOAPBindingUtil.getBindingAnnotation("WRAPPED"), "");
+                JAnnotation bindingAnnotation = new JAnnotation(SOAPBinding.class);
+                bindingAnnotation.addElement(new JAnnotationElement("parameterStyle", 
+                                                                        SOAPBinding.ParameterStyle.WRAPPED));
                 method.addAnnotation("SOAPBinding", bindingAnnotation);                
             }
         }

Added: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WSActionAnnotator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WSActionAnnotator.java?rev=586360&view=auto
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WSActionAnnotator.java (added)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WSActionAnnotator.java Fri Oct 19 03:05:03 2007
@@ -0,0 +1,121 @@
+/**
+ * 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 java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Action;
+import javax.xml.ws.FaultAction;
+
+import org.apache.cxf.common.util.StringUtils;
+import org.apache.cxf.service.model.FaultInfo;
+import org.apache.cxf.service.model.MessageInfo;
+import org.apache.cxf.service.model.OperationInfo;
+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.JavaException;
+import org.apache.cxf.tools.common.model.JavaInterface;
+import org.apache.cxf.tools.common.model.JavaMethod;
+
+public final class WSActionAnnotator implements Annotator {
+    private static final QName WSAW_ACTION_QNAME = new QName("http://www.w3.org/2006/05/addressing/wsdl", 
+                                                             "Action");    
+    private OperationInfo operation;
+
+    public WSActionAnnotator(final OperationInfo op) {
+        this.operation = op;
+    }
+    
+    public void annotate(JavaAnnotatable ja) {
+        JavaMethod method;
+        if (ja instanceof JavaMethod) {
+            method = (JavaMethod) ja;
+        } else {
+            throw new RuntimeException("RequestWrapper and ResponseWrapper can only annotate JavaMethod");
+        }
+
+        boolean required = false;
+
+
+        JavaInterface intf = method.getInterface();
+        MessageInfo inputMessage = operation.getInput();
+        MessageInfo outputMessage = operation.getOutput();
+
+        JAnnotation actionAnnotation = new JAnnotation(Action.class);
+        if (inputMessage.getExtensionAttributes() != null) {
+            QName inputAction = (QName)inputMessage.getExtensionAttribute(WSAW_ACTION_QNAME);
+            if (inputAction != null) {
+                actionAnnotation.addElement(new JAnnotationElement("input", 
+                                                                          inputAction.getLocalPart()));
+                required = true;
+            }
+        }
+
+        if (outputMessage != null && outputMessage.getExtensionAttributes() != null) {
+            QName outputAction = (QName)outputMessage.getExtensionAttribute(WSAW_ACTION_QNAME);
+            if (outputAction != null) {
+                actionAnnotation.addElement(new JAnnotationElement("output", 
+                                                                          outputAction.getLocalPart()));
+                required = true;
+            }
+        }
+        if (operation.hasFaults()) {
+            List<JAnnotation> faultAnnotations = new ArrayList<JAnnotation>();
+            for (FaultInfo faultInfo : operation.getFaults()) {
+                if (faultInfo.getExtensionAttributes() != null) {
+                    QName faultAction = (QName)faultInfo.getExtensionAttribute(WSAW_ACTION_QNAME);
+
+                    JavaException exceptionClass = getExceptionClass(method, faultInfo);                    
+                    if (!StringUtils.isEmpty(exceptionClass.getPackageName())
+                        && !exceptionClass.getPackageName().equals(intf.getPackageName())) {
+                        intf.addImport(exceptionClass.getClassName());
+                    }                    
+
+                    JAnnotation faultAnnotation = new JAnnotation(FaultAction.class);
+                    faultAnnotation.addElement(new JAnnotationElement("className", exceptionClass));
+                    faultAnnotation.addElement(new JAnnotationElement("value", 
+                                                                             faultAction.getLocalPart()));
+                    faultAnnotations.add(faultAnnotation);
+                    required = true;
+                }
+            }
+            actionAnnotation.addElement(new JAnnotationElement("fault", faultAnnotations));
+        }
+
+        if (required) {
+            method.addAnnotation("Action", actionAnnotation);
+        }
+    }
+
+    private JavaException getExceptionClass(JavaMethod method, FaultInfo faultInfo) {
+        for (JavaException exception : method.getExceptions()) {
+            QName faultName = faultInfo.getFaultName();
+            if (exception.getTargetNamespace().equals(faultName.getNamespaceURI()) 
+                && exception.getName().toLowerCase().startsWith(faultName.getLocalPart().toLowerCase())) {
+                return exception;
+            }
+        }
+        return null;
+    }
+}

Modified: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebMethodAnnotator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebMethodAnnotator.java?rev=586360&r1=586359&r2=586360&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebMethodAnnotator.java (original)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebMethodAnnotator.java Fri Oct 19 03:05:03 2007
@@ -19,10 +19,13 @@
 
 package org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.annotator;
 
+import javax.jws.WebMethod;
+
 import org.apache.cxf.common.util.StringUtils;
 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.JavaAnnotation;
 import org.apache.cxf.tools.common.model.JavaMethod;
 
 public class WebMethodAnnotator implements Annotator {
@@ -35,15 +38,14 @@
             throw new RuntimeException("WebMethod can only annotate JavaMethod");
         }
         String operationName = method.getOperationName();
-        JavaAnnotation methodAnnotation = new JavaAnnotation("WebMethod");
+        JAnnotation methodAnnotation = new JAnnotation(WebMethod.class);
         
         if (!method.getName().equals(operationName)) {
-            methodAnnotation.addArgument("operationName", operationName);
+            methodAnnotation.addElement(new JAnnotationElement("operationName", operationName));
         }
         if (!StringUtils.isEmpty(method.getSoapAction())) {
-            methodAnnotation.addArgument("action", method.getSoapAction());
+            methodAnnotation.addElement(new JAnnotationElement("action", method.getSoapAction()));
         }
         method.addAnnotation("WebMethod", methodAnnotation);
-        method.getInterface().addImport("javax.jws.WebMethod");
     }
 }

Modified: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebParamAnnotator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebParamAnnotator.java?rev=586360&r1=586359&r2=586360&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebParamAnnotator.java (original)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebParamAnnotator.java Fri Oct 19 03:05:03 2007
@@ -19,11 +19,13 @@
 
 package org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.annotator;
 
+import javax.jws.WebParam;
 import javax.jws.soap.SOAPBinding;
 
 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.JavaAnnotation;
 import org.apache.cxf.tools.common.model.JavaMethod;
 import org.apache.cxf.tools.common.model.JavaParameter;
 import org.apache.cxf.tools.common.model.JavaType;
@@ -45,7 +47,7 @@
             }
         }
 
-        JavaAnnotation webParamAnnotation = new JavaAnnotation("WebParam");
+        JAnnotation webParamAnnotation = new JAnnotation(WebParam.class);
         String name = parameter.getName();
         String targetNamespace = method.getInterface().getNamespace();
         String partName = null;
@@ -68,14 +70,18 @@
         }
 
         if (partName != null) {
-            webParamAnnotation.addArgument("partName", partName);
+            webParamAnnotation.addElement(new JAnnotationElement("partName", partName));
         }
-        if (parameter.getStyle() == JavaType.Style.OUT || parameter.getStyle() == JavaType.Style.INOUT) {
-            webParamAnnotation.addArgument("mode", "Mode." + parameter.getStyle().toString(), "");
-        }
-        webParamAnnotation.addArgument("name", name);
-        if (method.getSoapStyle() == SOAPBinding.Style.DOCUMENT || parameter.isHeader()) {
-            webParamAnnotation.addArgIgnoreEmpty("targetNamespace", targetNamespace, "\"");
+        if (parameter.getStyle() == JavaType.Style.OUT) {
+            webParamAnnotation.addElement(new JAnnotationElement("mode", WebParam.Mode.OUT));
+        } else if (parameter.getStyle() == JavaType.Style.INOUT) {
+            webParamAnnotation.addElement(new JAnnotationElement("mode", WebParam.Mode.INOUT));
+        }
+        webParamAnnotation.addElement(new JAnnotationElement("name", name));
+        if (null != targetNamespace 
+                && (method.getSoapStyle() == SOAPBinding.Style.DOCUMENT || parameter.isHeader())) {        
+            webParamAnnotation.addElement(new JAnnotationElement("targetNamespace", 
+                                                                        targetNamespace));        
         }
 
         parameter.setAnnotation(webParamAnnotation);

Modified: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebResultAnnotator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebResultAnnotator.java?rev=586360&r1=586359&r2=586360&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebResultAnnotator.java (original)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebResultAnnotator.java Fri Oct 19 03:05:03 2007
@@ -19,10 +19,14 @@
 
 package org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.annotator;
 
+import javax.jws.Oneway;
+import javax.jws.WebResult;
 import javax.jws.soap.SOAPBinding;
+
 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.JavaAnnotation;
 import org.apache.cxf.tools.common.model.JavaMethod;
 
 public class WebResultAnnotator implements Annotator {
@@ -36,16 +40,15 @@
         }
             
         if (method.isOneWay()) {
-            JavaAnnotation oneWayAnnotation = new JavaAnnotation("Oneway");
+            JAnnotation oneWayAnnotation = new JAnnotation(Oneway.class);
             method.addAnnotation("Oneway", oneWayAnnotation);
-            method.getInterface().addImport("javax.jws.Oneway");
             return;
         }
 
         if ("void".equals(method.getReturn().getType())) {
             return;
         }
-        JavaAnnotation resultAnnotation = new JavaAnnotation("WebResult");
+        JAnnotation resultAnnotation = new JAnnotation(WebResult.class);
         String targetNamespace = method.getReturn().getTargetNamespace();
         String name = "return";
 
@@ -66,13 +69,15 @@
         }
 
         
-        
-        resultAnnotation.addArgument("name", name);
-        resultAnnotation.addArgIgnoreEmpty("targetNamespace", targetNamespace, "\"");
+        resultAnnotation.addElement(new JAnnotationElement("name", name));
+        if (null != targetNamespace) {
+            resultAnnotation.addElement(new JAnnotationElement("targetNamespace", targetNamespace));
+        }
 
         if (method.getSoapStyle() == SOAPBinding.Style.RPC
             || (method.getSoapStyle() == SOAPBinding.Style.DOCUMENT && !method.isWrapperStyle())) {
-            resultAnnotation.addArgument("partName", method.getReturn().getName());
+            resultAnnotation.addElement(new JAnnotationElement("partName", 
+                                                                      method.getReturn().getName()));
         }
 
         method.addAnnotation("WebResult", resultAnnotation);

Modified: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebServiceAnnotator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebServiceAnnotator.java?rev=586360&r1=586359&r2=586360&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebServiceAnnotator.java (original)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebServiceAnnotator.java Fri Oct 19 03:05:03 2007
@@ -19,9 +19,12 @@
 
 package org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.annotator;
 
+import javax.jws.WebService;
+
 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.JavaAnnotation;
 import org.apache.cxf.tools.common.model.JavaInterface;
 
 public final class WebServiceAnnotator implements Annotator {
@@ -33,12 +36,12 @@
         } else {
             throw new RuntimeException("WebService can only annotate JavaInterface");
         }
-        JavaAnnotation serviceAnnotation = new JavaAnnotation("WebService");
-        serviceAnnotation.addArgument("targetNamespace", intf.getNamespace());
-        //serviceAnnotation.addArgument("wsdlLocation", intf.getLocation());
-        serviceAnnotation.addArgument("name", intf.getWebServiceName());
+        JAnnotation serviceAnnotation = new JAnnotation(WebService.class);
+        serviceAnnotation.addElement(new JAnnotationElement("targetNamespace", 
+                                                                   intf.getNamespace()));
+        serviceAnnotation.addElement(new JAnnotationElement("name", intf.getWebServiceName()));
         
-        intf.addAnnotation(serviceAnnotation.toString());
+        intf.addAnnotation(serviceAnnotation);
     }
 }
 

Modified: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WrapperAnnotator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WrapperAnnotator.java?rev=586360&r1=586359&r2=586360&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WrapperAnnotator.java (original)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WrapperAnnotator.java Fri Oct 19 03:05:03 2007
@@ -19,9 +19,16 @@
 
 package org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.annotator;
 
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.ws.RequestWrapper;
+import javax.xml.ws.ResponseWrapper;
+
 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.JavaAnnotation;
 import org.apache.cxf.tools.common.model.JavaMethod;
 import org.apache.cxf.tools.common.model.JavaParameter;
 
@@ -42,20 +49,27 @@
             throw new RuntimeException("RequestWrapper and ResponseWrapper can only annotate JavaMethod");
         }
         if (wrapperRequest != null) {
-            JavaAnnotation wrapperRequestAnnotation = new JavaAnnotation("RequestWrapper");
-            wrapperRequestAnnotation.addArgument("localName", wrapperRequest.getType());
-            wrapperRequestAnnotation.addArgument("targetNamespace", wrapperRequest.getTargetNamespace());
-            wrapperRequestAnnotation.addArgument("className", wrapperRequest.getClassName());
-            method.addAnnotation("RequestWrapper", wrapperRequestAnnotation);
-            method.getInterface().addImport("javax.xml.ws.RequestWrapper");
+            JAnnotation requestAnnotation = new JAnnotation(RequestWrapper.class);
+            requestAnnotation.addElement(new JAnnotationElement("localName",
+                                                                       wrapperRequest.getType()));
+            requestAnnotation.addElement(new JAnnotationElement("targetNamespace",
+                                                                       wrapperRequest.getTargetNamespace()));
+            requestAnnotation.addElement(new JAnnotationElement("className", 
+                                                                       wrapperRequest.getClassName()));
+
+            method.addAnnotation("RequestWrapper", requestAnnotation);
+            method.getInterface().addImports(requestAnnotation.getImports());
         }
         if (wrapperResponse != null) {
-            JavaAnnotation wrapperResponseAnnotation = new JavaAnnotation("ResponseWrapper");
-            wrapperResponseAnnotation.addArgument("localName", wrapperResponse.getType());
-            wrapperResponseAnnotation.addArgument("targetNamespace", wrapperResponse.getTargetNamespace());
-            wrapperResponseAnnotation.addArgument("className", wrapperResponse.getClassName());
-            method.addAnnotation("ResponseWrapper", wrapperResponseAnnotation);
-            method.getInterface().addImport("javax.xml.ws.ResponseWrapper");
+            List<JAnnotationElement> elements = new ArrayList<JAnnotationElement>();
+            elements.add(new JAnnotationElement("localName", wrapperResponse.getType()));
+            elements.add(new JAnnotationElement("targetNamespace", wrapperResponse.getTargetNamespace()));
+            elements.add(new JAnnotationElement("className", wrapperResponse.getClassName()));
+
+            JAnnotation responseAnnotation = new JAnnotation(ResponseWrapper.class);
+            responseAnnotation.getElements().addAll(elements);
+            method.addAnnotation("ResponseWrapper", responseAnnotation);
+            method.getInterface().addImports(responseAnnotation.getImports());
         }
     }
 }

Modified: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/XmlSeeAlsoAnnotator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/XmlSeeAlsoAnnotator.java?rev=586360&r1=586359&r2=586360&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/XmlSeeAlsoAnnotator.java (original)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/XmlSeeAlsoAnnotator.java Fri Oct 19 03:05:03 2007
@@ -19,10 +19,17 @@
 
 package org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.annotator;
 
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlSeeAlso;
+
 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.JavaAnnotation;
 import org.apache.cxf.tools.common.model.JavaInterface;
+import org.apache.cxf.tools.common.model.JavaType;
 import org.apache.cxf.tools.util.ClassCollector;
 
 public final class XmlSeeAlsoAnnotator implements Annotator {
@@ -44,17 +51,19 @@
             throw new RuntimeException("XmlSeeAlso can only annotate JavaInterface");
         }
 
-        JavaAnnotation jaxbAnnotation = new JavaAnnotation("XmlSeeAlso");
-        intf.addImport("javax.xml.bind.annotation.XmlSeeAlso");
+        JAnnotation jaxbAnnotation = new JAnnotation(XmlSeeAlso.class);
+        intf.addImports(jaxbAnnotation.getImports());
         
+        List<JavaType> types = new ArrayList<JavaType>();
         for (String pkg : collector.getTypesPackages()) {
             if (pkg.equals(intf.getPackageName())) {
-                jaxbAnnotation.getClassList().add("ObjectFactory");
+                types.add(new JavaType(null, "ObjectFactory", null));
             } else {
-                jaxbAnnotation.getClassList().add(pkg + ".ObjectFactory");
+                types.add(new JavaType(null, pkg + ".ObjectFactory", null));
             }
         }
-        intf.addAnnotation(jaxbAnnotation.toString());
+        jaxbAnnotation.addElement(new JAnnotationElement(null, types));
+        intf.addAnnotation(jaxbAnnotation);
     }
 }
 

Modified: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/sei.vm
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/sei.vm?rev=586360&r1=586359&r2=586360&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/sei.vm (original)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/sei.vm Fri Oct 19 03:05:03 2007
@@ -17,11 +17,6 @@
 
 package $intf.PackageName;
 
-import javax.jws.WebParam.Mode;
-import javax.jws.WebParam;
-import javax.jws.WebService;
-import javax.jws.soap.SOAPBinding.Style;
-import javax.jws.soap.SOAPBinding;
 #foreach ($import in $intf.Imports)
 import ${import};
 #end