Java Doc for RmiServiceExporter.java in  » J2EE » spring-framework-2.0.6 » org » springframework » remoting » rmi » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » J2EE » spring framework 2.0.6 » org.springframework.remoting.rmi 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.springframework.remoting.rmi.RmiBasedExporter
   org.springframework.remoting.rmi.RmiServiceExporter

RmiServiceExporter
public class RmiServiceExporter extends RmiBasedExporter implements InitializingBean,DisposableBean(Code)
RMI exporter that exposes the specified service as RMI object with the specified name. Such services can be accessed via plain RMI or via RmiProxyFactoryBean . Also supports exposing any non-RMI service via RMI invokers, to be accessed via RmiClientInterceptor / RmiProxyFactoryBean '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 major advantage of RMI, compared to Hessian and Burlap, is serialization. Effectively, any serializable Java object can be transported without hassle. Hessian and Burlap have their own (de-)serialization mechanisms, but are HTTP-based and thus much easier to setup than RMI. Alternatively, consider Spring's HTTP invoker to combine Java serialization with HTTP-based transport.

Note: RMI makes a best-effort attempt to obtain the fully qualified host name. If one cannot be determined, it will fall back and use the IP address. Depending on your network configuration, in some cases it will resolve the IP to the loopback address. To ensure that RMI will use the host name bound to the correct network interface, you should pass the java.rmi.server.hostname property to the JVM that will export the registry and/or the service using the "-D" JVM argument. For example: -Djava.rmi.server.hostname=myserver.com
author:
   Juergen Hoeller
since:
   13.05.2003
See Also:   RmiClientInterceptor
See Also:   RmiProxyFactoryBean
See Also:   java.rmi.Remote
See Also:   java.rmi.RemoteException
See Also:   org.springframework.remoting.caucho.HessianServiceExporter
See Also:   org.springframework.remoting.caucho.BurlapServiceExporter
See Also:   org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter





Method Summary
public  voidafterPropertiesSet()
    
public  voiddestroy()
     Unbind the RMI service from the registry on bean factory shutdown.
protected  RegistrygetRegistry(String registryHost, int registryPort, RMIClientSocketFactory clientSocketFactory, RMIServerSocketFactory serverSocketFactory)
     Locate or create the RMI registry for this exporter.
protected  RegistrygetRegistry(int registryPort, RMIClientSocketFactory clientSocketFactory, RMIServerSocketFactory serverSocketFactory)
     Locate or create the RMI registry for this exporter.
protected  RegistrygetRegistry(int registryPort)
     Locate or create the RMI registry for this exporter.
public  voidprepare()
     Initialize this service exporter, registering the service as RMI object.
public  voidsetAlwaysCreateRegistry(boolean alwaysCreateRegistry)
     Set whether to always create the registry in-process, not attempting to locate an existing registry at the specified port.

Default is "false".

public  voidsetClientSocketFactory(RMIClientSocketFactory clientSocketFactory)
     Set a custom RMI client socket factory to use for exporting the service.
public  voidsetRegistry(Registry registry)
     Specify the RMI registry to register the exported service with.
public  voidsetRegistryClientSocketFactory(RMIClientSocketFactory registryClientSocketFactory)
     Set a custom RMI client socket factory to use for the RMI registry.
public  voidsetRegistryHost(String registryHost)
     Set the host of the registry for the exported RMI service, i.e.
public  voidsetRegistryPort(int registryPort)
     Set the port of the registry for the exported RMI service, i.e.
public  voidsetRegistryServerSocketFactory(RMIServerSocketFactory registryServerSocketFactory)
     Set a custom RMI server socket factory to use for the RMI registry.
public  voidsetReplaceExistingBinding(boolean replaceExistingBinding)
     Set whether to replace an existing binding in the RMI registry, that is, whether to simply override an existing binding with the specified service in case of a naming conflict in the registry.

Default is "true", assuming that an existing binding for this exporter's service name is an accidental leftover from a previous execution.

public  voidsetServerSocketFactory(RMIServerSocketFactory serverSocketFactory)
     Set a custom RMI server socket factory to use for exporting the service.
public  voidsetServiceName(String serviceName)
     Set the name of the exported RMI service, i.e.
public  voidsetServicePort(int servicePort)
     Set the port that the exported RMI service will use.
protected  voidtestRegistry(Registry registry)
     Test the given RMI registry, calling some operation on it to check whether it is still active.



Method Detail
afterPropertiesSet
public void afterPropertiesSet() throws RemoteException(Code)



destroy
public void destroy() throws RemoteException(Code)
Unbind the RMI service from the registry on bean factory shutdown.



getRegistry
protected Registry getRegistry(String registryHost, int registryPort, RMIClientSocketFactory clientSocketFactory, RMIServerSocketFactory serverSocketFactory) throws RemoteException(Code)
Locate or create the RMI registry for this exporter.
Parameters:
  registryHost - the registry host to use (if this is specified,no implicit creation of a RMI registry will happen)
Parameters:
  registryPort - the registry port to use
Parameters:
  clientSocketFactory - the RMI client socket factory for the registry (if any)
Parameters:
  serverSocketFactory - the RMI server socket factory for the registry (if any) the RMI registry
throws:
  RemoteException - if the registry couldn't be located or created



getRegistry
protected Registry getRegistry(int registryPort, RMIClientSocketFactory clientSocketFactory, RMIServerSocketFactory serverSocketFactory) throws RemoteException(Code)
Locate or create the RMI registry for this exporter.
Parameters:
  registryPort - the registry port to use
Parameters:
  clientSocketFactory - the RMI client socket factory for the registry (if any)
Parameters:
  serverSocketFactory - the RMI server socket factory for the registry (if any) the RMI registry
throws:
  RemoteException - if the registry couldn't be located or created



getRegistry
protected Registry getRegistry(int registryPort) throws RemoteException(Code)
Locate or create the RMI registry for this exporter.
Parameters:
  registryPort - the registry port to use the RMI registry
throws:
  RemoteException - if the registry couldn't be located or created



prepare
public void prepare() throws RemoteException(Code)
Initialize this service exporter, registering the service as RMI object.

Creates an RMI registry on the specified port if none exists.
throws:
  RemoteException - if service registration failed




setAlwaysCreateRegistry
public void setAlwaysCreateRegistry(boolean alwaysCreateRegistry)(Code)
Set whether to always create the registry in-process, not attempting to locate an existing registry at the specified port.

Default is "false". Switch this flag to "true" in order to avoid the overhead of locating an existing registry when you always intend to create a new registry in any case.




setClientSocketFactory
public void setClientSocketFactory(RMIClientSocketFactory clientSocketFactory)(Code)
Set a custom RMI client socket factory to use for exporting the service.

If the given object also implements java.rmi.server.RMIServerSocketFactory, it will automatically be registered as server socket factory too.
See Also:   RmiServiceExporter.setServerSocketFactory
See Also:   java.rmi.server.RMIClientSocketFactory
See Also:   java.rmi.server.RMIServerSocketFactory
See Also:   UnicastRemoteObject.exportObject(RemoteintRMIClientSocketFactoryRMIServerSocketFactory)




setRegistry
public void setRegistry(Registry registry)(Code)
Specify the RMI registry to register the exported service with. Typically used in combination with RmiRegistryFactoryBean.

Alternatively, you can specify all registry properties locally. This exporter will then try to locate the specified registry, automatically creating a new local one if appropriate.

Default is a local registry at the default port (1099), created on the fly if necessary.
See Also:   RmiRegistryFactoryBean
See Also:   RmiServiceExporter.setRegistryHost
See Also:   RmiServiceExporter.setRegistryPort
See Also:   RmiServiceExporter.setRegistryClientSocketFactory
See Also:   RmiServiceExporter.setRegistryServerSocketFactory




setRegistryClientSocketFactory
public void setRegistryClientSocketFactory(RMIClientSocketFactory registryClientSocketFactory)(Code)
Set a custom RMI client socket factory to use for the RMI registry.

If the given object also implements java.rmi.server.RMIServerSocketFactory, it will automatically be registered as server socket factory too.
See Also:   RmiServiceExporter.setRegistryServerSocketFactory
See Also:   java.rmi.server.RMIClientSocketFactory
See Also:   java.rmi.server.RMIServerSocketFactory
See Also:   LocateRegistry.getRegistry(StringintRMIClientSocketFactory)




setRegistryHost
public void setRegistryHost(String registryHost)(Code)
Set the host of the registry for the exported RMI service, i.e. rmi://HOST:port/name

Default is localhost.




setRegistryPort
public void setRegistryPort(int registryPort)(Code)
Set the port of the registry for the exported RMI service, i.e. rmi://host:PORT/name

Default is Registry.REGISTRY_PORT (1099).
See Also:   java.rmi.registry.Registry.REGISTRY_PORT




setRegistryServerSocketFactory
public void setRegistryServerSocketFactory(RMIServerSocketFactory registryServerSocketFactory)(Code)
Set a custom RMI server socket factory to use for the RMI registry.

Only needs to be specified when the client socket factory does not implement java.rmi.server.RMIServerSocketFactory already.
See Also:   RmiServiceExporter.setRegistryClientSocketFactory
See Also:   java.rmi.server.RMIClientSocketFactory
See Also:   java.rmi.server.RMIServerSocketFactory
See Also:   LocateRegistry.createRegistry(intRMIClientSocketFactoryRMIServerSocketFactory)




setReplaceExistingBinding
public void setReplaceExistingBinding(boolean replaceExistingBinding)(Code)
Set whether to replace an existing binding in the RMI registry, that is, whether to simply override an existing binding with the specified service in case of a naming conflict in the registry.

Default is "true", assuming that an existing binding for this exporter's service name is an accidental leftover from a previous execution. Switch this to "false" to make the exporter fail in such a scenario, indicating that there was already an RMI object bound.




setServerSocketFactory
public void setServerSocketFactory(RMIServerSocketFactory serverSocketFactory)(Code)
Set a custom RMI server socket factory to use for exporting the service.

Only needs to be specified when the client socket factory does not implement java.rmi.server.RMIServerSocketFactory already.
See Also:   RmiServiceExporter.setClientSocketFactory
See Also:   java.rmi.server.RMIClientSocketFactory
See Also:   java.rmi.server.RMIServerSocketFactory
See Also:   UnicastRemoteObject.exportObject(RemoteintRMIClientSocketFactoryRMIServerSocketFactory)




setServiceName
public void setServiceName(String serviceName)(Code)
Set the name of the exported RMI service, i.e. rmi://host:port/NAME



setServicePort
public void setServicePort(int servicePort)(Code)
Set the port that the exported RMI service will use.

Default is 0 (anonymous port).




testRegistry
protected void testRegistry(Registry registry) throws RemoteException(Code)
Test the given RMI registry, calling some operation on it to check whether it is still active.

Default implementation calls Registry.list().
Parameters:
  registry - the RMI registry to test
throws:
  RemoteException - if thrown by registry methods
See Also:   java.rmi.registry.Registry.list




Methods inherited from org.springframework.remoting.rmi.RmiBasedExporter
protected Remote getObjectToExport()(Code)(Java Doc)
protected Object invoke(RemoteInvocation invocation, Object targetObject) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.