0N/A/*
0N/A * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
2362N/A * under the terms of the GNU General Public License version 2 only, as
0N/A * published by the Free Software Foundation. Oracle designates this
2362N/A * particular file as subject to the "Classpath" exception as provided
0N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2362N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
0N/A * questions.
0N/A */
0N/A
0N/Apackage com.sun.tools.internal.ws.wsdl.document;
0N/A
0N/Aimport com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible;
0N/Aimport com.sun.tools.internal.ws.api.wsdl.TWSDLExtension;
0N/Aimport com.sun.tools.internal.ws.wsdl.framework.*;
0N/Aimport com.sun.tools.internal.ws.wscompile.ErrorReceiver;
0N/Aimport org.xml.sax.Locator;
3984N/A
0N/Aimport javax.xml.namespace.QName;
0N/Aimport java.util.ArrayList;
0N/Aimport java.util.Iterator;
0N/Aimport java.util.List;
0N/A
0N/A/**
0N/A * Entity corresponding to the "service" WSDL element.
0N/A *
0N/A * @author WS Development Team
0N/A */
0N/Apublic class Service extends GlobalEntity implements TWSDLExtensible {
0N/A
0N/A public Service(Defining defining, Locator locator, ErrorReceiver errReceiver) {
0N/A super(defining, locator, errReceiver);
0N/A _ports = new ArrayList();
0N/A _helper = new ExtensibilityHelper();
0N/A }
0N/A
0N/A public void add(Port port) {
0N/A port.setService(this);
0N/A _ports.add(port);
0N/A }
0N/A
0N/A public Iterator <Port> ports() {
0N/A return _ports.iterator();
0N/A }
0N/A
0N/A public Kind getKind() {
0N/A return Kinds.SERVICE;
0N/A }
0N/A
0N/A public QName getElementName() {
0N/A return WSDLConstants.QNAME_SERVICE;
0N/A }
0N/A
0N/A public Documentation getDocumentation() {
0N/A return _documentation;
0N/A }
0N/A
0N/A public void setDocumentation(Documentation d) {
0N/A _documentation = d;
0N/A }
0N/A
0N/A public void withAllSubEntitiesDo(EntityAction action) {
0N/A for (Iterator iter = _ports.iterator(); iter.hasNext();) {
0N/A action.perform((Entity) iter.next());
0N/A }
0N/A _helper.withAllSubEntitiesDo(action);
0N/A }
0N/A
0N/A public void accept(WSDLDocumentVisitor visitor) throws Exception {
0N/A visitor.preVisit(this);
0N/A for (Iterator iter = _ports.iterator(); iter.hasNext();) {
0N/A ((Port) iter.next()).accept(visitor);
0N/A }
0N/A _helper.accept(visitor);
0N/A visitor.postVisit(this);
0N/A }
0N/A
0N/A public void validateThis() {
0N/A if (getName() == null) {
0N/A failValidation("validation.missingRequiredAttribute", "name");
0N/A }
0N/A }
0N/A
0N/A public String getNameValue() {
0N/A return getName();
0N/A }
0N/A
0N/A public String getNamespaceURI() {
0N/A return getDefining().getTargetNamespaceURI();
0N/A }
0N/A
0N/A public QName getWSDLElementName() {
0N/A return getElementName();
0N/A }
0N/A
0N/A public void addExtension(TWSDLExtension e) {
0N/A _helper.addExtension(e);
0N/A }
0N/A
0N/A public Iterable<TWSDLExtension> extensions() {
0N/A return _helper.extensions();
0N/A }
0N/A
0N/A public TWSDLExtensible getParent() {
0N/A return null; //To change body of implemented methods use File | Settings | File Templates.
0N/A }
0N/A
0N/A private ExtensibilityHelper _helper;
0N/A private Documentation _documentation;
0N/A private List <Port> _ports;
0N/A}
0N/A