blob: be958bcaa9273274f9db659a53d703b17952ae11 [file] [log] [blame]
Kelly O'Hairbc113af2012-03-06 16:09:35 -08001/*
Miroslav Kos91a27902013-04-09 14:51:13 +01002 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
Kelly O'Hairbc113af2012-03-06 16:09:35 -08003 * 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;
27
28import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible;
29import com.sun.tools.internal.ws.api.wsdl.TWSDLExtension;
30import com.sun.tools.internal.ws.wsdl.framework.*;
31import org.xml.sax.Locator;
32
33import javax.xml.namespace.QName;
34
35/**
36 * Entity corresponding to the "fault" child element of a port type operation.
37 *
38 * @author WS Development Team
39 */
40public class Fault extends Entity implements TWSDLExtensible {
41
42 public Fault(Locator locator) {
43 super(locator);
44 _helper = new ExtensibilityHelper();
45 }
46
47 public String getName() {
48 return _name;
49 }
50
51 public void setName(String name) {
52 _name = name;
53 }
54
55 public QName getMessage() {
56 return _message;
57 }
58
59 public void setMessage(QName n) {
60 _message = n;
61 }
62
63 public Message resolveMessage(AbstractDocument document) {
64 return (Message) document.find(Kinds.MESSAGE, _message);
65 }
66
Miroslav Kos91a27902013-04-09 14:51:13 +010067 @Override
Kelly O'Hairbc113af2012-03-06 16:09:35 -080068 public QName getElementName() {
69 return WSDLConstants.QNAME_FAULT;
70 }
71
72 public Documentation getDocumentation() {
73 return _documentation;
74 }
75
76 public void setDocumentation(Documentation d) {
77 _documentation = d;
78 }
79
Miroslav Kos91a27902013-04-09 14:51:13 +010080 @Override
Kelly O'Hairbc113af2012-03-06 16:09:35 -080081 public void withAllQNamesDo(QNameAction action) {
82 if (_message != null) {
83 action.perform(_message);
84 }
85 }
86
Miroslav Kos91a27902013-04-09 14:51:13 +010087 @Override
Kelly O'Hairbc113af2012-03-06 16:09:35 -080088 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
Miroslav Kos91a27902013-04-09 14:51:13 +0100100 @Override
Kelly O'Hairbc113af2012-03-06 16:09:35 -0800101 public void validateThis() {
102 if (_name == null) {
103 failValidation("validation.missingRequiredAttribute", "name");
104 }
105 if (_message == null) {
106 failValidation("validation.missingRequiredAttribute", "message");
107 }
108 }
109
110 private Documentation _documentation;
111 private String _name;
112 private QName _message;
113 private String _action;
114 private ExtensibilityHelper _helper;
115
Miroslav Kos91a27902013-04-09 14:51:13 +0100116 @Override
Kelly O'Hairbc113af2012-03-06 16:09:35 -0800117 public String getNameValue() {
118 return getName();
119 }
120
Miroslav Kos91a27902013-04-09 14:51:13 +0100121 @Override
Kelly O'Hairbc113af2012-03-06 16:09:35 -0800122 public String getNamespaceURI() {
Miroslav Kos91a27902013-04-09 14:51:13 +0100123 return (parent == null) ? null : parent.getNamespaceURI();
Kelly O'Hairbc113af2012-03-06 16:09:35 -0800124 }
125
Miroslav Kos91a27902013-04-09 14:51:13 +0100126 @Override
Kelly O'Hairbc113af2012-03-06 16:09:35 -0800127 public QName getWSDLElementName() {
128 return getElementName();
129 }
130
131 /* (non-Javadoc)
132 * @see TWSDLExtensible#addExtension(ExtensionImpl)
133 */
Miroslav Kos91a27902013-04-09 14:51:13 +0100134 @Override
Kelly O'Hairbc113af2012-03-06 16:09:35 -0800135 public void addExtension(TWSDLExtension e) {
136 _helper.addExtension(e);
137
138 }
139
140 /* (non-Javadoc)
141 * @see TWSDLExtensible#extensions()
142 */
Miroslav Kos91a27902013-04-09 14:51:13 +0100143 @Override
Kelly O'Hairbc113af2012-03-06 16:09:35 -0800144 public Iterable<TWSDLExtension> extensions() {
145 return _helper.extensions();
146 }
147
Miroslav Kos91a27902013-04-09 14:51:13 +0100148 @Override
Kelly O'Hairbc113af2012-03-06 16:09:35 -0800149 public TWSDLExtensible getParent() {
150 return parent;
151 }
152
153
154 public void setParent(TWSDLExtensible parent) {
155 this.parent = parent;
156 }
157
158 private TWSDLExtensible parent;
159
160 public String getAction() {
161 return _action;
162 }
163
164 public void setAction(String _action) {
165 this._action = _action;
166 }
167}