• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NX: Question about data adapter

 
HaoZhe Xu
Ranch Hand
Posts: 222
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am doing the URLyBird project, and I am using RMI, the instruction said that I should write a Data class implements DBMain interface, but the DBMain interface does not extend Remote, so do I need to write a new interface extending Remote and a class implements it and do the exactly what Data do? I mean in the implement class there's an Data member and I use the same methods' names and just let the Data member do the job in the method body.
Some people mentioned that make two adapters for each mode: standalone and networked, but I don't know how to achieve this?
 
Nicholas Cheung
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

the instruction said that I should write a Data class implements DBMain interface, but the DBMain interface does not extend Remote, so do I need to write a new interface extending Remote and a class implements it and do the exactly what Data do?

In the instruction, it mentions that the users are allow to SEARCH and BOOK only. It does not mention that the user will create, delete records.
Thus, in fact, functions provided by DBMain is more than the instructions required.
In my implementation, I created an interface DBOperation, which provides the 2 functions (Search and book) only, that implements by the GUIController and Database.
Note: GUI client calls GUIController, where GUIController calls the methods in Database, and Database calls Data to perform the real operation.

Some people mentioned that make two adapters for each mode: standalone and networked, but I don't know how to achieve this

Your command line will specify this:
For local connection: java -jar runme.jar alone
For remote connection: java -jar runme.jar
In my implementaion, my client detects the input, if is alone, the GUIContrller gets the connection from local. Remote otherwise.

Hope this help.
Nick.
 
HaoZhe Xu
Ranch Hand
Posts: 222
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot, but I am still a little confused. Do you mean the DBOperation interface extends Remote? If it is not, how can you use it remotely? If it is, do you need to catch RemoteException in standalone mode?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic