1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/share/jaxws_classes/javax/xml/soap/SAAJMetaFactory.java Wed Apr 27 01:27:09 2016 +0800 1.3 @@ -0,0 +1,113 @@ 1.4 +/* 1.5 + * Copyright (c) 2004, 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 javax.xml.soap; 1.30 + 1.31 +/** 1.32 +* The access point for the implementation classes of the factories defined in the 1.33 +* SAAJ API. All of the <code>newInstance</code> methods defined on factories in 1.34 +* SAAJ 1.3 defer to instances of this class to do the actual object creation. 1.35 +* The implementations of <code>newInstance()</code> methods (in SOAPFactory and MessageFactory) 1.36 +* that existed in SAAJ 1.2 have been updated to also delegate to the SAAJMetaFactory when the SAAJ 1.2 1.37 +* defined lookup fails to locate the Factory implementation class name. 1.38 +* 1.39 +* <p> 1.40 +* SAAJMetaFactory is a service provider interface. There are no public methods on this 1.41 +* class. 1.42 +* 1.43 +* @author SAAJ RI Development Team 1.44 +* @since SAAJ 1.3 1.45 +*/ 1.46 + 1.47 +public abstract class SAAJMetaFactory { 1.48 + static private final String META_FACTORY_CLASS_PROPERTY = 1.49 + "javax.xml.soap.MetaFactory"; 1.50 + static final String DEFAULT_META_FACTORY_CLASS = 1.51 + "com.sun.xml.internal.messaging.saaj.soap.SAAJMetaFactoryImpl"; 1.52 + 1.53 + /** 1.54 + * Creates a new instance of a concrete <code>SAAJMetaFactory</code> object. 1.55 + * The SAAJMetaFactory is an SPI, it pulls the creation of the other factories together into a 1.56 + * single place. Changing out the SAAJMetaFactory has the effect of changing out the entire SAAJ 1.57 + * implementation. Service providers provide the name of their <code>SAAJMetaFactory</code> 1.58 + * implementation. 1.59 + * 1.60 + * This method uses the following ordered lookup procedure to determine the SAAJMetaFactory implementation class to load: 1.61 + * <UL> 1.62 + * <LI> Use the javax.xml.soap.MetaFactory system property. 1.63 + * <LI> Use the properties file "lib/jaxm.properties" in the JRE directory. This configuration file is in standard 1.64 + * java.util.Properties format and contains the fully qualified name of the implementation class with the key being the 1.65 + * system property defined above. 1.66 + * <LI> Use the Services API (as detailed in the JAR specification), if available, to determine the classname. The Services API 1.67 + * will look for a classname in the file META-INF/services/javax.xml.soap.MetaFactory in jars available to the runtime. 1.68 + * <LI> Default to com.sun.xml.internal.messaging.saaj.soap.SAAJMetaFactoryImpl. 1.69 + * </UL> 1.70 + * 1.71 + * @return a concrete <code>SAAJMetaFactory</code> object 1.72 + * @exception SOAPException if there is an error in creating the <code>SAAJMetaFactory</code> 1.73 + */ 1.74 + static SAAJMetaFactory getInstance() throws SOAPException { 1.75 + try { 1.76 + SAAJMetaFactory instance = 1.77 + (SAAJMetaFactory) FactoryFinder.find( 1.78 + META_FACTORY_CLASS_PROPERTY, 1.79 + DEFAULT_META_FACTORY_CLASS); 1.80 + return instance; 1.81 + } catch (Exception e) { 1.82 + throw new SOAPException( 1.83 + "Unable to create SAAJ meta-factory" + e.getMessage()); 1.84 + } 1.85 + } 1.86 + 1.87 + protected SAAJMetaFactory() { } 1.88 + 1.89 + /** 1.90 + * Creates a <code>MessageFactory</code> object for 1.91 + * the given <code>String</code> protocol. 1.92 + * 1.93 + * @param protocol a <code>String</code> indicating the protocol 1.94 + * @exception SOAPException if there is an error in creating the 1.95 + * MessageFactory 1.96 + * @see SOAPConstants#SOAP_1_1_PROTOCOL 1.97 + * @see SOAPConstants#SOAP_1_2_PROTOCOL 1.98 + * @see SOAPConstants#DYNAMIC_SOAP_PROTOCOL 1.99 + */ 1.100 + protected abstract MessageFactory newMessageFactory(String protocol) 1.101 + throws SOAPException; 1.102 + 1.103 + /** 1.104 + * Creates a <code>SOAPFactory</code> object for 1.105 + * the given <code>String</code> protocol. 1.106 + * 1.107 + * @param protocol a <code>String</code> indicating the protocol 1.108 + * @exception SOAPException if there is an error in creating the 1.109 + * SOAPFactory 1.110 + * @see SOAPConstants#SOAP_1_1_PROTOCOL 1.111 + * @see SOAPConstants#SOAP_1_2_PROTOCOL 1.112 + * @see SOAPConstants#DYNAMIC_SOAP_PROTOCOL 1.113 + */ 1.114 + protected abstract SOAPFactory newSOAPFactory(String protocol) 1.115 + throws SOAPException; 1.116 +}