Mercurial > repos > ganjoo > webservice_toolsuite
comparison WebServiceToolWorkflow/lib/SAWADLParser/src/edu/uga/cs/lsdis/meteors/wadls/RequestImpl.java @ 0:d5cd409b8a18 default tip
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
| author | ganjoo |
|---|---|
| date | Tue, 07 Jun 2011 18:00:50 -0400 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:d5cd409b8a18 |
|---|---|
| 1 /* | |
| 2 * (c) Copyright IBM Corp 2001, 2005 | |
| 3 */ | |
| 4 | |
| 5 package edu.uga.cs.lsdis.meteors.wadls; | |
| 6 | |
| 7 import java.util.*; | |
| 8 | |
| 9 import javax.wadls.*; | |
| 10 import javax.wadls.ModelReference; | |
| 11 import javax.xml.namespace.*; | |
| 12 import org.w3c.dom.*; | |
| 13 | |
| 14 /** | |
| 15 * This class represents an input message, and contains the name | |
| 16 * of the input and the message itself. | |
| 17 * | |
| 18 * @author Matthew J. Duftler | |
| 19 */ | |
| 20 public class RequestImpl implements Request | |
| 21 { | |
| 22 protected String name = null; | |
| 23 List<String> inputXSDList = new Vector(); | |
| 24 List<ParamImpl> paramList = new Vector(); | |
| 25 protected List<ModelReference> modelReferences = null; | |
| 26 protected Element docEl = null; | |
| 27 protected Map extensionAttributes = new HashMap(); | |
| 28 protected List nativeAttributeNames = | |
| 29 Arrays.asList(Constants.INPUT_ATTR_NAMES); | |
| 30 | |
| 31 public static final long serialVersionUID = 1; | |
| 32 | |
| 33 /** | |
| 34 * Set the name of this input message. | |
| 35 * | |
| 36 * @param name the desired name | |
| 37 */ | |
| 38 public void setName(String name) | |
| 39 { | |
| 40 this.name = name; | |
| 41 } | |
| 42 public List<ModelReference> getModelReferences() { | |
| 43 return modelReferences; | |
| 44 } | |
| 45 | |
| 46 public void setModelReferences(List<ModelReference> refs) { | |
| 47 modelReferences = refs; | |
| 48 } | |
| 49 public ModelReference getModelReference(){ | |
| 50 if(modelReferences == null) | |
| 51 return null; | |
| 52 return modelReferences.get(0); | |
| 53 } | |
| 54 | |
| 55 /** | |
| 56 * Set the modelReference. | |
| 57 * | |
| 58 * @param modelReference The desired modelReference. | |
| 59 */ | |
| 60 public void addModelReference(ModelReference modelReference){ | |
| 61 if(modelReferences == null) | |
| 62 modelReferences = new ArrayList<ModelReference>(); | |
| 63 modelReferences.add(0, modelReference); | |
| 64 } | |
| 65 /** | |
| 66 * Get the name of this input message. | |
| 67 * | |
| 68 * @return the input message name | |
| 69 */ | |
| 70 public String getName() | |
| 71 { | |
| 72 return name; | |
| 73 } | |
| 74 | |
| 75 public void setInputXSDList(List inputXSDList){ | |
| 76 this.inputXSDList=inputXSDList; | |
| 77 } | |
| 78 public List getInputXSDList(){ | |
| 79 | |
| 80 return this.inputXSDList; | |
| 81 } | |
| 82 | |
| 83 | |
| 84 public void setParamList(List paramList){ | |
| 85 this.paramList=paramList; | |
| 86 } | |
| 87 public List getParamList(){ | |
| 88 | |
| 89 return this.paramList; | |
| 90 } | |
| 91 | |
| 92 /** | |
| 93 * Set the documentation element for this document. This dependency | |
| 94 * on org.w3c.dom.Element should eventually be removed when a more | |
| 95 * appropriate way of representing this information is employed. | |
| 96 * | |
| 97 * @param docEl the documentation element | |
| 98 */ | |
| 99 public void setDocumentationElement(Element docEl) | |
| 100 { | |
| 101 this.docEl = docEl; | |
| 102 } | |
| 103 | |
| 104 /** | |
| 105 * Get the documentation element. This dependency on org.w3c.dom.Element | |
| 106 * should eventually be removed when a more appropriate way of | |
| 107 * representing this information is employed. | |
| 108 * | |
| 109 * @return the documentation element | |
| 110 */ | |
| 111 public Element getDocumentationElement() | |
| 112 { | |
| 113 return docEl; | |
| 114 } | |
| 115 | |
| 116 /** | |
| 117 * Set an extension attribute on this element. Pass in a null value to remove | |
| 118 * an extension attribute. | |
| 119 * | |
| 120 * @param name the extension attribute name | |
| 121 * @param value the extension attribute value. Can be a String, a QName, a | |
| 122 * List of Strings, or a List of QNames. | |
| 123 * | |
| 124 * @see #getExtensionAttribute | |
| 125 * @see #getExtensionAttributes | |
| 126 * @see ExtensionRegistry#registerExtensionAttributeType | |
| 127 * @see ExtensionRegistry#queryExtensionAttributeType | |
| 128 */ | |
| 129 public void setExtensionAttribute(QName name, Object value) | |
| 130 { | |
| 131 if (value != null) | |
| 132 { | |
| 133 extensionAttributes.put(name, value); | |
| 134 } | |
| 135 else | |
| 136 { | |
| 137 extensionAttributes.remove(name); | |
| 138 } | |
| 139 } | |
| 140 | |
| 141 /** | |
| 142 * Retrieve an extension attribute from this element. If the extension | |
| 143 * attribute is not defined, null is returned. | |
| 144 * | |
| 145 * @param name the extension attribute name | |
| 146 * | |
| 147 * @return the value of the extension attribute, or null if | |
| 148 * it is not defined. Can be a String, a QName, a List of Strings, or a List | |
| 149 * of QNames. | |
| 150 * | |
| 151 * @see #setExtensionAttribute | |
| 152 * @see #getExtensionAttributes | |
| 153 * @see ExtensionRegistry#registerExtensionAttributeType | |
| 154 * @see ExtensionRegistry#queryExtensionAttributeType | |
| 155 */ | |
| 156 public Object getExtensionAttribute(QName name) | |
| 157 { | |
| 158 return extensionAttributes.get(name); | |
| 159 } | |
| 160 | |
| 161 /** | |
| 162 * Get the map containing all the extension attributes defined | |
| 163 * on this element. The keys are the qnames of the attributes. | |
| 164 * | |
| 165 * @return a map containing all the extension attributes defined | |
| 166 * on this element | |
| 167 * | |
| 168 * @see #setExtensionAttribute | |
| 169 * @see #getExtensionAttribute | |
| 170 */ | |
| 171 public Map getExtensionAttributes() | |
| 172 { | |
| 173 return extensionAttributes; | |
| 174 } | |
| 175 | |
| 176 /** | |
| 177 * Get the list of local attribute names defined for this element in | |
| 178 * the WSDL specification. | |
| 179 * | |
| 180 * @return a List of Strings, one for each local attribute name | |
| 181 */ | |
| 182 public List getNativeAttributeNames() | |
| 183 { | |
| 184 return nativeAttributeNames; | |
| 185 } | |
| 186 | |
| 187 public String toString() | |
| 188 { | |
| 189 StringBuffer strBuf = new StringBuffer(); | |
| 190 | |
| 191 strBuf.append("Input: name=" + name); | |
| 192 | |
| 193 Iterator keys = extensionAttributes.keySet().iterator(); | |
| 194 | |
| 195 while (keys.hasNext()) | |
| 196 { | |
| 197 QName name = (QName)keys.next(); | |
| 198 | |
| 199 strBuf.append("\nextension attribute: " + name + "=" + | |
| 200 extensionAttributes.get(name)); | |
| 201 } | |
| 202 | |
| 203 return strBuf.toString(); | |
| 204 } | |
| 205 } |
