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


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "RMI Interface" Watch "RMI Interface" New topic
Author

RMI Interface

Pete Palmer
Ranch Hand

Joined: Oct 21, 2008
Posts: 92
Hi

The code below is my current approach to provide an RMI interface to the client.



My thoughts on this approach.

DBAccess is Sun’s provided interface.

ClientDBAcess extends above to introduce two additional methods –

readRecordObj() – identical to Sun’s readRecord() except a Record object is returned instead
of an Array of Strings. I don’t particularly like the method name !
readRecords() – Return all records in the database. Useful to initialise the JTable on startup.


1) The client will communicate with either the local or remote database via a ClientDBAcess instance.
In the local mode, I will return an instance of Data, which implements ClientDBAcess.
In the remote mode, I will return an instance of DatabaseRemote, which implements ClientDBAcess.
This way, the client will not have to worry whether the connection is remote or local.
Any issues that I have overlooked/should consider with this approach ?

2) Is it OK to simply add the RemoteExceptions to the methods DatabaseRemoteImpl class, like I have shown.

3) My client will not be using the readRecord() which returns an array of Strings or findByCriteria() which
returns a array of londs, however, if the client did use either, would there be any issue with serialization ?

4) Do I need to consider any serialization issue with respect List<Record> readRecords() ?


Pete
Alecsandru Cocarla
Ranch Hand

Joined: Feb 29, 2008
Posts: 158
1. See 2.
2. It's not possible, your remote class won't compile.
3. No.
4. Only that Record is Serializable.


SCJP 1.4 100%
SCJD 99.5%
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5406
    
  13

Hi Pete,

Because i had also no experience with RMI i made a small testing application to see how RMI works and what you can do and can not do regarding your interface and the RemoteException.

You can find this thread here.

Regards,
Roel


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: RMI Interface