Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

RMI Interface

 
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. See 2.
2. It's not possible, your remote class won't compile.
3. No.
4. Only that Record is Serializable.
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic