Peter Crowley

Greenhorn
+ Follow
since Nov 06, 2001
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Peter Crowley

I would think that if you just list the classes that you created or are using, then that should cover both source files and class files. It seems rediculous to list the source files and then list the class files and saying "This is the class file generated from the source file" every time.
Just my thoughts,
-Peter Crowley

Originally posted by Trevor Dunn:
I think you are reading to much into the project. Do not worry about such things.


Treavor is exactly right. Every client has the ability to add, delete, and modify. That is why it is so important that you get the server right, especially the record locking.
-Peter Crowley

Originally posted by Martin Habicht:
How simple can a Server be, as it gives up to 53 points?


You just have to meet the requirements.

I'm asking because so far I have a very simple Server and all he does is to create an instance of a RemoteData object (which extends UnicastRemoteObject and redirects every mehtod call to a single Data instance). Then it puts it on the RMI-registry. Done! Only one command line parameter: the file name. No GUI, no extras.


I agree, that for a nicer design, I would rather put a ConnectionFactory on the RMI-Registry, which would give each client it's own instance of a RemoteData (Data would still be Singleton). This would also allow tracking of Client-ID's for lock() and unlock().


Yes, you need to explicitly worry about threading.

Each time client that connects to your server they will be given a thread to work on. (Multiple clients = multiple threads) And each time the client calls a method, they might be given a different thread. (thread != clientID) For the factory's connections this is not a problem because a client will only be given one thread at a time as long as your client is single threaded, which almost never happens with GUIs. Someone can help verify this, but one of two things happen:
1)Every time a java.awt.event.Event happens your client spawns a seperate thread to handle that event.
2) For every event, the "swing" thread (the thread responsible for doing screen refreshes) handles the event. (I can see problems with this thread being blocked while waiting on the server if this is the case.)
If your client spawns two threads on the client (example #1 above), both could call methods on your server and get two threads running on your server on the same connection object.
Connection factory or not, I say that you should worry about threading.


Please comment if you know for certain that the awt events happen on their own thread for each event or if they share a single thread.


-Peter Crowley
Some book reviews.

Some design patterns.
I hope that this will help you and others that read this. Good luck to you all.
-Peter Crowley

Originally posted by nitin kanaskar:

what are hot key combinations ?


Using hot keys an pnemonics are, IMHO, way too complicated for this project. They are not part of the requirements and tend to make your GUI much too complicated, thereby actually costing you points.
Hot Keys are keyboard strokes that are mapped to Gui Components. For example your browser probably has a menu with "File" or "Edit". If you press ALT-F, it will do the same thing as selecting "File" from the menu. This is a hot key.
-Peter Crowley
I have experienced similar problems such as this when using GridBagLayout in some GUIs I have developed on different projects I have worked on. I finally stopped using it because it was so difficult to bebug on all the different platforms. Now I stick to using javax.swing.JPanel with GridLayout, BoxLayout, and BorderLayout. These seem to live up to the promise of platform independance.
-Peter Crowley
This is the method from the src.jar distributed in the JDK:

So, yes, this is exactly what I was saying. You are doing it correctly if you use this method.


As for what it does... This method sends a table model event to the listeners (namely the JTable) to let them know hat there was a change in the data. The TableModelEvent allows you to specify exactly what changed so that the JTable can update specific cells instead of updating the entire table every time that there is a change. It allows increased performance from the JTable.
-Peter Crowley
Ashley,
Do you have any hints to what worked for you, or what didn't? Did they give you any feedback at all?
-Peter Crowley

Originally posted by dennis deng:
hi, guys, a little question about my GUI, do someone know exactly ' fireTableCellUpdated(null) 'means? is it means update all table cells or do nothing? BTW, in my book flight method, i need to check db field: 'Available seats' and refresh JTable by method:fireTableCellUpdated(index, 8); you know this is not obey the expectation of future functionality enhancements such as database sturcture changed and 'Available seats 'become another position not 8 ? who can tell me something about this ? thanks alot.


I think that you would want to decouple the table from the data. The JTable and TableModel classes are a good example of Model-View. A differnet way to solve this problem would be to add an outside class to do the work for you. This class (the controller in MVC pattern) should update the data and then the TableModel should fire a tableChanged() with a TableModelEvent that has the fine grained information of what specifically changed.
You do not have to account for the data columns changing, however. Nowhere does it even hint that this data structure (schema) will ever change.
I hope that this helps.
-Peter Crowley

[This message has been edited by Peter Crowley (edited November 27, 2001).]

Originally posted by Peter den Haan:
Remember, what identifies the client is the Connection object he's talking to; not the Thread he happens to be executing in.
Regarding your earlier response: you don't need any locking code in Data. It is worth thinking of your objects in terms of responsibilities and collaborations here. Data's responsibility is looking after a local database. Locks aren't part of that.


So if I understand this correctly,
  • Data is not using any locking at all and the methods are empty.
  • Clients in local mode will use Data directly and avoid locking alltogether.
  • Locking happens only in the Connection object that meets the RemoteData interface
    and wraps a single Data instance on the server.
  • This connection object come from a ConnectionFactory that makes a new Connection instance for each client.
  • The Connection has the reference to a Lock Manager instance for the Data instance.
  • There is only one Lock Manager for each Data.

  • Is this correct? If it is, is there any reason why not to implement the lock-read-modify-unlock code in the Connection object instead of the client. This cuts down on a lot of network traffic, and you can still send the exceptions (if any) back to the client to handle. That way the client isn't bothered with any multi threaded or locking code, and a client in local mode won't do either.
    -Peter Crowley
    [This message has been edited by Peter Crowley (edited November 27, 2001).]

Originally posted by Mark Spritzler:
What changes, that was not part of the assignment. It specifically gave us what the criteria string is supposed to be, including names.


You are correct. I read over and over the assignment.html and see no mention of ever having the data change. I remember someone mentioning on another thread that the database was for reuse, but the assignment mentions nothing about ever changing the data structure.
I still think that making the criteriaFind method generic enough to take in any [field info]=[value] combination is the way to go.
Thanks for your comments, all.
-Peter Crowley

[This message has been edited by Peter Crowley (edited November 27, 2001).]
[This message has been edited by Peter Crowley (edited November 27, 2001).]

Originally posted by Erik Gfesser:
One of the main reasons I asked my original question was because the assignment notes that "your user interface should be designed with the expectation of future functionality enhancements, and it should establish a control scheme that will support this with minimal disruption to the users when this occurs." Any interpretations of what this statement means?


I read this to mean to design the UI in such a way that the user will not have to do anything differently when it changes. For example, using a JMenuBar and adding new MenuItems for new features, doesn't change the way that the existing functions work, or how the user accesses them. I personally added a status bar to my GUI, but this is not necessary by any means.
I hope that this helps.

------------------
-Peter Crowley,
who is looking for work in North Florida
What do you mean? If you get some code it realy won't help you to pass the exam. You have to know the design decisions in order to pass. If you know the design decisions then you don't need anyone else's code.
If you want to know what the requirements are for the exam or what the assignemnt is, just read the message boards here and you'll find out everything that you need to know.
------------------
-Peter Crowley,
who is looking for work in North Florida
[This message has been edited by Peter Crowley (edited November 27, 2001).]

Originally posted by Mark Spritzler:
In my submission, I had three JComboBoxes, one for carrier, one for origin airport, and one for destination airport. The user selects fro the JCombobox, when they click the search button, I create the string "Carrier='SpeedyAir',Origin='SFO'" in code, and pass it to the criteriaFind method. How you handle the rest, is decisions you need to make.
Good luck
Mark


Mark, did you account for changes in the column names? I mean, you didn't just hard code the column names into the search string did you? I couldn't figure out a good way of figuring out what the column names were, so I have a JTextField for the user to enter the search criteria into, and instructions on how to do it.

As for the <code>criteriaFind(String)</code> method, I can search on any column name looking for any value. I didn't interpret the assignment to say LIMIT the client to searching only on the "origin" and "destination" fields. Since I can't really tell which columns and fields to look at for origin and destination if they ever change in the db file, I have no choice but to allow the user to specify the column name and the value. Any thoughts?

------------------
-Peter Crowley,
who is looking for work in North Florida