• 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:About DBMain interface

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In my explainDocument for SCJD:
The data access class must implement the following interface:

This interface is implemented by my remote data access class which is "DatabaseImpl.java".
DatabaseImpl class implement java.rmi.Remote class,too.
So,these methods must throw the java.rmi.RemoteException for implement remote access.
Since these methods extend the DBMain interface,so may not throw the java.rmi.RemoteException?
Q:How do I do for the remote access?
 
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Xi,
You may want to follow the links and discussion in this thread.
Regards, Andrew
 
xi ruo
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I do like this.Is it OK???

Data.java
 
Ranch Hand
Posts: 555
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Xi,
It will not work:
public class DataAdapter implement DBMain.
DataAdapter must implement another interface, whose method signatures throw either RemoteException or its parent Exceptions. This interface you should define yourself.
But the idea is correct...
Regards,
Vlad
 
Ranch Hand
Posts: 493
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Xi Ruo,
In addition to what Vlad says, you need to make sure that the Data class must implement DBMain.
Regards.
Bharat
 
xi ruo
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Andrew and Vlad and Bharat,thank you for your response.
I rework like this.

Data.java

AnotherDBMain.java

Is it OK?
Q:AnotherDBMain-interface's structure must the same as DBMain-interface's structure.Is it?
[ September 09, 2003: Message edited by: xi ruo ]
 
Vlad Rabkin
Ranch Hand
Posts: 555
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Xi,
It looks Ok.
Don't forget to implement also:
public int getRecordCount() throws RemoteException;//I add this extra method to AnotherDBMain interface
in your DataAdapter class.
Regards,
Vlad
 
Andrew Monkhouse
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Xi

Is it OK?


Looks OK.

Q:AnotherDBMain-interface's structure must the same as DBMain-interface's structure.Is it?


Not necessarily.
For the older Fly By Night Services assignment, you did have to provide networked versions of all the methods of the Data class. However there is no such requirement for the new assignments.
Some people here are only providing business methods over the network interface. Others are providing equivalent methods to all the methods detailed in the provided interface. I believe you may choose for yourself which you wish to do.
The advantage of your interface having the same methods as the provided interface is that you will be writing a generic database server. You will be able to use this with any database. Not just with Hotels or Contractors (whichever you have).
The advantage of only having business methods exposed to the clients is that you can save yourself some effort.
Personally I think that you should consider writing your interface so that it has the same methods as the provided interface. It is more extensible for the future, and it is more challenging.
Regards, Andrew
 
When it is used for evil, then watch out! When it is used for good, then things are much nicer. Like this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic