-this class behaves as an adapter, to adapt the Data interface to the Connection interface. They have the subtle difference that Connection throws an IOException when operations are performed on it. This class basically delegates the work on to Data.
Then my RemoteConnectionImpl operates identically to LocalConnection with the exception of the lock and unlock methods. Would it not make sense for RemoteConnectionImpl to extend LocalConnection and override the lock methods? It can export itself rather than extending UnicastRemoteObject. We are saying that a RemoteConnectionImpl is a LocalConnection which can be remotely exported. After all, the server object is always a connection to a local database, but we are just saying that it also implements to declare that can also be exported remotely. Therefore, the class declaration would be:
town drunk ( and author)
posted 13 years ago
This isn't a bad idea @ all. I can see you going either way with it. However, in a real world application, I probably wouldn't do it. Reason? I'd like for my RemoteConnection class and my LocalConnection class to be able to grow /evolve without having side effects on each other. M