Could anybody please come-up with a suggestion?
During the RemoteInterface realization, I tried an option like this ...
Made two interfaces.
DBAccessLocal with Sun’s framework and DBAcessRemote with additional RemoteExceptions to handle RMI .
Data class implements both local & remote interfaces.
Hopefully I am not violating sun’s must requirements up-to here.
Probably I am a bit concerned at this area
Suppose I convert DBAccessLocal to DBAcessRemote in the local-connection-mode(Direct without Network) …
And used dataConn as the local-connection-mode-handle ,
Can I assume that, its not breaking sun’s must requirements?
Once you got that set up, plug back the Sun interface and see where that goes. Is it really the local interface? Or just let the Data class implement it to satisfy the requirements?
You definitely need a local interface and remote interface. Yet you also need a super interface that umbrella the 2.
This super interface was exactly missed by me
Is it really the local interface? Or just let the Data class implement it to satisfy the requirements?
Seems right , possibly l feel like playing with a RemoteInterface even in local-mode
Naveen Narayanan wrote:Seems right , possibly l feel like playing with a RemoteInterface even in local-mode
Well sort of from coding perspective especially for the client side. What exceptions to catch on the client? Are you working with the specific local/remote interface or the super interface? (hint the latter one). What exceptions to declare in the super interface?
What exceptions to catch on the client?
RemoteException when in Networked-Mode , IOException when Local-Mode
Are you working with the specific local/remote interface or the super interface?
Db handle will be based on Super-Interface that can be assigned by
Remote-Interface from client when in Networked-Mode
Local-Interface from client when in Standalone-Mode
What exceptions to declare in the super interface?
Probably it contains all exceptions viz Remote ... , DupKey …, Security …, RecNotFound …
What are Methods in Super Interface ?
Seems can have read , update as well ... Probably create/delete might not be required
Am I getting closer?
Then you need to worry about Sun's provided interface. Then in the LocalService implementation class, you get an instance of Data class or its super class/interface and delegate to that Data class. In the RemoteService implementation class, delegate to LocalService.
In my Service interface, I only have 2 exceptions, RemoteException for server stuff and DatabaseException for local stuff. You may ask what about RecordNotFoundException etc? In my implementation class, if I catch those, I rethrow it as DatabaseException. This will make client code only worry 2 exceptions.
Oh in the super interface you declare methods that are more business needs, not necessarily the same methods as Sun's interface. If it is, why not just use Sun's interface as the super interface? Which of course doesn't work ... cos how to cater for RemoteException for RMI?
Perhaps, stepping-down Sun interface to a database related one.
Possibly isolating its grip from Super, Local & Remote interfaces.
Business Service layer start to speak between client & server (Rather than Db Service layer)
Am I grasping it right?