com.oracle.webservices.api.databinding.DatabindingFactory Maven / Gradle / Ivy
/*
* Copyright (c) 1997, 2019 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
package com.oracle.webservices.api.databinding;
import java.util.Map;
/**
* {@code DatabindingFactory} is the entry point of all the WebService
* Databinding APIs. A DatabindingFactory instance can be used to create
* Databinding.Builder
instances, and Databinding.Builder
* instances are used to configure and build Databinding
instances.
*
*
*
* Following is an example that creates a {@code Databinding} which provides the
* operations to serialize/deserialize a JavaCallInfo to/from a SOAP message:
*
* DatabindingFactory factory = DatabindingFactory.newInstance();
* Databinding.Builder builder = factory.createBuilder(seiClass, endpointClass);
* Databinding databinding = builder.build();
*
*
*
* @see com.oracle.webservices.api.databinding.Databinding
*
* @author [email protected]
*/
public abstract class DatabindingFactory {
/**
* Creates a new instance of a Databinding.Builder
which is
* initialized with the specified contractClass and endpointClass. The most
* importance initial states of a Builder object is the contract class which
* is also called "service endpoint interface" or "SEI" in JAX-WS and JAX-RPC,
* and the implementation bean class (endpointClass). The the implementation
* bean class (endpointClass) should be null if the Builder is to create
* the client side proxy databinding.
*
* @param contractClass The service endpoint interface class
* @param endpointClass The service implementation bean class
*
* @return New instance of a Databinding.Builder
*/
abstract public Databinding.Builder createBuilder(Class> contractClass, Class> endpointClass);
/**
* Access properties on the DatabindingFactory
instance.
*
* @return properties of this WsFactory
*/
abstract public Map properties();
/**
* The default implementation class name.
*/
static final String ImplClass = "com.sun.xml.ws.db.DatabindingFactoryImpl";
/**
* Create a new instance of a DatabindingFactory
. This static method
* creates a new factory instance.
*
* Once an application has obtained a reference to a DatabindingFactory
* it can use the factory to obtain and configure a Databinding.Builder
* to build a Databinding
instances.
*
* @return New instance of a DatabindingFactory
*/
static public DatabindingFactory newInstance() {
try {
Class> cls = Class.forName(ImplClass);
return convertIfNecessary(cls);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
@SuppressWarnings("deprecation")
private static DatabindingFactory convertIfNecessary(Class> cls) throws InstantiationException, IllegalAccessException {
return (DatabindingFactory) cls.newInstance();
}
}