src/share/jaxws_classes/com/oracle/webservices/internal/api/databinding/DatabindingFactory.java

changeset 0
373ffda63c9a
child 637
9c07ef4934dd
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/share/jaxws_classes/com/oracle/webservices/internal/api/databinding/DatabindingFactory.java	Wed Apr 27 01:27:09 2016 +0800
     1.3 @@ -0,0 +1,105 @@
     1.4 +/*
     1.5 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
     1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 + *
     1.8 + * This code is free software; you can redistribute it and/or modify it
     1.9 + * under the terms of the GNU General Public License version 2 only, as
    1.10 + * published by the Free Software Foundation.  Oracle designates this
    1.11 + * particular file as subject to the "Classpath" exception as provided
    1.12 + * by Oracle in the LICENSE file that accompanied this code.
    1.13 + *
    1.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
    1.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.17 + * version 2 for more details (a copy is included in the LICENSE file that
    1.18 + * accompanied this code).
    1.19 + *
    1.20 + * You should have received a copy of the GNU General Public License version
    1.21 + * 2 along with this work; if not, write to the Free Software Foundation,
    1.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.23 + *
    1.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.25 + * or visit www.oracle.com if you need additional information or have any
    1.26 + * questions.
    1.27 + */
    1.28 +
    1.29 +package com.oracle.webservices.internal.api.databinding;
    1.30 +
    1.31 +import java.util.Map;
    1.32 +
    1.33 +/**
    1.34 + * {@code DatabindingFactory} is the entry point of all the WebService
    1.35 + * Databinding APIs. A DatabindingFactory instance can be used to create
    1.36 + * <code>Databinding.Builder</code> instances, and <code>Databinding.Builder</code>
    1.37 + * instances are used to configure and build <code>Databinding</code> instances.
    1.38 + * <p>
    1.39 + * </P>
    1.40 + * <blockquote>
    1.41 + * Following is an example that creates a {@code Databinding} which provides the
    1.42 + * operations to serialize/deserialize a JavaCallInfo to/from a SOAP message:<br/>
    1.43 + * <pre>
    1.44 + * DatabindingFactory factory = DatabindingFactory.newInstance();
    1.45 + * Databinding.Builder builder = factory.createBuilder(seiClass, endpointClass);
    1.46 + * Databinding databinding = builder.build();
    1.47 + * </pre>
    1.48 + * </blockquote>
    1.49 + *
    1.50 + * @see com.oracle.webservices.internal.api.databinding.Databinding
    1.51 + *
    1.52 + * @author shih-chang.chen@oracle.com
    1.53 + */
    1.54 +public abstract class DatabindingFactory {
    1.55 +
    1.56 +  /**
    1.57 +   * Creates a new instance of a <code>Databinding.Builder</code> which is
    1.58 +   * initialized with the specified contractClass and endpointClass. The most
    1.59 +   * importance initial states of a Builder object is the contract class which
    1.60 +   * is also called "service endpoint interface" or "SEI" in JAX-WS and JAX-RPC,
    1.61 +   * and the implementation bean class (endpointClass). The the implementation
    1.62 +   * bean class (endpointClass) should be null if the Builder is to create
    1.63 +   * the client side proxy databinding.
    1.64 +   *
    1.65 +   * @param contractClass The service endpoint interface class
    1.66 +   * @param endpointClass The service implementation bean class
    1.67 +   *
    1.68 +   * @return New instance of a <code>Databinding.Builder</code>
    1.69 +   */
    1.70 +  abstract public Databinding.Builder createBuilder(Class<?> contractClass, Class<?> endpointClass);
    1.71 +
    1.72 +  /**
    1.73 +   * Access properties on the <code>DatabindingFactory</code> instance.
    1.74 +   *
    1.75 +   * @return properties of this WsFactory
    1.76 +   */
    1.77 +   abstract public Map<String, Object> properties();
    1.78 +
    1.79 +        /**
    1.80 +         * The default implementation class name.
    1.81 +         */
    1.82 +   static final String ImplClass = "com.sun.xml.internal.ws.db.DatabindingFactoryImpl";
    1.83 +
    1.84 +  /**
    1.85 +   * Create a new instance of a <code>DatabindingFactory</code>. This static method
    1.86 +   * creates a new factory instance.
    1.87 +   *
    1.88 +   * Once an application has obtained a reference to a <code>DatabindingFactory</code>
    1.89 +   * it can use the factory to obtain and configure a <code>Databinding.Builder</code>
    1.90 +   * to build a <code>Databinding</code> instances.
    1.91 +   *
    1.92 +   * @return New instance of a <code>DatabindingFactory</code>
    1.93 +   */
    1.94 +        static public DatabindingFactory newInstance() {
    1.95 +                try {
    1.96 +                        Class<?> cls = Class.forName(ImplClass);
    1.97 +                        return convertIfNecessary(cls);
    1.98 +                } catch (Exception e) {
    1.99 +                        e.printStackTrace();
   1.100 +                }
   1.101 +                return null;
   1.102 +        }
   1.103 +
   1.104 +    @SuppressWarnings("deprecation")
   1.105 +    private static DatabindingFactory convertIfNecessary(Class<?> cls) throws InstantiationException, IllegalAccessException {
   1.106 +        return (DatabindingFactory) cls.newInstance();
   1.107 +    }
   1.108 +}

mercurial