KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > remoting > caucho > HessianProxyFactoryBean


1 /*
2  * Copyright 2002-2007 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
17 package org.springframework.remoting.caucho;
18
19 import org.springframework.aop.framework.ProxyFactory;
20 import org.springframework.beans.factory.BeanClassLoaderAware;
21 import org.springframework.beans.factory.FactoryBean;
22 import org.springframework.util.ClassUtils;
23
24 /**
25  * FactoryBean for Hessian proxies. Exposes the proxied service for
26  * use as a bean reference, using the specified service interface.
27  *
28  * <p>Hessian is a slim, binary RPC protocol.
29  * For information on Hessian, see the
30  * <a HREF="http://www.caucho.com/hessian">Hessian website</a>
31  *
32  * <p>The service URL must be an HTTP URL exposing a Hessian service.
33  * For details, see the {@link HessianClientInterceptor} javadoc.
34  *
35  * @author Juergen Hoeller
36  * @since 13.05.2003
37  * @see #setServiceInterface
38  * @see #setServiceUrl
39  * @see HessianClientInterceptor
40  * @see HessianServiceExporter
41  * @see org.springframework.remoting.caucho.BurlapProxyFactoryBean
42  * @see org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean
43  * @see org.springframework.remoting.rmi.RmiProxyFactoryBean
44  */

45 public class HessianProxyFactoryBean extends HessianClientInterceptor
46         implements FactoryBean, BeanClassLoaderAware {
47
48     private ClassLoader JavaDoc beanClassLoader = ClassUtils.getDefaultClassLoader();
49
50     private Object JavaDoc serviceProxy;
51
52
53     public void setBeanClassLoader(ClassLoader JavaDoc classLoader) {
54         this.beanClassLoader = classLoader;
55     }
56
57     public void afterPropertiesSet() {
58         super.afterPropertiesSet();
59         this.serviceProxy = new ProxyFactory(getServiceInterface(), this).getProxy(this.beanClassLoader);
60     }
61
62
63     public Object JavaDoc getObject() {
64         return this.serviceProxy;
65     }
66
67     public Class JavaDoc getObjectType() {
68         return getServiceInterface();
69     }
70
71     public boolean isSingleton() {
72         return true;
73     }
74
75 }
76
Popular Tags