| Author |
Implementing Data interface in local and network mode
|
Aruneesh Salhotra
Ranch Hand
Joined: May 12, 2004
Posts: 167
|
|
The interface describes the interface method as readRecord throws RecordNotFoundException ... etc etc.. In local mode, one could simply do localInterface implements DataMain But in case of network mode, networkInterface implements DataMain, would require methods also throwing RemoteException. This wont compile. How are others handling this when doing the same with RMI. The base interface has to be Data I would assume.
|
 |
Kevin Conaway
Ranch Hand
Joined: Jan 27, 2006
Posts: 57
|
|
Aruneesh, I would suggest buying a book on design patterns and studying up on the Adapter pattern. Kevin
|
 |
Aruneesh Salhotra
Ranch Hand
Joined: May 12, 2004
Posts: 167
|
|
One of the books I have by "Apress" suggests that I created Interface public interface DVDDatabaseRemote extends Remote, DBClient { } public interface DBClient { public DVD getDVD(String upc) throws IOException, ClassNotFoundException; } public class DVDDatabaseImp extends UnicastRemoteObject implements DVDDatabaseRemote { public DVDDatabaseImpl() throws RemoteException{ } public DVD getDVD(String upc) throws RemoteException, IOException, CLassNotFoundException{ return <somevalue>; } } But doing a similar thing, I get compilation errors, that RemoteException is not defined in the interface DBClient.
|
 |
Kevin Conaway
Ranch Hand
Joined: Jan 27, 2006
Posts: 57
|
|
Aruneesh, Try something like Kevin [ February 17, 2006: Message edited by: Kevin Conaway ]
|
 |
Aruneesh Salhotra
Ranch Hand
Joined: May 12, 2004
Posts: 167
|
|
I am not sure if this mentioned in the assignment. I specifies a Data interface with few methods. Ofcourse none of the methods throw any RemoteException. Are we at luxury of defining similar interface for RMI.
|
 |
 |
|
|
subject: Implementing Data interface in local and network mode
|
|
|