File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes RemoteData implementation 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 "RemoteData implementation" Watch "RemoteData implementation" New topic
Author

RemoteData implementation

John Chien
Ranch Hand

Joined: Feb 06, 2003
Posts: 105
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


SCJP, SCJD, SCWCD, SCBCD<br />IBM Certified Specialist (158)<br />Oracle9i PL/SQL Developer Certified Associate
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17260
    
    6

"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


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
John Chien
Ranch Hand

Joined: Feb 06, 2003
Posts: 105
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: RemoteData implementation