FileDocCategorySizeDatePackage
BookDBFrontEnd.javaAPI DocExample2158Tue Dec 12 18:59:38 GMT 2000database

BookDBFrontEnd

public class BookDBFrontEnd extends Object
Object that gets information from the Duke's Bookstore database.

Fields Summary
private BookStoreDB
books
private static BookDBFrontEnd
onlyInstance
Constructors Summary
private BookDBFrontEnd()


  /* Private no-args constructor */
    
      init();
  
Methods Summary
public voiddestroy()
Set the database to null so that it can be garbage collected.

    books = null;
  
public BookDetailsgetBookDetails(java.lang.String bookId)
Return information about the book associated with the given book identifier.

    return books.getBookDetails(bookId);
  
public BookDetails[]getBooksSortedByTitle()
Return information about all the books in the bookstore. Sort the books into alphabetical order using their title as the key.

    return books.getBooksSortedByTitle();
  
public intgetNumberOfBooks()
Return the number of books in the bookstore database.

    return books.getNumberOfBooks();
  
public voidinit()
Initialize the book database, and store it in this.

    // Load the database to prepare for requests
    books = new BookStoreDB();
  
public static database.BookDBFrontEndinstance()
Static factory method that makes a single instance of this class.

    if (onlyInstance == null)
        onlyInstance = new BookDBFrontEnd();

    return onlyInstance;