Tue, 06 Mar 2012 16:09:35 -0800
7150322: Stop using drop source bundles in jaxws
Reviewed-by: darcy, ohrstrom
1 /*
2 * Copyright (c) 1997, 2010, 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 */
26 package com.sun.xml.internal.ws.model.wsdl;
28 import com.sun.istack.internal.NotNull;
29 import com.sun.xml.internal.ws.api.model.wsdl.WSDLFault;
30 import com.sun.xml.internal.ws.api.model.wsdl.WSDLOperation;
31 import com.sun.xml.internal.ws.api.model.wsdl.WSDLPortType;
32 import com.sun.xml.internal.ws.util.QNameMap;
34 import javax.xml.namespace.QName;
35 import javax.xml.stream.XMLStreamReader;
36 import java.util.ArrayList;
37 import java.util.HashMap;
38 import java.util.List;
39 import java.util.Map;
41 /**
42 * Implementaiton of {@link WSDLOperation}
43 *
44 * @author Vivek Pandey
45 */
46 public final class WSDLOperationImpl extends AbstractExtensibleImpl implements WSDLOperation {
47 private final QName name;
48 private String parameterOrder;
49 private WSDLInputImpl input;
50 private WSDLOutputImpl output;
51 private final List<WSDLFaultImpl> faults;
52 private final QNameMap<WSDLFaultImpl> faultMap;
53 protected Iterable<WSDLMessageImpl> messages;
54 private final WSDLPortType owner;
56 public WSDLOperationImpl(XMLStreamReader xsr,WSDLPortTypeImpl owner, QName name) {
57 super(xsr);
58 this.name = name;
59 this.faults = new ArrayList<WSDLFaultImpl>();
60 this.faultMap = new QNameMap<WSDLFaultImpl>();
61 this.owner = owner;
62 }
64 public QName getName() {
65 return name;
66 }
68 public String getParameterOrder() {
69 return parameterOrder;
70 }
72 public void setParameterOrder(String parameterOrder) {
73 this.parameterOrder = parameterOrder;
74 }
76 public WSDLInputImpl getInput() {
77 return input;
78 }
80 public void setInput(WSDLInputImpl input) {
81 this.input = input;
82 }
84 public WSDLOutputImpl getOutput() {
85 return output;
86 }
88 public boolean isOneWay() {
89 return output == null;
90 }
92 public void setOutput(WSDLOutputImpl output) {
93 this.output = output;
94 }
96 public Iterable<WSDLFaultImpl> getFaults() {
97 return faults;
98 }
100 public WSDLFault getFault(QName faultDetailName) {
101 WSDLFaultImpl fault = faultMap.get(faultDetailName);
102 if(fault != null)
103 return fault;
105 for(WSDLFaultImpl fi:faults){
106 assert fi.getMessage().parts().iterator().hasNext();
107 WSDLPartImpl part = fi.getMessage().parts().iterator().next();
108 if(part.getDescriptor().name().equals(faultDetailName)){
109 faultMap.put(faultDetailName, fi);
110 return fi;
111 }
112 }
113 return null;
114 }
116 WSDLPortType getOwner() {
117 return owner;
118 }
120 @NotNull
121 public QName getPortTypeName() {
122 return owner.getName();
123 }
125 public void addFault(WSDLFaultImpl fault) {
126 faults.add(fault);
127 }
129 public void freez(WSDLModelImpl root) {
130 assert input != null;
131 input.freeze(root);
132 if(output != null)
133 output.freeze(root);
134 for(WSDLFaultImpl fault : faults){
135 fault.freeze(root);
136 }
137 }
138 }