Hi, My design is as follows : On the client side I have the following Connection - Interface which defines all the methods of the data class. RemoteConnection - Implements Connection and provides remote data access LocalConenction - Implements Connection and provides local data access. On the server side I have the following RemoteConnectionFactory - Interface for a factory that creates connections RemoteConnectionFactoryImp - Implements RemoteConnectionFactory and creates connections ClientConnection - Interface which defines all the methods of the data class. ClientConnectionImp - Implements the ClientConnection interface. Each client that connects will receive it's own instance of this class
My question is, should the ClientConnection interface extend the Connection interface instead of defining it's own methods, this way I could get rid of the RemoteConnection class Any suggestions would be greatly appreciated Brian
Hi Brian, How does a local client get a connection? Does your GUI have to be smart enough to know that it's using a local connection, or do you want provide a general Connection Factory: one that decides if it, in turn, needs a LocalConnection or a RemoteConnection? I'm not suggesting that one way or another is correct: I'd just like to hear your approach. All best, M, author The Sun Certified Java Developer Exam with J2SE 1.4
The user would select what type of connection they wish to establish. And yes, I do have a connection factory is responsible for creating the actual connection.
posted 17 years ago
Sorry to answer the other question, the the GUI does not need to have any concept of what type of connection it is working with, that is totally transparent, all the GUI knows is that it has a connection (Connection Interface)
In my design, using MVC in GUI. Controller connects to Abstract Factory pattern which returns ConnectionFactory (Local or Remote). LocalConnection class connects to DataAdapter class which connects to Data class. RemoteConnection class connects to RMI using proxy and adapter pattern. I didn't finish yet from coding but I think the design is alright. Max, I read your book. A beautiful design there. Although Nobody lost points for not implementing ClientID, I will use ClientID in my design, that's why I used Abstract Factory, proxy and adapter patterns. I think you know many members takling about unlock() method documentaiton, so it is a chance to learn something here. Regards