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  */
  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 Set<SchemaInfo> schemaInfo;
  56 //      protected MappingInfo defaultMappingInfo = new MappingInfo();
  57 //      protected MappingInfo overrideMappingInfo = new MappingInfo();
  58         protected MappingInfo mappingInfo = new MappingInfo();
  59 //      protected Definition wsdl;
  60         protected URL wsdlURL;
  61         protected ClassLoader classLoader;
  62 //      protected QName serviceName;
  63 //      protected BindingID bindingId;
  64         protected Iterable<WebServiceFeature> features;
  65         //TODO WSBinding isn't it BindingID + features?
  66         //On the EndpointFactory.createEndpoint path, WSBinding could be created from DeploymentDescriptorParser.createBinding
  67         protected WSBinding wsBinding;
  68         protected WSDLPort wsdlPort;
  69         protected MetadataReader metadataReader;
  70         protected Map<String, Object> properties = new HashMap<String, Object>();
  71     protected Source wsdlSource;
  72     protected EntityResolver entityResolver;
  73 
  74 //      public MappingInfo getDefaultMappingInfo() {
  75 //              return defaultMappingInfo;
  76 //      }
  77 //      public void setDefaultMappingInfo(MappingInfo defaultMappingInfo) {
  78 //              this.defaultMappingInfo = defaultMappingInfo;
  79 //      }
  80 //      public MappingInfo getOverrideMappingInfo() {
  81 //              return overrideMappingInfo;
  82 //      }
  83 //      public void setOverrideMappingInfo(MappingInfo overrideMappingInfo) {
  84 //              this.overrideMappingInfo = overrideMappingInfo;
  85 //      }
  86 
  87         public Class getContractClass() {
  88                 return contractClass;
  89         }
  90         public void setContractClass(Class contractClass) {
  91                 this.contractClass = contractClass;
  92         }
  93         public Class getEndpointClass() {
  94                 return endpointClass;
  95         }
  96         public void setEndpointClass(Class implBeanClass) {
  97                 this.endpointClass = implBeanClass;
  98         }
  99         public MappingInfo getMappingInfo() {
 100                 return mappingInfo;
 101         }
 102         public void setMappingInfo(MappingInfo mappingInfo) {
 103                 this.mappingInfo = mappingInfo;
 104         }
 105         public URL getWsdlURL() {
 106                 return wsdlURL;
 107         }
 108         public void setWsdlURL(URL wsdlURL) {
 109                 this.wsdlURL = wsdlURL;
 110         }
 111         public ClassLoader getClassLoader() {
 112                 return classLoader;
 113         }
 114         public void setClassLoader(ClassLoader classLoader) {
 115                 this.classLoader = classLoader;
 116         }
 117 //      public QName getServiceName() {
 118 //              return serviceName;
 119 //      }
 120 //      public void setServiceName(QName serviceName) {
 121 //              this.serviceName = serviceName;
 122 //      }
 123 //      public BindingID getBindingId() {
 124 //              return bindingId;
 125 //      }
 126 //      public void setBindingId(BindingID bindingId) {
 127 //              this.bindingId = bindingId;
 128 //      }
 129         public Iterable<WebServiceFeature> getFeatures() {
 130                 return features;
 131         }
 132         public void setFeatures(WebServiceFeature[] features) {
 133                 setFeatures(new WebServiceFeatureList(features));
 134         }
 135         public void setFeatures(Iterable<WebServiceFeature> features) {
 136                 this.features = WebServiceFeatureList.toList(features);
 137         }
 138         public WSDLPort getWsdlPort() {
 139                 return wsdlPort;
 140         }
 141         public void setWsdlPort(WSDLPort wsdlPort) {
 142                 this.wsdlPort = wsdlPort;
 143         }
 144         public Set<Class> additionalValueTypes() {
 145                 return additionalValueTypes;
 146         }
 147         public Map<String, Object> properties() {
 148                 return properties;
 149         }
 150         public WSBinding getWSBinding() {
 151                 return wsBinding;
 152         }
 153         public void setWSBinding(WSBinding wsBinding) {
 154                 this.wsBinding = wsBinding;
 155         }
 156         public MetadataReader getMetadataReader() {
 157                 return metadataReader;
 158         }
 159         public void setMetadataReader(MetadataReader  reader) {
 160                 this.metadataReader = reader;
 161         }
 162 
 163     public Source getWsdlSource() {
 164         return wsdlSource;
 165     }
 166     public void setWsdlSource(Source wsdlSource) {
 167         this.wsdlSource = wsdlSource;
 168     }
 169     public EntityResolver getEntityResolver() {
 170         return entityResolver;
 171     }
 172     public void setEntityResolver(EntityResolver entityResolver) {
 173         this.entityResolver = entityResolver;
 174     }
 175 }