permaculture playing cards*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Connection Factory objects RMI Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Connection Factory objects RMI" Watch "Connection Factory objects RMI" New topic
Author

Connection Factory objects RMI

Dan Myers
Greenhorn

Joined: Aug 20, 2002
Posts: 7
Hi all,
i have a little question on the Connection Factory and RMI.
On the client i call all business functionality by a Interface IDataAccess which contains
methods lik book(), criteriasearch().
Based on the operating mode the client member variable of IDataAccess references a local (DataAccessLocal) or remote Implementation
(DataAccessRemote which is returned by the Factory). So i do not have to distinguish what source(local or remote) is connected at the client.
My Problem:
==========
Both classes implement the same Interface IDataAccess (Not Remote)
-DataAccessLocal must not be declared as remoteobject
-DataAccessRemote must be declared as remoteObject, how can i do it without adding a new Interface with the same
content like IDataAccess +RemoteInterface declarations ?
Thanks for
comments
Nate Johnson
Ranch Hand

Joined: May 13, 2002
Posts: 301
Originally posted by Dan Myers:
how can i do it without adding a new Interface with the same
content like IDataAccess +RemoteInterface declarations?

I used 2 interfaces... others have made their one interface implement Remote.


scwcd, scjd, scjp<br /><a href="http://natejohnson.us" target="_blank" rel="nofollow">http://natejohnson.us</a><br /><a href="http://rice.kuali.org" target="_blank" rel="nofollow">http://rice.kuali.org</a>
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Hi Dan,
I had only a single interface which extened Remote and all of the public Data methods were tagged to throw RemoteException, even though when locally connected, no RemoteException could be thrown. I used a Bulider Pattern to deal with the problem you mention. The Bulider Pattern is a great way to shift compile time decisions to runtime. At the point in your client bootstrap code that you know which mode you want, then you simply "build" that type of connection. As you mentioned, for remote mode you would build an object that most likely extended UnicastRemote object and not for the local variety.

Hope this helps,
Michael Morris


Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
 
 
subject: Connection Factory objects RMI
 
Similar Threads
FBN GUI
Design Question?
Overall Architecture
Design Question Mark
ConnectionFactory question