• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

RemoteInterface realization

 
Naveen Narayanan
Ranch Hand
Posts: 114
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,
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?

Kind Regards,
Naveen.
 
K. Tsang
Bartender
Posts: 3457
14
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One way to structure your services is forget the Sun's interface for a sec. Assume you still need to do create, read, update, delete, search functions, how would you set it up? You definitely need a local interface and remote interface. Yet you also need a super interface that umbrella the 2. Oh think as if you are the client. Eg book and search are 2 obvious methods in the super interface.

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?
 
Naveen Narayanan
Ranch Hand
Posts: 114
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Tsang for throwing light on this ...
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
Kind Regards,
Naveen Narayanan.
 
K. Tsang
Bartender
Posts: 3457
14
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Glad I helped.

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?
 
Naveen Narayanan
Ranch Hand
Posts: 114
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Tsang , Thanks for making me think ... sorry , I was running behind super-interface and was sorting out how it can umbrellas both.
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?

Kind Regards,
Naveen Narayanan.
 
K. Tsang
Bartender
Posts: 3457
14
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Super interface? Ah simple:


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?
 
Naveen Narayanan
Ranch Hand
Posts: 114
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Champ buddy Tsang, I am tunneling more in …
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?

Kind Regards,
Naveen Narayanan.
 
K. Tsang
Bartender
Posts: 3457
14
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You mention business service layer then you should be doing what you meant to do. If not, you will not where to change.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic