• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

RemoteData implementation

 
John Chien
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
By reading so many discussion about local & remote interface design, I think the best design approach is to do the following:
1) Design a DataInterface that includes all the methods in Data class plus lock, unlock, and criteriaFind. Each method in the interface throws RemoteException.
2) Change Data class to implement DataInterface and implement the three method Sun requires.
Do not thow RemoteException in all the methods.
3) Design a RemoteDataInterface to extends DataInterface and Remote
4) Use Data as local data class.
5) Design a RemoteData class which extends Data and implements RemoteDataInterface with all the methods throws RemoteException.

My Question:
a) Is this RemoteData equals remote database server ? For me, it seems not. It is just the implementation object of RemotedataInterface
b) Since Data has already implements DataInterface, the RemoteData will be, in reality, implements DataInterface and RemoteDataInterface.
It looks strange to me. Can anybody explain it to me?
c) According to Java, a class can not extends more than one class. The RemoteData implementation seems violate the rule.
For example:
public class RemoteData extends Data, UnicastRemoteObject implements RemoteDataInterface {
..........
}
I think I must messed up in some place. Can anybody points out where I messed up ?
Thanks,
John Chien
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"public class RemoteData extends Data, UnicastRemoteObject implements RemoteDataInterface {
..........
}"

Simply you do not need to extend Data, you will have a reference to a Data class.
So your methods might look like this

Hope that helps.
Mark
 
John Chien
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mark:
Thank you. That's really help.
I think I was not careful in reading the discussions. RemoteData uses has-a relationship with Data instead of is-a relationship.
Remote Database server has a database that client uses remote protocol to interface with it.
Your answer also solve my 2nd question.
Thanks,
John Chien
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic