public void startup() {
RemoteCache<String, Object> cars = provider.getCacheContainer().getCache(CarManager.CACHE_NAME);
List<String> carNumbers = new ArrayList<String>();
try {
Car c = new Car("Ford Focus", 1.6, CarType.COMBI, "white", "FML 23-25", Country.CHN);
carNumbers.add(c.getNumberPlate());
cars.put(CarManager.encode(c.getNumberPlate()), c);
c = new Car("BMW X3", 2.0, CarType.SEDAN, "gray", "1P3 2632", Country.CHN);
carNumbers.add(c.getNumberPlate());
cars.put(CarManager.encode(c.getNumberPlate()), c);
c = new Car("Ford Mondeo", 2.2, CarType.COMBI, "blue", "1B2 1111", Country.USA);
carNumbers.add(c.getNumberPlate());
cars.put(CarManager.encode(c.getNumberPlate()), c);
c = new Car("Mazda MX-5", 1.8, CarType.CABRIO, "red", "6T4 2526", Country.USA);
carNumbers.add(c.getNumberPlate());
cars.put(CarManager.encode(c.getNumberPlate()), c);
c = new Car("VW Golf", 1.6, CarType.HATCHBACK, "yellow", "2B2 4946", Country.GERMANY);
carNumbers.add(c.getNumberPlate());
cars.put(CarManager.encode(c.getNumberPlate()), c);
// insert a list of cars' number plates
cars.put(CarManager.CAR_NUMBERS_KEY, carNumbers);
} catch (Exception e) {
log.warning("An exception occured while populating the database!");
}