Wed, 27 Apr 2016 01:27:09 +0800
Initial load
http://hg.openjdk.java.net/jdk8u/jdk8u/jaxws/
changeset: 657:d47a47f961ee
tag: jdk8u25-b17
1 /*
2 * Copyright (c) 1997, 2012, 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.processor.model;
28 import com.sun.tools.internal.ws.processor.model.jaxb.JAXBModel;
29 import com.sun.tools.internal.ws.wsdl.framework.Entity;
31 import javax.xml.namespace.QName;
32 import java.util.*;
34 /**
35 * The model is used to represent the entire Web Service. The JAX-WS ProcessorActions can process
36 * this Model to generate Java artifacts such as the service interface.
37 *
38 * @author WS Development Team
39 */
40 public class Model extends ModelObject {
42 public Model(Entity entity) {
43 super(entity);
44 }
46 public Model(QName name, Entity entity) {
47 super(entity);
48 this.name = name;
49 }
51 public QName getName() {
52 return name;
53 }
55 public void setName(QName n) {
56 name = n;
57 }
59 public String getTargetNamespaceURI() {
60 return targetNamespace;
61 }
63 public void setTargetNamespaceURI(String s) {
64 targetNamespace = s;
65 }
67 public void addService(Service service) {
68 if (servicesByName.containsKey(service.getName())) {
69 throw new ModelException("model.uniqueness");
70 }
71 services.add(service);
72 servicesByName.put(service.getName(), service);
73 }
75 public Service getServiceByName(QName name) {
76 if (servicesByName.size() != services.size()) {
77 initializeServicesByName();
78 }
79 return (Service)servicesByName.get(name);
80 }
82 /* serialization */
83 public List<Service> getServices() {
84 return services;
85 }
87 /* serialization */
88 public void setServices(List<Service> l) {
89 services = l;
90 }
92 private void initializeServicesByName() {
93 servicesByName = new HashMap();
94 if (services != null) {
95 for (Service service : services) {
96 if (service.getName() != null &&
97 servicesByName.containsKey(service.getName())) {
99 throw new ModelException("model.uniqueness");
100 }
101 servicesByName.put(service.getName(), service);
102 }
103 }
104 }
106 public void addExtraType(AbstractType type) {
107 extraTypes.add(type);
108 }
110 public Iterator getExtraTypes() {
111 return extraTypes.iterator();
112 }
114 /* serialization */
115 public Set<AbstractType> getExtraTypesSet() {
116 return extraTypes;
117 }
119 /* serialization */
120 public void setExtraTypesSet(Set<AbstractType> s) {
121 extraTypes = s;
122 }
125 public void accept(ModelVisitor visitor) throws Exception {
126 visitor.visit(this);
127 }
129 /**
130 * @return the source version
131 */
132 public String getSource() {
133 return source;
134 }
136 /**
137 * @param string
138 */
139 public void setSource(String string) {
140 source = string;
141 }
143 public void setJAXBModel(JAXBModel jaxBModel) {
144 this.jaxBModel = jaxBModel;
145 }
147 public JAXBModel getJAXBModel() {
148 return jaxBModel;
149 }
151 private QName name;
152 private String targetNamespace;
153 private List<Service> services = new ArrayList<Service>();
154 private Map<QName, Service> servicesByName = new HashMap<QName, Service>();
155 private Set<AbstractType> extraTypes = new HashSet<AbstractType>();
156 private String source;
157 private JAXBModel jaxBModel = null;
158 }