src/share/jaxws_classes/com/sun/xml/internal/ws/db/DatabindingProviderImpl.java

changeset 286
f50545b5e2f1
child 368
0989ad8c0860
equal deleted inserted replaced
284:88b85470e72c 286:f50545b5e2f1
1 /*
2 * Copyright (c) 1997, 2011, 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.db;
27
28 import java.io.File;
29 import java.util.Map;
30
31 import com.sun.xml.internal.org.jvnet.ws.databinding.Databinding.WSDLGenerator;
32
33 import com.sun.xml.internal.ws.api.databinding.Databinding;
34 import com.sun.xml.internal.ws.api.databinding.DatabindingConfig;
35 import com.sun.xml.internal.ws.api.databinding.WSDLGenInfo;
36 import com.sun.xml.internal.ws.spi.db.DatabindingProvider;
37
38 /**
39 * DatabindingProviderImpl is the default JAXWS implementation of DatabindingProvider
40 *
41 * @author shih-chang.chen@oracle.com
42 */
43 public class DatabindingProviderImpl implements DatabindingProvider {
44 static final private String CachedDatabinding = "com.sun.xml.internal.ws.db.DatabindingProviderImpl";
45 Map<String, Object> properties;
46
47 public void init(Map<String, Object> p) {
48 properties = p;
49 }
50
51 DatabindingImpl getCachedDatabindingImpl(DatabindingConfig config) {
52 Object object = config.properties().get(CachedDatabinding);
53 return (object != null && object instanceof DatabindingImpl)? (DatabindingImpl)object : null;
54 }
55
56 public Databinding create(DatabindingConfig config) {
57 DatabindingImpl impl = getCachedDatabindingImpl(config);
58 if (impl == null) {
59 impl = new DatabindingImpl(this, config);
60 config.properties().put(CachedDatabinding, impl);
61 }
62 return impl;
63 }
64
65 public WSDLGenerator wsdlGen(DatabindingConfig config) {
66 DatabindingImpl impl = (DatabindingImpl)create(config);
67 return new JaxwsWsdlGen(impl);
68 }
69
70 public boolean isFor(String databindingMode) {
71 //This is the default one, so it always return true
72 return true;
73 }
74
75 static public class JaxwsWsdlGen implements Databinding.WSDLGenerator {
76 DatabindingImpl databinding;
77 WSDLGenInfo wsdlGenInfo;
78
79 JaxwsWsdlGen(DatabindingImpl impl) {
80 databinding = impl;
81 wsdlGenInfo = new WSDLGenInfo();
82 }
83
84 public WSDLGenerator inlineSchema(boolean inline) {
85 wsdlGenInfo.setInlineSchemas(inline);
86 return this;
87 }
88
89 public WSDLGenerator property(String name, Object value) {
90 // TODO Auto-generated method stub
91 return null;
92 }
93
94 public void generate(WSDLResolver wsdlResolver) {
95 // wsdlGenInfo.setWsdlResolver(wsdlResolver);
96 databinding.generateWSDL(wsdlGenInfo);
97 }
98
99 public void generate(File outputDir, String name) {
100 // TODO Auto-generated method stub
101 databinding.generateWSDL(wsdlGenInfo);
102 }
103 }
104 }

mercurial