Hmm...Now I'm a bit confused...
My server side:
I have an interface
Server and all its methods throw
IOExceptions. I also have an interface
RemoteServer which
extends Server and
Remote. There is then two Impl classes:
ServerImpl which
implements Server and
RemoteServerImpl which
extends UnicastRemoteObject and
implements RemoteServer. However,
RemoteServerImpl narrows the throwing on all its methods to only declare to
throws RemoteException. The
RemoteServerImpl then has an instance of a
ServerImpl and only acts as a wrapper and forward all method calls to the
ServerImpl instance.
(sorry if it reveals to much for others...then please delete it...)
The client side gets access to the
RemoteServerImpl by calling:
server = (RemoteServer) Naming.lookup(remoteServerName); and the
ServerImpl by calling:
server = ServerFactory.getInstance().getLocalServer(); These are the only two places where the client knows the type of the
Server. In all other cases it just calls server.doSomething();
Question #1: Is the server side design ok when considering the requirement "non-network-mode...must not use the network server code at all" since when in networking code the remote server will use the
ServerImpl instance which will also be used in the non-network mode (i.e., the
ServerImpl, not the
RemoteServerImpl).
Question #2: Is it ok that the client knows which server type it gets from the two different method calls? If not, how else is it possible to make the client totaly unaware of the type?
Question #3: Sun has a graphics repository (
http://java.sun.com/developer/techDocs/hi/repository/) that anyone is free to use. I feel that their icons could add some value to the GUI =). However, one is supposed (according to their license agreement) to add the license file to the application. Would I violate any must-issues in the assignment (e.g., The JAR file must have the following layout and contents in its root)?
Question #4: My submission should be packaged in a single JAR file which must contain the executable jar file runme.jar. However, is it stated anywhere which name the submitted jar file must have?
Regards,
Henrik
PS. Just found this site:
Design networked applications in RMI using the Adapter design pattern (
http://www.javaworld.com/javaworld/jw-05-1999/jw-05-networked_p.html)
Figure #2 looks very familiar
[ January 09, 2006: Message edited by: Henrik Strand ]
[ January 09, 2006: Message edited by: Henrik Strand ]