src/share/jaxws_classes/com/sun/tools/internal/ws/processor/model/Operation.java

Tue, 06 Mar 2012 16:09:35 -0800

author
ohair
date
Tue, 06 Mar 2012 16:09:35 -0800
changeset 286
f50545b5e2f1
child 368
0989ad8c0860
permissions
-rw-r--r--

7150322: Stop using drop source bundles in jaxws
Reviewed-by: darcy, ohrstrom

ohair@286 1 /*
ohair@286 2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
ohair@286 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
ohair@286 4 *
ohair@286 5 * This code is free software; you can redistribute it and/or modify it
ohair@286 6 * under the terms of the GNU General Public License version 2 only, as
ohair@286 7 * published by the Free Software Foundation. Oracle designates this
ohair@286 8 * particular file as subject to the "Classpath" exception as provided
ohair@286 9 * by Oracle in the LICENSE file that accompanied this code.
ohair@286 10 *
ohair@286 11 * This code is distributed in the hope that it will be useful, but WITHOUT
ohair@286 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
ohair@286 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
ohair@286 14 * version 2 for more details (a copy is included in the LICENSE file that
ohair@286 15 * accompanied this code).
ohair@286 16 *
ohair@286 17 * You should have received a copy of the GNU General Public License version
ohair@286 18 * 2 along with this work; if not, write to the Free Software Foundation,
ohair@286 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
ohair@286 20 *
ohair@286 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ohair@286 22 * or visit www.oracle.com if you need additional information or have any
ohair@286 23 * questions.
ohair@286 24 */
ohair@286 25
ohair@286 26 package com.sun.tools.internal.ws.processor.model;
ohair@286 27
ohair@286 28 import com.sun.tools.internal.ws.processor.model.java.JavaMethod;
ohair@286 29 import com.sun.tools.internal.ws.wsdl.document.soap.SOAPStyle;
ohair@286 30 import com.sun.tools.internal.ws.wsdl.document.soap.SOAPUse;
ohair@286 31 import com.sun.tools.internal.ws.wsdl.framework.Entity;
ohair@286 32 import com.sun.xml.internal.ws.spi.db.BindingHelper;
ohair@286 33
ohair@286 34 import javax.xml.namespace.QName;
ohair@286 35 import java.util.HashSet;
ohair@286 36 import java.util.Iterator;
ohair@286 37 import java.util.Set;
ohair@286 38
ohair@286 39 /**
ohair@286 40 *
ohair@286 41 * @author WS Development Team
ohair@286 42 */
ohair@286 43 public class Operation extends ModelObject {
ohair@286 44
ohair@286 45 public Operation(Entity entity) {
ohair@286 46 super(entity);
ohair@286 47 }
ohair@286 48
ohair@286 49 public Operation(Operation operation, Entity entity){
ohair@286 50 this(operation._name, entity);
ohair@286 51 this._style = operation._style;
ohair@286 52 this._use = operation._use;
ohair@286 53 this.customizedName = operation.customizedName;
ohair@286 54 }
ohair@286 55 public Operation(QName name, Entity entity) {
ohair@286 56 super(entity);
ohair@286 57 _name = name;
ohair@286 58 _uniqueName = name.getLocalPart();
ohair@286 59 _faultNames = new HashSet<String>();
ohair@286 60 _faults = new HashSet<Fault>();
ohair@286 61 }
ohair@286 62
ohair@286 63 public QName getName() {
ohair@286 64 return _name;
ohair@286 65 }
ohair@286 66
ohair@286 67 public void setName(QName n) {
ohair@286 68 _name = n;
ohair@286 69 }
ohair@286 70
ohair@286 71 public String getUniqueName() {
ohair@286 72 return _uniqueName;
ohair@286 73 }
ohair@286 74
ohair@286 75 public void setUniqueName(String s) {
ohair@286 76 _uniqueName = s;
ohair@286 77 }
ohair@286 78
ohair@286 79 public Request getRequest() {
ohair@286 80 return _request;
ohair@286 81 }
ohair@286 82
ohair@286 83 public void setRequest(Request r) {
ohair@286 84 _request = r;
ohair@286 85 }
ohair@286 86
ohair@286 87 public Response getResponse() {
ohair@286 88 return _response;
ohair@286 89 }
ohair@286 90
ohair@286 91 public void setResponse(Response r) {
ohair@286 92 _response = r;
ohair@286 93 }
ohair@286 94
ohair@286 95 public boolean isOverloaded() {
ohair@286 96 return !_name.getLocalPart().equals(_uniqueName);
ohair@286 97 }
ohair@286 98
ohair@286 99 public void addFault(Fault f) {
ohair@286 100 if (_faultNames.contains(f.getName())) {
ohair@286 101 throw new ModelException("model.uniqueness");
ohair@286 102 }
ohair@286 103 _faultNames.add(f.getName());
ohair@286 104 _faults.add(f);
ohair@286 105 }
ohair@286 106
ohair@286 107 public Iterator<Fault> getFaults() {
ohair@286 108 return _faults.iterator();
ohair@286 109 }
ohair@286 110
ohair@286 111 public Set<Fault> getFaultsSet() {
ohair@286 112 return _faults;
ohair@286 113 }
ohair@286 114
ohair@286 115 /* serialization */
ohair@286 116 public void setFaultsSet(Set<Fault> s) {
ohair@286 117 _faults = s;
ohair@286 118 initializeFaultNames();
ohair@286 119 }
ohair@286 120
ohair@286 121 private void initializeFaultNames() {
ohair@286 122 _faultNames = new HashSet<String>();
ohair@286 123 if (_faults != null) {
ohair@286 124 for (Iterator iter = _faults.iterator(); iter.hasNext();) {
ohair@286 125 Fault f = (Fault) iter.next();
ohair@286 126 if (f.getName() != null && _faultNames.contains(f.getName())) {
ohair@286 127 throw new ModelException("model.uniqueness");
ohair@286 128 }
ohair@286 129 _faultNames.add(f.getName());
ohair@286 130 }
ohair@286 131 }
ohair@286 132 }
ohair@286 133
ohair@286 134 public Iterator<Fault> getAllFaults() {
ohair@286 135 Set<Fault> allFaults = getAllFaultsSet();
ohair@286 136 return allFaults.iterator();
ohair@286 137 }
ohair@286 138
ohair@286 139 public Set<Fault> getAllFaultsSet() {
ohair@286 140 Set transSet = new HashSet();
ohair@286 141 transSet.addAll(_faults);
ohair@286 142 Iterator iter = _faults.iterator();
ohair@286 143 Fault fault;
ohair@286 144 Set tmpSet;
ohair@286 145 while (iter.hasNext()) {
ohair@286 146 tmpSet = ((Fault)iter.next()).getAllFaultsSet();
ohair@286 147 transSet.addAll(tmpSet);
ohair@286 148 }
ohair@286 149 return transSet;
ohair@286 150 }
ohair@286 151
ohair@286 152 public int getFaultCount() {
ohair@286 153 return _faults.size();
ohair@286 154 }
ohair@286 155
ohair@286 156 public Set<Block> getAllFaultBlocks(){
ohair@286 157 Set<Block> blocks = new HashSet<Block>();
ohair@286 158 Iterator faults = _faults.iterator();
ohair@286 159 while(faults.hasNext()){
ohair@286 160 Fault f = (Fault)faults.next();
ohair@286 161 blocks.add(f.getBlock());
ohair@286 162 }
ohair@286 163 return blocks;
ohair@286 164 }
ohair@286 165
ohair@286 166 public JavaMethod getJavaMethod() {
ohair@286 167 return _javaMethod;
ohair@286 168 }
ohair@286 169
ohair@286 170 public void setJavaMethod(JavaMethod i) {
ohair@286 171 _javaMethod = i;
ohair@286 172 }
ohair@286 173
ohair@286 174 public String getSOAPAction() {
ohair@286 175 return _soapAction;
ohair@286 176 }
ohair@286 177
ohair@286 178 public void setSOAPAction(String s) {
ohair@286 179 _soapAction = s;
ohair@286 180 }
ohair@286 181
ohair@286 182 public SOAPStyle getStyle() {
ohair@286 183 return _style;
ohair@286 184 }
ohair@286 185
ohair@286 186 public void setStyle(SOAPStyle s) {
ohair@286 187 _style = s;
ohair@286 188 }
ohair@286 189
ohair@286 190 public SOAPUse getUse() {
ohair@286 191 return _use;
ohair@286 192 }
ohair@286 193
ohair@286 194 public void setUse(SOAPUse u) {
ohair@286 195 _use = u;
ohair@286 196 }
ohair@286 197
ohair@286 198 public boolean isWrapped() {
ohair@286 199 return _isWrapped;
ohair@286 200 }
ohair@286 201
ohair@286 202 public void setWrapped(boolean isWrapped) {
ohair@286 203 _isWrapped = isWrapped;
ohair@286 204 }
ohair@286 205
ohair@286 206
ohair@286 207 public void accept(ModelVisitor visitor) throws Exception {
ohair@286 208 visitor.visit(this);
ohair@286 209 }
ohair@286 210
ohair@286 211 public void setCustomizedName(String name){
ohair@286 212 this.customizedName = name;
ohair@286 213 }
ohair@286 214
ohair@286 215 public String getCustomizedName(){
ohair@286 216 return customizedName;
ohair@286 217 }
ohair@286 218
ohair@286 219 public String getJavaMethodName(){
ohair@286 220 //if JavaMethod is created return the name
ohair@286 221 if(_javaMethod != null){
ohair@286 222 return _javaMethod.getName();
ohair@286 223 }
ohair@286 224
ohair@286 225 //return the customized operation name if any without mangling
ohair@286 226 if(customizedName != null){
ohair@286 227 return customizedName;
ohair@286 228 }
ohair@286 229
ohair@286 230 return BindingHelper.mangleNameToVariableName(_name.getLocalPart());
ohair@286 231 }
ohair@286 232
ohair@286 233 public com.sun.tools.internal.ws.wsdl.document.Operation getWSDLPortTypeOperation(){
ohair@286 234 return wsdlOperation;
ohair@286 235 }
ohair@286 236
ohair@286 237 public void setWSDLPortTypeOperation(com.sun.tools.internal.ws.wsdl.document.Operation wsdlOperation){
ohair@286 238 this.wsdlOperation = wsdlOperation;
ohair@286 239 }
ohair@286 240
ohair@286 241
ohair@286 242
ohair@286 243 private String customizedName;
ohair@286 244 private boolean _isWrapped = true;
ohair@286 245 private QName _name;
ohair@286 246 private String _uniqueName;
ohair@286 247 private Request _request;
ohair@286 248 private Response _response;
ohair@286 249 private JavaMethod _javaMethod;
ohair@286 250 private String _soapAction;
ohair@286 251 private SOAPStyle _style = SOAPStyle.DOCUMENT;
ohair@286 252 private SOAPUse _use = SOAPUse.LITERAL;
ohair@286 253 private Set<String> _faultNames;
ohair@286 254 private Set<Fault> _faults;
ohair@286 255 private com.sun.tools.internal.ws.wsdl.document.Operation wsdlOperation;
ohair@286 256
ohair@286 257 }

mercurial