Java Reference
In-Depth Information
import java.rmi.*;
import java.rmi.server.*;
public interface SumInterface extends java.rmi.Remote {
public int sum( int a, int b ) throws java.rmi.RemoteException;
public class SumImplementation extends UnicastRemoteObject
implements SumInterface {
public int sum( int a, int b ) { return a ! b;}
public class Server {
public void execute() {
SumImplementation sumImpl # new SumImplementation();
Naming.bind( "Adder", sumImpl );
public class Client {
String serverIP # "";
String adderUrl # "//" ! serverIP ! "/Adder" ;
public void execute() {
SumInterface adder # (SumInterface) Naming.lookup( adderUrl );
int result # adder.sum(5, 8);
does not offer such support. For the sake of simplicity, we use the RMI
mechanism as the common distribution mechanism for the interconnection
of every remote object in the SCADA system. Figure 13.11 depicts the class
diagram of Prototype 2. Class TankController represents the PLCs that
control the colour tanks. It invokes the methods of class Pump and class Tank
defined in PumpInterface and TankInterface using the RMI mechanism.
Class MixerController extends class TankController , since it controls the
mixture tank and its pumps and in addition it interacts with the colour tank
controllers. For this purpose, class TankController implements the remote
interface ControllerInterface that exports method openPump() . This method
is invoked by the mixture tank controller to request the colour tank
controllers to supply paint flows. The same interface is implemented by class
MixerController , as the supervisory console will need to invoke the
openPump() method to open the spray pump. In Figure 13.11 we have drawn
dashed lines to highlight the distribution of classes on different sites. The
arrows that cross a dashed line indicate that the interaction between two
classes is implemented using the Java RMI mechanism.
Both TankController and MixerController implement interface Runnable as
they manage an independent thread of control that executes their behaviours.
Decision point
How do PLCs and work cell devices handle synchronization of their behaviours?
Search WWH ::

Custom Search