1. /*
  2. * Copyright 2002-2004 the original author or authors.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. package org.springframework.remoting.jaxrpc;
  17. import javax.xml.rpc.Service;
  18. import javax.xml.rpc.ServiceException;
  19. import org.springframework.beans.factory.FactoryBean;
  20. import org.springframework.beans.factory.InitializingBean;
  21. /**
  22. * FactoryBean for locally defined JAX-RPC Service references.
  23. * Uses LocalJaxRpcServiceFactory's facilities underneath.
  24. *
  25. * <p>Alternatively, JAX-RPC Service references can be looked up
  26. * in the JNDI environment of the J2EE container.
  27. *
  28. * @author Juergen Hoeller
  29. * @since 15.12.2003
  30. * @see javax.xml.rpc.Service
  31. * @see org.springframework.jndi.JndiObjectFactoryBean
  32. * @see JaxRpcPortProxyFactoryBean
  33. */
  34. public class LocalJaxRpcServiceFactoryBean extends LocalJaxRpcServiceFactory
  35. implements FactoryBean, InitializingBean {
  36. private Service service;
  37. public void afterPropertiesSet() throws ServiceException {
  38. this.service = createJaxRpcService();
  39. }
  40. public Object getObject() throws Exception {
  41. return this.service;
  42. }
  43. public Class getObjectType() {
  44. return (this.service != null ? this.service.getClass() : Service.class);
  45. }
  46. public boolean isSingleton() {
  47. return true;
  48. }
  49. }