Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring 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

Please comment on FBN design

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
     
    author and jackaroo
    Posts: 12199
    280
    Mac IntelliJ IDE Firefox Browser Oracle C++ Java
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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
     
    Meena Pitchiah
    Greenhorn
    Posts: 16
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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
    Posts: 12199
    280
    Mac IntelliJ IDE Firefox Browser Oracle C++ Java
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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
    Posts: 16
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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
    Posts: 12199
    280
    Mac IntelliJ IDE Firefox Browser Oracle C++ Java
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi Meena,
    Good luck. Let us know when you get your results.
    Regards, Andrew
     
    This tiny ad is wafer thin:
    Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
      Bookmark Topic Watch Topic
    • New Topic