001/*
002 * Copyright 2002-2017 the original author or authors.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *      https://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package org.springframework.remoting.jaxws;
018
019import javax.xml.ws.Service;
020
021import org.springframework.beans.factory.FactoryBean;
022import org.springframework.beans.factory.InitializingBean;
023import org.springframework.lang.Nullable;
024
025/**
026 * {@link org.springframework.beans.factory.FactoryBean} for locally
027 * defined JAX-WS Service references.
028 * Uses {@link LocalJaxWsServiceFactory}'s facilities underneath.
029 *
030 * <p>Alternatively, JAX-WS Service references can be looked up
031 * in the JNDI environment of the Java EE container.
032 *
033 * @author Juergen Hoeller
034 * @since 2.5
035 * @see javax.xml.ws.Service
036 * @see org.springframework.jndi.JndiObjectFactoryBean
037 * @see JaxWsPortProxyFactoryBean
038 */
039public class LocalJaxWsServiceFactoryBean extends LocalJaxWsServiceFactory
040                implements FactoryBean<Service>, InitializingBean {
041
042        @Nullable
043        private Service service;
044
045
046        @Override
047        public void afterPropertiesSet() {
048                this.service = createJaxWsService();
049        }
050
051        @Override
052        @Nullable
053        public Service getObject() {
054                return this.service;
055        }
056
057        @Override
058        public Class<? extends Service> getObjectType() {
059                return (this.service != null ? this.service.getClass() : Service.class);
060        }
061
062        @Override
063        public boolean isSingleton() {
064                return true;
065        }
066
067}