325N/A/*
325N/A * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
325N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
325N/A *
325N/A * This code is free software; you can redistribute it and/or modify it
325N/A * under the terms of the GNU General Public License version 2 only, as
325N/A * published by the Free Software Foundation. Oracle designates this
325N/A * particular file as subject to the "Classpath" exception as provided
325N/A * by Oracle in the LICENSE file that accompanied this code.
325N/A *
325N/A * This code is distributed in the hope that it will be useful, but WITHOUT
325N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
325N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
325N/A * version 2 for more details (a copy is included in the LICENSE file that
325N/A * accompanied this code).
325N/A *
325N/A * You should have received a copy of the GNU General Public License version
325N/A * 2 along with this work; if not, write to the Free Software Foundation,
325N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
325N/A *
325N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
325N/A * or visit www.oracle.com if you need additional information or have any
325N/A * questions.
325N/A */
325N/A
325N/Apackage com.sun.tools.internal.ws.processor.model;
325N/A
325N/Aimport com.sun.tools.internal.ws.processor.model.jaxb.JAXBModel;
325N/Aimport com.sun.tools.internal.ws.wsdl.framework.Entity;
325N/A
325N/Aimport javax.xml.namespace.QName;
325N/Aimport java.util.*;
325N/A
325N/A/**
325N/A * The model is used to represent the entire Web Service. The JAX-WS ProcessorActions can process
325N/A * this Model to generate Java artifacts such as the service interface.
325N/A *
325N/A * @author WS Development Team
325N/A */
325N/Apublic class Model extends ModelObject {
325N/A
325N/A public Model(Entity entity) {
325N/A super(entity);
325N/A }
325N/A
325N/A public Model(QName name, Entity entity) {
325N/A super(entity);
325N/A this.name = name;
325N/A }
325N/A
325N/A public QName getName() {
325N/A return name;
325N/A }
325N/A
325N/A public void setName(QName n) {
325N/A name = n;
325N/A }
325N/A
325N/A public String getTargetNamespaceURI() {
325N/A return targetNamespace;
325N/A }
325N/A
325N/A public void setTargetNamespaceURI(String s) {
325N/A targetNamespace = s;
325N/A }
325N/A
325N/A public void addService(Service service) {
325N/A if (servicesByName.containsKey(service.getName())) {
325N/A throw new ModelException("model.uniqueness");
325N/A }
325N/A services.add(service);
325N/A servicesByName.put(service.getName(), service);
325N/A }
325N/A
325N/A public Service getServiceByName(QName name) {
325N/A if (servicesByName.size() != services.size()) {
325N/A initializeServicesByName();
325N/A }
325N/A return (Service)servicesByName.get(name);
325N/A }
325N/A
325N/A /* serialization */
325N/A public List<Service> getServices() {
325N/A return services;
325N/A }
325N/A
325N/A /* serialization */
325N/A public void setServices(List<Service> l) {
325N/A services = l;
325N/A }
325N/A
325N/A private void initializeServicesByName() {
325N/A servicesByName = new HashMap();
325N/A if (services != null) {
325N/A for (Service service : services) {
325N/A if (service.getName() != null &&
325N/A servicesByName.containsKey(service.getName())) {
325N/A
325N/A throw new ModelException("model.uniqueness");
325N/A }
325N/A servicesByName.put(service.getName(), service);
325N/A }
325N/A }
325N/A }
325N/A
325N/A public void addExtraType(AbstractType type) {
325N/A extraTypes.add(type);
325N/A }
325N/A
325N/A public Iterator getExtraTypes() {
325N/A return extraTypes.iterator();
325N/A }
325N/A
325N/A /* serialization */
325N/A public Set<AbstractType> getExtraTypesSet() {
325N/A return extraTypes;
325N/A }
325N/A
325N/A /* serialization */
325N/A public void setExtraTypesSet(Set<AbstractType> s) {
325N/A extraTypes = s;
325N/A }
325N/A
325N/A
325N/A public void accept(ModelVisitor visitor) throws Exception {
325N/A visitor.visit(this);
325N/A }
325N/A
325N/A /**
325N/A * @return the source version
325N/A */
325N/A public String getSource() {
325N/A return source;
325N/A }
325N/A
325N/A /**
325N/A * @param string
325N/A */
325N/A public void setSource(String string) {
325N/A source = string;
325N/A }
325N/A
325N/A public void setJAXBModel(JAXBModel jaxBModel) {
325N/A this.jaxBModel = jaxBModel;
325N/A }
325N/A
325N/A public JAXBModel getJAXBModel() {
325N/A return jaxBModel;
325N/A }
325N/A
325N/A private QName name;
325N/A private String targetNamespace;
325N/A private List<Service> services = new ArrayList<Service>();
325N/A private Map<QName, Service> servicesByName = new HashMap<QName, Service>();
325N/A private Set<AbstractType> extraTypes = new HashSet<AbstractType>();
325N/A private String source;
325N/A private JAXBModel jaxBModel = null;
325N/A}