Hi all!
I am planning on submitting my assignment this weekend, and would enjoy any comments y'all might have.
I decided to modify the existing Data class since it did not require any changes that were specific to the FBN application. I wrote a generic search function criteriaFind() within this Data class, and left lock() and unlock() as NOP's since I use a seperate LockManager class. (hence there was no need to subclass)
A DBConnection interface provides client access to the Data class, and as per the requirements it contains all the public methods of the Data class. This DBConnection interface is implemented by two classes, LocalDBConnectionImpl and RemoteDBConnectionImpl; which act as Data Access Objects (DAO). Each DAO contains a reference to a Data class, a LockManager class, and the client that is using the connection. The DAO delegates each method call to the appropriate class. The DBConnection interface acts as a Facade since it hides the Local vs. Remote network complexity.
Clients retrieve DBConnections via a DBConnectionFactory, which either creates and returns a local DBConnection, or connects to the RMI registry to access the DBConnectionManager, which hands out Remote DBConnections to the caller. The DBConnectionManager returns a DBConnection to each caller, and assigns the DBConnection a unique Client object, such that the DAO can notify the LockManager which client is locking the record.
The LockManager uses a simple HashSet to store the locked records, along with the client who locked it. The client ID is retreived from the DBConnection object, which has a reference to the client who created it (initialized by the DBConnectionManager).
The client UI is all written in Swing, and accesses the DAO via a buisness deleagte class. This class handles the locking, unlocking, and other low level DB functions, and surfaces a clean interface to the UI classes. This Business Delegate also wrappers the returned DataInfo objects into FlightInfo Value Objects (VO). The FlightInfo VO provides nice methods like getFlightOrigin(), etc, thereby allowing the client to be agnostic of the underlying DB structure.
The client UI has some very simple online help to assist the user.
I have a README.txt file that contains:
And a DESIGN_CHOICES.txt file that contains:
I have gone through every class and documented it using javadoc style comments, and generated the javadoc html files.
I created a TestSuite class that launches hundreds of client Threads to
test the concurrency of the database; everything seems fine, even when using multiple JVM's.
I think I am ready to submit this bad boy!
Any comments?
I look forward to joining the ranks of the
SCJD community
--Dave.