001    package org.andromda.cartridges.support.webservice.client;
002    
003    import org.springframework.aop.framework.ProxyFactory;
004    import org.springframework.beans.factory.FactoryBean;
005    
006    /**
007     * FactoryBean for a specific port of a webservice.
008     */
009    public class Axis2ProxyFactoryBean
010        extends Axis2PortClientInterceptor
011        implements FactoryBean
012    {
013        private static final long serialVersionUID = 34L;
014        private Object serviceProxy;
015    
016        /**
017         * @see org.andromda.cartridges.support.webservice.client.Axis2PortClientInterceptor#afterPropertiesSet()
018         */
019        public void afterPropertiesSet()
020        {
021            if (this.getServiceInterface() == null)
022            {
023                throw new IllegalArgumentException("serviceInterface is required");
024            }
025            if (this.getWsdlUrl() == null)
026            {
027                throw new IllegalArgumentException("WSDL URL is required");
028            }
029            super.afterPropertiesSet();
030            this.serviceProxy =
031                ProxyFactory.getProxy(
032                    getServiceInterface(),
033                    this);
034        }
035    
036        /**
037         * @see org.springframework.beans.factory.FactoryBean#getObject()
038         */
039        public Object getObject()
040        {
041            return this.serviceProxy;
042        }
043    
044        /**
045         * @see org.springframework.beans.factory.FactoryBean#getObjectType()
046         */
047        public Class getObjectType()
048        {
049            return getServiceInterface();
050        }
051    
052        /**
053         * @see org.springframework.beans.factory.FactoryBean#isSingleton()
054         */
055        public boolean isSingleton()
056        {
057            return true;
058        }
059    }