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.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 org.xml.sax.Locator;
34 import javax.xml.namespace.QName;
35 import java.util.ArrayList;
36 import java.util.Iterator;
37 import java.util.List;
39 /**
40 * Entity corresponding to the "service" WSDL element.
41 *
42 * @author WS Development Team
43 */
44 public class Service extends GlobalEntity implements TWSDLExtensible {
46 public Service(Defining defining, Locator locator, ErrorReceiver errReceiver) {
47 super(defining, locator, errReceiver);
48 _ports = new ArrayList();
49 _helper = new ExtensibilityHelper();
50 }
52 public void add(Port port) {
53 port.setService(this);
54 _ports.add(port);
55 }
57 public Iterator <Port> ports() {
58 return _ports.iterator();
59 }
61 public Kind getKind() {
62 return Kinds.SERVICE;
63 }
65 public QName getElementName() {
66 return WSDLConstants.QNAME_SERVICE;
67 }
69 public Documentation getDocumentation() {
70 return _documentation;
71 }
73 public void setDocumentation(Documentation d) {
74 _documentation = d;
75 }
77 public void withAllSubEntitiesDo(EntityAction action) {
78 for (Iterator iter = _ports.iterator(); iter.hasNext();) {
79 action.perform((Entity) iter.next());
80 }
81 _helper.withAllSubEntitiesDo(action);
82 }
84 public void accept(WSDLDocumentVisitor visitor) throws Exception {
85 visitor.preVisit(this);
86 for (Iterator iter = _ports.iterator(); iter.hasNext();) {
87 ((Port) iter.next()).accept(visitor);
88 }
89 _helper.accept(visitor);
90 visitor.postVisit(this);
91 }
93 public void validateThis() {
94 if (getName() == null) {
95 failValidation("validation.missingRequiredAttribute", "name");
96 }
97 }
99 public String getNameValue() {
100 return getName();
101 }
103 public String getNamespaceURI() {
104 return getDefining().getTargetNamespaceURI();
105 }
107 public QName getWSDLElementName() {
108 return getElementName();
109 }
111 public void addExtension(TWSDLExtension e) {
112 _helper.addExtension(e);
113 }
115 public Iterable<TWSDLExtension> extensions() {
116 return _helper.extensions();
117 }
119 public TWSDLExtensible getParent() {
120 return null; //To change body of implemented methods use File | Settings | File Templates.
121 }
123 private ExtensibilityHelper _helper;
124 private Documentation _documentation;
125 private List <Port> _ports;
126 }