Hi there,
sometimes I wonder if anyone gets through the javadeveloper exam without questions
The more often I read the task, the more questions I get, I hope you could help me solving them.
All questions belong to "Bodgitt and Scarper".
a) "The operating mode is selected using the single command line argument that is permitted. Architecturally, this mode must use the database and GUI from the networked form, but must not use the network server code at all."
My problem is the part "but must not use the network server code". I've decided to use RMI, so I HAVE to reuse some code of the server. Or is this just a misunderstanding. The server has about 10 lines, it creates an object, registers it to the rmiregistry and finishes. Is the server in the statement of Sun this 10-line-server or the 10-line-server together with the object created?
b) "It must be composed exclusively with components from the Java Foundation Classes (Swing components)."
I used own classes like MyButton (extended from JButton). These components are setting the color and other small points, so I don't have to add lines like buttononethousandfiftyone.setBackgoundColor(whitegreenglowing) EVERY time using a button (all buttons should have the same color). I think this button still counts to the Swing components, because it extends JButton, am I correct?
c) "Your user interface should be designed with the expectation of future functionality enhancements, and it should establish a framework that will support this with minimal disruption to the users when this occurs."
What do they think when writing "framework"? I've implemented all of my code dynamicly, so additional fields in the database will automatically add new rows to the JTable, searchinputfields and so on, but I wouldn't call this a framework. Is there some hint what they are thinking of?
d) "the current thread gives up the CPU and consumes no CPU cycles until the record is unlocked."
Do they really mean NO cpu cycles? Till now I implemented something like this:
synchronized (o) {
while (data.isLocked(recNo)) {
o.wait();
}}
using this and a o.notify() at the end of the unlock-method, I alway wake up one waiting thread, BUT possibly it's the wrong one, so it might be (if there are two waiting threads for two different recordnumbers) one thread will consume a minimal amount of cpucyles (data.isLocked) and then wait again.
Is this allowed?
e) My code (d)) MAY be a deadlock if one client crashes the moment he has the lock but didn't release it, the lock will not be removed automatically. Do I have to run a watchdog releasing the locks after some time?
f) The given interface throws a DuplicateKeyException on creating a new record.
But.... CAN this happen? This would mean you have to check all the database to the given data if this is already inserted. In my oppinion douplicate data MAY happen, e.g. if someone gives the order to paint his house and he whants to have a different bill for the roof and floor. The name, task and so on would be the same. So where does this exception come from? Simply implement this interface but never throw it and just documentating this to the choices.txt?
g) "It must allow the user to book a selected record, updating the database file accordingly."
Possibly a point for first INTENSIVLY read and then programm... Do I have to provide a simple button "book" and it enters something to the record-field "owner"? At the moment I have a button "edit" where you can change all fields, this should do the same job, doesn't it?
Sorry for bothering you with all these questions, but I hope you could help me a little bit :/
Greetings
Torsten