This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
Hi all, i have a little question on the Connection Factory and RMI. On the client i call all business functionality by a Interface IDataAccess which contains methods lik book(), criteriasearch(). Based on the operating mode the client member variable of IDataAccess references a local (DataAccessLocal) or remote Implementation (DataAccessRemote which is returned by the Factory). So i do not have to distinguish what source(local or remote) is connected at the client. My Problem: ========== Both classes implement the same Interface IDataAccess (Not Remote) -DataAccessLocal must not be declared as remoteobject -DataAccessRemote must be declared as remoteObject, how can i do it without adding a new Interface with the same content like IDataAccess +RemoteInterface declarations ? Thanks for comments
Hi Dan, I had only a single interface which extened Remote and all of the public Data methods were tagged to throw RemoteException, even though when locally connected, no RemoteException could be thrown. I used a Bulider Pattern to deal with the problem you mention. The Bulider Pattern is a great way to shift compile time decisions to runtime. At the point in your client bootstrap code that you know which mode you want, then you simply "build" that type of connection. As you mentioned, for remote mode you would build an object that most likely extended UnicastRemote object and not for the local variety.
Hope this helps, Michael Morris
Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher