Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Implementing Data interface in local and network mode

 
Aruneesh Salhotra
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Aruneesh,

I would suggest buying a book on design patterns and studying up on the Adapter pattern.

Kevin
 
Aruneesh Salhotra
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Aruneesh,

Try something like



Kevin
[ February 17, 2006: Message edited by: Kevin Conaway ]
 
Aruneesh Salhotra
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic