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

Thu, 31 Aug 2017 15:18:52 +0800

author
aoqi
date
Thu, 31 Aug 2017 15:18:52 +0800
changeset 637
9c07ef4934dd
parent 368
0989ad8c0860
parent 0
373ffda63c9a
permissions
-rw-r--r--

merge

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

mercurial