Spring Framework

org.springframework.remoting.rmi
Class RmiBasedExporter

java.lang.Object
  extended by org.springframework.remoting.support.RemotingSupport
      extended by org.springframework.remoting.support.RemoteExporter
          extended by org.springframework.remoting.support.RemoteInvocationBasedExporter
              extended by org.springframework.remoting.rmi.RmiBasedExporter
All Implemented Interfaces:
Aware, BeanClassLoaderAware
Direct Known Subclasses:
JndiRmiServiceExporter, RmiServiceExporter

public abstract class RmiBasedExporter
extends RemoteInvocationBasedExporter

Convenient superclass for RMI-based remote exporters. Provides a facility to automatically wrap a given plain Java service object with an RmiInvocationWrapper, exposing the RmiInvocationHandler remote interface.

Using the RMI invoker mechanism, RMI communication operates at the RmiInvocationHandler level, sharing a common invoker stub for any number of services. Service interfaces are not required to extend java.rmi.Remote or declare java.rmi.RemoteException on all service methods. However, in and out parameters still have to be serializable.

Since:
1.2.5
Author:
Juergen Hoeller
See Also:
RmiServiceExporter, JndiRmiServiceExporter

Field Summary
 
Fields inherited from class org.springframework.remoting.support.RemotingSupport
logger
 
Constructor Summary
RmiBasedExporter()
           
 
Method Summary
protected  java.rmi.Remote getObjectToExport()
          Determine the object to export: either the service object itself or a RmiInvocationWrapper in case of a non-RMI service object.
protected  java.lang.Object invoke(RemoteInvocation invocation, java.lang.Object targetObject)
          Redefined here to be visible to RmiInvocationWrapper.
 
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, setInterceptors, setRegisterTraceInterceptor, setService, setServiceInterface
 
Methods inherited from class org.springframework.remoting.support.RemotingSupport
getBeanClassLoader, overrideThreadContextClassLoader, resetThreadContextClassLoader, setBeanClassLoader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RmiBasedExporter

public RmiBasedExporter()
Method Detail

getObjectToExport

protected java.rmi.Remote getObjectToExport()
Determine the object to export: either the service object itself or a RmiInvocationWrapper in case of a non-RMI service object.

Returns:
the RMI object to export
See Also:
RemoteExporter.setService(java.lang.Object), RemoteExporter.setServiceInterface(java.lang.Class)

invoke

protected java.lang.Object invoke(RemoteInvocation invocation,
                                  java.lang.Object targetObject)
                           throws java.lang.NoSuchMethodException,
                                  java.lang.IllegalAccessException,
                                  java.lang.reflect.InvocationTargetException
Redefined here to be visible to RmiInvocationWrapper. Simply delegates to the corresponding superclass method.

Overrides:
invoke in class RemoteInvocationBasedExporter
Parameters:
invocation - the remote invocation
targetObject - the target object to apply the invocation to
Returns:
the invocation result
Throws:
java.lang.NoSuchMethodException - if the method name could not be resolved
java.lang.IllegalAccessException - if the method could not be accessed
java.lang.reflect.InvocationTargetException - if the method invocation resulted in an exception
See Also:
RemoteInvocationExecutor.invoke(org.springframework.remoting.support.RemoteInvocation, java.lang.Object)

Spring Framework