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: rmi remotexceptions on interface

 
Geoff Parkes
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,

I'm beginning work on my RMI implementation, but have reached a blocker around the interface for my remote "database access point".

The DBAccess interface provided by my assignment instructions presents a standard set of "accessor" methods for working with the underlying db. But these methods do not throw any IOExceptions. Which makes it tricky for my RMI version to throw RemoteExceptions.

Presently, i'm looking at creating an Adapter for my Data class (DBAccess implementation), adapting it to a new interface with IOExceptions thrown (and perhaps even some more intelligent accessor methods).

Is this a reasonable approach, or am i missing something obvious?

Does it still meet my instructions requirements to use Data and DBAccess as my "data access class", now that my GUI controller would be communicating via my adapter interface to the adapter rather than to the Data instance directly?
[ December 29, 2006: Message edited by: Geoff Parkes ]
 
Jeroen T Wenting
Ranch Hand
Posts: 1847
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All the requirements state is that you MUST implement your DB interface in the Data class. Nowhere does it state you MUST implement it directly, so you can implement an interface inheriting from DB instead that adds methods.
What you can NOT do is have it implement solely something else.

I have done something similar to what you seem to be planning, having the Data class proxied for network mode by another class implementing a shadow interface which has identical methods to the DB interface but throws more exceptions.
 
Geoff Parkes
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think my worry is not so much that my Data class would be implementing another interface, it would still just implement DBAccess.

But by using an adapter pattern, i essentially build a new interface (with IO Exceptions) and a new wrapper implementation class.

All the adapter class would do is pass calls onto Data via the DBAccess interface - but its still not DBAccess being used directly from the rest of the application its the "DBAccessExtended" interface if you will.

DBAccessExtended (for want of a better name), would not be an extension of DBAccess. I don't need to add methods, i'm looking to essentially replace those on DBAccess with a version throwing IOException (or RemoteException to be precise).
[ December 29, 2006: Message edited by: Geoff Parkes ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic