posted 18 years ago
Hi - thanks for yr help. However, can I ask for some clarification.
CURRENT SITUATION:
interface DBAccess (extends java.rmi.Remote, but this needs to be changed, as not allowed to alter this interface)
class Data (implements DBAccess, extends java.rmi.server.UnicastRemoteObject)
//server
DBAcess dba = new DBAccess();
Data r = (Data)dba;
r.loadData();
//create and bind registry
LocateRegistry.createRegistry(port);
Registry registry = LocateRegistry.getRegistry(port);
registry.rebind("Data", r);
//client
Data d = (Data)Naming.lookup("Data");
System.out.println("Running as client");
Gui g = new Gui (d);
g.createAndShowGui(d);
The Gui constructor parameter is of type DBAccess.
FUTURE SITUATION:
I can remove all rmi from the DBAccess interface and Data class and create a new package suncertify.db.net to include the following:
RemoteDB - extends java.rmi.remote
RemoteData - implements RemoteDB, extends java.rmi.server.UnicastRemoteObject
But is that not (unnecessary) duplication of code?
I'm not quite sure about this proxy...
"the proxy is the thing your client application is calling methods on, with the proxy being responsible for forwarding those calls to the network enabled RemoteData instance you got back when opening the RMI connection."
I can have a DataProxy class that implements DB but not sure what should go in there...Or maybe I am confused about what should go in the RemoteData class..
Can you pse provide a little more info...
Thanks
L