com.sun.tools.ws.wsdl.document.Definitions Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jaxws-tools Show documentation
Show all versions of jaxws-tools Show documentation
Open source Reference Implementation of JSR-224: Java API for XML Web Services
The newest version!
/*
* Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
package com.sun.tools.ws.wsdl.document;
import com.sun.tools.ws.api.wsdl.TWSDLExtensible;
import com.sun.tools.ws.api.wsdl.TWSDLExtension;
import com.sun.tools.ws.wsdl.framework.*;
import org.xml.sax.Locator;
import javax.xml.namespace.QName;
import java.util.*;
/**
* Entity corresponding to the "definitions" WSDL element.
*
* @author WS Development Team
*/
@SuppressWarnings({"deprecation"})
public class Definitions extends Entity implements Defining, TWSDLExtensible {
public Definitions(AbstractDocument document, Locator locator) {
super(locator);
_document = document;
_bindings = new ArrayList<>();
_imports = new ArrayList<>();
_messages = new ArrayList<>();
_portTypes = new ArrayList<>();
_services = new ArrayList<>();
_importedNamespaces = new HashSet<>();
_helper = new ExtensibilityHelper();
}
public String getName() {
return _name;
}
public void setName(String s) {
_name = s;
}
@Override
public String getTargetNamespaceURI() {
return _targetNsURI;
}
public void setTargetNamespaceURI(String s) {
_targetNsURI = s;
}
public void setTypes(Types t) {
_types = t;
}
public Types getTypes() {
return _types;
}
public void add(Message m) {
_document.define(m);
_messages.add(m);
}
public void add(PortType p) {
_document.define(p);
_portTypes.add(p);
}
public void add(Binding b) {
_document.define(b);
_bindings.add(b);
}
public void add(Service s) {
_document.define(s);
_services.add(s);
}
public void addServiceOveride(Service s) {
_services.add(s);
}
public void add(Import i) {
_imports.add(i);
_importedNamespaces.add(i.getNamespace());
}
public Iterator imports() {
return _imports.iterator();
}
public Iterator messages() {
return _messages.iterator();
}
public Iterator portTypes() {
return _portTypes.iterator();
}
public Iterator bindings() {
return _bindings.iterator();
}
public Iterator services() {
return _services.iterator();
}
@Override
public String getNameValue() {
return getName();
}
@Override
public String getNamespaceURI() {
return getTargetNamespaceURI();
}
@Override
public QName getWSDLElementName() {
return WSDLConstants.QNAME_DEFINITIONS;
}
public Documentation getDocumentation() {
return _documentation;
}
public void setDocumentation(Documentation d) {
_documentation = d;
}
@Override
public void addExtension(TWSDLExtension e) {
_helper.addExtension(e);
}
@Override
public Iterable extensions() {
return _helper.extensions();
}
/**
* wsdl:definition is the root hence no parent so return null.
*/
@Override
public TWSDLExtensible getParent() {
return null;
}
@Override
public void withAllSubEntitiesDo(EntityAction action) {
if (_types != null) {
action.perform(_types);
}
for (Message message : _messages) {
action.perform(message);
}
for (PortType portType : _portTypes) {
action.perform(portType);
}
for (Binding binding : _bindings) {
action.perform(binding);
}
for (Service service : _services) {
action.perform(service);
}
for (Import anImport : _imports) {
action.perform(anImport);
}
_helper.withAllSubEntitiesDo(action);
}
public void accept(WSDLDocumentVisitor visitor) throws Exception {
visitor.preVisit(this);
for (Import anImport : _imports) {
anImport.accept(visitor);
}
if (_types != null) {
_types.accept(visitor);
}
for (Message message : _messages) {
message.accept(visitor);
}
for (PortType portType : _portTypes) {
portType.accept(visitor);
}
for (Binding binding : _bindings) {
binding.accept(visitor);
}
for (Service service : _services) {
service.accept(visitor);
}
_helper.accept(visitor);
visitor.postVisit(this);
}
@Override
public void validateThis() {
}
public Map resolveBindings() {
return _document.getMap(Kinds.BINDING);
}
private AbstractDocument _document;
private ExtensibilityHelper _helper;
private Documentation _documentation;
private String _name;
private String _targetNsURI;
private Types _types;
private List _messages;
private List _portTypes;
private List _bindings;
private List _services;
private List _imports;
private Set _importedNamespaces;
@Override
public QName getElementName() {
return getWSDLElementName();
}
}