Kelly O'Hair | bc113af | 2012-03-06 16:09:35 -0800 | [diff] [blame] | 1 | /* |
Miroslav Kos | 91a2790 | 2013-04-09 14:51:13 +0100 | [diff] [blame] | 2 | * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. |
Kelly O'Hair | bc113af | 2012-03-06 16:09:35 -0800 | [diff] [blame] | 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 org.xml.sax.Locator; |
| 32 | |
| 33 | import 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 | */ |
| 40 | public 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 Kos | 91a2790 | 2013-04-09 14:51:13 +0100 | [diff] [blame] | 67 | @Override |
Kelly O'Hair | bc113af | 2012-03-06 16:09:35 -0800 | [diff] [blame] | 68 | 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 Kos | 91a2790 | 2013-04-09 14:51:13 +0100 | [diff] [blame] | 80 | @Override |
Kelly O'Hair | bc113af | 2012-03-06 16:09:35 -0800 | [diff] [blame] | 81 | public void withAllQNamesDo(QNameAction action) { |
| 82 | if (_message != null) { |
| 83 | action.perform(_message); |
| 84 | } |
| 85 | } |
| 86 | |
Miroslav Kos | 91a2790 | 2013-04-09 14:51:13 +0100 | [diff] [blame] | 87 | @Override |
Kelly O'Hair | bc113af | 2012-03-06 16:09:35 -0800 | [diff] [blame] | 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 | |
Miroslav Kos | 91a2790 | 2013-04-09 14:51:13 +0100 | [diff] [blame] | 100 | @Override |
Kelly O'Hair | bc113af | 2012-03-06 16:09:35 -0800 | [diff] [blame] | 101 | 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 Kos | 91a2790 | 2013-04-09 14:51:13 +0100 | [diff] [blame] | 116 | @Override |
Kelly O'Hair | bc113af | 2012-03-06 16:09:35 -0800 | [diff] [blame] | 117 | public String getNameValue() { |
| 118 | return getName(); |
| 119 | } |
| 120 | |
Miroslav Kos | 91a2790 | 2013-04-09 14:51:13 +0100 | [diff] [blame] | 121 | @Override |
Kelly O'Hair | bc113af | 2012-03-06 16:09:35 -0800 | [diff] [blame] | 122 | public String getNamespaceURI() { |
Miroslav Kos | 91a2790 | 2013-04-09 14:51:13 +0100 | [diff] [blame] | 123 | return (parent == null) ? null : parent.getNamespaceURI(); |
Kelly O'Hair | bc113af | 2012-03-06 16:09:35 -0800 | [diff] [blame] | 124 | } |
| 125 | |
Miroslav Kos | 91a2790 | 2013-04-09 14:51:13 +0100 | [diff] [blame] | 126 | @Override |
Kelly O'Hair | bc113af | 2012-03-06 16:09:35 -0800 | [diff] [blame] | 127 | public QName getWSDLElementName() { |
| 128 | return getElementName(); |
| 129 | } |
| 130 | |
| 131 | /* (non-Javadoc) |
| 132 | * @see TWSDLExtensible#addExtension(ExtensionImpl) |
| 133 | */ |
Miroslav Kos | 91a2790 | 2013-04-09 14:51:13 +0100 | [diff] [blame] | 134 | @Override |
Kelly O'Hair | bc113af | 2012-03-06 16:09:35 -0800 | [diff] [blame] | 135 | public void addExtension(TWSDLExtension e) { |
| 136 | _helper.addExtension(e); |
| 137 | |
| 138 | } |
| 139 | |
| 140 | /* (non-Javadoc) |
| 141 | * @see TWSDLExtensible#extensions() |
| 142 | */ |
Miroslav Kos | 91a2790 | 2013-04-09 14:51:13 +0100 | [diff] [blame] | 143 | @Override |
Kelly O'Hair | bc113af | 2012-03-06 16:09:35 -0800 | [diff] [blame] | 144 | public Iterable<TWSDLExtension> extensions() { |
| 145 | return _helper.extensions(); |
| 146 | } |
| 147 | |
Miroslav Kos | 91a2790 | 2013-04-09 14:51:13 +0100 | [diff] [blame] | 148 | @Override |
Kelly O'Hair | bc113af | 2012-03-06 16:09:35 -0800 | [diff] [blame] | 149 | 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 | } |