File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes URLYBird Data Interface Questions 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 "URLYBird Data Interface Questions" Watch "URLYBird Data Interface Questions" New topic

URLYBird Data Interface Questions

Thomas Paul Bigbee
Ranch Hand

Joined: Jun 28, 2005
Posts: 71
The create method of the Interface throws a DuplicateKeyException, what is the key? There are no room numbers, is it valid to have the same hotel in the same city have identical rooms available on the same night? I previously did the Flight Reservation Project some years ago and it used physical record numbers in embedded in the data however URLYBird has no Keys.

When updating, reading and deleting records the methods to do so take a record number (int) argument, record numbers are a logical construct, is it safe to assume that when assessing records a user must first search for a record before manipulating it, I'm assuming that it is not valid to directly input record numbers into a field on the interface.

Is it safe to assume that even when running in Non-networked Mode the Server first has to be started, my Server returns Session IDs first thing, and maintains a Synchronized list of all records that are locked by what Session ID, these are accessed thru static methods


public class Server extends Thread {
public final DataAccess = new DataAccess();

class DataAccess {
private static int sessionId;

public synchronized static int setSessionId() {
DataAccess.sessionId += ((int) (Math.random() * 100)) + 1;
return sessionId;

Even though I'll have a bogus socket connection that I'm not going to use, I can still use record locking in Non-Networked Mode, with no serialized objects, is this valid?

This is int the specification
It must allow the user to search the data for all records, or for records where the name and/or location fields exactly match values specified by the user.

This is in the interface
// Returns an array of record numbers that match the specified
// criteria. Field n in the database file is described by
// criteria[n]. A null value in criteria[n] matches any field
// value. A non-null value in criteria[n] matches any field
// value that begins with criteria[n]. (For example, "Fred"
// matches "Fred" or "Freddy".)
public int [] find(String [] criteria)

These don't match, one says "exactly match" the other says "begins with", which is correct
Alex Matute

Joined: Jun 28, 2005
Posts: 14
Hey Thomas! I beleive that the recNo is the actual physical number in which the record is written in the file. For instance, after the header length (which specifies the names of the fields and its sizes), the first record showed (flag and field info) should have recNo = 0. I think lots of people use that recNo as the primary key in the db, at least I am... Because of that, I will never have to throw a DuplicateKeyException in the create() method. I just implemented it as to follow Sun's spec, nothing else.

Concerning the equality issue, I think Sun leaves up to you whether two hotel rooms can be equal. According to my logic, two rooms may have same owner, the same location, the same hotel room, etc. and will still be two different rooms.

About the find() method, I think the one requiered by the DBMain interface is a low-level one that should be smartly called by a higher-level one responsible for looking for the "exact match" of the client's request (using regular expressions is my first idea - I haven't implemented it yet).

Have a nice day!
[ July 12, 2005: Message edited by: Alex Matute ]

-------------------<br /> <br />SCJD
wood burning stoves
subject: URLYBird Data Interface Questions
It's not a secret anymore!