Package bcu.cmp5332.bookingsystem.data
Class FlightDataManager
java.lang.Object
bcu.cmp5332.bookingsystem.data.FlightDataManager
- All Implemented Interfaces:
DataManager
The
FlightDataManager class is responsible for managing the data
related to flights in the flight booking system. It implements the
DataManager interface and provides methods to load and store flight data.
The flight data is stored in a text file located at ./resources/data/flights.txt.
This class reads from and writes to this file to persist the flight information.
- See Also:
-
Field Summary
Fields inherited from interface bcu.cmp5332.bookingsystem.data.DataManager
SEPARATOR -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidLoads the flight data from the resource file and populates theFlightBookingSystemwith flight information.voidStores the flight data from theFlightBookingSystemto the resource file.
-
Constructor Details
-
FlightDataManager
public FlightDataManager()
-
-
Method Details
-
loadData
Loads the flight data from the resource file and populates theFlightBookingSystemwith flight information.- Specified by:
loadDatain interfaceDataManager- Parameters:
fbs- theFlightBookingSystemto be populated with flight data- Throws:
IOException- if there is an I/O error during the loading processFlightBookingSystemException- if there is an error in the flight data format
-
storeData
Stores the flight data from theFlightBookingSystemto the resource file.- Specified by:
storeDatain interfaceDataManager- Parameters:
fbs- theFlightBookingSystemcontaining flight data to be stored- Throws:
IOException- if there is an I/O error during the storing process
-