Hi Tony,
And 2 and 3 really just either handle or throw caught exceptions are they adapters
All of the cleasses you mentioned are adapters. Adapter is the class/interface whose main purpose is wrap another class to change his methods signature. Whether it is new exception to be thrown or new method it doesn't matter.
And if they are all Adapters whats the difference between an Adapter and a wrapper
Wrapper is (to my opinion) more more common notion. It has no the main purpose to change interface. Example: Integer/Long and son are all wrappers, but not adapters. They wrap int/long.
One question: Is your adapter #3 on the client? If so, why do you need it for?
I have
- one ServerAdapter class on the server to change change signature of methods
- one RemoteServerAdapter class on the server with RemoteExceptions
- one adapter on the client ClientAdapter , adopting/wrapping RemoteServerAdapter to hide RemoteException.
The Factory class on the client gets either ServerAdapter object or RemoteServerAdapter. In case of RemoteServerAdapter is will be wrapped in ClientAdapter. So Factory delivers either ServerAdapter or ClientAdapter class. Both of them implement the same interface. So, the client GUI actually doesn't know if it is local or remote mode.
By the way, nobody , who hides lock/unlock/readRecord/delete/create/update methods in the Adapter class doesn't worry about following requirement:
The following are the "top level" features that must be implemented:
A client program with a graphical user interface that connects to the database
A data access system that provides record locking and a flexible search mechanism
Network server functionality for the database system
Only Adapter classes (book, find, getSchema) in our case will be available remotely. I am afraid it is dangerous.
Andrew said, well just put other methods in interface. I don't think it is good idea to have interface containing methods together:
book (implicitely locks record):
update (doesn't locks record)
lock
unlock
read
find
I have sent the question to Sun whether it is Ok to make only three methods, needed by our client, available remotely. It was at least one month ago.
I have NOT got any answer !? ...
Best,
Vlad
[ September 16, 2003: Message edited by: Vlad Rabkin ]
[ September 16, 2003: Message edited by: Vlad Rabkin ]