File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Please comment on FBN design Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Please comment on FBN design" Watch "Please comment on FBN design" New topic
Author

Please comment on FBN design

Meena Pitchiah
Greenhorn

Joined: Apr 24, 2003
Posts: 16
Hi,
I am almost done with the assignment. Planning to submit it in few days. Thanks for all your help. I have listed down my server and GUI design. Please comment on it.

Server :
Patterns used : Adapter and Factory
  • Contains a high level interface called DataInterface. All the public methods in Data class are declared in the interface and all of them throws IOException. DataAdapter class implements DataInterface and contains an instance of Data. The RemoteDataInterface extends Remote and DataInterface. RemoteData implements RemoteDataInterface and

  • contains an instance of DataAdapter. The remote server contains RemoteConnectionInterface which extends RemoteInterface. RemoteConnectionFactory implements RemoteConnectionInterface.
  • When the Network server is started, An instance of RemoteConnectionFactory is created and Registered with the RMI Registry. getConnection() method in RemoteConnectionFactory class creates an instance of RemoteData each time when it is called.
  • Modified Data class. Implemented criteriaFind in Data.java. Implemented Left lock() and unlock() methods in RemoteData and left them blank in Data.
  • Implemented unrefernced() to handle dead clients.
  • Using GUI to start up and shutdown server. Server shutdown acquires DB lock and closes the db file and the server startup window. It does not inform the connected clients about the shutdown.


  • GUI :
    Patterns used: MVC and Facade (FBNController contains one instance of DataInterface to handle both local and network mode).
  • Using JDialog to get the connetion type and local/remote server connection.
  • Application contains a main window called FBNView implements. FBNView contains an instance of classes FBNController, SearchButton, BookButton, ResetButton, FBNTable, FBNTableModel and four instances of FBNComboBox (one for each search field - origin, destination, departure day and Carrier).
  • FBNController contains an instance of DataInterface (private) and methods to get connetion, search flights and book flight, populate all the comboboxes with values from the database fields.
  • All the button classes are derived from GenericButton which implements ActionListener. The actionPerformed() method is overriden by all these derived classes implements action to be performed when that button is pressed.
  • FBNCombobox extends JComboBox. Populates the combobox with values of that field from the database.
  • FBNTable extends JTable and implements ListSelectionListener. Implements valueChange() method. Also implements updateFlightTable() method which will be called when the search Panel needs to be updated (after search or booking a flight). Uses the pull model to update the table panel with matching flights with most current available seats.
  • FBNTableModel extends AbstractTableModel.


  • I think I have covered all the requirements. Any comments would be very helpful.
    Thanks,
    Meena
    [ September 07, 2003: Message edited by: Meena Pitchiah ]
    Andrew Monkhouse
    author and jackaroo
    Marshal Commander

    Joined: Mar 28, 2003
    Posts: 11278
        
      59

    Hi Meena
    Implemented Left lock() and unlock() methods in RemoteData and left them blank in Data.

    I understand you doing this, it does make life so much simpler.
    However do you think this meets Sun's requirements? When talking about enhancing the Data class, they say "Record locking must be implemented using the methods public void lock(int) and public void unlock(int)".
    And if you feel you have met either the requirements (or the spirit of the requirements) have you justified your interpretation of the requirements in your design document?
    FBNController contains an instance of DataInterface (private) and methods to get connetion, search flights and book flight, populate all the comboboxes with values from the database fields.

    Normally in an MVC design, it is the model which models the data (and hence has all the accessor / modifier methods).
    Regards, Andrew


    The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
    Meena Pitchiah
    Greenhorn

    Joined: Apr 24, 2003
    Posts: 16
    Hi Andrew,
    Thanks for your comments.

    Sun's requirements is

    Record locking must be implemented using the methods public void lock(int) and public void unlock(int). These methods are required to allow concurrent use of the database when booking flights from multiple clients...

    Here is my justification : these two methods are required when there are multiple clients. In the case of local mode there will be only one client and hence there is no need for locking. Data class will be used in the local mode. Only in the network mode there will be multiple clients accessing the database concurrently. So I feel RemoteData is the right place to implement these two methods.
    I hope I understand the requirements correctly and my justification is reasonable. Please correct me if am wrong.


    Normally in an MVC design, it is the model which models the data (and hence has all the accessor / modifier methods).

    I wanted to implement a generic data server. Also business logic ( searchFlight, bookFlight and other methods) is application specific. So I implemented them in the client. These methods inturn call criteriaFind, read, lock, modify and unlock methods.(that are implemented in the model). Correct me if I am on trhe wrong track.

    thanks,
    Meena
    Andrew Monkhouse
    author and jackaroo
    Marshal Commander

    Joined: Mar 28, 2003
    Posts: 11278
        
      59

    Hi Meena,
    I personally don't have a problem with how you handled locking. I just wanted to be sure that you have justified your implementation in your design document.
    My comment about the model of the MVC was related to your statement that the "FBNController contains an instance of DataInterface". So this sounds like the controller has access to the database, not the model.
    Regards, Andrew
    Meena Pitchiah
    Greenhorn

    Joined: Apr 24, 2003
    Posts: 16
    Hi Andrew,

    I have submitted my assignment and took the essay exam on Friday. Thank you for all your help.

    Thanks
    Meena
    Andrew Monkhouse
    author and jackaroo
    Marshal Commander

    Joined: Mar 28, 2003
    Posts: 11278
        
      59

    Hi Meena,
    Good luck. Let us know when you get your results.
    Regards, Andrew
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Please comment on FBN design
     
    Similar Threads
    Please Help -- Question on testing lock() with multiple threads
    FBN : Exception in High level Data Interface
    Initial design review
    Final design
    Final check before submission