1/* 2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26package com.sun.tools.internal.ws.wsdl.document.jaxws; 27 28import com.sun.tools.internal.ws.wsdl.framework.ExtensionImpl; 29import org.w3c.dom.Element; 30import org.xml.sax.Locator; 31 32import javax.xml.namespace.QName; 33import java.util.*; 34 35 36/** 37 * @author Vivek Pandey 38 * 39 * To change the template for this generated type comment go to 40 * Window>Preferences>Java>Code Generation>Code and Comments 41 */ 42public class JAXWSBinding extends ExtensionImpl { 43 44 /** 45 * 46 */ 47 public JAXWSBinding(Locator locator){ 48 super(locator); 49 jaxbBindings = new HashSet<Element>(); 50 // TODO Auto-generated constructor stub 51 } 52 53 54 /* (non-Javadoc) 55 * @see Entity#validateThis() 56 */ 57 public void validateThis(){ 58 // TODO Auto-generated method stub 59 60 } 61 62 /* (non-Javadoc) 63 * @see Elemental#getElementName() 64 */ 65 public QName getElementName(){ 66 // TODO Auto-generated method stub 67 return JAXWSBindingsConstants.JAXWS_BINDINGS; 68 } 69 70 public QName getWSDLElementName() { 71 return getElementName(); 72 } 73 74 /* (non-Javadoc) 75 * @see TWSDLExtensible#addExtension(ExtensionImpl) 76 */ 77 public void addExtension(ExtensionImpl e) { 78 // TODO Auto-generated method stub 79 80 } 81 82 /* (non-Javadoc) 83 * @see TWSDLExtensible#extensions() 84 */ 85 public Iterable<ExtensionImpl> extensions() { 86 // TODO Auto-generated method stub 87 return null; 88 } 89 90 91// /** 92// * @return Returns the enableAdditionalHeaderMapping. 93// */ 94// public Boolean isEnableAdditionalHeaderMapping() { 95// return enableAdditionalHeaderMapping; 96// } 97// /** 98// * @param enableAdditionalHeaderMapping The enableAdditionalHeaderMapping to set. 99// */ 100// public void setEnableAdditionalHeaderMapping( 101// Boolean enableAdditionalHeaderMapping) { 102// this.enableAdditionalHeaderMapping = enableAdditionalHeaderMapping; 103// } 104 /** 105 * @return Returns the enableAsyncMapping. 106 */ 107 public Boolean isEnableAsyncMapping() { 108 return enableAsyncMapping; 109 } 110 /** 111 * @param enableAsyncMapping The enableAsyncMapping to set. 112 */ 113 public void setEnableAsyncMapping(Boolean enableAsyncMapping) { 114 this.enableAsyncMapping = enableAsyncMapping; 115 } 116 /** 117 * @return Returns the enableMimeContentMapping. 118 */ 119 public Boolean isEnableMimeContentMapping() { 120 return enableMimeContentMapping; 121 } 122 /** 123 * @param enableMimeContentMapping The enableMimeContentMapping to set. 124 */ 125 public void setEnableMimeContentMapping(Boolean enableMimeContentMapping) { 126 this.enableMimeContentMapping = enableMimeContentMapping; 127 } 128 /** 129 * @return Returns the enableWrapperStyle. 130 */ 131 public Boolean isEnableWrapperStyle() { 132 return enableWrapperStyle; 133 } 134 /** 135 * @param enableWrapperStyle The enableWrapperStyle to set. 136 */ 137 public void setEnableWrapperStyle(Boolean enableWrapperStyle) { 138 this.enableWrapperStyle = enableWrapperStyle; 139 } 140 /** 141 * @return Returns the jaxwsPackage. 142 */ 143 public CustomName getJaxwsPackage() { 144 return jaxwsPackage; 145 } 146 /** 147 * @param jaxwsPackage The jaxwsPackage to set. 148 */ 149 public void setJaxwsPackage(CustomName jaxwsPackage) { 150 this.jaxwsPackage = jaxwsPackage; 151 } 152 /** 153 * @return Returns the node. 154 */ 155 public String getNode() { 156 return node; 157 } 158 /** 159 * @param node The node to set. 160 */ 161 public void setNode(String node) { 162 this.node = node; 163 } 164 /** 165 * @return Returns the version. 166 */ 167 public String getVersion() { 168 return version; 169 } 170 /** 171 * @param version The version to set. 172 */ 173 public void setVersion(String version) { 174 this.version = version; 175 } 176 177 /** 178 * @return Returns the wsdlLocation. 179 */ 180 public String getWsdlLocation() { 181 return wsdlLocation; 182 } 183 184 /** 185 * @param wsdlLocation The wsdlLocation to set. 186 */ 187 public void setWsdlLocation(String wsdlLocation) { 188 this.wsdlLocation = wsdlLocation; 189 } 190 191 /** 192 * @return Returns the wsdlNamespace. 193 */ 194 public String getWsdlNamespace() { 195 return wsdlNamespace; 196 } 197 198 199 /** 200 * @param wsdlNamespace The wsdlNamespace to set. 201 */ 202 public void setWsdlNamespace(String wsdlNamespace) { 203 this.wsdlNamespace = wsdlNamespace; 204 } 205 206 /** 207 * @return Returns the jaxbBindings. 208 */ 209 public Set<Element> getJaxbBindings() { 210 return jaxbBindings; 211 } 212 213 /** 214 * @param jaxbBinding The jaxbBindings to set. 215 */ 216 public void addJaxbBindings(Element jaxbBinding) { 217 if(jaxbBindings == null) 218 return; 219 this.jaxbBindings.add(jaxbBinding); 220 } 221 222 223 /** 224 * @return the isProvider. 225 */ 226 public Boolean isProvider() { 227 return isProvider; 228 } 229 /** 230 * @param isProvider The isProvider to set. 231 */ 232 public void setProvider(Boolean isProvider) { 233 this.isProvider = isProvider; 234 } 235 236 /** 237 * @return Returns the methodName. 238 */ 239 public CustomName getMethodName() { 240 return methodName; 241 } 242 /** 243 * @param methodName The methodName to set. 244 */ 245 public void setMethodName(CustomName methodName) { 246 this.methodName = methodName; 247 } 248 249 /** 250 * @return Returns the parameter. 251 */ 252 public Iterator<Parameter> parameters() { 253 return parameters.iterator(); 254 } 255 256 /** 257 * @param parameter The parameter to set. 258 */ 259 public void addParameter(Parameter parameter) { 260 if(parameters == null) 261 parameters = new ArrayList<Parameter>(); 262 parameters.add(parameter); 263 } 264 265 public String getParameterName(String msgName, String wsdlPartName, QName element, boolean wrapperStyle){ 266 if(msgName == null || wsdlPartName == null || element == null || parameters == null) 267 return null; 268 for(Parameter param : parameters){ 269 if(param.getMessageName().equals(msgName) && param.getPart().equals(wsdlPartName)){ 270 if(wrapperStyle && (param.getElement() != null)){ 271 if(param.getElement().equals(element)) 272 return param.getName(); 273 }else if(!wrapperStyle){ 274 return param.getName(); 275 } 276 } 277 } 278 return null; 279 } 280 281 /** 282 * @return Returns the className. 283 */ 284 public CustomName getClassName() { 285 return className; 286 } 287 /** 288 * @param className The className to set. 289 */ 290 public void setClassName(CustomName className) { 291 this.className = className; 292 } 293 294 private String wsdlNamespace; 295 private String wsdlLocation; 296 private String node; 297 private String version; 298 299 private CustomName jaxwsPackage; 300 private List<Parameter> parameters; 301 private Boolean enableWrapperStyle; 302 private Boolean enableAsyncMapping; 303// private Boolean enableAdditionalHeaderMapping; 304 private Boolean enableMimeContentMapping; 305 private Boolean isProvider; 306 307 private Set<Element> jaxbBindings; 308 309 // portType className 310 private CustomName className; 311 312 //portType WSDLOperation 313 private CustomName methodName; 314} 315