View Javadoc

1   package org.codehaus.xfire.spring.remoting;
2   
3   import java.net.MalformedURLException;
4   
5   import org.springframework.aop.framework.ProxyFactory;
6   import org.springframework.beans.factory.FactoryBean;
7   
8   /***
9    * Factory bean for XFire proxies. Behaves like the proxied service when used as bean reference, exposing the specified
10   * service interface.
11   * <p/>
12   * The service URL must be an HTTP URL exposing a SOAP service. For details, see <code>XFireClientInterceptor</code>
13   * docs.
14   *
15   * @author <a href="mailto:poutsma@mac.com">Arjen Poutsma</a>
16   * @see #setServiceInterface
17   * @see #setServiceUrl
18   */
19  public class XFireProxyFactoryBean
20          extends XFireClientInterceptor
21          implements FactoryBean
22  {
23      private Object serviceProxy;
24  
25      public void afterPropertiesSet()
26              throws MalformedURLException
27      {
28          super.afterPropertiesSet();
29  
30          this.serviceProxy = ProxyFactory.getProxy(getService().getServiceInterface(), this);
31      }
32  
33      public Object getObject()
34      {
35          return this.serviceProxy;
36      }
37  
38      public Class getObjectType()
39      {
40          return (this.serviceProxy != null) ? this.serviceProxy.getClass() : getService().getServiceInterface();
41      }
42  
43      public boolean isSingleton()
44      {
45          return true;
46      }
47  
48  }