org.springframework.remoting.rmi
Class JndiRmiProxyFactoryBean
java.lang.Object
org.springframework.jndi.JndiAccessor
org.springframework.jndi.JndiLocatorSupport
org.springframework.jndi.JndiObjectLocator
org.springframework.remoting.rmi.JndiRmiClientInterceptor
org.springframework.remoting.rmi.JndiRmiProxyFactoryBean
- All Implemented Interfaces:
- org.aopalliance.aop.Advice, FactoryBean, InitializingBean, org.aopalliance.intercept.Interceptor, org.aopalliance.intercept.MethodInterceptor
- public class JndiRmiProxyFactoryBean
- extends JndiRmiClientInterceptor
- implements FactoryBean
Factory bean 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
,
JndiRmiProxyFactoryBean
,
RemoteAccessException
,
RemoteException
,
Remote
,
PortableRemoteObject.narrow(java.lang.Object, java.lang.Class)
Method Summary |
void |
afterPropertiesSet()
Fetches RMI stub on startup, if necessary. |
java.lang.Object |
getObject()
Return an instance (possibly shared or independent) of the object
managed by this factory. |
java.lang.Class |
getObjectType()
Return the type of object that this FactoryBean creates, or null
if not known in advance. |
boolean |
isSingleton()
Is the bean managed by this factory a singleton or a prototype?
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
JndiRmiProxyFactoryBean
public JndiRmiProxyFactoryBean()
afterPropertiesSet
public void afterPropertiesSet()
throws javax.naming.NamingException
- Description copied from class:
JndiRmiClientInterceptor
- Fetches RMI stub on startup, if necessary.
- Specified by:
afterPropertiesSet
in interface InitializingBean
- Overrides:
afterPropertiesSet
in class JndiRmiClientInterceptor
- Throws:
javax.naming.NamingException
- See Also:
JndiRmiClientInterceptor.setLookupStubOnStartup(boolean)
,
JndiRmiClientInterceptor.lookupStub()
getObject
public java.lang.Object getObject()
- Description copied from interface:
FactoryBean
- Return an instance (possibly shared or independent) of the object
managed by this factory. As with a BeanFactory, this allows
support for both the Singleton and Prototype design pattern.
- Specified by:
getObject
in interface FactoryBean
- Returns:
- an instance of the bean (should never be null)
getObjectType
public java.lang.Class getObjectType()
- Description copied from interface:
FactoryBean
- Return the type of object that this FactoryBean creates, or null
if not known in advance. This allows to check for specific types of
beans without instantiating objects, e.g. on autowiring.
For a singleton, this can simply return getObject().getClass(),
or even null, as autowiring will always check the actual objects
for singletons. For prototypes, returning a meaningful type here
is highly advisable, as autowiring will simply ignore them else.
- Specified by:
getObjectType
in interface FactoryBean
- Returns:
- the type of object that this FactoryBean creates, or null
- See Also:
ListableBeanFactory.getBeansOfType(java.lang.Class, boolean, boolean)
isSingleton
public boolean isSingleton()
- Description copied from interface:
FactoryBean
- Is the bean managed by this factory a singleton or a prototype?
That is, will getObject() always return the same object?
The singleton status of the FactoryBean itself will
generally be provided by the owning BeanFactory.
- Specified by:
isSingleton
in interface FactoryBean
- Returns:
- if this bean is a singleton
Copyright (C) 2003-2004 The Spring Framework Project.