Programming Enterprise Components Practical Coursework
from Dr Markus Wolf
Developed by Tayyib Oladoja - Enterprise Systems and Database Administration
18th March 2016
A web system that can help customers find a restaurant close to a particular postcode in England. They have enlisted you to develop a prototype of a system which will enable company employees to add restaurants to the system and customers to search for restaurants.
The system needs to provide the following functionality to each type of user:
The database needs to be used for persistent storage of restaurants and their details. For more information on what data should be stored in the database.
A Web application that allows a member of staff to add, edit and delete restaurants, including an image of the logo or business card. It should also be possible to view restaurants in a list and apply some search filters
A section for customers to the web application. It should allow a user to register a new account. An authenticated customer should be able to view a list of restaurants closest to his/her home address. Furthermore, a customer should be able to search for restaurants by postcode and search results should be displayed as a list.
A component that calculates the actual distance between the postcode that the user searched for and that of the restaurants. A third-party RESTful web service, http://www.uk-postcodes.com/ is used to return return the geographical details of a postcode in JSON format. The formula described by http://www.movable-type.co.uk/scripts/latlong.html is used calculate the distance between the latitude/longitude coordinates.
In an attempt to increase the performance of the system and speed up searches, distances between restaurants and the postcodes should be cached in the database.
The idea is that rather than always calling a third-party service and recalculating distances dynamically, the database builds up a cache of distances over time.
When a user searches for a particular postcode, the system would first check whether distances between the given postcode and restaurants are already available in the database. If so, the distances stored in the database are used, if not, then the third-party service is used to calculate distances which are then stored for future searches.
Message-Driven Beans that ensures that when a new restaurant is added to the system, the distances between it and all existing postcodes in the distance cache are calculated and stored in the database.
As the calculation of distances is not time-critical and shouldn’t slow down the restaurant registration process, this should be implemented using asynchronous messaging (MJB).
A SOAP Web Service, which provides search functionality for restaurants based on a specified postcode. The number of desired results should also be provided as a parameter (e.g. return the 5 closest restaurants or 10 closest restaurants).
The Web Service should expose at least two methods: