KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > xml > soap > SOAPConnectionFactory


1 /*
2  * $Id: SOAPConnectionFactory.java,v 1.5 2005/04/05 21:03:23 mk125090 Exp $
3  * $Revision: 1.5 $
4  * $Date: 2005/04/05 21:03:23 $
5  */

6
7 /*
8  * The contents of this file are subject to the terms
9  * 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 JavaDoc DEFAULT_SOAP_CONNECTION_FACTORY
44         = "com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnectionFactory";
45
46     /**
47      * A constant representing the <code>SOAPConnection</code> class.
48      */

49     static private final String JavaDoc SF_PROPERTY
50         = "javax.xml.soap.SOAPConnectionFactory";
51
52     /**
53      * Creates an instance of the default
54      * <code>SOAPConnectionFactory</code> object.
55      *
56      * @return a new instance of a default
57      * <code>SOAPConnectionFactory</code> object
58      *
59      * @exception SOAPException if there was an error creating the
60      * <code>SOAPConnectionFactory</code>
61      *
62      * @exception UnsupportedOperationException if newInstance is not
63      * supported.
64      */

65     public static SOAPConnectionFactory JavaDoc newInstance()
66         throws SOAPException JavaDoc, UnsupportedOperationException JavaDoc
67     {
68         try {
69         return (SOAPConnectionFactory JavaDoc)
70                 FactoryFinder.find(SF_PROPERTY,
71                                    DEFAULT_SOAP_CONNECTION_FACTORY);
72         } catch (Exception JavaDoc ex) {
73             throw new SOAPException JavaDoc("Unable to create SOAP connection factory: "
74                                     +ex.getMessage());
75         }
76     }
77
78     /**
79      * Create a new <code>SOAPConnection</code>.
80      *
81      * @return the new <code>SOAPConnection</code> object.
82      *
83      * @exception SOAPException if there was an exception creating the
84      * <code>SOAPConnection</code> object.
85      */

86     public abstract SOAPConnection JavaDoc createConnection()
87         throws SOAPException JavaDoc;
88 }
89
90
Popular Tags