spring-context

org.springframework.remoting.rmi
Class JndiRmiProxyFactoryBean

java.lang.Object
  extended by org.springframework.jndi.JndiAccessor
      extended by org.springframework.jndi.JndiLocatorSupport
          extended by org.springframework.jndi.JndiObjectLocator
              extended by org.springframework.remoting.rmi.JndiRmiClientInterceptor
                  extended by org.springframework.remoting.rmi.JndiRmiProxyFactoryBean
All Implemented Interfaces:
org.aopalliance.aop.Advice, org.aopalliance.intercept.Interceptor, org.aopalliance.intercept.MethodInterceptor, org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanClassLoaderAware, org.springframework.beans.factory.FactoryBean<java.lang.Object>, org.springframework.beans.factory.InitializingBean

public class JndiRmiProxyFactoryBean
extends JndiRmiClientInterceptor
implements org.springframework.beans.factory.FactoryBean<java.lang.Object>, org.springframework.beans.factory.BeanClassLoaderAware

FactoryBean for RMI proxies from JNDI.

Typically used for RMI-IIOP (CORBA), but can also be used for EJB home objects (for example, a Stateful Session Bean home). In contrast to a plain JNDI lookup, this accessor also performs narrowing through PortableRemoteObject.

With conventional RMI services, this invoker is typically used with the RMI service interface. Alternatively, this invoker can also proxy a remote RMI service with a matching non-RMI business interface, i.e. an interface that mirrors the RMI service methods but does not declare RemoteExceptions. In the latter case, RemoteExceptions thrown by the RMI stub will automatically get converted to Spring's unchecked RemoteAccessException.

The JNDI environment can be specified as "jndiEnvironment" property, or be configured in a jndi.properties file or as system properties. For example:

<property name="jndiEnvironment">
         <props>
                 <prop key="java.naming.factory.initial">com.sun.jndi.cosnaming.CNCtxFactory</prop>
                 <prop key="java.naming.provider.url">iiop://localhost:1050</prop>
         </props>
 </property>

Since:
1.1
Author:
Juergen Hoeller
See Also:
JndiRmiClientInterceptor.setServiceInterface(java.lang.Class), JndiObjectLocator.setJndiName(java.lang.String), JndiAccessor.setJndiTemplate(org.springframework.jndi.JndiTemplate), JndiAccessor.setJndiEnvironment(java.util.Properties), JndiObjectLocator.setJndiName(java.lang.String), JndiRmiServiceExporter, RemoteAccessException, RemoteException, Remote, PortableRemoteObject.narrow(java.lang.Object, java.lang.Class)

Field Summary
 
Fields inherited from class org.springframework.jndi.JndiLocatorSupport
CONTAINER_PREFIX
 
Fields inherited from class org.springframework.jndi.JndiAccessor
logger
 
Constructor Summary
JndiRmiProxyFactoryBean()
           
 
Method Summary
 void afterPropertiesSet()
           
 java.lang.Object getObject()
           
 java.lang.Class<?> getObjectType()
           
 boolean isSingleton()
           
 void setBeanClassLoader(java.lang.ClassLoader classLoader)
           
 
Methods inherited from class org.springframework.remoting.rmi.JndiRmiClientInterceptor
createRemoteInvocation, doInvoke, doInvoke, getRemoteInvocationFactory, getServiceInterface, getStub, invoke, isConnectFailure, isConnectFailure, lookupStub, prepare, refreshAndRetry, setCacheStub, setLookupStubOnStartup, setRefreshStubOnConnectFailure, setRemoteInvocationFactory, setServiceInterface
 
Methods inherited from class org.springframework.jndi.JndiObjectLocator
getExpectedType, getJndiName, lookup, setExpectedType, setJndiName
 
Methods inherited from class org.springframework.jndi.JndiLocatorSupport
convertJndiName, isResourceRef, lookup, lookup, setResourceRef
 
Methods inherited from class org.springframework.jndi.JndiAccessor
getJndiEnvironment, getJndiTemplate, setJndiEnvironment, setJndiTemplate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JndiRmiProxyFactoryBean

public JndiRmiProxyFactoryBean()
Method Detail

setBeanClassLoader

public void setBeanClassLoader(java.lang.ClassLoader classLoader)
Specified by:
setBeanClassLoader in interface org.springframework.beans.factory.BeanClassLoaderAware

afterPropertiesSet

public void afterPropertiesSet()
                        throws javax.naming.NamingException
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Overrides:
afterPropertiesSet in class JndiRmiClientInterceptor
Throws:
javax.naming.NamingException

getObject

public java.lang.Object getObject()
Specified by:
getObject in interface org.springframework.beans.factory.FactoryBean<java.lang.Object>

getObjectType

public java.lang.Class<?> getObjectType()
Specified by:
getObjectType in interface org.springframework.beans.factory.FactoryBean<java.lang.Object>

isSingleton

public boolean isSingleton()
Specified by:
isSingleton in interface org.springframework.beans.factory.FactoryBean<java.lang.Object>

spring-context