the difference is that the LocalConnection throws it because it couldn't find the file locally( thus, it caught an IOException, logged it, and then threw a DBConnectionFailedException), where the RemoteConnection throws it because it caught a RemoteException(which it also caught an logged). For the moment, ignore the fact the a RemoteException is a IOException
Originally posted by Sam O'Neill:
Okay I understand - you are wrapping it one more time within a local object that catches the exceptions and then throws its own kind to the GUI.
Can I also ask a question about logging Max. When you say "log to the screen" to avoid fileio blocking, do you mean to add the message to the actual error message displayed on screen or to log it to System.err? I am not using the Logger facility but do feel my aplication lacks the means of separating the chained error messages that would not be very user friendly, but must be reported if a problem is to be resolved, and the a user tailored messages.
Many thanks Sam
Originally posted by Saraswathy Krishnamoorth:
Mark:
The GUI doesn't know, or care, if it's really using a RemoteConnector and/or a LocalConnector. They both implement the Connector interface, and thus the GUI simply uses that interface to point it's connector. So how did the GUI get the appropriate connector in the first place? It asked a factory to provide a connector to it, which factory did so.
Network Mode:
I have a ConnectionFactory interface which implements remote and has getConnection method. The connectionFactoryImpl class implements connectionFactory interface. I lookup for the connectionFactoryImpl class and use its getConnection method. It returns a unique connectionObject which had remoteData memeber variable.
Local Mode:
I simply create an instance of LocalConnection object which has Data member variable. I am not using any factory.
Can u explain about what u mean by GUI asked a factory to provide the connector. Do u mean that there should be another factory in addition to connectionFactoryImpl class.
Originally posted by Saraswathy Krishnamoorth:
Hi Max,
Sorry for not being specific.
In network mode:
I have a RemoteDataFactoryImpl which is bound to Registry. It's getConnection method will return a unique Remote Data object. I use a remoteDataWrapper around the remoteData object. This wrapper has methods like BookFlight, SerachFlights etc.
In Local Mode:
In local mode I have a LocalDataWrapper around the Data object. This wrapper has methods like Book Flight, SearchFlights etc.
I wanted to know whether this approach is corrrect.
Originally posted by walid aly:
now the PROBLEM
some method in the class localwrapper does not throw anything
now in the gui (last class to deal) should i enclose all the methods in try-catch my own exception, if i do thios i will have to declare all methods in localwraper to throw myownexception (which i feel is not correct to do)
plz advise
Originally posted by Saraswathy Krishnamoorth:
Instructions state that
"To connect with your server,you should create a client program. This implementation should inlcude a class that implements the same public methods as the suncertify.db.Data class."
If the GUI proxy is the Dataclient then it should expose all the public methods of Data according to the instruction. If GUI proxy is not the DataClient then which one acts as DataClient.
SCJP, SCJD, SCEA 5 "Any sufficiently analyzed magic is indistinguishable from science!" Agatha Heterodyne (Girl Genius)
Originally posted by Burk Hufnagel:
Max,
Pardon my jumping in but I'm currently in the middle of deciding how to handle the RemoteExceptions introduced by RMI so I've been following along.
I'm curious, where would you log the errors on the client side? If you write them to a file then who reads it and what happens if there's file io errors? If you store them in memory then you'll need to display them somewhere - like an error log window.
The only other place I can think of logging the error is on the server via RMI - which could set off a whole new round of error logging.
None of the three seems appropriate to me, though I hate the idea of dumping the information in a bit bucket and just displaying a generic "Communications error" message.
If you've got a good place to log the info to, please tell me.
Thanks!
Burk
... and now back to the message thread already in progress.
Is it okay to reference a Data instance directly and not have both Data and RemoteData implement the same interface?
(Say IDB)
{/quote]
Sorry for all the questions - I am finding this the most challenging part of the assignment
Many thanks Sam
I do some of my very best work in water. Like this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
|