X is the interface sun provided,W is the interface which local and remote all used.My design like this because X doesnot throws RemoteException,I wrapped it in W,W is ok for remote. In server side I make a class DBServerMain which start rmiregistry and bind remoteobject.In client I use a simple Factory whose static method getConnection() provides local or remote connection(type is W above).
my question is: 1.if the design is ok,which method should called in the clientside.though I refered the thread "Should lock methods be callable by the client",but I don't have a clear decision. 2.How to handle the Exception(RemoteException,RNFE,SecurityException),is which side. 3.I used jdk1.4 logging,If I need write the log into a file
[Andrew: Put diagram between [code] and [/code] UBB tags] [ September 21, 2004: Message edited by: Andrew Monkhouse ]
Joined: Jul 28, 2004
sorry for the uml,I use Marlene Miller 's Example 4. or 2b. (W wraps X).
I have edited your post to put the diagram between [code] and [/code] UBB tags. Doing this ensures that indenting is preserved, which makes the code easier to read.
When you are writing your post, there are a number of buttons just below the edit pane, which will insert the tags for you, so you don't have to remember what they are.
If you would like to edit your original post so that you can see what I have done, you can click on the button that is just above your post.
1.if the design is ok,which method should called in the clientside.
I'm sorry, I don't understand. You've said that you have a factory on the client side, which must be creating an instance of some class or interface. So you're clientside code will be calling that instance won't it?
2.How to handle the Exception(RemoteException,RNFE,SecurityException),is which side.
Both sides can get RemoteException so you need to handle that on both sides.
If you are going with a thick client (all the business logic is done in the client) then you will need to handle the business logic exceptions (RFNE, Security ...) on the client side.
3.I used jdk1.4 logging,If I need write the log into a file
You need to make a design decision (and document it )
You could have logging set by a command line parameter, which since the examiner will not use any command line parameters (other than the 'server' or 'alone' parameters) will mean that logging is turned off.
Or you could decide to log to a file in the current working directory (then you have to decide whether to overwrite it each time, or append).
Or you could decide to log to standard output.
Or you could even log to a separate log pane in your application (with a possible option to save the log to file).
THANK YOU VERY MUCH,Andrew! you know I am a new man,I don't know how to get others' attention,and I don't know how to make my question more clear.no one reply my post,I think it must be too simple to reply.and I appreciate for your editing my code. 1>I am not sure you understand the interface,class w,x and wImpl,xImpl.you konw x is the interface sun provided,but it's signature dos not throw RemoteException or IOException.I don't want use Exception chain to wrappe RNFE.w is the interface I make to wrapped x,to handle the remoteException.The factory in clientside is return a interface W,Wimpl is the connection used in local mode,RemoteWImpl is the connection used in remote mode,they are all implements W.the client will have all method sun provided.it is ok? I don't know if I state it clear. 2>just like you said,then which class must be copy to client?all the logic exception, the w interface,the stub,should the x and ximpl? It is a question too fussy,sorry about it 3>if the user does not specify the mode of logging,I put the output of logging in the console,it's ok?
author and jackaroo
Sorry, I don't have time to work through the logic of the UML diagram and verify whether it will meet the requirements of the assignment. I know that in the other thread you referenced, there was discussion about whether the various designs met the requirements - I would suggest you verify that the design you are going with was not discounted in that thread.
2. just like you said,then which class must be copy to client?all the logic exception, the w interface,the stub,should the x and ximpl?
You should only need the interface, the stubs, and the exceptions.
3. if the user does not specify the mode of logging,I put the output of logging in the console,it's ok?
As long as you document what you are doing and why you are doing it, that should be OK.