aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes NX: RMI and Local access Design Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "NX: RMI and Local access Design" Watch "NX: RMI and Local access Design" New topic
Author

NX: RMI and Local access Design

frank sun
Ranch Hand

Joined: Apr 11, 2003
Posts: 102
Hi, I got one question about the RMI design, please refer to the below snippet code.
I want to define a common interface : Server, for Local and Remote, But I am not sure whether it deviate the SUN spec or not?
Please help me out of this?
Much Appreciated!
Frank
/**
* public interface: Server provide the common interface for Local and Remote access.
* The Server extends Remote interface and defines the method: update() throws RemoteException.
* In the LocalDBServer, just take it as a local class, without any Remote properties.
* While in the RemoteDBServer, it calls the LocalDBServer's method.
* Does that deviate the SUN specification(Room booking assignment)?
*/
public interface Server extends java.rmi.Remote {
public void update() throws RemoteException;
}
public class RemoteDBServer extends UnicastRemoteObject implements Server {
private Server localsvr=new LocalDBServer();;

public RemoteDBServer() throws RemoteException {
super();
}

public void update() throws RecordNotFoundException {
localsvr.update();
}
}
public class LocalDBServer implements Server {
public LocalDBServer() {
super();
}

public void update() throws RecordNotFoundException() {
/* update code*/
}
}
frank sun
Ranch Hand

Joined: Apr 11, 2003
Posts: 102
Sorry, assumning that the RecordNotFoundException
extends RemoteException.
Please comment it.
Best regards!
Frank
frank sun
Ranch Hand

Joined: Apr 11, 2003
Posts: 102
Hi, Dear all,
=========This assignment is about the Booking room application. =========
Actually, What I concerned is, if I define a Remote interface and one method in there,
and then create one concrete class which implements this remote interface,
while this class is a pure Local class, without any RMI factors.
So, does that deviate the Sun spec which claimed
"must not involve the serialization of any objects when communicating between
the GUI and database elements. and bypass all the network entirely." ?
public interface Server extends java.rmi.Remote {
public void update() throws RemoteException,RecordNotFoundException;
}
// it doesnot extends the UnicastRemoteObject
public class LocalDBServer implements Server {
//it does not throws RemoteException
public LocalDBServer() {
super();
}
public void update() throws RecordNotFoundException() {
/* update code here*/
}
}
Please kindly give me your hand!
Frank
frank sun
Ranch Hand

Joined: Apr 11, 2003
Posts: 102
Hi,Dear all,
Would you please help me out of here?
<or if there are any not clear words in the question, please kindly let me know it.>
Best regards!
Frank
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

"I want to define a common interface : Server, for Local and Remote"
Well first I would say that in local mode there is no server.
Now if you mean a common interface for Local and Remote access to the Data class, then you would be on the right track.
Also this interface should have all the public methods of the Data class to meet the recquirements in the instructions.html.
"This implementation should include a class that implements the same public methods as the suncertify.db.Data class"
Taken from the instructions.html.
Hope that helps
Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
frank sun
Ranch Hand

Joined: Apr 11, 2003
Posts: 102
Hi, thanks a lot, Mark
Frank
Matthew Anderson
Ranch Hand

Joined: Apr 18, 2003
Posts: 33
Also this interface should have all the public methods of the Data class to meet the recquirements in the instructions.html.
"This implementation should include a class that implements the same public methods as the suncertify.db.Data class"

Hi
Regarding the above statement, would it be ok if I implement all the public methods of Data class but with different method signatures.
I've a FlightDataStore interface which is implemented by FlightDataAdapter (deals with local) and FlightDataRemote (deals with remote via local adapter).
FlightDataStore has all public methods of Data but with different return types. For example, return types like DataInfo[], etc in Data class become Flight[] in FlightDataStore.
I've used Flight class as a value object for data manipulation instead of manipulating DataInfo directly. FlightDataAdapter takes care of the conversion between DataInfo and Flight.
This design allows other kinds of database to be used in future without being locked to Data class. Only FlightDataAdapter needs to be modified for conversion between the underlying data type and the Flight value object type.
Is this design in accordance to Sun's specifications?
Thanks for any advice.


SCJP 1.2, SCWCD, SCJD
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: NX: RMI and Local access Design
 
Similar Threads
RMI server interfaces
DBMain method need throw RemoteException?
Unreferenced without a lock manager - your ideas Max
NX: URLy Bird 1.3.1 Connection Factory Design
My design...getting cloudier