posted 17 years ago
Hi
I have run into (what I see as) a huge problem. In URLyBird 1.2.2 I have decided to go for the RMI solution.
What I have done is:
Guicontroller class has connection to database facade via interface DatabaseInterface (both for RMI and local mode).
I have data access class (Data.java) implementing DBAccess in the bottom. On top of that in local mode I have DatabaseImpl (facade class) implementing DatabaseInterface. So far, all good and works ok.
Same basic setup for RMI part, but with RemoteDatabaseImpl implementing RemoteDatabaseInterface (extends Remote and DatabaseInterface). From the controller a factory class is used to return instance on which we can run the getConnection() method -> gives us (DatabaseInterface)RemoteDatabaseImpl
. But since this is RMI RemoteDatabaseImpl has to throw RemoteException for all methods (and hey, now it has to be in the interface as well). The interface used in controller class has to declare all methods that we want to use there (search, makeReservation etc) and now we have a problem Houston! Yikes, controller class has to handle RemoteExceptions also for local mode.
Besides being ugly, is this also criminal and worse, close to failure?
I have turned and tweaked and tested different solutions but I really don't ge a nice solution sofar. Maybe a good advice or I think its time to start over from scratch with a new design again.