• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

NX: Question about data adapter

 
Ranch Hand
Posts: 222
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic