aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Workflow Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Workflow" Watch "Workflow" New topic
Author

Workflow

Linus Friedrich
Greenhorn

Joined: Jan 18, 2005
Posts: 2
Hi,
I got the urlybird 1.1.3 assignment is and I have some questions about the workflow and the data file.

First of all, I don't see something like a record id in the database, so I assume the record id is just a virtual unique id representing a specific record.
As far as I can see, the update and create method in the DB interface are never used. Do I have to fill the implementation with working code ?

When a request is made and the result of the query is displayed in a table, the user should be able to select a record and submit it using its customer id.
Do I have to delete the record then (mark it with 0xFF) or do I have to update the owner of the record, indicating that the room is booked ?

What if the room was already booked by another client inbetween ?
Do I have to display a message to the user, that his selection was already booked while he made his decision ?

Thanks for your help
Dieskun Koper
Ranch Hand

Joined: Aug 15, 2004
Posts: 85

As far as I can see, the update and create method in the DB interface are never used. Do I have to fill the implementation with working code ?


I didn't fill the create and delete methods. Reading other people's posts on the list I feel most people do.


What if the room was already booked by another client inbetween ?
Do I have to display a message to the user, that his selection was already booked while he made his decision ?


There are several solutions to this problem. Pick one that you feel is best and defend it on your choices.txt.

Good luck!
Dies
Kris Reid
Ranch Hand

Joined: Jan 05, 2005
Posts: 247
My understanding is the update is used. When a CSR assigns a customer number to the record it needs to update.

The create and delete don't ever seem to be used. I did however implement them as it says you must implement the DBMain interface and these methods are part of it.
Kris Reid
Ranch Hand

Joined: Jan 05, 2005
Posts: 247
One thing I don't understand is the DuplicateKeyException
When would this be thrown?

It is ownly used with create. Isn't the Key the record number? and the record number is just its position in the file. How could you have a Duplicate Key?
peter wooster
Ranch Hand

Joined: Jun 13, 2004
Posts: 1033
The best solution is to update the record to book it for a customer. I implemented all the CRUD methods, since they are described in the interface and may be needed in a later version. They are also useful for testing that your code behaves properly under those conditions.

On the questions about keys and DuplicateKeyException, URLyBird doesn't have a primary key, since the room number isn't included in the record.

BTW, is your name really M. Groening? Did you write Live in Hell?
Kris Reid
Ranch Hand

Joined: Jan 05, 2005
Posts: 247
Is it exceptable to change the interface by declaring exceptions?

i.e.
This
public String [] read(int recNo) throws RecordNotFoundException;

to this
public String [] read(int recNo) throws RecordNotFoundException, RemoteException;
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11458
    
  93

Hi M. Groening,

Welcome to JavaRanch and this forum.

We don't have many rules here, but one we do have is the Official policy on registered names, which states (in part) "No names of celebrities or fictional characters.".

Could you please review the official policy, and change your name accordingly. You can change your name here.

Thanks, Andrew


The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Linus Friedrich
Greenhorn

Joined: Jan 18, 2005
Posts: 2
So, if a booking procedure is just a matter of update the record and set the given customer number, where is the lock and unlock method for ?
In this case it should be sufficient to "synchronize" the update method, isn't it.
Do I miss something ???



By the way: My apologize about my display name, I wasn't aware of that. I changed it now from M. Groening to Linus Friedrich.
peter wooster
Ranch Hand

Joined: Jun 13, 2004
Posts: 1033
Originally posted by Linus Friedrich:
So, if a booking procedure is just a matter of update the record and set the given customer number, where is the lock and unlock method for ?
In this case it should be sufficient to "synchronize" the update method, isn't it.
Do I miss something ???


Yes, the sequence {read, compare, update} must be available across the network. You can't get synchronization between multiple clients over the network. If you were using the "thin client" model you could synchronize that, but its a rather large block of code.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

Originally posted by Linus Friedrich:
So, if a booking procedure is just a matter of update the record and set the given customer number, where is the lock and unlock method for ?
In this case it should be sufficient to "synchronize" the update method, isn't it.
Do I miss something ???



By the way: My apologize about my display name, I wasn't aware of that. I changed it now from M. Groening to Linus Friedrich.


So how was your last Bicycle race Linus?

Markus, just change it to your real name please.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
dennis du
Ranch Hand

Joined: Dec 31, 2004
Posts: 59
--------------------------------------------------------
Is it exceptable to change the interface by declaring exceptions?

i.e.
This
public String [] read(int recNo) throws RecordNotFoundException;

to this
public String [] read(int recNo) throws RecordNotFoundException, RemoteException;
--------------------
I don't think this change is ok. So I write a new Interface for
client ,for RMI server.
For the DB class , I just implement it to Data class.
Maybe the request just want some olg system can access the new application through the interface,So you should not change this DB interface.

dennis


-------------------------------<br />OCP 9i <br />SCJP/SCJD/SCWCD(92%)/SCDJWS<br />XML(IBM Test 141)<br />Who is the next?SCBCD<br />SCBCD/CCNA/CCNP/PMP<br />not sure
peter wooster
Ranch Hand

Joined: Jun 13, 2004
Posts: 1033
Originally posted by dennis du:
--------------------------------------------------------
Is it exceptable to change the interface by declaring exceptions?

i.e.
This
public String [] read(int recNo) throws RecordNotFoundException;

to this
public String [] read(int recNo) throws RecordNotFoundException, RemoteException;
--------------------
I don't think this change is ok. So I write a new Interface for
client ,for RMI server.
For the DB class , I just implement it to Data class.
Maybe the request just want some olg system can access the new application through the interface,So you should not change this DB interface.

dennis


It's not a good idea to add checked exceptions to the interface. There has been a lot of discussion of this on this forum. Do a search on Exception. The choices boil down to using a RuntimeException to wrap IOException or trying to shoehorn it into the declared exceptions. Throwing additional checked exceptions is sure to break any code that tries to use your Data class as a facade on your database.

I use a RuntimeException and the Adapter and Proxy patterns to get around this.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Workflow