• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Data interface does not throw RemoteException

 
Sam Segal
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all great people,
I am curious if any of you would have input of a know pattern for
guidance in dealing with throwing an exception that is not thrown in
the interface. My directions specifically say that my data access class
must implement the interface provided. The methods defined in the interface provided do not throw RemoteException, or IOException. So I get the error,
"Exception RemoteException is not compatible with DBAccess.readRecord(long)"
My question is how will I share an interface reference on the client
if the interface I pass must throw the remoteException, but the data
access interface I am required to use does not support such an exception.
I am inexperienced and new to OO design, and am having a hell of a
time trying to merge the laws of inheritance, encapsulation,
polyWhatEverTheHeckItIs, compostition, open/close, this/that. Anyway,
any guidance is much appreciated and thanks in advance if your welcome.
Sincerely,
Sam
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sam, I think the instructions state that your data class must implement the interface. You can still create a DataAccess Interface on your own that has all the public methods of the Data class, in that interface you can throw any type of Exception that you chose. I mean you could have all the methods in your interface throw Exception, or even extend Remote and throw RemoteExceptions. But that is a choice you get to make.
Mark
 
Leo Tien
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sam:
After look this thread, perhaps you can get some idean.
 
Sam Segal
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
WOW. You guys are 911 X 911. Thankyou so Much for the shared knowledge. Object Adapter is exactly what I was looking for. That was awesome. I probably would have sat for hours cursing why, why, whY, wHY, WHY!!! WHY!!!

WHY!!!
I need to know WHY?
Please...
 
Leo Tien
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sam:
Do you ask why the methods in DBAccess interface don't throw RemoteException or IOException.
I think :
1) this program we design have two different model, alone and remote. At alone model, there is no network, so no RMI, so no RemoteException anywhere.
2) ever in the remote model, should you hope expose these methods to the cilent?
Make sense?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic