You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by bi...@apache.org on 2008/01/11 02:44:49 UTC

svn commit: r611013 [1/2] - in /incubator/cxf/trunk/rt/databinding/aegis/src: main/java/org/apache/cxf/aegis/type/java5/ main/java/org/codehaus/ main/java/org/codehaus/xfire/ main/java/org/codehaus/xfire/aegis/ main/java/org/codehaus/xfire/aegis/type/ ...

Author: bimargulies
Date: Thu Jan 10 17:44:45 2008
New Revision: 611013

URL: http://svn.apache.org/viewvc?rev=611013&view=rev
Log:
Commit Dain's work for CXF-1381.

Added:
    incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/AnnotationReader.java   (with props)
    incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/codehaus/
    incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/codehaus/xfire/
    incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/codehaus/xfire/aegis/
    incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/codehaus/xfire/aegis/type/
    incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/codehaus/xfire/aegis/type/java5/
    incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/codehaus/xfire/aegis/type/java5/IgnoreProperty.java   (with props)
    incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/codehaus/xfire/aegis/type/java5/XmlAttribute.java   (with props)
    incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/codehaus/xfire/aegis/type/java5/XmlElement.java   (with props)
    incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/codehaus/xfire/aegis/type/java5/XmlParamType.java   (with props)
    incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/codehaus/xfire/aegis/type/java5/XmlReturnType.java   (with props)
    incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/codehaus/xfire/aegis/type/java5/XmlType.java   (with props)
    incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbBean1.java   (with props)
    incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbBean2.java   (with props)
    incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbBean3.aegis.xml   (with props)
    incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbBean3.java   (with props)
    incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbBean4.java   (with props)
    incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbService.java   (with props)
    incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbTestEnum.java   (with props)
    incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbTypeTest.java   (with props)
    incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbXmlParamTypeTest.java   (with props)
    incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/XFireBean1.java   (with props)
    incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/XFireBean2.java   (with props)
    incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/XFireBean3.aegis.xml   (with props)
    incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/XFireBean3.java   (with props)
    incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/XFireBean4.java   (with props)
    incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/XFireService.java   (with props)
    incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/XFireTestEnum.java   (with props)
    incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/XFireTypeTest.java   (with props)
    incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/XFireXmlParamTypeTest.java   (with props)
Modified:
    incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/AnnotatedTypeInfo.java
    incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/Java5TypeCreator.java
    incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/EnumTypeTest.java

Modified: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/AnnotatedTypeInfo.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/AnnotatedTypeInfo.java?rev=611013&r1=611012&r2=611013&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/AnnotatedTypeInfo.java (original)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/AnnotatedTypeInfo.java Thu Jan 10 17:44:45 2008
@@ -19,17 +19,24 @@
 package org.apache.cxf.aegis.type.java5;
 
 import java.beans.PropertyDescriptor;
+import java.lang.reflect.Method;
 
 import javax.xml.namespace.QName;
 
-import org.apache.cxf.aegis.type.Type;
 import org.apache.cxf.aegis.type.TypeMapping;
 import org.apache.cxf.aegis.type.basic.BeanTypeInfo;
 import org.apache.cxf.aegis.util.NamespaceHelper;
 
 public class AnnotatedTypeInfo extends BeanTypeInfo {
+    private final AnnotationReader annotationReader;
+
     public AnnotatedTypeInfo(TypeMapping tm, Class typeClass, String ns) {
+        this(tm, typeClass, ns, new AnnotationReader());
+    }
+
+    public AnnotatedTypeInfo(TypeMapping tm, Class typeClass, String ns, AnnotationReader annotationReader) {
         super(typeClass, ns);
+        this.annotationReader = annotationReader;
         setTypeMapping(tm);
         initialize();
     }
@@ -38,8 +45,9 @@
      * Override from parent in order to check for IgnoreProperty annotation.
      */
     protected void mapProperty(PropertyDescriptor pd) {
-        if (isIgnored(pd)) {
-            return; // do not map ignored properties
+        // skip ignored properties
+        if (annotationReader.isIgnored(pd.getReadMethod())) {
+            return; 
         }
 
         String name = pd.getName();
@@ -52,79 +60,50 @@
 
     @Override
     protected boolean registerType(PropertyDescriptor desc) {
-        XmlAttribute att = desc.getReadMethod().getAnnotation(XmlAttribute.class);
-        if (att != null && att.type() != Type.class) {
-            return false;
-        }
-
-        XmlElement el = desc.getReadMethod().getAnnotation(XmlElement.class);
-        if (el != null && el.type() != Type.class) {
-            return false;            
-        }
-
-        return super.registerType(desc);
-    }
+        Method readMethod = desc.getReadMethod();
 
-    protected boolean isIgnored(PropertyDescriptor desc) {
-        return desc.getReadMethod().isAnnotationPresent(IgnoreProperty.class);
+        Class type = annotationReader.getType(readMethod);
+        return type == null && super.registerType(desc);
     }
 
     protected boolean isAttribute(PropertyDescriptor desc) {
-        return desc.getReadMethod().isAnnotationPresent(XmlAttribute.class);
+        return annotationReader.isAttribute(desc.getReadMethod());
     }
 
     protected boolean isElement(PropertyDescriptor desc) {
         return !isAttribute(desc);
     }
 
-    protected boolean isAnnotatedElement(PropertyDescriptor desc) {
-        return desc.getReadMethod().isAnnotationPresent(XmlElement.class);
-    }
-
     @Override
     protected QName createMappedName(PropertyDescriptor desc) {
         return createQName(desc);
     }
 
     protected QName createQName(PropertyDescriptor desc) {
-        String name = null;
-        String ns = null;
-
-        XmlType xtype = (XmlType)getTypeClass().getAnnotation(XmlType.class);
-        if (xtype != null) {
-            ns = xtype.namespace();
-        }
-
-        if (isAttribute(desc)) {
-            XmlAttribute att = desc.getReadMethod().getAnnotation(XmlAttribute.class);
-            name = att.name();
-            if (att.namespace().length() > 0) {
-                ns = att.namespace();                
-            }
-        } else if (isAnnotatedElement(desc)) {
-            XmlElement att = desc.getReadMethod().getAnnotation(XmlElement.class);
-            name = att.name();
-            if (att.namespace().length() > 0) {
-                ns = att.namespace();
-            }
-        }
-
-        if (name == null || name.length() == 0) {
+        String name = annotationReader.getName(desc.getReadMethod());
+        if (name == null) {
             name = desc.getName();
         }
 
-        if (ns == null || ns.length() == 0) {
-            ns = NamespaceHelper.makeNamespaceFromClassName(getTypeClass().getName(), "http");
+        // namespace: method, class, package, generated
+        String namespace = annotationReader.getNamespace(desc.getReadMethod());
+        if (namespace == null) {
+            namespace = annotationReader.getNamespace(getTypeClass());
+        }
+        if (namespace == null) {
+            namespace = annotationReader.getNamespace(getTypeClass().getPackage());
+        }
+        if (namespace == null) {
+            namespace = NamespaceHelper.makeNamespaceFromClassName(getTypeClass().getName(), "http");
         }
 
-        return new QName(ns, name);
+        return new QName(namespace, name);
     }
 
     public boolean isNillable(QName name) {
         PropertyDescriptor desc = getPropertyDescriptorFromMappedName(name);
-
-        if (isAnnotatedElement(desc)) {
-            return desc.getReadMethod().getAnnotation(XmlElement.class).nillable();
+        if (annotationReader.isElement(desc.getReadMethod())) {
+            return annotationReader.isNillable(desc.getReadMethod());
         } else {
             return super.isNillable(name);
         }
@@ -132,12 +111,8 @@
 
     public int getMinOccurs(QName name) {
         PropertyDescriptor desc = getPropertyDescriptorFromMappedName(name);
-        if (isAnnotatedElement(desc)) {
-            XmlElement att = desc.getReadMethod().getAnnotation(XmlElement.class);
-            String minOccurs = att.minOccurs();
-            if (minOccurs != null && minOccurs.length() > 0) {
-                return Integer.parseInt(minOccurs);
-            }
+        if (annotationReader.isElement(desc.getReadMethod())) {
+            return annotationReader.getMinOccurs(desc.getReadMethod());
         }
         return super.getMinOccurs(name);
     }

Added: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/AnnotationReader.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/AnnotationReader.java?rev=611013&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/AnnotationReader.java (added)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/AnnotationReader.java Thu Jan 10 17:44:45 2008
@@ -0,0 +1,353 @@
+/**
+ * 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.aegis.type.java5;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.AnnotatedElement;
+import java.lang.reflect.Method;
+
+import org.apache.cxf.aegis.type.Type;
+
+@SuppressWarnings("deprecation")
+public class AnnotationReader {
+    private static final Class<? extends Annotation> WEB_PARAM = load("javax.jws.WebParam");
+    private static final Class<? extends Annotation> WEB_RESULT = load("javax.jws.WebResult");
+    private static final Class<? extends Annotation> XML_ATTRIBUTE =
+            load("javax.xml.bind.annotation.XmlAttribute");
+    private static final Class<? extends Annotation> XML_ELEMENT =
+            load("javax.xml.bind.annotation.XmlElement");
+    private static final Class<? extends Annotation> XML_SCHEMA =
+            load("javax.xml.bind.annotation.XmlSchema");
+    private static final Class<? extends Annotation> XML_TYPE =
+            load("javax.xml.bind.annotation.XmlType");
+    private static final Class<? extends Annotation> XML_TRANSIENT =
+            load("javax.xml.bind.annotation.XmlTransient");
+
+    @SuppressWarnings("unchecked")
+    public boolean isIgnored(AnnotatedElement element) {
+        return isAnnotationPresent(element,
+                IgnoreProperty.class,
+                org.codehaus.xfire.aegis.type.java5.IgnoreProperty.class,
+                XML_TRANSIENT);
+    }
+
+    @SuppressWarnings("unchecked")
+    public boolean isAttribute(AnnotatedElement element) {
+        return isAnnotationPresent(element,
+                XmlAttribute.class,
+                org.codehaus.xfire.aegis.type.java5.XmlAttribute.class,
+                XML_ATTRIBUTE);
+    }
+
+    @SuppressWarnings("unchecked")
+    public boolean isElement(AnnotatedElement element) {
+        return isAnnotationPresent(element,
+                XmlElement.class,
+                org.codehaus.xfire.aegis.type.java5.XmlElement.class,
+                XML_ELEMENT);
+    }
+
+    // PMD incorrectly identifies this as a string comparison
+    @SuppressWarnings("unchecked")
+    public boolean isNillable(AnnotatedElement element) {
+        return Boolean.TRUE.equals(getAnnotationValue("nillable", // NOPMD
+                element,
+                Boolean.FALSE,
+                XmlElement.class,
+                org.codehaus.xfire.aegis.type.java5.XmlElement.class,
+                XML_ELEMENT));
+    }
+
+    @SuppressWarnings("unchecked")
+    public Class getType(AnnotatedElement element) {
+        return (Class) getAnnotationValue("type",
+                element,
+                Type.class,
+                XmlAttribute.class,
+                XmlElement.class,
+                org.codehaus.xfire.aegis.type.java5.XmlAttribute.class,
+                org.codehaus.xfire.aegis.type.java5.XmlElement.class);
+    }
+
+    @SuppressWarnings("unchecked")
+    public Class getParamType(Method method, int index) {
+        return (Class) getAnnotationValue("type",
+                method,
+                index,
+                Type.class,
+                XmlParamType.class,
+                org.codehaus.xfire.aegis.type.java5.XmlParamType.class);
+    }
+
+    @SuppressWarnings("unchecked")
+    public Class getReturnType(AnnotatedElement element) {
+        return (Class) getAnnotationValue("type",
+                element,
+                Type.class,
+                XmlReturnType.class,
+                org.codehaus.xfire.aegis.type.java5.XmlReturnType.class);
+    }
+
+    @SuppressWarnings("unchecked")
+    public String getName(AnnotatedElement element) {
+        String name = (String) getAnnotationValue("name",
+                element,
+                "",
+                XmlType.class,
+                org.codehaus.xfire.aegis.type.java5.XmlType.class,
+                XmlAttribute.class,
+                org.codehaus.xfire.aegis.type.java5.XmlAttribute.class,
+                XmlElement.class,
+                org.codehaus.xfire.aegis.type.java5.XmlElement.class);
+
+        // jaxb uses a different default value
+        if (name == null) {
+            name = (String) getAnnotationValue("name",
+                    element,
+                    "##default",
+                    XML_TYPE,
+                    XML_ATTRIBUTE,
+                    XML_ELEMENT);
+        }
+        return name;
+    }
+
+    @SuppressWarnings("unchecked")
+    public String getParamName(Method method, int index) {
+        return (String) getAnnotationValue("name",
+                method,
+                index,
+                Type.class,
+                XmlParamType.class,
+                org.codehaus.xfire.aegis.type.java5.XmlParamType.class,
+                WEB_PARAM);
+    }
+
+    @SuppressWarnings("unchecked")
+    public String getReturnName(AnnotatedElement element) {
+        return (String) getAnnotationValue("name",
+                element,
+                "",
+                XmlReturnType.class,
+                org.codehaus.xfire.aegis.type.java5.XmlReturnType.class,
+                WEB_RESULT);
+    }
+
+    @SuppressWarnings("unchecked")
+    public String getNamespace(AnnotatedElement element) {
+        // some poor class loader implementations may end not define Package elements
+        if (element == null) {
+            return null;
+        }
+
+        String namespace = (String) getAnnotationValue("namespace",
+                element,
+                "",
+                XmlType.class,
+                org.codehaus.xfire.aegis.type.java5.XmlType.class,
+                XmlAttribute.class,
+                org.codehaus.xfire.aegis.type.java5.XmlAttribute.class,
+                XmlElement.class,
+                org.codehaus.xfire.aegis.type.java5.XmlElement.class,
+                XML_SCHEMA);
+
+        // jaxb uses a different default value
+        if (namespace == null) {
+            namespace = (String) getAnnotationValue("namespace",
+                    element,
+                    "##default",
+                    XML_TYPE,
+                    XML_ATTRIBUTE,
+                    XML_ELEMENT);
+        }
+
+        return namespace;
+    }
+
+    @SuppressWarnings("unchecked")
+    public String getParamNamespace(Method method, int index) {
+        String namespace = (String) getAnnotationValue("namespace",
+                method,
+                index,
+                "",
+                XmlParamType.class,
+                org.codehaus.xfire.aegis.type.java5.XmlParamType.class);
+
+        // JWS annotation field is named targetNamespace
+        if (namespace == null) {
+            namespace = (String) getAnnotationValue("targetNamespace", method, index, "", WEB_PARAM);
+        }
+        return namespace;
+    }
+
+    @SuppressWarnings("unchecked")
+    public String getReturnNamespace(AnnotatedElement element) {
+        String namespace = (String) getAnnotationValue("namespace",
+                element,
+                "",
+                XmlReturnType.class,
+                org.codehaus.xfire.aegis.type.java5.XmlReturnType.class);
+
+        // JWS annotation field is named targetNamespace
+        if (namespace == null) {
+            namespace = (String) getAnnotationValue("targetNamespace", element, "", WEB_RESULT);
+        }
+        return namespace;
+    }
+
+    @SuppressWarnings("unchecked")
+    public int getMinOccurs(AnnotatedElement element) {
+        String minOccurs = (String) getAnnotationValue("minOccurs",
+                element,
+                "",
+                XmlElement.class,
+                org.codehaus.xfire.aegis.type.java5.XmlElement.class);
+        if (minOccurs != null) {
+            return Integer.parseInt(minOccurs);
+        }
+
+        // check jaxb annotation
+        Boolean required = (Boolean) getAnnotationValue("required", element, null, XML_ELEMENT);
+        if (Boolean.TRUE.equals(required)) {
+            return 1;
+        }
+
+        return 0;
+    }
+
+    @SuppressWarnings("unchecked")
+    public boolean isExtensibleElements(AnnotatedElement element, boolean defaultValue) {
+        Boolean extensibleElements = (Boolean) getAnnotationValue("extensibleElements",
+                element,
+                Boolean.TRUE,
+                XmlType.class,
+                org.codehaus.xfire.aegis.type.java5.XmlType.class);
+
+        if (extensibleElements == null) {
+            return defaultValue;
+        }
+        return extensibleElements;
+    }
+
+    @SuppressWarnings("unchecked")
+    public boolean isExtensibleAttributes(AnnotatedElement element, boolean defaultValue) {
+        Boolean extensibleAttributes = (Boolean) getAnnotationValue("extensibleAttributes",
+                element,
+                Boolean.TRUE,
+                XmlType.class,
+                org.codehaus.xfire.aegis.type.java5.XmlType.class);
+
+        if (extensibleAttributes == null) {
+            return defaultValue;
+        }
+        return extensibleAttributes;
+    }
+
+    // PMD doesn't fully understand varargs
+    private static boolean isAnnotationPresent(AnnotatedElement element, // NOPMD
+            Class<? extends Annotation>... annotations) {
+        for (Class<?> annotation : annotations) {
+            if (annotation != null && element.isAnnotationPresent(annotation.asSubclass(Annotation.class))) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    private static Object getAnnotationValue(String name,
+            AnnotatedElement element,
+            Object ignoredValue,
+            Class<? extends Annotation>... annotations) {
+        
+        for (Class<?> annotation : annotations) {
+            if (annotation != null) {
+                try {
+                    Annotation ann = element.getAnnotation(annotation.asSubclass(Annotation.class));
+                    if (ann != null) {
+                        Method method = ann.getClass().getMethod(name);
+                        Object value = method.invoke(ann);
+                        if ((ignoredValue == null && value != null) || (ignoredValue != null
+                                && !ignoredValue.equals(value))) {
+                            return value;
+                        }
+                    }
+                } catch (Exception ignored) {
+                    // annotation did not have value
+                }
+            }
+        }
+        return null;
+    }
+
+    private static Object getAnnotationValue(String name,
+            Method method,
+            int index,
+            Object ignoredValue,
+            Class<? extends Annotation>... annotations) {
+        
+        if (method.getParameterAnnotations() == null
+            || method.getParameterAnnotations().length <= index
+            || method.getParameterAnnotations()[index] == null) {
+            return null;
+        }
+
+        for (Class<? extends Annotation> annotation : annotations) {
+            if (annotation != null) {
+                try {
+                    Annotation ann = getAnnotation(method, index, annotation);
+                    if (ann != null) {
+                        Object value = ann.getClass().getMethod(name).invoke(ann);
+                        if ((ignoredValue == null && value != null) || (ignoredValue != null
+                                && !ignoredValue.equals(value))) {
+                            return value;
+                        }
+                    }
+                } catch (Exception ignored) {
+                    // annotation did not have value
+                }
+            }
+        }
+        return null;
+    }
+
+    private static Annotation getAnnotation(Method method, int index, Class<? extends Annotation> type) {
+        if (method.getParameterAnnotations() == null
+            || method.getParameterAnnotations().length <= index
+            || method.getParameterAnnotations()[index] == null) {
+            return null;
+        }
+
+        Annotation[] annotations = method.getParameterAnnotations()[index];
+        for (Annotation annotation : annotations) {
+            if (type.isInstance(annotation)) {
+                return annotation;
+            }
+        }
+        return null;
+    }
+
+    private static Class<? extends Annotation> load(String name) {
+        try {
+            return AnnotationReader.class.getClassLoader().loadClass(name).asSubclass(Annotation.class);
+        } catch (ClassNotFoundException e) {
+            return null;
+        }
+    }
+
+}

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/AnnotationReader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/AnnotationReader.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/Java5TypeCreator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/Java5TypeCreator.java?rev=611013&r1=611012&r2=611013&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/Java5TypeCreator.java (original)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/Java5TypeCreator.java Thu Jan 10 17:44:45 2008
@@ -19,12 +19,10 @@
 package org.apache.cxf.aegis.type.java5;
 
 import java.beans.PropertyDescriptor;
-import java.lang.annotation.Annotation;
 import java.lang.reflect.Method;
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.WildcardType;
 import java.util.Collection;
-
 import javax.xml.namespace.QName;
 
 import org.apache.cxf.aegis.type.AbstractTypeCreator;
@@ -34,6 +32,15 @@
 import org.apache.cxf.aegis.util.ServiceUtils;
 
 public class Java5TypeCreator extends AbstractTypeCreator {
+    private AnnotationReader annotationReader;
+
+    public Java5TypeCreator() {
+        this(new AnnotationReader());
+    }
+
+    public Java5TypeCreator(AnnotationReader annotationReader) {
+        this.annotationReader = annotationReader;
+    }
 
     @Override
     public TypeClassInfo createClassInfo(Method m, int index) {
@@ -49,14 +56,13 @@
             }
             info.setTypeClass(m.getParameterTypes()[index]);
 
-            XmlParamType xmlParam = getXmlParamAnnotation(m, index);
-            if (xmlParam != null) {
-                if (xmlParam.type() != Type.class) {
-                    info.setType(xmlParam.type());
-                }
+            info.setType(annotationReader.getParamType(m, index));
 
-                info.setTypeName(createQName(m.getParameterTypes()[index], xmlParam.name(), xmlParam
-                    .namespace()));
+            String paramName = annotationReader.getParamName(m, index);
+            if (paramName != null) {
+                info.setTypeName(createQName(m.getParameterTypes()[index],
+                        paramName,
+                        annotationReader.getParamNamespace(m, index)));
             }
 
             return info;
@@ -70,58 +76,32 @@
                 info.setDescription("method " + m.getName() + " parameter " + index);
                 info.setGenericType(genericReturnType);
             }
+
             info.setTypeClass(m.getReturnType());
+
             if (m.getParameterAnnotations() != null && m.getAnnotations().length > 0) {
                 info.setAnnotations(m.getAnnotations());
             }
 
-            XmlReturnType xmlParam = m.getAnnotation(XmlReturnType.class);
-            if (xmlParam != null) {
-                if (xmlParam.type() != Type.class) {
-                    info.setType(xmlParam.type());
-                }
+            info.setType(annotationReader.getReturnType(m));
 
-                info.setTypeName(createQName(m.getReturnType(), xmlParam.name(), xmlParam.namespace()));
+            String returnName = annotationReader.getReturnName(m);
+            if (returnName != null) {
+                info.setTypeName(createQName(m.getReturnType(),
+                        returnName,
+                        annotationReader.getReturnNamespace(m)));
             }
 
             return info;
         }
     }
 
-    public XmlParamType getXmlParamAnnotation(Method m, int index) {
-        if (m.getParameterAnnotations() == null
-            || m.getParameterAnnotations().length <= index
-            || m.getParameterAnnotations()[index] == null) {
-            return null;
-        }
-
-        Annotation[] annotations = m.getParameterAnnotations()[index];
-
-        for (int i = 0; i < annotations.length; i++) {
-            Annotation annotation = annotations[i];
-            if (annotation.annotationType().equals(XmlParamType.class)) {
-                return (XmlParamType)annotations[i];
-            }
-        }
-
-        return null;
-    }
-
     @Override
     public TypeClassInfo createClassInfo(PropertyDescriptor pd) {
         TypeClassInfo info = createBasicClassInfo(pd.getPropertyType());
         info.setGenericType(pd.getReadMethod().getGenericReturnType());
         info.setAnnotations(pd.getReadMethod().getAnnotations());
-
-        XmlElement el = pd.getReadMethod().getAnnotation(XmlElement.class);
-        if (el != null && !el.type().equals(Type.class)) {
-            info.setType(el.type());
-        }
-
-        XmlAttribute att = pd.getReadMethod().getAnnotation(XmlAttribute.class);
-        if (att != null && !att.type().equals(Type.class)) {
-            info.setType(att.type());
-        }
+        info.setType(annotationReader.getType(pd.getReadMethod()));
 
         return info;
     }
@@ -220,16 +200,17 @@
             typeName = createQName(info.getTypeClass());
         }
 
-        AnnotatedTypeInfo typeInfo = new AnnotatedTypeInfo(getTypeMapping(), info.getTypeClass(), typeName
-            .getNamespaceURI());
-        XmlType xtype = (XmlType)info.getTypeClass().getAnnotation(XmlType.class);
-        if (xtype != null) {
-            typeInfo.setExtensibleElements(xtype.extensibleElements());
-            typeInfo.setExtensibleAttributes(xtype.extensibleAttributes());
-        } else {
-            typeInfo.setExtensibleElements(getConfiguration().isDefaultExtensibleElements());
-            typeInfo.setExtensibleAttributes(getConfiguration().isDefaultExtensibleAttributes());
-        }
+        AnnotatedTypeInfo typeInfo = new AnnotatedTypeInfo(
+                getTypeMapping(),
+                info.getTypeClass(),
+                typeName.getNamespaceURI());
+
+        typeInfo.setExtensibleElements(annotationReader.isExtensibleElements(
+                info.getTypeClass(),
+                getConfiguration().isDefaultExtensibleElements()));
+        typeInfo.setExtensibleAttributes(annotationReader.isExtensibleAttributes(
+                info.getTypeClass(),
+                getConfiguration().isDefaultExtensibleAttributes()));
 
         typeInfo.setDefaultMinOccurs(getConfiguration().getDefaultMinOccurs());
         typeInfo.setDefaultNillable(getConfiguration().isDefaultNillable());
@@ -255,26 +236,22 @@
     @SuppressWarnings("unchecked")
     @Override
     public QName createQName(Class typeClass) {
-        String name = null;
-        String ns = null;
-
-        XmlType xtype = (XmlType)typeClass.getAnnotation(XmlType.class);
-        if (xtype != null) {
-            name = xtype.name();
-            ns = xtype.namespace();
-        }
-
+        String name = annotationReader.getName(typeClass);
+        String ns = annotationReader.getNamespace(typeClass);
         return createQName(typeClass, name, ns);
     }
 
     private QName createQName(Class typeClass, String name, String ns) {
-        String clsName = typeClass.getName();
         if (name == null || name.length() == 0) {
             name = ServiceUtils.makeServiceNameFromClassName(typeClass);
         }
 
+        // check jaxb package annotation
+        if (ns == null || ns.length() == 0) {
+            ns = annotationReader.getNamespace(typeClass.getPackage());
+        }
         if (ns == null || ns.length() == 0) {
-            ns = NamespaceHelper.makeNamespaceFromClassName(clsName, "http");
+            ns = NamespaceHelper.makeNamespaceFromClassName(typeClass.getName(), "http");
         }
 
         return new QName(ns, name);

Added: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/codehaus/xfire/aegis/type/java5/IgnoreProperty.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/codehaus/xfire/aegis/type/java5/IgnoreProperty.java?rev=611013&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/codehaus/xfire/aegis/type/java5/IgnoreProperty.java (added)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/codehaus/xfire/aegis/type/java5/IgnoreProperty.java Thu Jan 10 17:44:45 2008
@@ -0,0 +1,41 @@
+/**
+ * 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.codehaus.xfire.aegis.type.java5;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Provided only for backward compatability with XFire clients.
+ *
+ * IgnoreProperty Annotation allows us to Ignore JavaBean Properties
+ * when using AEGIS POJO Binding with Java 5 Annotations
+ *
+ * @author <a href="mailto:adam@multicom.co.uk">Adam J Chesney</a>
+ *
+ * @deprecated use org.apache.cxf.aegis.type.java5.IgnoreProperty
+ */
+@Deprecated
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+public @interface IgnoreProperty {
+
+}
\ No newline at end of file

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/codehaus/xfire/aegis/type/java5/IgnoreProperty.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/codehaus/xfire/aegis/type/java5/IgnoreProperty.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/codehaus/xfire/aegis/type/java5/XmlAttribute.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/codehaus/xfire/aegis/type/java5/XmlAttribute.java?rev=611013&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/codehaus/xfire/aegis/type/java5/XmlAttribute.java (added)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/codehaus/xfire/aegis/type/java5/XmlAttribute.java Thu Jan 10 17:44:45 2008
@@ -0,0 +1,42 @@
+/**
+ * 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.codehaus.xfire.aegis.type.java5;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.apache.cxf.aegis.type.Type;
+
+/**
+ * Provided only for backward compatability with XFire clients.
+ * 
+ * @deprecated use org.apache.cxf.aegis.type.java5.XmlAttribute
+ */
+@Deprecated
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+public @interface XmlAttribute {
+    Class type() default Type.class;
+
+    String name() default "";
+
+    String namespace() default "";
+}
\ No newline at end of file

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/codehaus/xfire/aegis/type/java5/XmlAttribute.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/codehaus/xfire/aegis/type/java5/XmlAttribute.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/codehaus/xfire/aegis/type/java5/XmlElement.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/codehaus/xfire/aegis/type/java5/XmlElement.java?rev=611013&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/codehaus/xfire/aegis/type/java5/XmlElement.java (added)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/codehaus/xfire/aegis/type/java5/XmlElement.java Thu Jan 10 17:44:45 2008
@@ -0,0 +1,49 @@
+/**
+ * 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.codehaus.xfire.aegis.type.java5;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.apache.cxf.aegis.type.Type;
+
+/**
+ * Provided only for backward compatability with XFire clients.
+ *
+ * @deprecated use org.apache.cxf.aegis.type.java5.XmlElement
+ */
+@Deprecated
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+public @interface XmlElement {
+    Class type() default Type.class;
+
+    String name() default "";
+
+    String namespace() default "";
+
+    boolean nillable() default true;
+
+    /**
+     * Set to "0" to make the property optional, "1" for required
+     */
+    String minOccurs() default "";
+}
\ No newline at end of file

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/codehaus/xfire/aegis/type/java5/XmlElement.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/codehaus/xfire/aegis/type/java5/XmlElement.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/codehaus/xfire/aegis/type/java5/XmlParamType.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/codehaus/xfire/aegis/type/java5/XmlParamType.java?rev=611013&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/codehaus/xfire/aegis/type/java5/XmlParamType.java (added)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/codehaus/xfire/aegis/type/java5/XmlParamType.java Thu Jan 10 17:44:45 2008
@@ -0,0 +1,47 @@
+/**
+ * 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.codehaus.xfire.aegis.type.java5;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.apache.cxf.aegis.type.Type;
+
+/**
+ * Provided only for backward compatability with XFire clients.
+ *
+ * Annotates services method parameters to provide information about how they
+ * are to be serialized.
+ *
+ * @author Dan Diephouse
+ *
+ * @deprecated use org.apache.cxf.aegis.type.java5.XmlParamType
+ */
+@Deprecated
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.PARAMETER)
+public @interface XmlParamType {
+    Class type() default Type.class;
+
+    String name() default "";
+
+    String namespace() default "";
+}
\ No newline at end of file

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/codehaus/xfire/aegis/type/java5/XmlParamType.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/codehaus/xfire/aegis/type/java5/XmlParamType.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/codehaus/xfire/aegis/type/java5/XmlReturnType.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/codehaus/xfire/aegis/type/java5/XmlReturnType.java?rev=611013&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/codehaus/xfire/aegis/type/java5/XmlReturnType.java (added)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/codehaus/xfire/aegis/type/java5/XmlReturnType.java Thu Jan 10 17:44:45 2008
@@ -0,0 +1,47 @@
+/**
+ * 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.codehaus.xfire.aegis.type.java5;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.apache.cxf.aegis.type.Type;
+
+/**
+ * Provided only for backward compatability with XFire clients.
+ * 
+ * Annotates a service's return type to provide information about how it is to
+ * be serialized.
+ *
+ * @author Dan Diephouse
+ *
+ * @deprecated use org.apache.cxf.aegis.type.java5.XmlReturnType
+ */
+@Deprecated
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+public @interface XmlReturnType {
+    Class type() default Type.class;
+
+    String name() default "";
+
+    String namespace() default "";
+}
\ No newline at end of file

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/codehaus/xfire/aegis/type/java5/XmlReturnType.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/codehaus/xfire/aegis/type/java5/XmlReturnType.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/codehaus/xfire/aegis/type/java5/XmlType.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/codehaus/xfire/aegis/type/java5/XmlType.java?rev=611013&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/codehaus/xfire/aegis/type/java5/XmlType.java (added)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/codehaus/xfire/aegis/type/java5/XmlType.java Thu Jan 10 17:44:45 2008
@@ -0,0 +1,46 @@
+/**
+ * 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.codehaus.xfire.aegis.type.java5;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.apache.cxf.aegis.type.Type;
+
+/**
+ * Provided only for backward compatability with XFire clients.
+ *
+ * @deprecated use org.apache.cxf.aegis.type.java5.XmlType
+ */
+@Deprecated
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+public @interface XmlType {
+    Class type() default Type.class;
+
+    String name() default "";
+
+    String namespace() default "";
+
+    boolean extensibleElements() default true;
+
+    boolean extensibleAttributes() default true;
+}
\ No newline at end of file

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/codehaus/xfire/aegis/type/java5/XmlType.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/codehaus/xfire/aegis/type/java5/XmlType.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/EnumTypeTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/EnumTypeTest.java?rev=611013&r1=611012&r2=611013&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/EnumTypeTest.java (original)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/EnumTypeTest.java Thu Jan 10 17:44:45 2008
@@ -75,14 +75,32 @@
 
     @Test
     public void testAutoCreation() throws Exception {
-        Type type = (Type)tm.getTypeCreator().createType(smallEnum.class);
+        Type type = tm.getTypeCreator().createType(smallEnum.class);
 
         assertTrue(type instanceof EnumType);
     }
 
     @Test
     public void testTypeAttributeOnEnum() throws Exception {
-        Type type = (Type)tm.getTypeCreator().createType(TestEnum.class);
+        Type type = tm.getTypeCreator().createType(TestEnum.class);
+
+        assertEquals("urn:xfire:foo", type.getSchemaType().getNamespaceURI());
+
+        assertTrue(type instanceof EnumType);
+    }
+
+    @Test
+    public void testXFireTypeAttributeOnEnum() throws Exception {
+        Type type = tm.getTypeCreator().createType(XFireTestEnum.class);
+
+        assertEquals("urn:xfire:foo", type.getSchemaType().getNamespaceURI());
+
+        assertTrue(type instanceof EnumType);
+    }
+
+    @Test
+    public void testJaxbTypeAttributeOnEnum() throws Exception {
+        Type type = tm.getTypeCreator().createType(JaxbTestEnum.class);
 
         assertEquals("urn:xfire:foo", type.getSchemaType().getNamespaceURI());
 

Added: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbBean1.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbBean1.java?rev=611013&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbBean1.java (added)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbBean1.java Thu Jan 10 17:44:45 2008
@@ -0,0 +1,54 @@
+/**
+ * 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.aegis.type.java5;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+
+public class JaxbBean1 {
+    private String elementProperty;
+    private String attributeProperty;
+    private String bogusProperty;
+
+    @XmlAttribute
+    public String getAttributeProperty() {
+        return attributeProperty;
+    }
+
+    public void setAttributeProperty(String attributeProperty) {
+        this.attributeProperty = attributeProperty;
+    }
+
+    public String getBogusProperty() {
+        return bogusProperty;
+    }
+
+    public void setBogusProperty(String bogusProperty) {
+        this.bogusProperty = bogusProperty;
+    }
+
+    @XmlElement(type = CustomStringType.class)
+    public String getElementProperty() {
+        return elementProperty;
+    }
+
+    public void setElementProperty(String elementProperty) {
+        this.elementProperty = elementProperty;
+    }
+}

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbBean1.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbBean1.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbBean2.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbBean2.java?rev=611013&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbBean2.java (added)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbBean2.java Thu Jan 10 17:44:45 2008
@@ -0,0 +1,56 @@
+/**
+ * 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.aegis.type.java5;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlTransient;
+
+public class JaxbBean2 {
+    private String elementProperty;
+    private String attributeProperty;
+    private String ignoredProperty;
+
+    @XmlAttribute(name = "attribute")
+    public String getAttributeProperty() {
+        return attributeProperty;
+    }
+
+    public void setAttributeProperty(String attributeProperty) {
+        this.attributeProperty = attributeProperty;
+    }
+
+    @XmlElement(name = "element")
+    public String getElementProperty() {
+        return elementProperty;
+    }
+
+    public void setElementProperty(String elementProperty) {
+        this.elementProperty = elementProperty;
+    }
+
+    @XmlTransient
+    public String getIgnoredProperty() {
+        return ignoredProperty;
+    }
+
+    public void setIgnoredProperty(String ignoredProperty) {
+        this.ignoredProperty = ignoredProperty;
+    }
+}

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbBean2.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbBean2.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbBean3.aegis.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbBean3.aegis.xml?rev=611013&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbBean3.aegis.xml (added)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbBean3.aegis.xml Thu Jan 10 17:44:45 2008
@@ -0,0 +1,5 @@
+<mappings>
+  <mapping>
+    <property name="attributeProperty" mappedName="attProp"/>
+  </mapping>
+</mappings>

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbBean3.aegis.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbBean3.aegis.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbBean3.aegis.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbBean3.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbBean3.java?rev=611013&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbBean3.java (added)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbBean3.java Thu Jan 10 17:44:45 2008
@@ -0,0 +1,34 @@
+/**
+ * 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.aegis.type.java5;
+
+import javax.xml.bind.annotation.XmlAttribute;
+
+public class JaxbBean3 {
+    private String attributeProperty;
+
+    @XmlAttribute(name = "attribute")
+    public String getAttributeProperty() {
+        return attributeProperty;
+    }
+
+    public void setAttributeProperty(String attributeProperty) {
+        this.attributeProperty = attributeProperty;
+    }
+}

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbBean3.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbBean3.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbBean4.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbBean4.java?rev=611013&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbBean4.java (added)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbBean4.java Thu Jan 10 17:44:45 2008
@@ -0,0 +1,47 @@
+/**
+ * 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.aegis.type.java5;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlType
+public class JaxbBean4 {
+    private String nillableProperty;
+
+    private String minOccursProperty;
+
+    @XmlElement(nillable = false)
+    public String getNillableProperty() {
+        return nillableProperty;
+    }
+
+    public void setNillableProperty(String nillableProperty) {
+        this.nillableProperty = nillableProperty;
+    }
+
+    @XmlElement(required = true)
+    public String getMinOccursProperty() {
+        return minOccursProperty;
+    }
+
+    public void setMinOccursProperty(String minOccursProperty) {
+        this.minOccursProperty = minOccursProperty;
+    }
+}

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbBean4.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbBean4.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbService.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbService.java?rev=611013&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbService.java (added)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbService.java Thu Jan 10 17:44:45 2008
@@ -0,0 +1,38 @@
+/**
+ * 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.aegis.type.java5;
+
+public class JaxbService {
+    public JaxbBean1 getJaxbBean1() {
+        JaxbBean1 bean = new JaxbBean1();
+        bean.setAttributeProperty("attribute");
+        bean.setBogusProperty("bogus");
+        bean.setElementProperty("element");
+
+        return bean;
+    }
+
+    public JaxbBean2 getJaxbBean2() {
+        JaxbBean2 bean = new JaxbBean2();
+        bean.setAttributeProperty("attribute");
+        bean.setElementProperty("element");
+
+        return bean;
+    }
+}

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbService.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbTestEnum.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbTestEnum.java?rev=611013&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbTestEnum.java (added)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbTestEnum.java Thu Jan 10 17:44:45 2008
@@ -0,0 +1,26 @@
+/**
+ * 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.aegis.type.java5;
+
+import javax.xml.bind.annotation.XmlType;
+
+@XmlType(namespace = "urn:xfire:foo")
+public enum JaxbTestEnum {
+    VALUE1, VALUE2
+}

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbTestEnum.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbTestEnum.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbTypeTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbTypeTest.java?rev=611013&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbTypeTest.java (added)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbTypeTest.java Thu Jan 10 17:44:45 2008
@@ -0,0 +1,184 @@
+/**
+ * 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.aegis.type.java5;
+
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Document;
+
+import org.apache.cxf.aegis.AbstractAegisTest;
+import org.apache.cxf.aegis.databinding.AegisDatabinding;
+import org.apache.cxf.aegis.type.Type;
+import org.apache.cxf.aegis.type.TypeMapping;
+import org.apache.cxf.aegis.type.XMLTypeCreator;
+import org.apache.cxf.aegis.type.basic.BeanType;
+import org.apache.cxf.aegis.type.basic.StringType;
+import org.apache.cxf.common.util.SOAPConstants;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.service.Service;
+import org.junit.Before;
+import org.junit.Test;
+
+public class JaxbTypeTest extends AbstractAegisTest {
+    private TypeMapping tm;
+    private Service service;
+    private AegisDatabinding databinding;
+
+    @Before
+    public void setUp() throws Exception {
+        super.setUp();
+
+        Server s = createService(JaxbService.class);
+        service = s.getEndpoint().getService();
+        databinding = (AegisDatabinding) service.getDataBinding();
+
+        tm = databinding.getAegisContext().getTypeMapping();
+    }
+
+    @Test
+    public void testTM() {
+        assertTrue(tm.getTypeCreator() instanceof XMLTypeCreator);
+    }
+
+    @Test
+    public void testType() {
+        AnnotatedTypeInfo info = new AnnotatedTypeInfo(tm, JaxbBean1.class, "urn:foo");
+
+        Iterator elements = info.getElements();
+        assertTrue(elements.hasNext());
+        QName element = (QName)elements.next();
+        assertTrue(elements.hasNext());
+
+        Type custom = info.getType(element);
+
+        if ("bogusProperty".equals(element.getLocalPart())) {
+            assertTrue(custom instanceof StringType);
+        } else if ("elementProperty".equals(element.getLocalPart())) {
+            assertTrue(custom instanceof CustomStringType);
+        } else {
+            fail("Unexpected element name: " + element.getLocalPart());
+        }
+        element = (QName)elements.next();
+        assertFalse(elements.hasNext());
+
+        custom = info.getType(element);
+
+        if ("bogusProperty".equals(element.getLocalPart())) {
+            assertTrue(custom instanceof StringType);
+        } else if ("elementProperty".equals(element.getLocalPart())) {
+            assertTrue(custom instanceof StringType);
+        } else {
+            fail("Unexpected element name: " + element.getLocalPart());
+        }
+
+        Iterator atts = info.getAttributes();
+        assertTrue(atts.hasNext());
+        atts.next();
+        assertFalse(atts.hasNext());
+
+        assertTrue(info.isExtensibleElements());
+        assertTrue(info.isExtensibleAttributes());
+    }
+
+    @Test
+    public void testAegisType() {
+        BeanType type = (BeanType)tm.getTypeCreator().createType(JaxbBean3.class);
+
+        assertFalse(type.getTypeInfo().getAttributes().hasNext());
+
+        Iterator itr = type.getTypeInfo().getElements();
+        assertTrue(itr.hasNext());
+        QName q = (QName)itr.next();
+        assertEquals("attProp", q.getLocalPart());
+    }
+
+    @Test
+    public void testExtensibilityOff() {
+        BeanType type = (BeanType)tm.getTypeCreator().createType(JaxbBean4.class);
+
+        assertFalse(type.getTypeInfo().isExtensibleElements());
+        assertFalse(type.getTypeInfo().isExtensibleAttributes());
+    }
+
+    @Test
+    public void testNillableAndMinOccurs() {
+        BeanType type = (BeanType)tm.getTypeCreator().createType(JaxbBean4.class);
+        AnnotatedTypeInfo info = (AnnotatedTypeInfo)type.getTypeInfo();
+        Iterator elements = info.getElements();
+        assertTrue(elements.hasNext());
+        // nillable first
+        QName element = (QName)elements.next();
+        if ("minOccursProperty".equals(element.getLocalPart())) {
+            assertEquals(1, info.getMinOccurs(element));
+        } else {
+            assertFalse(info.isNillable(element));
+        }
+
+        assertTrue(elements.hasNext());
+        // minOccurs = 1 second
+        element = (QName)elements.next();
+        if ("minOccursProperty".equals(element.getLocalPart())) {
+            assertEquals(1, info.getMinOccurs(element));
+        } else {
+            assertFalse(info.isNillable(element));
+        }
+    }
+
+    @Test
+    public void testWSDL() throws Exception {
+        Document wsdl = getWSDLDocument("JaxbService");
+
+        addNamespace("xsd", SOAPConstants.XSD);
+        assertValid(
+                    "//xsd:complexType[@name='JaxbBean1']/xsd:sequence/xsd:"
+                    + "element[@name='elementProperty']",
+                    wsdl);
+        assertValid("//xsd:complexType[@name='JaxbBean1']/xsd:attribute"
+                    + "[@name='attributeProperty']",
+                    wsdl);
+        assertValid(
+                    "//xsd:complexType[@name='JaxbBean1']/xsd:sequence/xsd:element"
+                    + "[@name='bogusProperty']",
+                    wsdl);
+
+        assertValid(
+                    "//xsd:complexType[@name='JaxbBean2']/xsd:sequence/xsd:element"
+                    + "[@name='element'][@type='xsd:string']",
+                    wsdl);
+        assertValid(
+                    "//xsd:complexType[@name='JaxbBean2']/xsd:attribute"
+                    + "[@name='attribute'][@type='xsd:string']",
+                    wsdl);
+    }
+
+    @Test
+    public void testGetSetRequired() throws Exception {
+        BeanType type = new BeanType(new AnnotatedTypeInfo(tm, BadBean.class, "urn:foo"));
+        type.setSchemaType(new QName("urn:foo", "BadBean"));
+
+        assertFalse(type.getTypeInfo().getElements().hasNext());
+    }
+
+    public static class BadBean {
+        public void setString(String string) {
+        }
+    }
+}

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbTypeTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbTypeTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbXmlParamTypeTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbXmlParamTypeTest.java?rev=611013&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbXmlParamTypeTest.java (added)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbXmlParamTypeTest.java Thu Jan 10 17:44:45 2008
@@ -0,0 +1,84 @@
+/**
+ * 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.aegis.type.java5;
+
+import java.lang.reflect.Method;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+import javax.xml.namespace.QName;
+
+import org.apache.cxf.aegis.AbstractAegisTest;
+import org.apache.cxf.aegis.type.Configuration;
+import org.apache.cxf.aegis.type.CustomTypeMapping;
+import org.apache.cxf.aegis.type.DefaultTypeCreator;
+import org.apache.cxf.aegis.type.Type;
+import org.junit.Before;
+import org.junit.Test;
+
+public class JaxbXmlParamTypeTest extends AbstractAegisTest {
+    private CustomTypeMapping tm;
+    private Java5TypeCreator creator;
+
+    @Before
+    public void setUp() throws Exception {
+        super.setUp();
+
+        tm = new CustomTypeMapping();
+        creator = new Java5TypeCreator();
+        creator.setNextCreator(new DefaultTypeCreator());
+        creator.setConfiguration(new Configuration());
+        tm.setTypeCreator(creator);
+    }
+
+    @Test
+    public void testType() throws Exception {
+        Method m = CustomTypeService.class.getMethod("doFoo", new Class[] {String.class});
+
+        Type type = creator.createType(m, 0);
+        tm.register(type);
+        assertTrue(type instanceof org.apache.cxf.aegis.type.basic.BeanType);
+        assertEquals(new QName("urn:xfire:foo", "custom"), type.getSchemaType());
+
+        type = creator.createType(m, -1);
+        tm.register(type);
+        assertTrue(type instanceof org.apache.cxf.aegis.type.basic.BeanType);
+        assertEquals(new QName("urn:xfire:foo", "custom"), type.getSchemaType());
+    }
+
+    @Test
+    public void testMapServiceWSDL() throws Exception {
+        createService(CustomTypeService.class, new CustomTypeService(), null);
+
+        // Document wsdl = 
+        getWSDLDocument("CustomTypeService");
+        // todo overriding type qname only seems to work with a Aegis annotation with type class defined
+        // if type is not defined, aegis ignores specified qname
+        // assertValid("//xsd:element[@name='s'][@type='ns0:custom']", wsdl);
+    }
+
+    public class CustomTypeService {
+
+        @WebResult(targetNamespace = "urn:xfire:foo", name = "custom")
+        public String doFoo(
+                            @WebParam(targetNamespace = "urn:xfire:foo", name = "custom")
+                            String s) {
+            return null;
+        }
+    }
+}

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbXmlParamTypeTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbXmlParamTypeTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/XFireBean1.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/XFireBean1.java?rev=611013&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/XFireBean1.java (added)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/XFireBean1.java Thu Jan 10 17:44:45 2008
@@ -0,0 +1,52 @@
+/**
+ * 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.aegis.type.java5;
+
+@SuppressWarnings("deprecation")
+public class XFireBean1 {
+    private String elementProperty;
+    private String attributeProperty;
+    private String bogusProperty;
+
+    @org.codehaus.xfire.aegis.type.java5.XmlAttribute
+    public String getAttributeProperty() {
+        return attributeProperty;
+    }
+
+    public void setAttributeProperty(String attributeProperty) {
+        this.attributeProperty = attributeProperty;
+    }
+
+    public String getBogusProperty() {
+        return bogusProperty;
+    }
+
+    public void setBogusProperty(String bogusProperty) {
+        this.bogusProperty = bogusProperty;
+    }
+
+    @org.codehaus.xfire.aegis.type.java5.XmlElement(type = CustomStringType.class)
+    public String getElementProperty() {
+        return elementProperty;
+    }
+
+    public void setElementProperty(String elementProperty) {
+        this.elementProperty = elementProperty;
+    }
+}
\ No newline at end of file

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/XFireBean1.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/XFireBean1.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/XFireBean2.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/XFireBean2.java?rev=611013&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/XFireBean2.java (added)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/XFireBean2.java Thu Jan 10 17:44:45 2008
@@ -0,0 +1,53 @@
+/**
+ * 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.aegis.type.java5;
+
+@SuppressWarnings("deprecation")
+public class XFireBean2 {
+    private String elementProperty;
+    private String attributeProperty;
+    private String ignoredProperty;
+
+    @org.codehaus.xfire.aegis.type.java5.XmlAttribute(name = "attribute")
+    public String getAttributeProperty() {
+        return attributeProperty;
+    }
+
+    public void setAttributeProperty(String attributeProperty) {
+        this.attributeProperty = attributeProperty;
+    }
+
+    @org.codehaus.xfire.aegis.type.java5.XmlElement(name = "element")
+    public String getElementProperty() {
+        return elementProperty;
+    }
+
+    public void setElementProperty(String elementProperty) {
+        this.elementProperty = elementProperty;
+    }
+
+    @org.codehaus.xfire.aegis.type.java5.IgnoreProperty
+    public String getIgnoredProperty() {
+        return ignoredProperty;
+    }
+
+    public void setIgnoredProperty(String ignoredProperty) {
+        this.ignoredProperty = ignoredProperty;
+    }
+}
\ No newline at end of file

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/XFireBean2.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/XFireBean2.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/XFireBean3.aegis.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/XFireBean3.aegis.xml?rev=611013&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/XFireBean3.aegis.xml (added)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/XFireBean3.aegis.xml Thu Jan 10 17:44:45 2008
@@ -0,0 +1,5 @@
+<mappings>
+  <mapping>
+    <property name="attributeProperty" mappedName="attProp"/>
+  </mapping>
+</mappings>
\ No newline at end of file

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/XFireBean3.aegis.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/XFireBean3.aegis.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/XFireBean3.aegis.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/XFireBean3.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/XFireBean3.java?rev=611013&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/XFireBean3.java (added)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/XFireBean3.java Thu Jan 10 17:44:45 2008
@@ -0,0 +1,33 @@
+/**
+ * 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.aegis.type.java5;
+
+@SuppressWarnings("deprecation")
+public class XFireBean3 {
+    private String attributeProperty;
+
+    @org.codehaus.xfire.aegis.type.java5.XmlAttribute(name = "attribute")
+    public String getAttributeProperty() {
+        return attributeProperty;
+    }
+
+    public void setAttributeProperty(String attributeProperty) {
+        this.attributeProperty = attributeProperty;
+    }
+}
\ No newline at end of file

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/XFireBean3.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/XFireBean3.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date