ohair@286: /* alanb@368: * Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. ohair@286: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. ohair@286: * ohair@286: * This code is free software; you can redistribute it and/or modify it ohair@286: * under the terms of the GNU General Public License version 2 only, as ohair@286: * published by the Free Software Foundation. Oracle designates this ohair@286: * particular file as subject to the "Classpath" exception as provided ohair@286: * by Oracle in the LICENSE file that accompanied this code. ohair@286: * ohair@286: * This code is distributed in the hope that it will be useful, but WITHOUT ohair@286: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ohair@286: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ohair@286: * version 2 for more details (a copy is included in the LICENSE file that ohair@286: * accompanied this code). ohair@286: * ohair@286: * You should have received a copy of the GNU General Public License version ohair@286: * 2 along with this work; if not, write to the Free Software Foundation, ohair@286: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. ohair@286: * ohair@286: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ohair@286: * or visit www.oracle.com if you need additional information or have any ohair@286: * questions. ohair@286: */ ohair@286: ohair@286: package javax.xml.soap; ohair@286: ohair@286: /** ohair@286: * The access point for the implementation classes of the factories defined in the ohair@286: * SAAJ API. All of the newInstance methods defined on factories in ohair@286: * SAAJ 1.3 defer to instances of this class to do the actual object creation. ohair@286: * The implementations of newInstance() methods (in SOAPFactory and MessageFactory) ohair@286: * that existed in SAAJ 1.2 have been updated to also delegate to the SAAJMetaFactory when the SAAJ 1.2 ohair@286: * defined lookup fails to locate the Factory implementation class name. ohair@286: * ohair@286: *

ohair@286: * SAAJMetaFactory is a service provider interface. There are no public methods on this ohair@286: * class. ohair@286: * ohair@286: * @author SAAJ RI Development Team ohair@286: * @since SAAJ 1.3 ohair@286: */ ohair@286: ohair@286: public abstract class SAAJMetaFactory { ohair@286: static private final String META_FACTORY_CLASS_PROPERTY = ohair@286: "javax.xml.soap.MetaFactory"; ohair@286: static private final String DEFAULT_META_FACTORY_CLASS = ohair@286: "com.sun.xml.internal.messaging.saaj.soap.SAAJMetaFactoryImpl"; ohair@286: ohair@286: /** ohair@286: * Creates a new instance of a concrete SAAJMetaFactory object. ohair@286: * The SAAJMetaFactory is an SPI, it pulls the creation of the other factories together into a ohair@286: * single place. Changing out the SAAJMetaFactory has the effect of changing out the entire SAAJ ohair@286: * implementation. Service providers provide the name of their SAAJMetaFactory ohair@286: * implementation. ohair@286: * ohair@286: * This method uses the following ordered lookup procedure to determine the SAAJMetaFactory implementation class to load: ohair@286: *

ohair@286: * ohair@286: * @return a concrete SAAJMetaFactory object ohair@286: * @exception SOAPException if there is an error in creating the SAAJMetaFactory ohair@286: */ ohair@286: static SAAJMetaFactory getInstance() throws SOAPException { ohair@286: try { ohair@286: SAAJMetaFactory instance = ohair@286: (SAAJMetaFactory) FactoryFinder.find( ohair@286: META_FACTORY_CLASS_PROPERTY, ohair@286: DEFAULT_META_FACTORY_CLASS); ohair@286: return instance; ohair@286: } catch (Exception e) { ohair@286: throw new SOAPException( ohair@286: "Unable to create SAAJ meta-factory" + e.getMessage()); ohair@286: } ohair@286: } ohair@286: ohair@286: protected SAAJMetaFactory() { } ohair@286: ohair@286: /** ohair@286: * Creates a MessageFactory object for ohair@286: * the given String protocol. ohair@286: * ohair@286: * @param protocol a String indicating the protocol ohair@286: * @exception SOAPException if there is an error in creating the ohair@286: * MessageFactory ohair@286: * @see SOAPConstants#SOAP_1_1_PROTOCOL ohair@286: * @see SOAPConstants#SOAP_1_2_PROTOCOL ohair@286: * @see SOAPConstants#DYNAMIC_SOAP_PROTOCOL ohair@286: */ ohair@286: protected abstract MessageFactory newMessageFactory(String protocol) ohair@286: throws SOAPException; ohair@286: ohair@286: /** ohair@286: * Creates a SOAPFactory object for ohair@286: * the given String protocol. ohair@286: * ohair@286: * @param protocol a String indicating the protocol ohair@286: * @exception SOAPException if there is an error in creating the ohair@286: * SOAPFactory ohair@286: * @see SOAPConstants#SOAP_1_1_PROTOCOL ohair@286: * @see SOAPConstants#SOAP_1_2_PROTOCOL ohair@286: * @see SOAPConstants#DYNAMIC_SOAP_PROTOCOL ohair@286: */ ohair@286: protected abstract SOAPFactory newSOAPFactory(String protocol) ohair@286: throws SOAPException; ohair@286: }