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.tools.internal.ws.wsdl.document;
28 import com.sun.tools.internal.ws.wsdl.framework.Entity;
29 import com.sun.tools.internal.ws.wsdl.framework.EntityReferenceAction;
30 import com.sun.tools.internal.ws.wsdl.framework.Kind;
31 import com.sun.tools.internal.ws.wsdl.framework.QNameAction;
32 import org.xml.sax.Locator;
34 import javax.jws.WebParam.Mode;
35 import javax.xml.namespace.QName;
37 /**
38 * Entity corresponding to a WSDL message part.
39 *
40 * @author WS Development Team
41 */
42 public class MessagePart extends Entity {
44 public static final int SOAP_BODY_BINDING = 1;
45 public static final int SOAP_HEADER_BINDING = 2;
46 public static final int SOAP_HEADERFAULT_BINDING = 3;
47 public static final int SOAP_FAULT_BINDING = 4;
48 public static final int WSDL_MIME_BINDING = 5;
49 public static final int PART_NOT_BOUNDED = -1;
51 public MessagePart(Locator locator) {
52 super(locator);
53 }
55 public String getName() {
56 return _name;
57 }
59 public void setName(String name) {
60 _name = name;
61 }
63 public QName getDescriptor() {
64 return _descriptor;
65 }
67 public void setDescriptor(QName n) {
68 _descriptor = n;
69 }
71 public Kind getDescriptorKind() {
72 return _descriptorKind;
73 }
75 public void setDescriptorKind(Kind k) {
76 _descriptorKind = k;
77 }
79 public QName getElementName() {
80 return WSDLConstants.QNAME_PART;
81 }
83 public int getBindingExtensibilityElementKind(){
84 return _bindingKind;
85 }
87 public void setBindingExtensibilityElementKind(int kind) {
88 _bindingKind = kind;
89 }
91 public void withAllQNamesDo(QNameAction action) {
92 if (_descriptor != null) {
93 action.perform(_descriptor);
94 }
95 }
97 public void withAllEntityReferencesDo(EntityReferenceAction action) {
98 super.withAllEntityReferencesDo(action);
99 if (_descriptor != null && _descriptorKind != null) {
100 action.perform(_descriptorKind, _descriptor);
101 }
102 }
104 public void accept(WSDLDocumentVisitor visitor) throws Exception {
105 visitor.visit(this);
106 }
108 public void validateThis() {
109 if(_descriptor != null && _descriptor.getLocalPart().equals("")){
110 failValidation("validation.invalidElement", _descriptor.toString());
111 }
112 }
114 public void setMode(Mode mode){
115 this.mode = mode;
116 }
118 public Mode getMode(){
119 return mode;
120 }
122 public boolean isINOUT(){
123 if(mode!=null)
124 return (mode == Mode.INOUT);
125 return false;
126 }
128 public boolean isIN(){
129 if(mode!=null)
130 return (mode == Mode.IN);
131 return false;
132 }
134 public boolean isOUT(){
135 if(mode!=null)
136 return (mode == Mode.OUT);
137 return false;
138 }
140 public void setReturn(boolean ret){
141 isRet=ret;
142 }
144 public boolean isReturn(){
145 return isRet;
146 }
149 private boolean isRet;
150 private String _name;
151 private QName _descriptor;
152 private Kind _descriptorKind;
153 private int _bindingKind;
155 private Mode mode;
156 }