1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package javax.xml.soap;
17
18 /**
19 * A factory for creating <code>SOAPConnection</code> objects. Implementation of
20 * this class is optional. If <code>SOAPConnectionFactory.newInstance()</code>
21 * throws an <code>UnsupportedOperationException</code> then the implementation
22 * does not support the SAAJ communication infrastructure. Otherwise
23 * <code>SOAPConnection</code> objects can be created by calling
24 * <code>createConnection()</code> on the newly created
25 * <code>SOAPConnectionFactory</code> object.
26 */
27 public abstract class SOAPConnectionFactory {
28
29 public SOAPConnectionFactory() {}
30
31 /**
32 * Creates an instance of the default <CODE>
33 * SOAPConnectionFactory</CODE> object.
34 * @return a new instance of a default <CODE>
35 * SOAPConnectionFactory</CODE> object
36 * @throws SOAPException if there was an error creating
37 * the <CODE>SOAPConnectionFactory
38 * @throws UnsupportedOperationException if newInstance is not supported.
39 */
40 public static SOAPConnectionFactory newInstance()
41 throws SOAPException, UnsupportedOperationException {
42
43 try {
44 return (SOAPConnectionFactory) FactoryFinder.find(SF_PROPERTY,
45 DEFAULT_SOAP_CONNECTION_FACTORY);
46 } catch (Exception exception) {
47 throw new SOAPException("Unable to create SOAP connection factory: "
48 + exception.getMessage());
49 }
50 }
51
52 /**
53 * Create a new <CODE>SOAPConnection</CODE>.
54 * @return the new <CODE>SOAPConnection</CODE> object.
55 * @throws SOAPException if there was an exception
56 * creating the <CODE>SOAPConnection</CODE> object.
57 */
58 public abstract SOAPConnection createConnection() throws SOAPException;
59
60 private static final String DEFAULT_SOAP_CONNECTION_FACTORY =
61 "org.apache.axis.soap.SOAPConnectionFactoryImpl";
62
63 private static final String SF_PROPERTY =
64 "javax.xml.soap.SOAPConnectionFactory";
65 }