|
1 /* |
|
2 * Copyright (c) 1997, 2012, 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 |
|
26 package com.sun.tools.internal.ws.wsdl.document; |
|
27 |
|
28 import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible; |
|
29 import com.sun.tools.internal.ws.api.wsdl.TWSDLExtension; |
|
30 import com.sun.tools.internal.ws.wsdl.framework.*; |
|
31 import com.sun.tools.internal.ws.wscompile.ErrorReceiver; |
|
32 import com.sun.tools.internal.ws.wscompile.AbortException; |
|
33 import com.sun.tools.internal.ws.resources.WsdlMessages; |
|
34 import org.xml.sax.Locator; |
|
35 |
|
36 import javax.xml.namespace.QName; |
|
37 |
|
38 /** |
|
39 * Entity corresponding to the "output" child element of a port type operation. |
|
40 * |
|
41 * @author WS Development Team |
|
42 */ |
|
43 public class Output extends Entity implements TWSDLExtensible { |
|
44 |
|
45 public Output(Locator locator, ErrorReceiver errReceiver) { |
|
46 super(locator); |
|
47 this.errorReceiver = errReceiver; |
|
48 } |
|
49 |
|
50 public String getName() { |
|
51 return _name; |
|
52 } |
|
53 |
|
54 public void setName(String name) { |
|
55 _name = name; |
|
56 } |
|
57 |
|
58 public QName getMessage() { |
|
59 return _message; |
|
60 } |
|
61 |
|
62 public void setMessage(QName n) { |
|
63 _message = n; |
|
64 } |
|
65 |
|
66 public Message resolveMessage(AbstractDocument document) { |
|
67 return (Message) document.find(Kinds.MESSAGE, _message); |
|
68 } |
|
69 |
|
70 public QName getElementName() { |
|
71 return WSDLConstants.QNAME_OUTPUT; |
|
72 } |
|
73 |
|
74 public Documentation getDocumentation() { |
|
75 return _documentation; |
|
76 } |
|
77 |
|
78 public void setDocumentation(Documentation d) { |
|
79 _documentation = d; |
|
80 } |
|
81 |
|
82 public void withAllQNamesDo(QNameAction action) { |
|
83 if (_message != null) { |
|
84 action.perform(_message); |
|
85 } |
|
86 } |
|
87 |
|
88 public void withAllEntityReferencesDo(EntityReferenceAction action) { |
|
89 super.withAllEntityReferencesDo(action); |
|
90 if (_message != null) { |
|
91 action.perform(Kinds.MESSAGE, _message); |
|
92 } |
|
93 } |
|
94 |
|
95 public void accept(WSDLDocumentVisitor visitor) throws Exception { |
|
96 visitor.preVisit(this); |
|
97 visitor.postVisit(this); |
|
98 } |
|
99 |
|
100 public void validateThis() { |
|
101 if (_message == null) { |
|
102 errorReceiver.error(getLocator(), WsdlMessages.VALIDATION_MISSING_REQUIRED_ATTRIBUTE("name", "wsdl:message")); |
|
103 throw new AbortException(); |
|
104 } |
|
105 } |
|
106 |
|
107 private Documentation _documentation; |
|
108 private String _name; |
|
109 private QName _message; |
|
110 private String _action; |
|
111 private ExtensibilityHelper _helper; |
|
112 private TWSDLExtensible parent; |
|
113 |
|
114 public void addExtension(TWSDLExtension e) { |
|
115 _helper.addExtension(e); |
|
116 } |
|
117 |
|
118 public QName getWSDLElementName() { |
|
119 return getElementName(); |
|
120 } |
|
121 |
|
122 public TWSDLExtensible getParent() { |
|
123 return parent; |
|
124 } |
|
125 |
|
126 public void setParent(TWSDLExtensible parent) { |
|
127 this.parent = parent; |
|
128 } |
|
129 |
|
130 public String getNamespaceURI() { |
|
131 return getElementName().getNamespaceURI(); |
|
132 } |
|
133 |
|
134 public String getNameValue() { |
|
135 return null; |
|
136 } |
|
137 |
|
138 public Iterable<? extends TWSDLExtension> extensions() { |
|
139 return _helper.extensions(); |
|
140 } |
|
141 |
|
142 public String getAction() { |
|
143 return _action; |
|
144 } |
|
145 |
|
146 public void setAction(String _action) { |
|
147 this._action = _action; |
|
148 } |
|
149 } |