001/*
002 * Copyright 2002-2012 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;
023
024/**
025 * {@link org.springframework.beans.factory.FactoryBean} for locally
026 * defined JAX-WS Service references.
027 * Uses {@link LocalJaxWsServiceFactory}'s facilities underneath.
028 *
029 * <p>Alternatively, JAX-WS Service references can be looked up
030 * in the JNDI environment of the J2EE container.
031 *
032 * @author Juergen Hoeller
033 * @since 2.5
034 * @see javax.xml.ws.Service
035 * @see org.springframework.jndi.JndiObjectFactoryBean
036 * @see JaxWsPortProxyFactoryBean
037 */
038public class LocalJaxWsServiceFactoryBean extends LocalJaxWsServiceFactory
039                implements FactoryBean<Service>, InitializingBean {
040
041        private Service service;
042
043
044        @Override
045        public void afterPropertiesSet() {
046                this.service = createJaxWsService();
047        }
048
049        @Override
050        public Service getObject() {
051                return this.service;
052        }
053
054        @Override
055        public Class<? extends Service> getObjectType() {
056                return (this.service != null ? this.service.getClass() : Service.class);
057        }
058
059        @Override
060        public boolean isSingleton() {
061                return true;
062        }
063
064}