• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

DB extending DBMore interface ? (RemoteException)

 
josine wilms
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

One of my ideas is to give DB interface a parent interface which holds the same methods as DB but has certain methods throwing RemoteException for the RMI portion......

Technically I would have changed ONLY the signature of the class name of DB interface ("public DB extends DBMore" instead of "public DB").

Would you think this is acceptable with Sun?

I say yes the methods are still fine, I say no it's a difference of what is stated for the class name, I say I don't know if it's acceptable....?

:roll:
 
Mark Smyth
Ranch Hand
Posts: 288
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by josine wilms:
Hi all,

One of my ideas is to give DB interface a parent interface which holds the same methods as DB but has certain methods throwing RemoteException for the RMI portion......

Technically I would have changed ONLY the signature of the class name of DB interface ("public DB extends DBMore" instead of "public DB").

Would you think this is acceptable with Sun?

I say yes the methods are still fine, I say no it's a difference of what is stated for the class name, I say I don't know if it's acceptable....?

:roll:



I am not sure that this approach would be acceptable because if you use an instance of the the DBMore interface then you are not using the DB interface at all;
The reason for this is that a subclass the same type of its superclass interface, but a superclass may not nesessarily be the same type its subclass.



If you declare it like this then you have lost the
RemoteExceptions' you declared in DBMore in any case as the extended DB interface will have dropped them.

Why not have an adapter /wrapper ? class instead that throws remote exceptions and maintains an instance of DB delegating the 'dirty' lower level work it.
 
Edwin Dalorzo
Ranch Hand
Posts: 961
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Josine

My recommendation is that you simply implement the interface provided by Sun and then use the Adapter pattern to adapt this implementation to your RMI implementation needs.
 
Sam Codean
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Agree with Edwin. Whereever there is a must just follow it religiously.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic