Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

NX:About DBMain interface  RSS feed

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • 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
Marshal Commander
Posts: 12217
278
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
I do like this.Is it OK???

Data.java
 
Ranch Hand
Posts: 555
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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
Marshal Commander
Posts: 12217
278
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!