Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Required Interface and RMI

 
Dirk Band
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I have got a question concerning the required interface.
My assignment says:
"Server
Required Interface
Your data access class must be called "Data.java", must be in a package called "suncertify.db", and must implement the following interface:
package suncertify.db;
public interface DBAccess
{
// Reads a record from the file. Returns an array where each
// element is a record value.
public String [] readRecord(long recNo)
throws RecordNotFoundException;
// Modifies the fields of a record. The new value for field n
// appears in data[n]. Throws SecurityException
// if the record is locked with a cookie other than lockCookie.
public void updateRecord(long recNo, String[] data, long lockCookie)
throws RecordNotFoundException, SecurityException;
...................
"
this is clear to me when it comes to local access.
The Question is: Do I have to implement this interface into my RMI DataImpl class as well? If yes. It is not possible to implement this interface and throw any broader exceptions, as required when using RMI.
When using RMI each method must throw and RemoteException.
Is it completely wrong to use RMI in this case?
My main concern is the "must" in the requirement of th assignment.
Any answers?
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12014
220
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Dirk
I would only take that "must" as applying to the data access class (Data.java) not to your network interface.
I have noted that a lot of candidates in this forum are only providing business methods in their network interface (bookRoom() or bookContractor()) rather than providing any of the methods from the data access class's interface.
Regards, Andrew
 
Dirk Band
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Andrew,
If I have two interface one for network one for local. This causes probably more redundant work at the client side. Means data access via local mode and data access via network mode. Two simular interfaces would be nice.
Regards,
Dirk
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic