File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes RMI interfaces Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "RMI interfaces" Watch "RMI interfaces" New topic

RMI interfaces

Jason Hocker
Ranch Hand

Joined: Jul 23, 2003
Posts: 132
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?
janvy wei

Joined: Jan 03, 2004
Posts: 28
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 ]
I agree. Here's the link:
subject: RMI interfaces
It's not a secret anymore!