001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common Development
008: * and Distribution License("CDDL") (collectively, the "License"). You
009: * may not use this file except in compliance with the License. You can obtain
010: * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
011: * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
012: * language governing permissions and limitations under the License.
013: *
014: * When distributing the software, include this License Header Notice in each
015: * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
016: * Sun designates this particular file as subject to the "Classpath" exception
017: * as provided by Sun in the GPL Version 2 section of the License file that
018: * accompanied this code. If applicable, add the following below the License
019: * Header, with the fields enclosed by brackets [] replaced by your own
020: * identifying information: "Portions Copyrighted [year]
021: * [name of copyright owner]"
022: *
023: * Contributor(s):
024: *
025: * If you wish your version of this file to be governed by only the CDDL or
026: * only the GPL Version 2, indicate your decision by adding "[Contributor]
027: * elects to include this software in this distribution under the [CDDL or GPL
028: * Version 2] license." If you don't indicate a single choice of license, a
029: * recipient has the option to distribute your version of this file under
030: * either the CDDL, the GPL Version 2 or to extend the choice of license to
031: * its licensees as provided above. However, if you add GPL Version 2 code
032: * and therefore, elected the GPL Version 2 license, then the option applies
033: * only if the new code is made subject to such option by the copyright
034: * holder.
035: */
036: package com.sun.tools.ws.processor.model;
037:
038: import com.sun.codemodel.JClass;
039: import com.sun.tools.ws.processor.generator.GeneratorUtil;
040: import com.sun.tools.ws.processor.model.java.JavaException;
041: import com.sun.tools.ws.wsdl.framework.Entity;
042:
043: import javax.xml.namespace.QName;
044: import java.util.HashSet;
045: import java.util.Iterator;
046: import java.util.Set;
047: import java.util.TreeSet;
048:
049: /**
050: *
051: * @author WS Development Team
052: */
053: public class Fault extends ModelObject {
054:
055: public Fault(Entity entity) {
056: super (entity);
057: }
058:
059: public Fault(String name, Entity entity) {
060: super (entity);
061: this .name = name;
062: parentFault = null;
063: }
064:
065: public String getName() {
066: return name;
067: }
068:
069: public void setName(String s) {
070: name = s;
071: }
072:
073: public Block getBlock() {
074: return block;
075: }
076:
077: public void setBlock(Block b) {
078: block = b;
079: }
080:
081: public JavaException getJavaException() {
082: return javaException;
083: }
084:
085: public void setJavaException(JavaException e) {
086: javaException = e;
087: }
088:
089: public void accept(ModelVisitor visitor) throws Exception {
090: visitor.visit(this );
091: }
092:
093: public Fault getParentFault() {
094: return parentFault;
095: }
096:
097: public Iterator getSubfaults() {
098: if (subfaults.size() == 0) {
099: return null;
100: }
101: return subfaults.iterator();
102: }
103:
104: /* serialization */
105: public Set getSubfaultsSet() {
106: return subfaults;
107: }
108:
109: /* serialization */
110: public void setSubfaultsSet(Set s) {
111: subfaults = s;
112: }
113:
114: public Iterator getAllFaults() {
115: Set allFaults = getAllFaultsSet();
116: if (allFaults.size() == 0) {
117: return null;
118: }
119: return allFaults.iterator();
120: }
121:
122: public Set getAllFaultsSet() {
123: Set transSet = new HashSet();
124: Iterator iter = subfaults.iterator();
125: while (iter.hasNext()) {
126: transSet.addAll(((Fault) iter.next()).getAllFaultsSet());
127: }
128: transSet.addAll(subfaults);
129: return transSet;
130: }
131:
132: public QName getElementName() {
133: return elementName;
134: }
135:
136: public void setElementName(QName elementName) {
137: this .elementName = elementName;
138: }
139:
140: public String getJavaMemberName() {
141: return javaMemberName;
142: }
143:
144: public void setJavaMemberName(String javaMemberName) {
145: this .javaMemberName = javaMemberName;
146: }
147:
148: /**
149: * @return Returns the wsdlFault.
150: */
151: public boolean isWsdlException() {
152: return wsdlException;
153: }
154:
155: /**
156: * @param wsdlFault The wsdlFault to set.
157: */
158: public void setWsdlException(boolean wsdlFault) {
159: this .wsdlException = wsdlFault;
160: }
161:
162: public void setExceptionClass(JClass ex) {
163: exceptionClass = ex;
164: }
165:
166: public JClass getExceptionClass() {
167: return exceptionClass;
168: }
169:
170: private boolean wsdlException = true;
171: private String name;
172: private Block block;
173: private JavaException javaException;
174: private Fault parentFault;
175: private Set subfaults = new HashSet();
176: private QName elementName = null;
177: private String javaMemberName = null;
178: private JClass exceptionClass;
179:
180: public String getWsdlFaultName() {
181: return wsdlFaultName;
182: }
183:
184: public void setWsdlFaultName(String wsdlFaultName) {
185: this .wsdlFaultName = wsdlFaultName;
186: }
187:
188: private String wsdlFaultName;
189: }
|