aoqi@0: /*
aoqi@0: * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
aoqi@0: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
aoqi@0: *
aoqi@0: * This code is free software; you can redistribute it and/or modify it
aoqi@0: * under the terms of the GNU General Public License version 2 only, as
aoqi@0: * published by the Free Software Foundation. Oracle designates this
aoqi@0: * particular file as subject to the "Classpath" exception as provided
aoqi@0: * by Oracle in the LICENSE file that accompanied this code.
aoqi@0: *
aoqi@0: * This code is distributed in the hope that it will be useful, but WITHOUT
aoqi@0: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
aoqi@0: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
aoqi@0: * version 2 for more details (a copy is included in the LICENSE file that
aoqi@0: * accompanied this code).
aoqi@0: *
aoqi@0: * You should have received a copy of the GNU General Public License version
aoqi@0: * 2 along with this work; if not, write to the Free Software Foundation,
aoqi@0: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
aoqi@0: *
aoqi@0: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
aoqi@0: * or visit www.oracle.com if you need additional information or have any
aoqi@0: * questions.
aoqi@0: */
aoqi@0:
aoqi@0: package javax.xml.soap;
aoqi@0:
aoqi@0: /**
aoqi@0: * The access point for the implementation classes of the factories defined in the
aoqi@0: * SAAJ API. All of the newInstance
methods defined on factories in
aoqi@0: * SAAJ 1.3 defer to instances of this class to do the actual object creation.
aoqi@0: * The implementations of newInstance()
methods (in SOAPFactory and MessageFactory)
aoqi@0: * that existed in SAAJ 1.2 have been updated to also delegate to the SAAJMetaFactory when the SAAJ 1.2
aoqi@0: * defined lookup fails to locate the Factory implementation class name.
aoqi@0: *
aoqi@0: *
aoqi@0: * SAAJMetaFactory is a service provider interface. There are no public methods on this
aoqi@0: * class.
aoqi@0: *
aoqi@0: * @author SAAJ RI Development Team
aoqi@0: * @since SAAJ 1.3
aoqi@0: */
aoqi@0:
aoqi@0: public abstract class SAAJMetaFactory {
aoqi@0: static private final String META_FACTORY_CLASS_PROPERTY =
aoqi@0: "javax.xml.soap.MetaFactory";
aoqi@0: static final String DEFAULT_META_FACTORY_CLASS =
aoqi@0: "com.sun.xml.internal.messaging.saaj.soap.SAAJMetaFactoryImpl";
aoqi@0:
aoqi@0: /**
aoqi@0: * Creates a new instance of a concrete SAAJMetaFactory
object.
aoqi@0: * The SAAJMetaFactory is an SPI, it pulls the creation of the other factories together into a
aoqi@0: * single place. Changing out the SAAJMetaFactory has the effect of changing out the entire SAAJ
aoqi@0: * implementation. Service providers provide the name of their SAAJMetaFactory
aoqi@0: * implementation.
aoqi@0: *
aoqi@0: * This method uses the following ordered lookup procedure to determine the SAAJMetaFactory implementation class to load:
aoqi@0: *
SAAJMetaFactory
object
aoqi@0: * @exception SOAPException if there is an error in creating the SAAJMetaFactory
aoqi@0: */
aoqi@0: static SAAJMetaFactory getInstance() throws SOAPException {
aoqi@0: try {
aoqi@0: SAAJMetaFactory instance =
aoqi@0: (SAAJMetaFactory) FactoryFinder.find(
aoqi@0: META_FACTORY_CLASS_PROPERTY,
aoqi@0: DEFAULT_META_FACTORY_CLASS);
aoqi@0: return instance;
aoqi@0: } catch (Exception e) {
aoqi@0: throw new SOAPException(
aoqi@0: "Unable to create SAAJ meta-factory" + e.getMessage());
aoqi@0: }
aoqi@0: }
aoqi@0:
aoqi@0: protected SAAJMetaFactory() { }
aoqi@0:
aoqi@0: /**
aoqi@0: * Creates a MessageFactory
object for
aoqi@0: * the given String
protocol.
aoqi@0: *
aoqi@0: * @param protocol a String
indicating the protocol
aoqi@0: * @exception SOAPException if there is an error in creating the
aoqi@0: * MessageFactory
aoqi@0: * @see SOAPConstants#SOAP_1_1_PROTOCOL
aoqi@0: * @see SOAPConstants#SOAP_1_2_PROTOCOL
aoqi@0: * @see SOAPConstants#DYNAMIC_SOAP_PROTOCOL
aoqi@0: */
aoqi@0: protected abstract MessageFactory newMessageFactory(String protocol)
aoqi@0: throws SOAPException;
aoqi@0:
aoqi@0: /**
aoqi@0: * Creates a SOAPFactory
object for
aoqi@0: * the given String
protocol.
aoqi@0: *
aoqi@0: * @param protocol a String
indicating the protocol
aoqi@0: * @exception SOAPException if there is an error in creating the
aoqi@0: * SOAPFactory
aoqi@0: * @see SOAPConstants#SOAP_1_1_PROTOCOL
aoqi@0: * @see SOAPConstants#SOAP_1_2_PROTOCOL
aoqi@0: * @see SOAPConstants#DYNAMIC_SOAP_PROTOCOL
aoqi@0: */
aoqi@0: protected abstract SOAPFactory newSOAPFactory(String protocol)
aoqi@0: throws SOAPException;
aoqi@0: }