Implementing the database connections

The MIDlet implements the database connections with the following classes and interfaces:

  • BookingTicket

    This class represents the booking returned by MovieDB from the sendBookingRequest method. It contains all information concerning a particular booking, such as price, code, and showing time.

  • Movie

    This class contains information about a particular movie title, including a name and a poster for the movie. A Movie object contains a set of Showings.

  • MovieDB

    This class abstracts the database and handles operations that require access to the database. The database contains a set of Movie objects.

    This class has the following functions:

    • Retrieving data

      The MIDlet implementation reads data from the MovieDB.properties file. However, in a real-life implementation, you want to establish a connection to a remote server in order to retrieve the data. In that case, you need to reconstruct the connection.

    • Implementing the ability to make a booking

  • MovieDBEvent

    This class represents events triggered by MovieDB. Note that both events and objects with data can be passed.

  • MovieDBListener

    This interface contains the handleEvent method, which is called when an interesting event happens. The handleEvent method in turn takes a MovieDBEvent object.

  • Showing

    This class encapsulates a particular showing of a movie, including the date and time, seat distribution plan, and the price.