Java Reference
In-Depth Information
The operations in Figure 3.1 make up the public interface, DBClient.java , that the
Denny's DVDs application must implement. Here are descriptions of the interface methods:
addDVD —Requires a DVD object as an input parameter. Will add the DVD to the system if
the UPC is unique; otherwise, will throw an exception.
getDVD —Given a UPC value for a DVD, this method should return the corresponding DVD
object. A null object is returned if the UPC is not found in the database.
modifyDVD —Requires a DVD object with a UPC that exists in the database. Will overwrite
an existing DVD with new DVD values. If the database does not contain a DVD with the
supplied UPC code, then false is returned and the database is not updated.
getDVDs —Should return a collection of all the DVDs in the database. If there are no DVDs
in the database, then an empty collection should be returned.
Note The Denny's DVDs system available for download comes with a starter database, which is referred
to throughout the topic's examples.
findDVD —This operation should use a regular expression query as the input parameter.
The supplied input parameter should match on multiple attributes with a regular expres-
sion query. The input parameter is the regular expression query, so the application must
translate the user's search criteria into a regular expression query prior to invoking this
method. Transforming the user's search criteria into a regular expression can be done
either in the GUI or via some intermediate class, but not in the findDVD method itself. Of
course, you must not require or expect the user to enter the regular expression syntax as
the search criteria. A collection of DVDs should be returned.
releaseDVD —Will increment the count of available DVDs. This operation is equivalent to a
rental return. The operation should return true, which indicates whether the DVD identi-
fied by the UPC exists in the database and has copies out for rental. Otherwise, the
operation returns false.
reserveDVD —Will decrement the DVD count indicating that someone has rented one of
the available copies. Requires a UPC as an input parameter. If the UPC of the DVD to
reserve does not exist, false is returned; false is also returned if no more copies of the DVD
are available for rental.
removeDVD —Will remove the DVD with the matching UPC and return true. If the UPC is
not found in the database, then no DVD is removed and the method returns false.
The interface must have a GUI to allow the execution of each of the required methods
listed here. Also, the GUI must be capable of connecting to a server on a network, or work in
stand-alone mode and connect to a server on the localhost. You must also consider design
issues related to concurrent user access and record locking. Listing 3.1 contains the code for
the DBClient.java interface.
Search WWH ::




Custom Search