Global Positioning System Reference
In-Depth Information
to tag classes for remote access and java.rmi.RemoteException to detect
connection problems.
Java RMI is divided into three packages comprising the three parties
involved (see the sequence diagram on page 137):
1. java.rmi : This package provides everything for the RMI client:
ˆ Remote interface to reference remote objects;
ˆ RemoteException , if something goes wrong in the network;
ˆ Naming class to get the registry and look up remote objects;
ˆ RMISecurityManager to identify the involved classes;
ˆ a number of Exception s.
2. java.rmi.registry : This package sets up and locates a registry|the
third party between client and server. The registry is only initially
needed to look up the reference of a RMI object. Once the connection
is established the registry could be turned off.
3. java.rmi.server : This package provides classes and interfaces for sup-
porting the RMI server side. This is basically the
ˆ UnicastRemoteObject , which inherits from
ˆ RemoteServer(getClientHost()) , which inherits from
ˆ RemoteObject
and is able to turn any object tagged with Remote into a remote object.
Using the roaf.util.RMI class, the ROAF developer can invoke RMI
methods with a single call and proceed in the program flow by checking
the return value indicating success or failure.
1. setRMISecurityManager() : The RMISecurityManager should be set as
soon as the application is distributed via the internet. It can only be
set before beginning with RMI and cannot be unset. The consecutive
methods provide hints on how to satisfy the security manager.
2. allocateRegistry(Stringhost,intport) : With this method, a
registry can be launched on any host and specified port (port 1099 is
the default port for the RMI protocol) with the command line tool:
%java.home%\bin\rmiregistry.exe <port>
Then, this registry can be allocated from any other (connected) host.
Note that the RMI class hides the rmiRegistry as a private member!
Consequently, the roaf application should always call this method
with the same host and port.
Otherwise, an initial allocation of a
previous registry will be lost.
 
Search WWH ::




Custom Search