View Javadoc
1   /*
2    * Copyright (c) 1997, 2013, 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   */
25  
26  package com.sun.xml.internal.ws.api.databinding;
27  
28  import java.net.URL;
29  import java.util.HashMap;
30  import java.util.HashSet;
31  import java.util.Set;
32  import java.util.Map;
33  
34  import javax.xml.transform.Source;
35  import javax.xml.ws.WebServiceFeature;
36  
37  import org.xml.sax.EntityResolver;
38  
39  import com.sun.xml.internal.ws.api.WSBinding;
40  import com.sun.xml.internal.ws.api.WSFeatureList;
41  import com.sun.xml.internal.ws.api.model.wsdl.WSDLPort;
42  import com.sun.xml.internal.ws.binding.WebServiceFeatureList;
43  
44  /**
45   * DatabindingConfig contains the initial states for Databinding. After a Databinding
46   * instance is created, all it's internal states should be considered
47   * 'immutable' and therefore the operations on Databinding are thread-safe.
48   *
49   * @author shih-chang.chen@oracle.com
50   */
51  public class DatabindingConfig {
52      protected Class contractClass;
53          protected Class endpointClass;
54          protected Set<Class> additionalValueTypes = new HashSet<Class>();
55          protected MappingInfo mappingInfo = new MappingInfo();
56          protected URL wsdlURL;
57          protected ClassLoader classLoader;
58          protected Iterable<WebServiceFeature> features;
59          protected WSBinding wsBinding;
60          protected WSDLPort wsdlPort;
61          protected MetadataReader metadataReader;
62          protected Map<String, Object> properties = new HashMap<String, Object>();
63      protected Source wsdlSource;
64      protected EntityResolver entityResolver;
65  
66          public Class getContractClass() {
67                  return contractClass;
68          }
69          public void setContractClass(Class contractClass) {
70                  this.contractClass = contractClass;
71          }
72          public Class getEndpointClass() {
73                  return endpointClass;
74          }
75          public void setEndpointClass(Class implBeanClass) {
76                  this.endpointClass = implBeanClass;
77          }
78          public MappingInfo getMappingInfo() {
79                  return mappingInfo;
80          }
81          public void setMappingInfo(MappingInfo mappingInfo) {
82                  this.mappingInfo = mappingInfo;
83          }
84          public URL getWsdlURL() {
85                  return wsdlURL;
86          }
87          public void setWsdlURL(URL wsdlURL) {
88                  this.wsdlURL = wsdlURL;
89          }
90          public ClassLoader getClassLoader() {
91                  return classLoader;
92          }
93          public void setClassLoader(ClassLoader classLoader) {
94                  this.classLoader = classLoader;
95          }
96          public Iterable<WebServiceFeature> getFeatures() {
97              if (features == null && wsBinding != null) return wsBinding.getFeatures();
98                  return features;
99          }
100         public void setFeatures(WebServiceFeature[] features) {
101                 setFeatures(new WebServiceFeatureList(features));
102         }
103         public void setFeatures(Iterable<WebServiceFeature> features) {
104                 this.features = WebServiceFeatureList.toList(features);
105         }
106         public WSDLPort getWsdlPort() {
107                 return wsdlPort;
108         }
109         public void setWsdlPort(WSDLPort wsdlPort) {
110                 this.wsdlPort = wsdlPort;
111         }
112         public Set<Class> additionalValueTypes() {
113                 return additionalValueTypes;
114         }
115         public Map<String, Object> properties() {
116                 return properties;
117         }
118         public WSBinding getWSBinding() {
119                 return wsBinding;
120         }
121         public void setWSBinding(WSBinding wsBinding) {
122                 this.wsBinding = wsBinding;
123         }
124         public MetadataReader getMetadataReader() {
125                 return metadataReader;
126         }
127         public void setMetadataReader(MetadataReader  reader) {
128                 this.metadataReader = reader;
129         }
130 
131     public Source getWsdlSource() {
132         return wsdlSource;
133     }
134     public void setWsdlSource(Source wsdlSource) {
135         this.wsdlSource = wsdlSource;
136     }
137     public EntityResolver getEntityResolver() {
138         return entityResolver;
139     }
140     public void setEntityResolver(EntityResolver entityResolver) {
141         this.entityResolver = entityResolver;
142     }
143 }