01: /*
02: * $Id: SOAPConnectionFactory.java,v 1.6 2006/03/30 00:59:40 ofung Exp $
03: * $Revision: 1.6 $
04: * $Date: 2006/03/30 00:59:40 $
05: */
06:
07: /*
08: * The contents of this file are subject to the terms
09: * of the Common Development and Distribution License
10: * (the License). You may not use this file except in
11: * compliance with the License.
12: *
13: * You can obtain a copy of the license at
14: * https://glassfish.dev.java.net/public/CDDLv1.0.html.
15: * See the License for the specific language governing
16: * permissions and limitations under the License.
17: *
18: * When distributing Covered Code, include this CDDL
19: * Header Notice in each file and include the License file
20: * at https://glassfish.dev.java.net/public/CDDLv1.0.html.
21: * If applicable, add the following below the CDDL Header,
22: * with the fields enclosed by brackets [] replaced by
23: * you own identifying information:
24: * "Portions Copyrighted [year] [name of copyright owner]"
25: *
26: * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
27: */
28: package javax.xml.soap;
29:
30: /**
31: * A factory for creating <code>SOAPConnection</code> objects. Implementation of this class
32: * is optional. If <code>SOAPConnectionFactory.newInstance()</code> throws an
33: * UnsupportedOperationException then the implementation does not support the
34: * SAAJ communication infrastructure. Otherwise {@link SOAPConnection} objects
35: * can be created by calling <code>createConnection()</code> on the newly
36: * created <code>SOAPConnectionFactory</code> object.
37: */
38: public abstract class SOAPConnectionFactory {
39: /**
40: * A constant representing the default value for a <code>SOAPConnection</code>
41: * object. The default is the point-to-point SOAP connection.
42: */
43: static private final String DEFAULT_SOAP_CONNECTION_FACTORY = "com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnectionFactory";
44:
45: /**
46: * A constant representing the <code>SOAPConnection</code> class.
47: */
48: static private final String SF_PROPERTY = "javax.xml.soap.SOAPConnectionFactory";
49:
50: /**
51: * Creates an instance of the default
52: * <code>SOAPConnectionFactory</code> object.
53: *
54: * @return a new instance of a default
55: * <code>SOAPConnectionFactory</code> object
56: *
57: * @exception SOAPException if there was an error creating the
58: * <code>SOAPConnectionFactory</code>
59: *
60: * @exception UnsupportedOperationException if newInstance is not
61: * supported.
62: */
63: public static SOAPConnectionFactory newInstance()
64: throws SOAPException, UnsupportedOperationException {
65: try {
66: return (SOAPConnectionFactory) FactoryFinder.find(
67: SF_PROPERTY, DEFAULT_SOAP_CONNECTION_FACTORY);
68: } catch (Exception ex) {
69: throw new SOAPException(
70: "Unable to create SOAP connection factory: "
71: + ex.getMessage());
72: }
73: }
74:
75: /**
76: * Create a new <code>SOAPConnection</code>.
77: *
78: * @return the new <code>SOAPConnection</code> object.
79: *
80: * @exception SOAPException if there was an exception creating the
81: * <code>SOAPConnection</code> object.
82: */
83: public abstract SOAPConnection createConnection()
84: throws SOAPException;
85: }
|