wink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject svn commit: r1000080 [2/3] - in /incubator/wink/trunk/wink-common: ./ src/main/java/org/apache/wink/common/model/wadl/ src/test/java/org/apache/wink/common/model/wadl/
Date Wed, 22 Sep 2010 16:46:12 GMT
Added: incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/wadl/Request.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/wadl/Request.java?rev=1000080&view=auto
==============================================================================
--- incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/wadl/Request.java (added)
+++ incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/wadl/Request.java Wed Sep 22 16:46:11 2010
@@ -0,0 +1,221 @@
+/*
+ * 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.
+ *  
+ */
+
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6 
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
+// Any modifications to this file will be lost upon recompilation of the source schema. 
+// Generated on: 2010.08.03 at 04:53:29 PM CDT 
+//
+
+
+package org.apache.wink.common.model.wadl;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAnyAttribute;
+import javax.xml.bind.annotation.XmlAnyElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.namespace.QName;
+import org.w3c.dom.Element;
+
+
+/**
+ * <p>Java class for anonymous complex type.
+ * 
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * 
+ * <pre>
+ * &lt;complexType>
+ *   &lt;complexContent>
+ *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       &lt;sequence>
+ *         &lt;element ref="{http://wadl.dev.java.net/2009/02}doc" maxOccurs="unbounded" minOccurs="0"/>
+ *         &lt;element ref="{http://wadl.dev.java.net/2009/02}param" maxOccurs="unbounded" minOccurs="0"/>
+ *         &lt;element ref="{http://wadl.dev.java.net/2009/02}representation" maxOccurs="unbounded" minOccurs="0"/>
+ *         &lt;any processContents='lax' namespace='##other' maxOccurs="unbounded" minOccurs="0"/>
+ *       &lt;/sequence>
+ *       &lt;anyAttribute processContents='lax' namespace='##other'/>
+ *     &lt;/restriction>
+ *   &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ * 
+ * 
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+    "doc",
+    "param",
+    "representation",
+    "any"
+})
+@XmlRootElement(name = "request")
+public class Request {
+
+    protected List<Doc> doc;
+    protected List<Param> param;
+    protected List<Representation> representation;
+    @XmlAnyElement(lax = true)
+    protected List<Object> any;
+    @XmlAnyAttribute
+    private Map<QName, String> otherAttributes = new HashMap<QName, String>();
+
+    /**
+     * Gets the value of the doc property.
+     * 
+     * <p>
+     * This accessor method returns a reference to the live list,
+     * not a snapshot. Therefore any modification you make to the
+     * returned list will be present inside the JAXB object.
+     * This is why there is not a <CODE>set</CODE> method for the doc property.
+     * 
+     * <p>
+     * For example, to add a new item, do as follows:
+     * <pre>
+     *    getDoc().add(newItem);
+     * </pre>
+     * 
+     * 
+     * <p>
+     * Objects of the following type(s) are allowed in the list
+     * {@link Doc }
+     * 
+     * 
+     */
+    public List<Doc> getDoc() {
+        if (doc == null) {
+            doc = new ArrayList<Doc>();
+        }
+        return this.doc;
+    }
+
+    /**
+     * Gets the value of the param property.
+     * 
+     * <p>
+     * This accessor method returns a reference to the live list,
+     * not a snapshot. Therefore any modification you make to the
+     * returned list will be present inside the JAXB object.
+     * This is why there is not a <CODE>set</CODE> method for the param property.
+     * 
+     * <p>
+     * For example, to add a new item, do as follows:
+     * <pre>
+     *    getParam().add(newItem);
+     * </pre>
+     * 
+     * 
+     * <p>
+     * Objects of the following type(s) are allowed in the list
+     * {@link Param }
+     * 
+     * 
+     */
+    public List<Param> getParam() {
+        if (param == null) {
+            param = new ArrayList<Param>();
+        }
+        return this.param;
+    }
+
+    /**
+     * Gets the value of the representation property.
+     * 
+     * <p>
+     * This accessor method returns a reference to the live list,
+     * not a snapshot. Therefore any modification you make to the
+     * returned list will be present inside the JAXB object.
+     * This is why there is not a <CODE>set</CODE> method for the representation property.
+     * 
+     * <p>
+     * For example, to add a new item, do as follows:
+     * <pre>
+     *    getRepresentation().add(newItem);
+     * </pre>
+     * 
+     * 
+     * <p>
+     * Objects of the following type(s) are allowed in the list
+     * {@link Representation }
+     * 
+     * 
+     */
+    public List<Representation> getRepresentation() {
+        if (representation == null) {
+            representation = new ArrayList<Representation>();
+        }
+        return this.representation;
+    }
+
+    /**
+     * Gets the value of the any property.
+     * 
+     * <p>
+     * This accessor method returns a reference to the live list,
+     * not a snapshot. Therefore any modification you make to the
+     * returned list will be present inside the JAXB object.
+     * This is why there is not a <CODE>set</CODE> method for the any property.
+     * 
+     * <p>
+     * For example, to add a new item, do as follows:
+     * <pre>
+     *    getAny().add(newItem);
+     * </pre>
+     * 
+     * 
+     * <p>
+     * Objects of the following type(s) are allowed in the list
+     * {@link Object }
+     * {@link Element }
+     * 
+     * 
+     */
+    public List<Object> getAny() {
+        if (any == null) {
+            any = new ArrayList<Object>();
+        }
+        return this.any;
+    }
+
+    /**
+     * Gets a map that contains attributes that aren't bound to any typed property on this class.
+     * 
+     * <p>
+     * the map is keyed by the name of the attribute and 
+     * the value is the string value of the attribute.
+     * 
+     * the map returned by this method is live, and you can add new attribute
+     * by updating the map directly. Because of this design, there's no setter.
+     * 
+     * 
+     * @return
+     *     always non-null
+     */
+    public Map<QName, String> getOtherAttributes() {
+        return otherAttributes;
+    }
+
+}

Added: incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/wadl/Resource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/wadl/Resource.java?rev=1000080&view=auto
==============================================================================
--- incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/wadl/Resource.java (added)
+++ incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/wadl/Resource.java Wed Sep 22 16:46:11 2010
@@ -0,0 +1,357 @@
+/*
+ * 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.
+ *  
+ */
+
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6 
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
+// Any modifications to this file will be lost upon recompilation of the source schema. 
+// Generated on: 2010.08.03 at 04:53:29 PM CDT 
+//
+
+
+
+package org.apache.wink.common.model.wadl;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAnyAttribute;
+import javax.xml.bind.annotation.XmlAnyElement;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElements;
+import javax.xml.bind.annotation.XmlID;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlSchemaType;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import javax.xml.namespace.QName;
+import org.w3c.dom.Element;
+
+
+/**
+ * <p>Java class for anonymous complex type.
+ * 
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * 
+ * <pre>
+ * &lt;complexType>
+ *   &lt;complexContent>
+ *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       &lt;sequence>
+ *         &lt;element ref="{http://wadl.dev.java.net/2009/02}doc" maxOccurs="unbounded" minOccurs="0"/>
+ *         &lt;element ref="{http://wadl.dev.java.net/2009/02}param" maxOccurs="unbounded" minOccurs="0"/>
+ *         &lt;choice maxOccurs="unbounded" minOccurs="0">
+ *           &lt;element ref="{http://wadl.dev.java.net/2009/02}method"/>
+ *           &lt;element ref="{http://wadl.dev.java.net/2009/02}resource"/>
+ *         &lt;/choice>
+ *         &lt;any processContents='lax' namespace='##other' maxOccurs="unbounded" minOccurs="0"/>
+ *       &lt;/sequence>
+ *       &lt;attribute name="id" type="{http://www.w3.org/2001/XMLSchema}ID" />
+ *       &lt;attribute name="type" type="{http://wadl.dev.java.net/2009/02}resource_type_list" />
+ *       &lt;attribute name="queryType" type="{http://www.w3.org/2001/XMLSchema}string" default="application/x-www-form-urlencoded" />
+ *       &lt;attribute name="path" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *       &lt;anyAttribute processContents='lax' namespace='##other'/>
+ *     &lt;/restriction>
+ *   &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ * 
+ * 
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+    "doc",
+    "param",
+    "methodOrResource",
+    "any"
+})
+@XmlRootElement(name = "resource")
+public class Resource {
+
+    protected List<Doc> doc;
+    protected List<Param> param;
+    @XmlElements({
+        @XmlElement(name = "method", type = Method.class),
+        @XmlElement(name = "resource", type = Resource.class)
+    })
+    protected List<Object> methodOrResource;
+    @XmlAnyElement(lax = true)
+    protected List<Object> any;
+    @XmlAttribute
+    @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
+    @XmlID
+    @XmlSchemaType(name = "ID")
+    protected String id;
+    @XmlAttribute
+    protected List<String> type;
+    @XmlAttribute
+    protected String queryType;
+    @XmlAttribute
+    protected String path;
+    @XmlAnyAttribute
+    private Map<QName, String> otherAttributes = new HashMap<QName, String>();
+
+    /**
+     * Gets the value of the doc property.
+     * 
+     * <p>
+     * This accessor method returns a reference to the live list,
+     * not a snapshot. Therefore any modification you make to the
+     * returned list will be present inside the JAXB object.
+     * This is why there is not a <CODE>set</CODE> method for the doc property.
+     * 
+     * <p>
+     * For example, to add a new item, do as follows:
+     * <pre>
+     *    getDoc().add(newItem);
+     * </pre>
+     * 
+     * 
+     * <p>
+     * Objects of the following type(s) are allowed in the list
+     * {@link Doc }
+     * 
+     * 
+     */
+    public List<Doc> getDoc() {
+        if (doc == null) {
+            doc = new ArrayList<Doc>();
+        }
+        return this.doc;
+    }
+
+    /**
+     * Gets the value of the param property.
+     * 
+     * <p>
+     * This accessor method returns a reference to the live list,
+     * not a snapshot. Therefore any modification you make to the
+     * returned list will be present inside the JAXB object.
+     * This is why there is not a <CODE>set</CODE> method for the param property.
+     * 
+     * <p>
+     * For example, to add a new item, do as follows:
+     * <pre>
+     *    getParam().add(newItem);
+     * </pre>
+     * 
+     * 
+     * <p>
+     * Objects of the following type(s) are allowed in the list
+     * {@link Param }
+     * 
+     * 
+     */
+    public List<Param> getParam() {
+        if (param == null) {
+            param = new ArrayList<Param>();
+        }
+        return this.param;
+    }
+
+    /**
+     * Gets the value of the methodOrResource property.
+     * 
+     * <p>
+     * This accessor method returns a reference to the live list,
+     * not a snapshot. Therefore any modification you make to the
+     * returned list will be present inside the JAXB object.
+     * This is why there is not a <CODE>set</CODE> method for the methodOrResource property.
+     * 
+     * <p>
+     * For example, to add a new item, do as follows:
+     * <pre>
+     *    getMethodOrResource().add(newItem);
+     * </pre>
+     * 
+     * 
+     * <p>
+     * Objects of the following type(s) are allowed in the list
+     * {@link Method }
+     * {@link Resource }
+     * 
+     * 
+     */
+    public List<Object> getMethodOrResource() {
+        if (methodOrResource == null) {
+            methodOrResource = new ArrayList<Object>();
+        }
+        return this.methodOrResource;
+    }
+
+    /**
+     * Gets the value of the any property.
+     * 
+     * <p>
+     * This accessor method returns a reference to the live list,
+     * not a snapshot. Therefore any modification you make to the
+     * returned list will be present inside the JAXB object.
+     * This is why there is not a <CODE>set</CODE> method for the any property.
+     * 
+     * <p>
+     * For example, to add a new item, do as follows:
+     * <pre>
+     *    getAny().add(newItem);
+     * </pre>
+     * 
+     * 
+     * <p>
+     * Objects of the following type(s) are allowed in the list
+     * {@link Object }
+     * {@link Element }
+     * 
+     * 
+     */
+    public List<Object> getAny() {
+        if (any == null) {
+            any = new ArrayList<Object>();
+        }
+        return this.any;
+    }
+
+    /**
+     * Gets the value of the id property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getId() {
+        return id;
+    }
+
+    /**
+     * Sets the value of the id property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setId(String value) {
+        this.id = value;
+    }
+
+    /**
+     * Gets the value of the type property.
+     * 
+     * <p>
+     * This accessor method returns a reference to the live list,
+     * not a snapshot. Therefore any modification you make to the
+     * returned list will be present inside the JAXB object.
+     * This is why there is not a <CODE>set</CODE> method for the type property.
+     * 
+     * <p>
+     * For example, to add a new item, do as follows:
+     * <pre>
+     *    getType().add(newItem);
+     * </pre>
+     * 
+     * 
+     * <p>
+     * Objects of the following type(s) are allowed in the list
+     * {@link String }
+     * 
+     * 
+     */
+    public List<String> getType() {
+        if (type == null) {
+            type = new ArrayList<String>();
+        }
+        return this.type;
+    }
+
+    /**
+     * Gets the value of the queryType property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getQueryType() {
+        if (queryType == null) {
+            return "application/x-www-form-urlencoded";
+        } else {
+            return queryType;
+        }
+    }
+
+    /**
+     * Sets the value of the queryType property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setQueryType(String value) {
+        this.queryType = value;
+    }
+
+    /**
+     * Gets the value of the path property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getPath() {
+        return path;
+    }
+
+    /**
+     * Sets the value of the path property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setPath(String value) {
+        this.path = value;
+    }
+
+    /**
+     * Gets a map that contains attributes that aren't bound to any typed property on this class.
+     * 
+     * <p>
+     * the map is keyed by the name of the attribute and 
+     * the value is the string value of the attribute.
+     * 
+     * the map returned by this method is live, and you can add new attribute
+     * by updating the map directly. Because of this design, there's no setter.
+     * 
+     * 
+     * @return
+     *     always non-null
+     */
+    public Map<QName, String> getOtherAttributes() {
+        return otherAttributes;
+    }
+
+}

Added: incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/wadl/ResourceType.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/wadl/ResourceType.java?rev=1000080&view=auto
==============================================================================
--- incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/wadl/ResourceType.java (added)
+++ incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/wadl/ResourceType.java Wed Sep 22 16:46:11 2010
@@ -0,0 +1,266 @@
+/*
+ * 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.
+ *  
+ */
+
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6 
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
+// Any modifications to this file will be lost upon recompilation of the source schema. 
+// Generated on: 2010.08.03 at 04:53:29 PM CDT 
+//
+
+
+package org.apache.wink.common.model.wadl;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAnyAttribute;
+import javax.xml.bind.annotation.XmlAnyElement;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElements;
+import javax.xml.bind.annotation.XmlID;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlSchemaType;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import javax.xml.namespace.QName;
+import org.w3c.dom.Element;
+
+
+/**
+ * <p>Java class for anonymous complex type.
+ * 
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * 
+ * <pre>
+ * &lt;complexType>
+ *   &lt;complexContent>
+ *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       &lt;sequence>
+ *         &lt;element ref="{http://wadl.dev.java.net/2009/02}doc" maxOccurs="unbounded" minOccurs="0"/>
+ *         &lt;element ref="{http://wadl.dev.java.net/2009/02}param" maxOccurs="unbounded" minOccurs="0"/>
+ *         &lt;choice maxOccurs="unbounded" minOccurs="0">
+ *           &lt;element ref="{http://wadl.dev.java.net/2009/02}method"/>
+ *           &lt;element ref="{http://wadl.dev.java.net/2009/02}resource"/>
+ *         &lt;/choice>
+ *         &lt;any processContents='lax' namespace='##other' maxOccurs="unbounded" minOccurs="0"/>
+ *       &lt;/sequence>
+ *       &lt;attribute name="id" type="{http://www.w3.org/2001/XMLSchema}ID" />
+ *       &lt;anyAttribute processContents='lax' namespace='##other'/>
+ *     &lt;/restriction>
+ *   &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ * 
+ * 
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+    "doc",
+    "param",
+    "methodOrResource",
+    "any"
+})
+@XmlRootElement(name = "resource_type")
+public class ResourceType {
+
+    protected List<Doc> doc;
+    protected List<Param> param;
+    @XmlElements({
+        @XmlElement(name = "resource", type = Resource.class),
+        @XmlElement(name = "method", type = Method.class)
+    })
+    protected List<Object> methodOrResource;
+    @XmlAnyElement(lax = true)
+    protected List<Object> any;
+    @XmlAttribute
+    @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
+    @XmlID
+    @XmlSchemaType(name = "ID")
+    protected String id;
+    @XmlAnyAttribute
+    private Map<QName, String> otherAttributes = new HashMap<QName, String>();
+
+    /**
+     * Gets the value of the doc property.
+     * 
+     * <p>
+     * This accessor method returns a reference to the live list,
+     * not a snapshot. Therefore any modification you make to the
+     * returned list will be present inside the JAXB object.
+     * This is why there is not a <CODE>set</CODE> method for the doc property.
+     * 
+     * <p>
+     * For example, to add a new item, do as follows:
+     * <pre>
+     *    getDoc().add(newItem);
+     * </pre>
+     * 
+     * 
+     * <p>
+     * Objects of the following type(s) are allowed in the list
+     * {@link Doc }
+     * 
+     * 
+     */
+    public List<Doc> getDoc() {
+        if (doc == null) {
+            doc = new ArrayList<Doc>();
+        }
+        return this.doc;
+    }
+
+    /**
+     * Gets the value of the param property.
+     * 
+     * <p>
+     * This accessor method returns a reference to the live list,
+     * not a snapshot. Therefore any modification you make to the
+     * returned list will be present inside the JAXB object.
+     * This is why there is not a <CODE>set</CODE> method for the param property.
+     * 
+     * <p>
+     * For example, to add a new item, do as follows:
+     * <pre>
+     *    getParam().add(newItem);
+     * </pre>
+     * 
+     * 
+     * <p>
+     * Objects of the following type(s) are allowed in the list
+     * {@link Param }
+     * 
+     * 
+     */
+    public List<Param> getParam() {
+        if (param == null) {
+            param = new ArrayList<Param>();
+        }
+        return this.param;
+    }
+
+    /**
+     * Gets the value of the methodOrResource property.
+     * 
+     * <p>
+     * This accessor method returns a reference to the live list,
+     * not a snapshot. Therefore any modification you make to the
+     * returned list will be present inside the JAXB object.
+     * This is why there is not a <CODE>set</CODE> method for the methodOrResource property.
+     * 
+     * <p>
+     * For example, to add a new item, do as follows:
+     * <pre>
+     *    getMethodOrResource().add(newItem);
+     * </pre>
+     * 
+     * 
+     * <p>
+     * Objects of the following type(s) are allowed in the list
+     * {@link Resource }
+     * {@link Method }
+     * 
+     * 
+     */
+    public List<Object> getMethodOrResource() {
+        if (methodOrResource == null) {
+            methodOrResource = new ArrayList<Object>();
+        }
+        return this.methodOrResource;
+    }
+
+    /**
+     * Gets the value of the any property.
+     * 
+     * <p>
+     * This accessor method returns a reference to the live list,
+     * not a snapshot. Therefore any modification you make to the
+     * returned list will be present inside the JAXB object.
+     * This is why there is not a <CODE>set</CODE> method for the any property.
+     * 
+     * <p>
+     * For example, to add a new item, do as follows:
+     * <pre>
+     *    getAny().add(newItem);
+     * </pre>
+     * 
+     * 
+     * <p>
+     * Objects of the following type(s) are allowed in the list
+     * {@link Object }
+     * {@link Element }
+     * 
+     * 
+     */
+    public List<Object> getAny() {
+        if (any == null) {
+            any = new ArrayList<Object>();
+        }
+        return this.any;
+    }
+
+    /**
+     * Gets the value of the id property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getId() {
+        return id;
+    }
+
+    /**
+     * Sets the value of the id property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setId(String value) {
+        this.id = value;
+    }
+
+    /**
+     * Gets a map that contains attributes that aren't bound to any typed property on this class.
+     * 
+     * <p>
+     * the map is keyed by the name of the attribute and 
+     * the value is the string value of the attribute.
+     * 
+     * the map returned by this method is live, and you can add new attribute
+     * by updating the map directly. Because of this design, there's no setter.
+     * 
+     * 
+     * @return
+     *     always non-null
+     */
+    public Map<QName, String> getOtherAttributes() {
+        return otherAttributes;
+    }
+
+}

Added: incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/wadl/Resources.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/wadl/Resources.java?rev=1000080&view=auto
==============================================================================
--- incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/wadl/Resources.java (added)
+++ incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/wadl/Resources.java Wed Sep 22 16:46:11 2010
@@ -0,0 +1,221 @@
+/*
+ * 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.
+ *  
+ */
+
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6 
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
+// Any modifications to this file will be lost upon recompilation of the source schema. 
+// Generated on: 2010.08.03 at 04:53:29 PM CDT 
+//
+
+
+package org.apache.wink.common.model.wadl;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAnyAttribute;
+import javax.xml.bind.annotation.XmlAnyElement;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlSchemaType;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.namespace.QName;
+import org.w3c.dom.Element;
+
+
+/**
+ * <p>Java class for anonymous complex type.
+ * 
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * 
+ * <pre>
+ * &lt;complexType>
+ *   &lt;complexContent>
+ *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       &lt;sequence>
+ *         &lt;element ref="{http://wadl.dev.java.net/2009/02}doc" maxOccurs="unbounded" minOccurs="0"/>
+ *         &lt;element ref="{http://wadl.dev.java.net/2009/02}resource" maxOccurs="unbounded"/>
+ *         &lt;any processContents='lax' namespace='##other' maxOccurs="unbounded" minOccurs="0"/>
+ *       &lt;/sequence>
+ *       &lt;attribute name="base" type="{http://www.w3.org/2001/XMLSchema}anyURI" />
+ *       &lt;anyAttribute processContents='lax' namespace='##other'/>
+ *     &lt;/restriction>
+ *   &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ * 
+ * 
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+    "doc",
+    "resource",
+    "any"
+})
+@XmlRootElement(name = "resources")
+public class Resources {
+
+    protected List<Doc> doc;
+    @XmlElement(required = true)
+    protected List<Resource> resource;
+    @XmlAnyElement(lax = true)
+    protected List<Object> any;
+    @XmlAttribute
+    @XmlSchemaType(name = "anyURI")
+    protected String base;
+    @XmlAnyAttribute
+    private Map<QName, String> otherAttributes = new HashMap<QName, String>();
+
+    /**
+     * Gets the value of the doc property.
+     * 
+     * <p>
+     * This accessor method returns a reference to the live list,
+     * not a snapshot. Therefore any modification you make to the
+     * returned list will be present inside the JAXB object.
+     * This is why there is not a <CODE>set</CODE> method for the doc property.
+     * 
+     * <p>
+     * For example, to add a new item, do as follows:
+     * <pre>
+     *    getDoc().add(newItem);
+     * </pre>
+     * 
+     * 
+     * <p>
+     * Objects of the following type(s) are allowed in the list
+     * {@link Doc }
+     * 
+     * 
+     */
+    public List<Doc> getDoc() {
+        if (doc == null) {
+            doc = new ArrayList<Doc>();
+        }
+        return this.doc;
+    }
+
+    /**
+     * Gets the value of the resource property.
+     * 
+     * <p>
+     * This accessor method returns a reference to the live list,
+     * not a snapshot. Therefore any modification you make to the
+     * returned list will be present inside the JAXB object.
+     * This is why there is not a <CODE>set</CODE> method for the resource property.
+     * 
+     * <p>
+     * For example, to add a new item, do as follows:
+     * <pre>
+     *    getResource().add(newItem);
+     * </pre>
+     * 
+     * 
+     * <p>
+     * Objects of the following type(s) are allowed in the list
+     * {@link Resource }
+     * 
+     * 
+     */
+    public List<Resource> getResource() {
+        if (resource == null) {
+            resource = new ArrayList<Resource>();
+        }
+        return this.resource;
+    }
+
+    /**
+     * Gets the value of the any property.
+     * 
+     * <p>
+     * This accessor method returns a reference to the live list,
+     * not a snapshot. Therefore any modification you make to the
+     * returned list will be present inside the JAXB object.
+     * This is why there is not a <CODE>set</CODE> method for the any property.
+     * 
+     * <p>
+     * For example, to add a new item, do as follows:
+     * <pre>
+     *    getAny().add(newItem);
+     * </pre>
+     * 
+     * 
+     * <p>
+     * Objects of the following type(s) are allowed in the list
+     * {@link Object }
+     * {@link Element }
+     * 
+     * 
+     */
+    public List<Object> getAny() {
+        if (any == null) {
+            any = new ArrayList<Object>();
+        }
+        return this.any;
+    }
+
+    /**
+     * Gets the value of the base property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getBase() {
+        return base;
+    }
+
+    /**
+     * Sets the value of the base property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setBase(String value) {
+        this.base = value;
+    }
+
+    /**
+     * Gets a map that contains attributes that aren't bound to any typed property on this class.
+     * 
+     * <p>
+     * the map is keyed by the name of the attribute and 
+     * the value is the string value of the attribute.
+     * 
+     * the map returned by this method is live, and you can add new attribute
+     * by updating the map directly. Because of this design, there's no setter.
+     * 
+     * 
+     * @return
+     *     always non-null
+     */
+    public Map<QName, String> getOtherAttributes() {
+        return otherAttributes;
+    }
+
+}

Added: incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/wadl/Response.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/wadl/Response.java?rev=1000080&view=auto
==============================================================================
--- incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/wadl/Response.java (added)
+++ incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/wadl/Response.java Wed Sep 22 16:46:11 2010
@@ -0,0 +1,254 @@
+/*
+ * 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.
+ *  
+ */
+
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6 
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
+// Any modifications to this file will be lost upon recompilation of the source schema. 
+// Generated on: 2010.08.03 at 04:53:29 PM CDT 
+//
+
+
+package org.apache.wink.common.model.wadl;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAnyAttribute;
+import javax.xml.bind.annotation.XmlAnyElement;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.namespace.QName;
+import org.w3c.dom.Element;
+
+
+/**
+ * <p>Java class for anonymous complex type.
+ * 
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * 
+ * <pre>
+ * &lt;complexType>
+ *   &lt;complexContent>
+ *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       &lt;sequence>
+ *         &lt;element ref="{http://wadl.dev.java.net/2009/02}doc" maxOccurs="unbounded" minOccurs="0"/>
+ *         &lt;element ref="{http://wadl.dev.java.net/2009/02}param" maxOccurs="unbounded" minOccurs="0"/>
+ *         &lt;element ref="{http://wadl.dev.java.net/2009/02}representation" maxOccurs="unbounded" minOccurs="0"/>
+ *         &lt;any processContents='lax' namespace='##other' maxOccurs="unbounded" minOccurs="0"/>
+ *       &lt;/sequence>
+ *       &lt;attribute name="status" type="{http://wadl.dev.java.net/2009/02}statusCodeList" />
+ *       &lt;anyAttribute processContents='lax' namespace='##other'/>
+ *     &lt;/restriction>
+ *   &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ * 
+ * 
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+    "doc",
+    "param",
+    "representation",
+    "any"
+})
+@XmlRootElement(name = "response")
+public class Response {
+
+    protected List<Doc> doc;
+    protected List<Param> param;
+    protected List<Representation> representation;
+    @XmlAnyElement(lax = true)
+    protected List<Object> any;
+    @XmlAttribute
+    protected List<Long> status;
+    @XmlAnyAttribute
+    private Map<QName, String> otherAttributes = new HashMap<QName, String>();
+
+    /**
+     * Gets the value of the doc property.
+     * 
+     * <p>
+     * This accessor method returns a reference to the live list,
+     * not a snapshot. Therefore any modification you make to the
+     * returned list will be present inside the JAXB object.
+     * This is why there is not a <CODE>set</CODE> method for the doc property.
+     * 
+     * <p>
+     * For example, to add a new item, do as follows:
+     * <pre>
+     *    getDoc().add(newItem);
+     * </pre>
+     * 
+     * 
+     * <p>
+     * Objects of the following type(s) are allowed in the list
+     * {@link Doc }
+     * 
+     * 
+     */
+    public List<Doc> getDoc() {
+        if (doc == null) {
+            doc = new ArrayList<Doc>();
+        }
+        return this.doc;
+    }
+
+    /**
+     * Gets the value of the param property.
+     * 
+     * <p>
+     * This accessor method returns a reference to the live list,
+     * not a snapshot. Therefore any modification you make to the
+     * returned list will be present inside the JAXB object.
+     * This is why there is not a <CODE>set</CODE> method for the param property.
+     * 
+     * <p>
+     * For example, to add a new item, do as follows:
+     * <pre>
+     *    getParam().add(newItem);
+     * </pre>
+     * 
+     * 
+     * <p>
+     * Objects of the following type(s) are allowed in the list
+     * {@link Param }
+     * 
+     * 
+     */
+    public List<Param> getParam() {
+        if (param == null) {
+            param = new ArrayList<Param>();
+        }
+        return this.param;
+    }
+
+    /**
+     * Gets the value of the representation property.
+     * 
+     * <p>
+     * This accessor method returns a reference to the live list,
+     * not a snapshot. Therefore any modification you make to the
+     * returned list will be present inside the JAXB object.
+     * This is why there is not a <CODE>set</CODE> method for the representation property.
+     * 
+     * <p>
+     * For example, to add a new item, do as follows:
+     * <pre>
+     *    getRepresentation().add(newItem);
+     * </pre>
+     * 
+     * 
+     * <p>
+     * Objects of the following type(s) are allowed in the list
+     * {@link Representation }
+     * 
+     * 
+     */
+    public List<Representation> getRepresentation() {
+        if (representation == null) {
+            representation = new ArrayList<Representation>();
+        }
+        return this.representation;
+    }
+
+    /**
+     * Gets the value of the any property.
+     * 
+     * <p>
+     * This accessor method returns a reference to the live list,
+     * not a snapshot. Therefore any modification you make to the
+     * returned list will be present inside the JAXB object.
+     * This is why there is not a <CODE>set</CODE> method for the any property.
+     * 
+     * <p>
+     * For example, to add a new item, do as follows:
+     * <pre>
+     *    getAny().add(newItem);
+     * </pre>
+     * 
+     * 
+     * <p>
+     * Objects of the following type(s) are allowed in the list
+     * {@link Object }
+     * {@link Element }
+     * 
+     * 
+     */
+    public List<Object> getAny() {
+        if (any == null) {
+            any = new ArrayList<Object>();
+        }
+        return this.any;
+    }
+
+    /**
+     * Gets the value of the status property.
+     * 
+     * <p>
+     * This accessor method returns a reference to the live list,
+     * not a snapshot. Therefore any modification you make to the
+     * returned list will be present inside the JAXB object.
+     * This is why there is not a <CODE>set</CODE> method for the status property.
+     * 
+     * <p>
+     * For example, to add a new item, do as follows:
+     * <pre>
+     *    getStatus().add(newItem);
+     * </pre>
+     * 
+     * 
+     * <p>
+     * Objects of the following type(s) are allowed in the list
+     * {@link Long }
+     * 
+     * 
+     */
+    public List<Long> getStatus() {
+        if (status == null) {
+            status = new ArrayList<Long>();
+        }
+        return this.status;
+    }
+
+    /**
+     * Gets a map that contains attributes that aren't bound to any typed property on this class.
+     * 
+     * <p>
+     * the map is keyed by the name of the attribute and 
+     * the value is the string value of the attribute.
+     * 
+     * the map returned by this method is live, and you can add new attribute
+     * by updating the map directly. Because of this design, there's no setter.
+     * 
+     * 
+     * @return
+     *     always non-null
+     */
+    public Map<QName, String> getOtherAttributes() {
+        return otherAttributes;
+    }
+
+}

Added: incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/wadl/WADLGenerator.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/wadl/WADLGenerator.java?rev=1000080&view=auto
==============================================================================
--- incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/wadl/WADLGenerator.java (added)
+++ incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/wadl/WADLGenerator.java Wed Sep 22 16:46:11 2010
@@ -0,0 +1,329 @@
+/*
+ * 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.wink.common.model.wadl;
+
+import java.lang.annotation.Annotation;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.ws.rs.DefaultValue;
+import javax.ws.rs.FormParam;
+import javax.ws.rs.HeaderParam;
+import javax.ws.rs.MatrixParam;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.MediaType;
+import javax.xml.namespace.QName;
+
+import org.apache.wink.common.internal.registry.Injectable;
+import org.apache.wink.common.internal.registry.Injectable.ParamType;
+import org.apache.wink.common.internal.registry.metadata.ClassMetadata;
+import org.apache.wink.common.internal.registry.metadata.MethodMetadata;
+import org.apache.wink.common.internal.registry.metadata.ResourceMetadataCollector;
+
+public class WADLGenerator {
+
+    private static final String XML_SCHEMA_NS = "http://www.w3.org/2001/XMLSchema";
+
+    public Application generate(Set<Class<?>> classes) {
+        /*
+         * the idea is that classes comes from the Application subclass
+         */
+        Application app = new Application();
+        if (classes == null || classes.isEmpty()) {
+            return app;
+        }
+
+        Resources resources = new Resources();
+
+        Set<ClassMetadata> metadataSet = buildClassMetdata(classes);
+        resources.getResource().addAll(buildResources(metadataSet));
+        app.getResources().add(resources);
+        return app;
+    }
+
+    /* package */Set<ClassMetadata> buildClassMetdata(Set<Class<?>> classes) {
+        Set<ClassMetadata> metadataSet = new HashSet<ClassMetadata>(classes.size());
+        for (Class<?> c : classes) {
+            if (!ResourceMetadataCollector.isResource(c)) {
+                /* not a resource, so skip it */
+                continue;
+            }
+
+            ClassMetadata metadata = ResourceMetadataCollector.collectMetadata(c);
+            metadataSet.add(metadata);
+        }
+
+        return metadataSet;
+    }
+
+    /* package */Set<Resource> buildResources(Set<ClassMetadata> metadataSet) {
+        Set<Resource> s = new HashSet<Resource>(metadataSet.size());
+        for (ClassMetadata metadata : metadataSet) {
+            Resource r = buildResource(metadata);
+            s.add(r);
+        }
+
+        return s;
+    }
+
+    /* package */Resource buildResource(ClassMetadata metadata) {
+        Resource r = new Resource();
+
+        /* set the path */
+        r.setPath(metadata.getPath());
+
+        List<Object> methodOrSubresource = r.getMethodOrResource();
+        List<MethodMetadata> methodMetadata = metadata.getResourceMethods();
+        if (methodMetadata != null && !methodMetadata.isEmpty()) {
+            for (MethodMetadata methodMeta : methodMetadata) {
+                Method m = buildMethod(metadata, methodMeta);
+                methodOrSubresource.add(m);
+            }
+        }
+
+        return r;
+    }
+
+    /* package */Method buildMethod(ClassMetadata classMetadata, MethodMetadata metadata) {
+        Method m = new Method();
+        m.setName(metadata.getHttpMethod());
+        Request r = buildRequest(classMetadata, metadata);
+        if (r != null) {
+            m.setRequest(r);
+        }
+        return m;
+    }
+
+    /* package */Request buildRequest(ClassMetadata classMetadata, MethodMetadata metadata) {
+        Request r = null;
+        List<Injectable> params = metadata.getFormalParameters();
+        if (params != null && params.size() > 0) {
+            if (r == null) {
+                r = new Request();
+            }
+            List<Param> requestParams = r.getParam();
+            for (Injectable p : params) {
+                switch (p.getParamType()) {
+                    case QUERY:
+                        requestParams.add(buildParam(p));
+                        break;
+                    case HEADER:
+                        requestParams.add(buildParam(p));
+                        break;
+                    case ENTITY:
+                        /* need to build the representation */
+                        Set<Representation> representations =
+                            buildRepresentation(classMetadata, metadata, p);
+                        r.getRepresentation().addAll(representations);
+                        break;
+                    case COOKIE:
+                        /* not supported in WADL */
+                        break;
+                    case FORM:
+                        /* should show up in the representation instead */
+                        break;
+                    case PATH:
+                        /* should show up in the containing resource */
+                        break;
+                    case MATRIX:
+                        /* should show up in the containing resource */
+                        break;
+                    case CONTEXT:
+                        /* do nothing */
+                        break;
+                }
+            }
+        }
+
+        return r;
+    }
+
+    /* package */Param buildParam(Injectable paramMetadata) {
+        Param p = null;
+        ParamType pt = paramMetadata.getParamType();
+        Annotation[] annotations = paramMetadata.getAnnotations();
+        switch (pt) {
+            case HEADER:
+                p = new Param();
+                p.setStyle(ParamStyle.HEADER);
+                if (annotations != null) {
+                    for (Annotation a : annotations) {
+                        if (HeaderParam.class.equals(a.annotationType())) {
+                            HeaderParam paramAnn = (HeaderParam)a;
+                            p.setName(paramAnn.value());
+                        }
+                    }
+                }
+                break;
+            case MATRIX:
+                p = new Param();
+                p.setStyle(ParamStyle.MATRIX);
+                for (Annotation a : annotations) {
+                    if (MatrixParam.class.equals(a.annotationType())) {
+                        MatrixParam paramAnn = (MatrixParam)a;
+                        p.setName(paramAnn.value());
+                    }
+                }
+                break;
+            case PATH:
+                p = new Param();
+                p.setStyle(ParamStyle.TEMPLATE);
+                for (Annotation a : annotations) {
+                    if (PathParam.class.equals(a.annotationType())) {
+                        PathParam paramAnn = (PathParam)a;
+                        p.setName(paramAnn.value());
+                    }
+                }
+                break;
+            case QUERY:
+                p = new Param();
+                p.setStyle(ParamStyle.QUERY);
+                for (Annotation a : annotations) {
+                    if (QueryParam.class.equals(a.annotationType())) {
+                        QueryParam paramAnn = (QueryParam)a;
+                        p.setName(paramAnn.value());
+                    }
+                }
+                break;
+            case FORM:
+                p = new Param();
+                p.setStyle(ParamStyle.QUERY);
+                for (Annotation a : annotations) {
+                    if (FormParam.class.equals(a.annotationType())) {
+                        FormParam paramAnn = (FormParam)a;
+                        p.setName(paramAnn.value());
+                    }
+                }
+                break;
+            case CONTEXT:
+                break;
+            case COOKIE:
+                break;
+            case ENTITY:
+                break;
+        }
+
+        if (p == null) {
+            /*
+             * The paramtype was never set so return null. This might have been
+             * some other type of injectable that shouldn't be created as a
+             * Param. This is a preventive measure.
+             */
+            return null;
+        }
+
+        Class<?> memberType = paramMetadata.getType();
+        if (memberType.equals(int.class) || memberType.equals(Integer.class)) {
+            p.setType(new QName(XML_SCHEMA_NS, "int"));
+        } else if (memberType.equals(float.class) || memberType.equals(Float.class)) {
+            p.setType(new QName(XML_SCHEMA_NS, "float"));
+        } else if (memberType.equals(long.class) || memberType.equals(Long.class)) {
+            p.setType(new QName(XML_SCHEMA_NS, "long"));
+        } else if (memberType.equals(boolean.class) || memberType.equals(Boolean.class)) {
+            p.setType(new QName(XML_SCHEMA_NS, "boolean"));
+        } else if (memberType.equals(short.class) || memberType.equals(Short.class)) {
+            p.setType(new QName(XML_SCHEMA_NS, "short"));
+        } else if (memberType.equals(double.class) || memberType.equals(Double.class)) {
+            p.setType(new QName(XML_SCHEMA_NS, "double"));
+        } else if (memberType.equals(byte.class) || memberType.equals(Byte.class)) {
+            p.setType(new QName(XML_SCHEMA_NS, "byte"));
+        }
+
+        for (Annotation a : annotations) {
+            if (DefaultValue.class.equals(a.annotationType())) {
+                DefaultValue paramAnn = (DefaultValue)a;
+                p.setDefault(paramAnn.value());
+            }
+        }
+
+        return p;
+    }
+
+    /* package */Set<Representation> buildRepresentation(ClassMetadata classMetadata,
+                                                         MethodMetadata methodMetadata,
+                                                         Injectable metadata) {
+        if (methodMetadata == null) {
+            return null;
+        }
+
+        if (metadata != null && metadata.getParamType() != ParamType.ENTITY) {
+            throw new IllegalArgumentException("Parameter data is not for an entity.");
+        }
+
+        /*
+         * first check all the consumes
+         */
+        Set<MediaType> consumesMT = methodMetadata.getConsumes();
+        Set<Representation> reps = null;
+        if (consumesMT != null && !consumesMT.isEmpty()) {
+            reps = new HashSet<Representation>();
+            for (MediaType mt : consumesMT) {
+                Representation r = new Representation();
+                r.setMediaType(mt.toString());
+
+                /*
+                 * if the representation is a special case, we need to build for
+                 * it
+                 */
+                /*
+                 * special cases include application/xml, text/xml;  should set the element attribute
+                 */
+                List<Param> params = new ArrayList<Param>();
+                if (mt.isCompatible(MediaType.APPLICATION_FORM_URLENCODED_TYPE) || mt
+                    .isCompatible(MediaType.MULTIPART_FORM_DATA_TYPE)) {
+                    List<Injectable> injectables = methodMetadata.getFormalParameters();
+                    if (injectables != null) {
+                        for (Injectable i : injectables) {
+                            if (ParamType.FORM.equals(i.getParamType())) {
+                                params.add(buildParam(i));
+                            }
+                        }
+                    }
+
+                    /*
+                     * should we scan the class metadata too? FormParams aren't
+                     * required to be supported in other places than the
+                     * resource method parameters
+                     */
+                    if(!params.isEmpty()) {
+                        r.getParam().addAll(params);
+                    }
+                }
+                reps.add(r);
+            }
+        } else {
+            if (metadata == null) {
+                return null;
+            }
+
+            /*
+             * there aren't any consumes so we can't look for that but maybe we
+             * can look at the Providers registry and find all the relevant
+             * media types there
+             */
+        }
+
+        return reps;
+    }
+}

Added: incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/wadl/package-info.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/wadl/package-info.java?rev=1000080&view=auto
==============================================================================
--- incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/wadl/package-info.java (added)
+++ incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/wadl/package-info.java Wed Sep 22 16:46:11 2010
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ *  
+ */
+
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6 
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
+// Any modifications to this file will be lost upon recompilation of the source schema. 
+// Generated on: 2010.08.03 at 04:53:29 PM CDT 
+//
+
+@javax.xml.bind.annotation.XmlSchema(namespace = "http://wadl.dev.java.net/2009/02", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
+package org.apache.wink.common.model.wadl;

Added: incubator/wink/trunk/wink-common/src/test/java/org/apache/wink/common/model/wadl/BuildParamTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-common/src/test/java/org/apache/wink/common/model/wadl/BuildParamTest.java?rev=1000080&view=auto
==============================================================================
--- incubator/wink/trunk/wink-common/src/test/java/org/apache/wink/common/model/wadl/BuildParamTest.java (added)
+++ incubator/wink/trunk/wink-common/src/test/java/org/apache/wink/common/model/wadl/BuildParamTest.java Wed Sep 22 16:46:11 2010
@@ -0,0 +1,574 @@
+/*
+ * 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.wink.common.model.wadl;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+
+import java.lang.annotation.Annotation;
+
+import javax.ws.rs.DefaultValue;
+import javax.ws.rs.FormParam;
+import javax.ws.rs.HeaderParam;
+import javax.ws.rs.MatrixParam;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.QueryParam;
+import javax.xml.namespace.QName;
+
+import org.apache.wink.common.internal.registry.Injectable;
+import org.apache.wink.common.internal.registry.Injectable.ParamType;
+import org.jmock.Expectations;
+import org.jmock.Mockery;
+import org.jmock.lib.legacy.ClassImposteriser;
+import org.junit.Test;
+
+public class BuildParamTest {
+
+    final private WADLGenerator generator   = new WADLGenerator();
+
+    final private Mockery       mockContext = new Mockery() {
+                                                {
+                                                    setImposteriser(ClassImposteriser.INSTANCE);
+                                                }
+                                            };
+
+    final Injectable            metadata    = mockContext.mock(Injectable.class);
+
+    static class Temp {
+        @QueryParam("q")
+        public void setQueryParam(int p) {
+
+        }
+
+        @HeaderParam("h")
+        public void setHeaderParam(Integer p) {
+
+        }
+
+        @MatrixParam("m")
+        public void setMatrixParam(float p) {
+
+        }
+
+        @PathParam("pp")
+        public void setPathParam(Float p) {
+
+        }
+
+        @FormParam("fp")
+        public void setFormParam(String p) {
+
+        }
+
+        @DefaultValue("myDefault")
+        @HeaderParam("h2")
+        public void setHeaderParamWithDefault(double d) {
+
+        }
+    }
+
+    private void assertDefaultAttributes(Param p) {
+        assertEquals(0, p.getDoc().size());
+        assertEquals(0, p.getAny().size());
+        assertEquals(0, p.getOtherAttributes().size());
+        assertNull(p.getDefault());
+        assertNull(p.getFixed());
+        assertNull(p.getHref());
+        assertNull(p.getId());
+        assertNull(p.getLink());
+        assertEquals(0, p.getOption().size());
+        assertNull(p.getPath());
+        assertFalse(p.getRepeating());
+        assertFalse(p.getRequired());
+    }
+
+    @Test
+    public void testBuildBasicQueryParamWithMock() throws Exception {
+        QueryParam qp =
+            Temp.class.getMethod("setQueryParam", int.class).getAnnotation(QueryParam.class);
+        final Annotation[] annArray = new Annotation[] {qp};
+
+        mockContext.checking(new Expectations() {
+            {
+                oneOf(metadata).getParamType();
+                will(returnValue(ParamType.QUERY));
+
+                oneOf(metadata).getAnnotations();
+                will(returnValue(annArray));
+
+                oneOf(metadata).getType();
+                will(returnValue(int.class));
+            }
+        });
+
+        Param p = generator.buildParam(metadata);
+        assertDefaultAttributes(p);
+        assertEquals("q", p.getName());
+        assertEquals(ParamStyle.QUERY, p.getStyle());
+        assertEquals(new QName("http://www.w3.org/2001/XMLSchema", "int"), p.getType());
+
+        mockContext.assertIsSatisfied();
+    }
+
+    @Test
+    public void testBuildBasicHeaderParamWithMock() throws Exception {
+        HeaderParam qp =
+            Temp.class.getMethod("setHeaderParam", Integer.class).getAnnotation(HeaderParam.class);
+        final Annotation[] annArray = new Annotation[] {qp};
+
+        mockContext.checking(new Expectations() {
+            {
+                oneOf(metadata).getParamType();
+                will(returnValue(ParamType.HEADER));
+
+                oneOf(metadata).getAnnotations();
+                will(returnValue(annArray));
+
+                oneOf(metadata).getType();
+                will(returnValue(Integer.class));
+            }
+        });
+
+        Param p = generator.buildParam(metadata);
+        assertDefaultAttributes(p);
+        assertEquals("h", p.getName());
+        assertEquals(ParamStyle.HEADER, p.getStyle());
+        assertEquals(new QName("http://www.w3.org/2001/XMLSchema", "int"), p.getType());
+
+        mockContext.assertIsSatisfied();
+    }
+
+    @Test
+    public void testBuildBasicMatrixParam() throws Exception {
+        MatrixParam qp =
+            Temp.class.getMethod("setMatrixParam", float.class).getAnnotation(MatrixParam.class);
+        final Annotation[] annArray = new Annotation[] {qp};
+
+        mockContext.checking(new Expectations() {
+            {
+                oneOf(metadata).getParamType();
+                will(returnValue(ParamType.MATRIX));
+
+                oneOf(metadata).getAnnotations();
+                will(returnValue(annArray));
+
+                oneOf(metadata).getType();
+                will(returnValue(float.class));
+            }
+        });
+
+        Param p = generator.buildParam(metadata);
+        assertDefaultAttributes(p);
+        assertEquals("m", p.getName());
+        assertEquals(ParamStyle.MATRIX, p.getStyle());
+        assertEquals(new QName("http://www.w3.org/2001/XMLSchema", "float"), p.getType());
+
+        mockContext.assertIsSatisfied();
+    }
+
+    @Test
+    public void testBuildBasicTemplateParam() throws Exception {
+        PathParam qp =
+            Temp.class.getMethod("setPathParam", Float.class).getAnnotation(PathParam.class);
+        final Annotation[] annArray = new Annotation[] {qp};
+
+        mockContext.checking(new Expectations() {
+            {
+                oneOf(metadata).getParamType();
+                will(returnValue(ParamType.PATH));
+
+                oneOf(metadata).getAnnotations();
+                will(returnValue(annArray));
+
+                oneOf(metadata).getType();
+                will(returnValue(Float.class));
+            }
+        });
+
+        Param p = generator.buildParam(metadata);
+        assertEquals("pp", p.getName());
+        assertEquals(ParamStyle.TEMPLATE, p.getStyle());
+        assertEquals(new QName("http://www.w3.org/2001/XMLSchema", "float"), p.getType());
+
+        mockContext.assertIsSatisfied();
+    }
+
+    @Test
+    public void testBuildBasicFormParam() throws Exception {
+        FormParam ann =
+            Temp.class.getMethod("setFormParam", String.class).getAnnotation(FormParam.class);
+        final Annotation[] annArray = new Annotation[] {ann};
+
+        mockContext.checking(new Expectations() {
+            {
+                oneOf(metadata).getParamType();
+                will(returnValue(ParamType.FORM));
+
+                oneOf(metadata).getAnnotations();
+                will(returnValue(annArray));
+
+                oneOf(metadata).getType();
+                will(returnValue(String.class));
+            }
+        });
+
+        Param p = generator.buildParam(metadata);
+        assertEquals("fp", p.getName());
+        assertEquals(ParamStyle.QUERY, p.getStyle());
+        assertEquals(new QName("http://www.w3.org/2001/XMLSchema", "string"), p.getType());
+
+        mockContext.assertIsSatisfied();
+    }
+
+    @Test
+    public void testBuildLongPrimitiveTypeParam() throws Exception {
+        mockContext.checking(new Expectations() {
+            {
+                oneOf(metadata).getParamType();
+                will(returnValue(ParamType.PATH));
+
+                oneOf(metadata).getAnnotations();
+                will(returnValue(new Annotation[0]));
+
+                oneOf(metadata).getType();
+                will(returnValue(long.class));
+            }
+        });
+
+        Param p = generator.buildParam(metadata);
+        assertDefaultAttributes(p);
+        assertNull(p.getName());
+        assertEquals(ParamStyle.TEMPLATE, p.getStyle());
+        assertEquals(new QName("http://www.w3.org/2001/XMLSchema", "long"), p.getType());
+
+        mockContext.assertIsSatisfied();
+    }
+
+    @Test
+    public void testBuildLongWrapperTypeParam() throws Exception {
+        mockContext.checking(new Expectations() {
+            {
+                oneOf(metadata).getParamType();
+                will(returnValue(ParamType.PATH));
+
+                oneOf(metadata).getAnnotations();
+                will(returnValue(new Annotation[0]));
+
+                oneOf(metadata).getType();
+                will(returnValue(Long.class));
+            }
+        });
+
+        Param p = generator.buildParam(metadata);
+        assertDefaultAttributes(p);
+        assertNull(p.getName());
+        assertEquals(ParamStyle.TEMPLATE, p.getStyle());
+        assertEquals(new QName("http://www.w3.org/2001/XMLSchema", "long"), p.getType());
+
+        mockContext.assertIsSatisfied();
+    }
+
+    @Test
+    public void testBuildBooleanPrimitiveTypeParam() throws Exception {
+        mockContext.checking(new Expectations() {
+            {
+                oneOf(metadata).getParamType();
+                will(returnValue(ParamType.PATH));
+
+                oneOf(metadata).getAnnotations();
+                will(returnValue(new Annotation[0]));
+
+                oneOf(metadata).getType();
+                will(returnValue(boolean.class));
+            }
+        });
+
+        Param p = generator.buildParam(metadata);
+        assertDefaultAttributes(p);
+        assertNull(p.getName());
+        assertEquals(ParamStyle.TEMPLATE, p.getStyle());
+        assertEquals(new QName("http://www.w3.org/2001/XMLSchema", "boolean"), p.getType());
+
+        mockContext.assertIsSatisfied();
+    }
+
+    @Test
+    public void testBuildBooleanWrapperTypeParam() throws Exception {
+        mockContext.checking(new Expectations() {
+            {
+                oneOf(metadata).getParamType();
+                will(returnValue(ParamType.PATH));
+
+                oneOf(metadata).getAnnotations();
+                will(returnValue(new Annotation[0]));
+
+                oneOf(metadata).getType();
+                will(returnValue(Boolean.class));
+            }
+        });
+
+        Param p = generator.buildParam(metadata);
+        assertDefaultAttributes(p);
+        assertNull(p.getName());
+        assertEquals(ParamStyle.TEMPLATE, p.getStyle());
+        assertEquals(new QName("http://www.w3.org/2001/XMLSchema", "boolean"), p.getType());
+
+        mockContext.assertIsSatisfied();
+    }
+
+    @Test
+    public void testBuildCharPrimitiveTypeParam() throws Exception {
+        mockContext.checking(new Expectations() {
+            {
+                oneOf(metadata).getParamType();
+                will(returnValue(ParamType.PATH));
+
+                oneOf(metadata).getAnnotations();
+                will(returnValue(new Annotation[0]));
+
+                oneOf(metadata).getType();
+                will(returnValue(char.class));
+            }
+        });
+
+        Param p = generator.buildParam(metadata);
+        assertDefaultAttributes(p);
+        assertNull(p.getName());
+        assertEquals(ParamStyle.TEMPLATE, p.getStyle());
+        assertEquals(new QName("http://www.w3.org/2001/XMLSchema", "string"), p.getType());
+
+        mockContext.assertIsSatisfied();
+    }
+
+    @Test
+    public void testBuildCharWrapperTypeParam() throws Exception {
+        mockContext.checking(new Expectations() {
+            {
+                oneOf(metadata).getParamType();
+                will(returnValue(ParamType.PATH));
+
+                oneOf(metadata).getAnnotations();
+                will(returnValue(new Annotation[0]));
+
+                oneOf(metadata).getType();
+                will(returnValue(Character.class));
+            }
+        });
+
+        Param p = generator.buildParam(metadata);
+        assertDefaultAttributes(p);
+        assertNull(p.getName());
+        assertEquals(ParamStyle.TEMPLATE, p.getStyle());
+        assertEquals(new QName("http://www.w3.org/2001/XMLSchema", "string"), p.getType());
+
+        mockContext.assertIsSatisfied();
+    }
+
+    @Test
+    public void testBuildBytePrimitiveTypeParam() throws Exception {
+        mockContext.checking(new Expectations() {
+            {
+                oneOf(metadata).getParamType();
+                will(returnValue(ParamType.PATH));
+
+                oneOf(metadata).getAnnotations();
+                will(returnValue(new Annotation[0]));
+
+                oneOf(metadata).getType();
+                will(returnValue(byte.class));
+            }
+        });
+
+        Param p = generator.buildParam(metadata);
+        assertDefaultAttributes(p);
+        assertNull(p.getName());
+        assertEquals(ParamStyle.TEMPLATE, p.getStyle());
+        assertEquals(new QName("http://www.w3.org/2001/XMLSchema", "byte"), p.getType());
+
+        mockContext.assertIsSatisfied();
+    }
+
+    @Test
+    public void testBuildByteWrapperTypeParam() throws Exception {
+        mockContext.checking(new Expectations() {
+            {
+                oneOf(metadata).getParamType();
+                will(returnValue(ParamType.PATH));
+
+                oneOf(metadata).getAnnotations();
+                will(returnValue(new Annotation[0]));
+
+                oneOf(metadata).getType();
+                will(returnValue(Byte.class));
+            }
+        });
+
+        Param p = generator.buildParam(metadata);
+        assertDefaultAttributes(p);
+        assertNull(p.getName());
+        assertEquals(ParamStyle.TEMPLATE, p.getStyle());
+        assertEquals(new QName("http://www.w3.org/2001/XMLSchema", "byte"), p.getType());
+
+        mockContext.assertIsSatisfied();
+    }
+
+    @Test
+    public void testBuildShortPrimitiveTypeParam() throws Exception {
+        mockContext.checking(new Expectations() {
+            {
+                oneOf(metadata).getParamType();
+                will(returnValue(ParamType.PATH));
+
+                oneOf(metadata).getAnnotations();
+                will(returnValue(new Annotation[0]));
+
+                oneOf(metadata).getType();
+                will(returnValue(short.class));
+            }
+        });
+
+        Param p = generator.buildParam(metadata);
+        assertDefaultAttributes(p);
+        assertNull(p.getName());
+        assertEquals(ParamStyle.TEMPLATE, p.getStyle());
+        assertEquals(new QName("http://www.w3.org/2001/XMLSchema", "short"), p.getType());
+
+        mockContext.assertIsSatisfied();
+    }
+
+    @Test
+    public void testBuildShortWrapperTypeParam() throws Exception {
+        mockContext.checking(new Expectations() {
+            {
+                oneOf(metadata).getParamType();
+                will(returnValue(ParamType.PATH));
+
+                oneOf(metadata).getAnnotations();
+                will(returnValue(new Annotation[0]));
+
+                oneOf(metadata).getType();
+                will(returnValue(Short.class));
+            }
+        });
+
+        Param p = generator.buildParam(metadata);
+        assertDefaultAttributes(p);
+        assertNull(p.getName());
+        assertEquals(ParamStyle.TEMPLATE, p.getStyle());
+        assertEquals(new QName("http://www.w3.org/2001/XMLSchema", "short"), p.getType());
+
+        mockContext.assertIsSatisfied();
+    }
+
+    @Test
+    public void testBuildDoublePrimitiveTypeParam() throws Exception {
+        mockContext.checking(new Expectations() {
+            {
+                oneOf(metadata).getParamType();
+                will(returnValue(ParamType.PATH));
+
+                oneOf(metadata).getAnnotations();
+                will(returnValue(new Annotation[0]));
+
+                oneOf(metadata).getType();
+                will(returnValue(double.class));
+            }
+        });
+
+        Param p = generator.buildParam(metadata);
+        assertDefaultAttributes(p);
+        assertNull(p.getName());
+        assertEquals(ParamStyle.TEMPLATE, p.getStyle());
+        assertEquals(new QName("http://www.w3.org/2001/XMLSchema", "double"), p.getType());
+
+        mockContext.assertIsSatisfied();
+    }
+
+    @Test
+    public void testBuildDoubleWrapperTypeParam() throws Exception {
+        mockContext.checking(new Expectations() {
+            {
+                oneOf(metadata).getParamType();
+                will(returnValue(ParamType.PATH));
+
+                oneOf(metadata).getAnnotations();
+                will(returnValue(new Annotation[0]));
+
+                oneOf(metadata).getType();
+                will(returnValue(Double.class));
+            }
+        });
+
+        Param p = generator.buildParam(metadata);
+        assertDefaultAttributes(p);
+        assertNull(p.getName());
+        assertEquals(ParamStyle.TEMPLATE, p.getStyle());
+        assertEquals(new QName("http://www.w3.org/2001/XMLSchema", "double"), p.getType());
+
+        mockContext.assertIsSatisfied();
+    }
+
+    @Test
+    public void testBuildParamWithDefault() throws Exception {
+        HeaderParam ann =
+            Temp.class.getMethod("setHeaderParamWithDefault", double.class)
+                .getAnnotation(HeaderParam.class);
+        DefaultValue dvAnn =
+            Temp.class.getMethod("setHeaderParamWithDefault", double.class)
+                .getAnnotation(DefaultValue.class);
+
+        final Annotation[] annArray = new Annotation[] {ann, dvAnn};
+
+        mockContext.checking(new Expectations() {
+            {
+                oneOf(metadata).getParamType();
+                will(returnValue(ParamType.HEADER));
+
+                oneOf(metadata).getAnnotations();
+                will(returnValue(annArray));
+
+                oneOf(metadata).getType();
+                will(returnValue(Double.class));
+            }
+        });
+
+        Param p = generator.buildParam(metadata);
+        assertEquals("h2", p.getName());
+        assertEquals(ParamStyle.HEADER, p.getStyle());
+        assertEquals("myDefault", p.getDefault());
+        assertEquals(new QName("http://www.w3.org/2001/XMLSchema", "double"), p.getType());
+
+        assertEquals(0, p.getDoc().size());
+        assertEquals(0, p.getAny().size());
+        assertEquals(0, p.getOtherAttributes().size());
+        assertNull(p.getFixed());
+        assertNull(p.getHref());
+        assertNull(p.getId());
+        assertNull(p.getLink());
+        assertEquals(0, p.getOption().size());
+        assertNull(p.getPath());
+        assertFalse(p.getRepeating());
+        assertFalse(p.getRequired());
+
+        mockContext.assertIsSatisfied();
+    }
+}



Mime
View raw message