aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes I'm ready to submit my assignment.  RMI question? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "I Watch "I New topic
Author

I'm ready to submit my assignment. RMI question?

Harry Henriques
Ranch Hand

Joined: Jun 17, 2009
Posts: 206
Roel De Nijs wrote:


Hi Roel,

I saw this implementation of the RMI framework earlier in January. I was very puzzled by this code snippet, especially now that I've finished my own implementation. My implementation looks something like the following:



I used "rmic" to create the stub, BusinessService_Stub.class, in the same directory. I look at the tangle of interfaces in your code snippet, and I wonder if I missed an important concept in my implementation. I have the client-server communication established and working, but the implementation is very simple. What am I missing?

MVC gui <-> Client.class <-> [NETWORK] <-> BusinessService.class <-> Data.class <-> Database { client-server }

MVC gui <-> Client.class <-> BusinessService.class <-> Data.class <-> Database { stand alone }

I use the same BusinessService class for stand alone and for client-server. In stand alone mode, I'm not doing any networking.

Best regards,
Harry Henriques
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5389
    
  13

Hi Harry,

I used 2 different implementation classes of the BusinessService, one for standalone mode and another one for networked mode. One of the reasons I used 2 classes is because in networked mode I have to do other things than in stand-alone mode: client identification that is (because my interface doesn't have a lockCookie). Another reason was that in Andrew's book there were also 2 seperate classes
You used 1 class and I think that's a valid approach too as long as you are able to meet this must requirement:
Keep in mind that networking must be entirely bypassed in the non-networked mode.


Kind regards,
Roel


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
Harry Henriques
Ranch Hand

Joined: Jun 17, 2009
Posts: 206
Hi Roel,

I made a simple modification to my implementation. I created a BusinessServiceRemote.class and a BusinessServiceLocal.class. Thanks for the suggestion. It's a whole lot easier to develop a consistent way of handling exceptions if you split the BusinessLayer into two classes, one remote and one local. I'm still on track to deliver my solution this week.

Best regards,
Harry Henriques
Allan Cheong
Ranch Hand

Joined: Nov 12, 2009
Posts: 71

In stand alone mode, is it okay if the application still lock and unlock records? I understand that there is a requirement stating that

Architecturally, this mode must use the database and GUI from the networked form, but must not use the network server code at all.


Registering RMI service and binding it are network codes. Calling lookup in Naming class can be considered network codes as well IMHO. I am not sure about locking and unlocking though. Any advice?


SCJP6, SCJD, OCJWCD5
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5389
    
  13

Hi Allan,

My application locks and unlocks records in standalone mode. It is required by the comments in Sun's interface
Kind regards,
Roel
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: I'm ready to submit my assignment. RMI question?