站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Spring Framework 1.2.9 API 文档英文版

JndiRmiServiceExporter (Spring Framework) - Spring Framework 1.2.9 API 文档英文版


org.springframework.remoting.rmi
Class JndiRmiServiceExporter

java.lang.Object
  extended by org.springframework.remoting.support.RemoteExporter
      extended by org.springframework.remoting.support.RemoteInvocationBasedExporter
          extended by org.springframework.remoting.rmi.RmiBasedExporter
              extended by org.springframework.remoting.rmi.JndiRmiServiceExporter
All Implemented Interfaces:
DisposableBean, InitializingBean

public class JndiRmiServiceExporter
extends RmiBasedExporter
implements InitializingBean, DisposableBean

Service exporter which binds RMI services to JNDI. Typically used for RMI-IIOP (CORBA).

Exports services via the PortableRemoteObject class. You need to run "rmic" with the "-iiop" option to generate corresponding stubs and skeletons for each exported service.

Also supports exposing any non-RMI service via RMI invokers, to be accessed via JndiRmiClientInterceptor/JndiRmiProxyFactoryBean's automatic detection of such invokers.

With an RMI invoker, RMI communication works on the RmiInvocationHandler level, needing only one stub for any service. Service interfaces do not have to extend java.rmi.Remote or throw java.rmi.RemoteException on all methods, but in and out parameters have to be serializable.

The JNDI environment can be specified as "jndiEnvironment" bean 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:
RemoteExporter.setService(java.lang.Object), setJndiTemplate(org.springframework.jndi.JndiTemplate), setJndiEnvironment(java.util.Properties), setJndiName(java.lang.String), JndiRmiClientInterceptor, JndiRmiProxyFactoryBean, PortableRemoteObject.exportObject(java.rmi.Remote)

Field Summary
 
Fields inherited from class org.springframework.remoting.support.RemoteExporter
logger
 
Constructor Summary
JndiRmiServiceExporter()
           
 
Method Summary
 void afterPropertiesSet()
          Register the service as RMI object.
 void destroy()
          Unbind the RMI service from JNDI on bean factory shutdown.
 void setJndiEnvironment(Properties jndiEnvironment)
          Set the JNDI environment to use for JNDI lookups.
 void setJndiName(String jndiName)
          Set the JNDI name of the exported RMI service.
 void setJndiTemplate(JndiTemplate jndiTemplate)
          Set the JNDI template to use for JNDI lookups.
 
Methods inherited from class org.springframework.remoting.rmi.RmiBasedExporter
getObjectToExport, invoke
 
Methods inherited from class org.springframework.remoting.support.RemoteInvocationBasedExporter
getRemoteInvocationExecutor, invokeAndCreateResult, setRemoteInvocationExecutor
 
Methods inherited from class org.springframework.remoting.support.RemoteExporter
checkService, checkServiceInterface, getExporterName, getProxyForService, getService, getServiceInterface, isRegisterTraceInterceptor, setRegisterTraceInterceptor, setService, setServiceInterface
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JndiRmiServiceExporter

public JndiRmiServiceExporter()
Method Detail

setJndiTemplate

public void setJndiTemplate(JndiTemplate jndiTemplate)
Set the JNDI template to use for JNDI lookups. You can also specify JNDI environment settings via "jndiEnvironment".

See Also:
setJndiEnvironment(java.util.Properties)

setJndiEnvironment

public void setJndiEnvironment(Properties jndiEnvironment)
Set the JNDI environment to use for JNDI lookups. Creates a JndiTemplate with the given environment settings.

See Also:
setJndiTemplate(org.springframework.jndi.JndiTemplate)

setJndiName

public void setJndiName(String jndiName)
Set the JNDI name of the exported RMI service.


afterPropertiesSet

public void afterPropertiesSet()
                        throws NamingException,
                               RemoteException
Register the service as RMI object. Creates an RMI registry on the specified port if none exists.

Specified by:
afterPropertiesSet in interface InitializingBean
Throws:
NamingException
RemoteException

destroy

public void destroy()
             throws NamingException,
                    NoSuchObjectException
Unbind the RMI service from JNDI on bean factory shutdown.

Specified by:
destroy in interface DisposableBean
Throws:
NamingException
NoSuchObjectException


Copyright (c) 2002-2007 The Spring Framework Project.