I am sure this has been asked many times before, but I did not understand. I have DBMain. I extended that and have Data (which has a RandomAccessFile). After that I get confused. I thought about having a class DBAdapter, which contained an instance of Data, with similar access methods. But what about RMI? I thought I would need a new interface DBRemote, that extended DBAdapter and Remote. And other class that implements DBRemote. But I cannot have the methods in this new class throw RemoteException since it isn't thrown in Data. Don't i want to have the client always refer to DBAdapter, so it does not know if it is using a remote or nonremote class?
posted 11 years ago
Hi,Jay. The DBRemote interface could extends Remote interface only,and The DBRemoteImpl class which implements DBRemote interface could keep an DBMain instance which access the data file. And the DBAdapter interface should be implemented according the mode. in local mode,the implementation could keep an DBMain instance, in network mode could keep a DBRemote instance. Then you can have the client always refer to DBAdapter, and it does not know if it is using a remote or nonremote class Hope this helps. [ April 09, 2004: Message edited by: janvy wei ]