• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Hopefully my final design, comments welcome

 
Ranch Hand
Posts: 704
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok here it is:
db package
All classes provided by sun. I modify instead of extend
DataInterface extends remote throws Exception. Contains all public methods
Lock Manager contains lock/unlock uses same signature as Data class.
server package
ConnectionInterface extends remote. One method getConnection returns DataInterface throws RemoteException
ConnectionFactory extends UnicastRemoteObject implements ConnectionInterface. binds to registry creates an instance of Data
RemoteDataImpl extends UnicastRemoteObject implements DataInterface

client package
StartClient acts as facade starting in local or remote mode. Boots the ClientController
LocalDataImpl implements DataInterface. wraps calls to Data class
RemoteDataClient. does lookup of connection factory, calls getConnection, passes calls via DataInterface
ClientController. Holds all ActionListeners for Gui. Boots ClientModel passes model into constructor of GUI
ClientGui the view for the application.
ClientModel extends AbstractTableModel holds the display data.
I am using JMenu although it doesn't do much. JTabbedPane to hold search and booking panes.
JComboboxes for the origins and destinations.
Just getting this far has taught me alot, so even though there have been frustrating moments, I do believe I will be a better programmer/developer after completing this exam
 
Ranch Hand
Posts: 560
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Server and db side looks really good. I would have only lock/unlock/modify pass through methods in the LockManager instead of all the methods in the Data class.
I am not really able to follow your client side design. Can you elaborate so that I can give you my comments? May be you are not to that point yet in the client design. Anyway...good luck
 
Nigel Browne
Ranch Hand
Posts: 704
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok I'll try to explain the client side a little better.
The user uses the StartClient class with either the arguments: local db.db or rmi <ipaddress> <port>. This class then initializes either a local or remote implementation of the DataInterface.
It then passes this instance into the ClientController class. The controller then creates a ClientModel instance passing in the column headers from the database. It then does a default query populating the model. This is so that I can run a method to populate Vectors of the origin and desination airports. These vectors and the model instance are passed to the constructor of the ClientGui so as to create the view of the application.
The controller class has anonymous innerclasses that handle all functionality of the view components. It also has a search database and then refresh view method, as well as the book flights method.
The gui class just initializes the components made visible to the user but doesn't perform any functionality.
As a reply to your previous mail my Lock Manager class only has lock and unlock methods. I was thinking of modifying Data so that add, modify and delete always lock and unlock. Do you think this is a good idea?
 
Sai Prasad
Ranch Hand
Posts: 560
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This class then initializes either a local or remote implementation of the DataInterface.
I assume here you use a factory and a client side proxy class
Rest of the gui design looks good. I am sure you will change it a bit when you implement it.
was thinking of modifying Data so that add, modify and delete always lock and unlock. Do you think this is a good idea?
As long as the add() and delete() methods in the Data class are synchronized, I wouldn't worry about locking the record for add and delete.
But to modify a particular record, you need to think in this flow, lock/read/modify/unlock. Some people have one method to take care of this sequence. I have the modify() in my LockManager to check to make sure the record is modified by the client who locked it.
 
reply
    Bookmark Topic Watch Topic
  • New Topic