wood burning stoves 2.0*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes MVC - Current Service instance 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 "MVC - Current Service instance" Watch "MVC - Current Service instance" New topic
Author

MVC - Current Service instance

Peter G Walker
Greenhorn

Joined: Apr 10, 2005
Posts: 2
Hi,

I'm wondering if anyone can help me out with my design.

I've implemented an MVC architecture for the client side gui. I'm using RMI to get an instance of a local or remote Services interface that holds the methods book & search.

The controller is registered as a listener of the view and so when a user clicks the book button the controller needs to determine the currently selected row by querying the view and then needs to call the Service book method with the record number as a parameter.

Now i'm just wondering where I should be putting the Services instance so that it can be called by the controller? Should it be:-

1) A static member of some class (MainClass)or
2) Passed into the controller with the model and view or
2) Should the service register with the controller and the controller should fire an event sending the recNum as a parameter in the event?

Any help is much appreciated.
Peter G Walker
Greenhorn

Joined: Apr 10, 2005
Posts: 2
Should the model contain the reference to the services instance? I.e should I pass the service to the model constructor?

Most of these will work i'm just wondering if anyone has a better design? since I think SUN is mostly interested in a well designed system.
 
Don't get me started about those stupid light bulbs.
 
subject: MVC - Current Service instance