001    /*
002     * Licensed to the Apache Software Foundation (ASF) under one
003     * or more contributor license agreements.  See the NOTICE file
004     * distributed with this work for additional information
005     * regarding copyright ownership.  The ASF licenses this file
006     * to you under the Apache License, Version 2.0 (the
007     * "License"); you may not use this file except in compliance
008     * with the License.  You may obtain a copy of the License at
009     *
010     *  http://www.apache.org/licenses/LICENSE-2.0
011     *
012     * Unless required by applicable law or agreed to in writing,
013     * software distributed under the License is distributed on an
014     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015     * KIND, either express or implied.  See the License for the
016     * specific language governing permissions and limitations
017     * under the License.
018     */
019    
020    package javax.xml.rpc;
021    
022    import javax.xml.namespace.QName;
023    import java.net.URL;
024    
025    /**
026     * The <code>javax.xml.rpc.ServiceFactory</code> is an abstract class
027     * that provides a factory for the creation of instances of the type
028     * <code>javax.xml.rpc.Service</code>. This abstract class follows the
029     * abstract static factory design pattern. This enables a J2SE based
030     * client to create a <code>Service instance</code> in a portable manner
031     * without using the constructor of the <code>Service</code>
032     * implementation class.
033     * <p>
034     * The ServiceFactory implementation class is set using the
035     * system property <code>SERVICEFACTORY_PROPERTY</code>.
036     *
037     * @version $Rev: 932204 $ $Date: 2010-04-08 20:50:07 -0400 (Thu, 08 Apr 2010) $
038     */
039    public abstract class ServiceFactory {
040    
041        /** Protected constructor. */
042        protected ServiceFactory() {}
043    
044        /**
045         * A constant representing the property used to lookup the
046         * name of a <code>ServiceFactory</code> implementation
047         * class.
048         */
049        public static final java.lang.String SERVICEFACTORY_PROPERTY =
050            "javax.xml.rpc.ServiceFactory";
051    
052        /**
053         * Gets an instance of the <code>ServiceFactory</code>
054         *
055         * <p>Only one copy of a factory exists and is returned to the
056         * application each time this method is called.
057         *
058         * <p> The implementation class to be used can be overridden by
059         * setting the javax.xml.rpc.ServiceFactory system property.
060         *
061         * @return  ServiceFactory.
062         * @throws  ServiceException
063         */
064        public static ServiceFactory newInstance() throws ServiceException {
065    
066            try {
067                return (ServiceFactory) FactoryFinder.find(
068                    /* The default property name according to the JAXRPC spec */
069                    ServiceFactory.class,
070                    /* The fallback implementation class name */
071                    "org.apache.axis.client.ServiceFactory");
072            } catch (FactoryFinder.ConfigurationError e) {
073                throw new ServiceException(e.getException());
074            }
075        }
076    
077        /**
078         * Create a <code>Service</code> instance.
079         *
080         * @param   wsdlDocumentLocation URL for the WSDL document location
081         * @param   serviceName  QName for the service.
082         * @return  Service.
083         * @throws  ServiceException If any error in creation of the
084         *                specified service
085         */
086        public abstract Service createService(
087            URL wsdlDocumentLocation, QName serviceName) throws ServiceException;
088    
089        /**
090         * Create a <code>Service</code> instance.
091         *
092         * @param   serviceName QName for the service
093         * @return  Service.
094         * @throws  ServiceException If any error in creation of the specified service
095         */
096        public abstract Service createService(QName serviceName)
097            throws ServiceException;
098    
099        public abstract Service loadService(java.lang.Class class1)
100                                 throws ServiceException;
101    
102        public abstract Service loadService(java.net.URL url,
103                                        java.lang.Class class1,
104                                        java.util.Properties properties)
105                                 throws ServiceException;
106    
107        public abstract Service loadService(java.net.URL url,
108                                        QName qname,
109                                        java.util.Properties properties)
110                                 throws ServiceException;
111    }
112