Model.java revision 325
0N/A/*
2362N/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
0N/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
0N/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,
2362N/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
0N/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.processor.model;
0N/A
0N/Aimport com.sun.tools.internal.ws.processor.model.jaxb.JAXBModel;
0N/Aimport com.sun.tools.internal.ws.wsdl.framework.Entity;
0N/A
0N/Aimport javax.xml.namespace.QName;
0N/Aimport java.util.*;
0N/A
0N/A/**
0N/A * The model is used to represent the entire Web Service. The JAX-WS ProcessorActions can process
0N/A * this Model to generate Java artifacts such as the service interface.
0N/A *
0N/A * @author WS Development Team
0N/A */
0N/Apublic class Model extends ModelObject {
0N/A
0N/A public Model(Entity entity) {
0N/A super(entity);
0N/A }
0N/A
0N/A public Model(QName name, Entity entity) {
0N/A super(entity);
0N/A this.name = name;
0N/A }
0N/A
0N/A public QName getName() {
0N/A return name;
0N/A }
0N/A
0N/A public void setName(QName n) {
0N/A name = n;
0N/A }
0N/A
0N/A public String getTargetNamespaceURI() {
0N/A return targetNamespace;
0N/A }
0N/A
0N/A public void setTargetNamespaceURI(String s) {
0N/A targetNamespace = s;
0N/A }
0N/A
0N/A public void addService(Service service) {
0N/A if (servicesByName.containsKey(service.getName())) {
0N/A throw new ModelException("model.uniqueness");
0N/A }
0N/A services.add(service);
0N/A servicesByName.put(service.getName(), service);
0N/A }
0N/A
0N/A public Service getServiceByName(QName name) {
0N/A if (servicesByName.size() != services.size()) {
0N/A initializeServicesByName();
0N/A }
0N/A return (Service)servicesByName.get(name);
0N/A }
0N/A
0N/A /* serialization */
0N/A public List<Service> getServices() {
0N/A return services;
0N/A }
0N/A
0N/A /* serialization */
0N/A public void setServices(List<Service> l) {
0N/A services = l;
0N/A }
0N/A
0N/A private void initializeServicesByName() {
0N/A servicesByName = new HashMap();
0N/A if (services != null) {
0N/A for (Service service : services) {
0N/A if (service.getName() != null &&
0N/A servicesByName.containsKey(service.getName())) {
0N/A
0N/A throw new ModelException("model.uniqueness");
0N/A }
0N/A servicesByName.put(service.getName(), service);
0N/A }
0N/A }
0N/A }
0N/A
0N/A public void addExtraType(AbstractType type) {
0N/A extraTypes.add(type);
0N/A }
0N/A
0N/A public Iterator getExtraTypes() {
0N/A return extraTypes.iterator();
0N/A }
0N/A
0N/A /* serialization */
0N/A public Set<AbstractType> getExtraTypesSet() {
0N/A return extraTypes;
0N/A }
0N/A
0N/A /* serialization */
public void setExtraTypesSet(Set<AbstractType> s) {
extraTypes = s;
}
public void accept(ModelVisitor visitor) throws Exception {
visitor.visit(this);
}
/**
* @return the source version
*/
public String getSource() {
return source;
}
/**
* @param string
*/
public void setSource(String string) {
source = string;
}
public void setJAXBModel(JAXBModel jaxBModel) {
this.jaxBModel = jaxBModel;
}
public JAXBModel getJAXBModel() {
return jaxBModel;
}
private QName name;
private String targetNamespace;
private List<Service> services = new ArrayList<Service>();
private Map<QName, Service> servicesByName = new HashMap<QName, Service>();
private Set<AbstractType> extraTypes = new HashSet<AbstractType>();
private String source;
private JAXBModel jaxBModel = null;
}