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

Thu, 31 Aug 2017 15:18:52 +0800

author
aoqi
date
Thu, 31 Aug 2017 15:18:52 +0800
changeset 637
9c07ef4934dd
parent 368
0989ad8c0860
parent 0
373ffda63c9a
permissions
-rw-r--r--

merge

     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.xml.internal.ws.db;
    28 import java.io.File;
    29 import java.util.Map;
    31 import com.oracle.webservices.internal.api.databinding.WSDLGenerator;
    32 import com.oracle.webservices.internal.api.databinding.WSDLResolver;
    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;
    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;
    47         public void init(Map<String, Object> p) {
    48             properties = p;
    49         }
    51         DatabindingImpl getCachedDatabindingImpl(DatabindingConfig config) {
    52             Object object = config.properties().get(CachedDatabinding);
    53             return (object != null && object instanceof DatabindingImpl)? (DatabindingImpl)object : null;
    54         }
    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         }
    65     public WSDLGenerator wsdlGen(DatabindingConfig config) {
    66         DatabindingImpl impl = (DatabindingImpl)create(config);
    67         return new JaxwsWsdlGen(impl);
    68     }
    70     public boolean isFor(String databindingMode) {
    71         //This is the default one, so it always return true
    72         return true;
    73     }
    75     static public class JaxwsWsdlGen implements WSDLGenerator {
    76         DatabindingImpl databinding;
    77         WSDLGenInfo wsdlGenInfo;
    79         JaxwsWsdlGen(DatabindingImpl impl) {
    80             databinding = impl;
    81             wsdlGenInfo = new WSDLGenInfo();
    82         }
    84         public WSDLGenerator inlineSchema(boolean inline) {
    85             wsdlGenInfo.setInlineSchemas(inline);
    86             return this;
    87         }
    89         public WSDLGenerator property(String name, Object value) {
    90             // TODO wsdlGenInfo.set...
    91             return this;
    92         }
    94         public void generate(WSDLResolver wsdlResolver) {
    95             wsdlGenInfo.setWsdlResolver(wsdlResolver);
    96             databinding.generateWSDL(wsdlGenInfo);
    97         }
    99         public void generate(File outputDir, String name) {
   100             // TODO Auto-generated method stub
   101             databinding.generateWSDL(wsdlGenInfo);
   102         }
   103     }
   104 }

mercurial