However, I am worried that I will automatically fail because my NonNetworkedServer implements the Server interface, which in turn implements the Remote interface.
I initially had a similar design and I got the same worries. I decided not to take any chances and abandoned this design.
I changed it with a new design, something like this:
Data: implements the given interface
DataAdapter: an abstract class that has the same same method signatures as the given interface (but does not implement it!); all methods are declared to throw RemoteException.
RemoteAdapter: implements DataAdapter and Remote; all methods just call the Data methods
LocalAdapter: implements DataAdapter; all methods just call the Data methods
My business classes were given an instance of DataAdapter, which did not contain any networked-related code if the server was a local-mode server. Minor downside is that the business classes still need to be ready to handle RemoteExceptions, even in local mode, but I stated that that was acceptable in my design document.
FWIW, I feel my design was a bit too constructed, only to prevent an auto-failure. The design you are describing sounds much more natural and I surely would have done it that way if it were a real-life project.
SCJP 1.4, SCJD
Joined: Mar 29, 2005
yeah, something similar to your DataAdapter interface is my plan B as well.
It's annoying to have to have to abandon (what I think is)a better design just to avoid the possibility of auto failure though.