equal
deleted
inserted
replaced
46 * @since 1.6 |
46 * @since 1.6 |
47 */ |
47 */ |
48 public abstract class SOAPFactory { |
48 public abstract class SOAPFactory { |
49 |
49 |
50 /** |
50 /** |
51 * A constant representing the property used to lookup the name of |
|
52 * a {@code SOAPFactory} implementation class. |
|
53 */ |
|
54 static private final String SOAP_FACTORY_PROPERTY = |
|
55 "javax.xml.soap.SOAPFactory"; |
|
56 |
|
57 /** |
|
58 * Class name of default {@code SOAPFactory} implementation. |
51 * Class name of default {@code SOAPFactory} implementation. |
59 */ |
52 */ |
60 static final String DEFAULT_SOAP_FACTORY |
53 private static final String DEFAULT_SOAP_FACTORY |
61 = "com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPFactory1_1Impl"; |
54 = "com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPFactory1_1Impl"; |
62 |
55 |
63 /** |
56 /** |
64 * Creates a {@code SOAPElement} object from an existing DOM |
57 * Creates a {@code SOAPElement} object from an existing DOM |
65 * {@code Element}. If the DOM {@code Element} that is passed in |
58 * {@code Element}. If the DOM {@code Element} that is passed in |
66 * as an argument is already a {@code SOAPElement} then this method |
59 * as an argument is already a {@code SOAPElement} then this method |
237 */ |
230 */ |
238 public abstract Name createName(String localName) throws SOAPException; |
231 public abstract Name createName(String localName) throws SOAPException; |
239 |
232 |
240 /** |
233 /** |
241 * Creates a new {@code SOAPFactory} object that is an instance of |
234 * Creates a new {@code SOAPFactory} object that is an instance of |
242 * the default implementation (SOAP 1.1), |
235 * the default implementation (SOAP 1.1). |
243 * |
236 * |
244 * This method uses the following ordered lookup procedure to determine the SOAPFactory implementation class to load: |
237 * This method uses the lookup procedure specified in {@link javax.xml.soap} to locate and load the |
245 * <UL> |
238 * {@link javax.xml.soap.SOAPFactory} class. |
246 * <LI> Use the javax.xml.soap.SOAPFactory system property. |
|
247 * <LI> Use the properties file "lib/jaxm.properties" in the JRE directory. This configuration file is in standard |
|
248 * java.util.Properties format and contains the fully qualified name of the implementation class with the key being the |
|
249 * system property defined above. |
|
250 * <LI> Use the Services API (as detailed in the JAR specification), if available, to determine the classname. The Services API |
|
251 * will look for a classname in the file META-INF/services/javax.xml.soap.SOAPFactory in jars available to the runtime. |
|
252 * <LI> Use the SAAJMetaFactory instance to locate the SOAPFactory implementation class. |
|
253 * </UL> |
|
254 * |
239 * |
255 * @return a new instance of a {@code SOAPFactory} |
240 * @return a new instance of a {@code SOAPFactory} |
256 * |
241 * |
257 * @exception SOAPException if there was an error creating the |
242 * @exception SOAPException if there was an error creating the |
258 * default {@code SOAPFactory} |
243 * default {@code SOAPFactory} |
260 */ |
245 */ |
261 public static SOAPFactory newInstance() |
246 public static SOAPFactory newInstance() |
262 throws SOAPException |
247 throws SOAPException |
263 { |
248 { |
264 try { |
249 try { |
265 SOAPFactory factory = (SOAPFactory) FactoryFinder.find( |
250 SOAPFactory factory = FactoryFinder.find( |
266 SOAP_FACTORY_PROPERTY, DEFAULT_SOAP_FACTORY, false); |
251 SOAPFactory.class, |
267 if (factory != null) |
252 DEFAULT_SOAP_FACTORY, |
268 return factory; |
253 false); |
|
254 if (factory != null) return factory; |
|
255 |
|
256 // leave it on SAAJMetaFactory |
269 return newInstance(SOAPConstants.SOAP_1_1_PROTOCOL); |
257 return newInstance(SOAPConstants.SOAP_1_1_PROTOCOL); |
270 } catch (Exception ex) { |
258 } catch (Exception ex) { |
271 throw new SOAPException( |
259 throw new SOAPException( |
272 "Unable to create SOAP Factory: " + ex.getMessage()); |
260 "Unable to create SOAP Factory: " + ex.getMessage()); |
273 } |
261 } |