From Requirements: The operating mode is selected using the single command line argument that is permitted. Architecturally, this mode must use the database and GUI from the networked form, but must not use the network server code at all.
To make my code and life simple, I need an answer to a question:
LOCAL MODE: :- Can I use the Data class which extends SUN's interface in local mode as it is. How I am thinking of doing it: Import the Data class on client side and use it as regular local object. NOT accessing it through network mode(which requires registering the object on serverside and lookingup on client side).
NETWORK MODE: Create instance of Data class on server-side, BUT this time it is registered with RMI-registry and on client side we can perform registry lookup and use remote object.
I am viewing the DATA class as designed for API of this applicaiton and can be used by the server and client both AND it becomes server code only when and instance is created on severside.
What do you say..
Many thanks, Alain
[ December 27, 2008: Message edited by: Alain Dickson ]
[ December 27, 2008: Message edited by: Alain Dickson ] [ December 27, 2008: Message edited by: Alain Dickson ]
You must be able to throw RemoteException from every method of Data. If the SUN interface allows you to do this (for example the methods throw IOException) then it should be possible. Your Data class should implement an interface which extends both java.rmi.Remote and the SUN interface, and it should also extend UnicastRemoteObject.
However, I'd say this is not a very nice choice, because it makes your Data class depend on the server's implementation. If you decide sometime later that RMI is not desirable anymore, you have to change the Data class. It's better to keeps concerns separated.
About your "must not use the network server code at all" concern, I'd say it's ok as long as you don't start the RMI registry in non-networked mode. [ December 27, 2008: Message edited by: Alecsandru Cocarla ]