1 /* |
1 /* |
2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. |
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. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
36 import javax.xml.namespace.QName; |
35 import javax.xml.namespace.QName; |
37 import javax.xml.transform.Source; |
36 import javax.xml.transform.Source; |
38 import javax.xml.ws.WebServiceException; |
37 import javax.xml.ws.WebServiceException; |
39 import javax.xml.ws.WebServiceFeature; |
38 import javax.xml.ws.WebServiceFeature; |
40 |
39 |
41 import com.sun.xml.internal.org.jvnet.ws.databinding.Databinding; |
|
42 import com.sun.xml.internal.org.jvnet.ws.databinding.DatabindingModeFeature; |
|
43 import com.sun.xml.internal.org.jvnet.ws.databinding.Databinding.Builder; |
|
44 import com.sun.xml.internal.org.jvnet.ws.databinding.Databinding.WSDLGenerator; |
|
45 import org.xml.sax.EntityResolver; |
40 import org.xml.sax.EntityResolver; |
46 |
41 |
|
42 import com.oracle.webservices.internal.api.databinding.Databinding; |
|
43 import com.oracle.webservices.internal.api.databinding.Databinding.Builder; |
|
44 import com.oracle.webservices.internal.api.databinding.WSDLGenerator; |
47 import com.sun.xml.internal.ws.api.BindingID; |
45 import com.sun.xml.internal.ws.api.BindingID; |
48 import com.sun.xml.internal.ws.api.WSBinding; |
46 import com.sun.xml.internal.ws.api.WSBinding; |
49 import com.sun.xml.internal.ws.api.databinding.DatabindingConfig; |
47 import com.sun.xml.internal.ws.api.databinding.DatabindingConfig; |
50 import com.sun.xml.internal.ws.api.databinding.DatabindingFactory; |
48 import com.sun.xml.internal.ws.api.databinding.DatabindingFactory; |
51 import com.sun.xml.internal.ws.api.databinding.WSDLGenInfo; |
49 import com.sun.xml.internal.ws.api.databinding.MetadataReader; |
52 import com.sun.xml.internal.ws.api.model.wsdl.WSDLPort; |
50 import com.sun.xml.internal.ws.api.model.wsdl.WSDLPort; |
53 import com.sun.xml.internal.ws.spi.db.DatabindingException; |
|
54 import com.sun.xml.internal.ws.spi.db.DatabindingProvider; |
51 import com.sun.xml.internal.ws.spi.db.DatabindingProvider; |
55 import com.sun.xml.internal.ws.util.ServiceFinder; |
52 import com.sun.xml.internal.ws.util.ServiceFinder; |
56 |
53 |
57 /** |
54 /** |
58 * DatabindingFactoryImpl |
55 * DatabindingFactoryImpl |
113 public Databinding createRuntime(DatabindingConfig config) { |
110 public Databinding createRuntime(DatabindingConfig config) { |
114 DatabindingProvider provider = provider(config); |
111 DatabindingProvider provider = provider(config); |
115 return provider.create(config); |
112 return provider.create(config); |
116 } |
113 } |
117 |
114 |
118 public Databinding.WSDLGenerator createWsdlGen(DatabindingConfig config) { |
115 public WSDLGenerator createWsdlGen(DatabindingConfig config) { |
119 DatabindingProvider provider = provider(config); |
116 DatabindingProvider provider = provider(config); |
120 return provider.wsdlGen(config); |
117 return provider.wsdlGen(config); |
121 } |
118 } |
122 |
119 |
123 // DatabindingProvider newRuntimeFactory(String name) { |
120 // DatabindingProvider newRuntimeFactory(String name) { |
143 |
140 |
144 if ( config.getMappingInfo() != null && |
141 if ( config.getMappingInfo() != null && |
145 config.getMappingInfo().getDatabindingMode() != null) |
142 config.getMappingInfo().getDatabindingMode() != null) |
146 return config.getMappingInfo().getDatabindingMode(); |
143 return config.getMappingInfo().getDatabindingMode(); |
147 if ( config.getFeatures() != null) for (WebServiceFeature f : config.getFeatures()) { |
144 if ( config.getFeatures() != null) for (WebServiceFeature f : config.getFeatures()) { |
148 if (f instanceof DatabindingModeFeature) { |
145 if (f instanceof com.oracle.webservices.internal.api.databinding.DatabindingModeFeature) { |
149 DatabindingModeFeature dmf = (DatabindingModeFeature) f; |
146 com.oracle.webservices.internal.api.databinding.DatabindingModeFeature dmf = (com.oracle.webservices.internal.api.databinding.DatabindingModeFeature) f; |
150 return dmf.getMode(); |
147 return dmf.getMode(); |
151 } |
148 } |
152 } |
149 } |
153 return null; |
150 return null; |
154 } |
151 } |
233 config.setWSBinding((WSBinding)value); |
230 config.setWSBinding((WSBinding)value); |
234 } |
231 } |
235 if (isfor(WSDLPort.class, name, value)) { |
232 if (isfor(WSDLPort.class, name, value)) { |
236 config.setWsdlPort((WSDLPort)value); |
233 config.setWsdlPort((WSDLPort)value); |
237 } |
234 } |
|
235 if (isfor(MetadataReader.class, name, value)) { |
|
236 config.setMetadataReader((MetadataReader)value); |
|
237 } |
238 return this; |
238 return this; |
239 } |
239 } |
240 boolean isfor(Class<?> type, String name, Object value) { |
240 boolean isfor(Class<?> type, String name, Object value) { |
241 return type.getName().equals(name) && type.isInstance(value); |
241 return type.getName().equals(name) && type.isInstance(value); |
242 } |
242 } |
243 |
243 |
244 public com.sun.xml.internal.org.jvnet.ws.databinding.Databinding build() { |
244 public com.oracle.webservices.internal.api.databinding.Databinding build() { |
245 return factory.createRuntime(config); |
245 return factory.createRuntime(config); |
246 } |
246 } |
247 public WSDLGenerator createWSDLGenerator() { |
247 public com.oracle.webservices.internal.api.databinding.WSDLGenerator createWSDLGenerator() { |
248 return factory.createWsdlGen(config); |
248 return factory.createWsdlGen(config); |
249 } |
249 } |
250 } |
250 } |
251 } |
251 } |