Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

B&S: Question about DBMain

 
Jiwoong Lee
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi. All

Now I am working B&S with serious problem.

This is my given interface from SUN. And I am trying to use RMI. but As you know, There is no throw RemoteException. So i am really wordering that does it possible if i extend DBMain interface ? Because my assignment sheet said

"Your data access class must be called "Data.java", must be in a package called "suncertify.db", and must implement the following interface".

and It doesn't mention about modification and extension, Only Said implements given interface. so I am really confused what should i do...
some people said in this forum, Never modify and If You decide to use RMI. Adapter Pattern is the only way. But actually I don't understand well so...Plz help me the way as much detail as possible...
Sorry for my poor English, And
Thanks in advance.

-----------------------------
Jiwoong Lee
bluepopo@empal.com
SCJP 1.4
OCP 9i
SCJD(IN progress)
-----------------------------
 
Dieskun Koper
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Although you have to implement that class and use it to access the data file, you do not need to use that interface/class directly from your (RMI) client, do you?
You could add another class in the middle, that has the same methods as that interface, but that includes RemoteException in the throws clause of each method. Your client will call the methods on this class, and these methods call the methods on Sun's interface.
With this technique, you can change the method names and signatures of a class and still retain its functionalities. This is called the adapter pattern.

Regards,
Dies
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic