Complimentary Material For The Book "Foundations of Software Engineering"
Complimentary Material For The Book "Foundations of Software Engineering"
Copyright material Distributed under Creative Commons CC-BY 2.0 license. You can use the material for education
purpose freely if attribution of source of the material is provided. For commercial inquiries please contact Ashfaque
Ahmed at ashfaque.a@gmail.com. Do not duplicate and do not give it to any other person or entity.
Smart city system documentation
Welcome to the documentation information about Smart City system. Here in this
document you will find information about installation instructions as well as information
about how it works.
The requirement specifications, high level design, detail design, database design etc.
about the Smart City system are available in a separate document which is a
supplementary material for the book “Foundations of Software Engineering”.
We have created the Smart City system using an object oriented programming language
(Java). The Smart City system has been built to teach students as to how to implement a
software product using an object oriented programming language.
System requirements
Smart City system uses web based architecture. The user interface is always a web
browser. Once the Smart City system is installed on a web server (including appropriate
application server and database) then any user located anywhere in the world can access
it using any web browser installed on the user computer. The URL (Universal Resource
Locator) of the deployed Smart City system must be registered with the world wide web
(WWW) registrar so that it can be published and subsequently available on the world
wide web. On the other hand if it is installed on an intranet then you do not need to
register it on the World Wide Web.
Requirement for accessing Smart City system is not much for a user. A user may only
need a computer with a web browser installed. The user may need to know where on the
web; Smart City system is located. Once the user knows the URL (Universal Resource
Locator) of Smart City system instance then the user will be able to access it.
The software installation team however needs to know the system requirements for
installing the Smart City system. So here the system requirements are described for the
software installation.
Copyright material Distributed under Creative Commons CC-BY 2.0 license. You can use the material for education
purpose freely if attribution of source of the material is provided. For commercial inquiries please contact Ashfaque
Ahmed at ashfaque.a@gmail.com. Do not duplicate and do not give it to any other person or entity.
2. Web server: any web server can host the Smart City system. The file directory
contains JSP files and some XML configuration files. The disk requirements for
installing these files is around 500 KB.
3. Application server: Any application server which can run compiled Java byte
code as well as web pages written in Java Server Pages programming language
(JSP) is fine. The only consideration will be application server specific
configuration requirements. Some of the Java compliant application servers
include IBM’s Websphere, Oracle’s weblogic, Apache Foundation’s TomCat etc.
Any of these application servers can be used to install compiled Java byte code of
Smart City system. Any of these application servers can also process the JSP
pages which have been used to glue the HTML and the Java byte codes. The
demonstration Smart City system source code has been written and tested on a
TomCat application server. If you are using any other application server then
please check your configuration settings if Smart City system is not able to run.
The current configuration settings are done for TomCat application server.
4. Package: a package has been created named “smart_city”. All class files are
stored inside this package.
5. Classes: There are 10 classes created inside the “smart_city” package:
create_city_info, create_entity, create_servlet, DB_initialize, DB_connection,
login_servlet, registration_servlet, register_user, upload_servlet and verify_user.
6. All the class files for Smart City system are provided in the “Smart City system.pdf”
file.
7. JSP files: Here is the list of files and their brief description for Smart City system:
admin_after_login.jsp: this is the response part of account creation for an
administrator functionality.
business_after_login.jsp: this is the response part of account creation for a
businessman functionality.
create_acc_admin_req.jsp: this is the request part of account creation for an
administrator functionality.
create_acc_admin_res.jsp: this is the response part of account creation for an
administrator functionality.
create_acc_business_res.jsp: this is the response part of account creation for an
businessman functionality.
create_acc_business_req.jsp: this is the request part of account creation for an
businessman functionality.
create_acc_err.jsp: this is the response part of failed account creation as well as
failed login functionality.
create_acc_student_req.jsp: this is the request part of create account functionality
for a student.
create_acc_student_res.jsp: this is the response part of create account
functionality for a student.
create_acc_tourist_req.jsp: this is the request part of create account functionality
for a tourist.
create_acc_tourist_res.jsp: this is the response part of create account functionality
for a tourist
Copyright material Distributed under Creative Commons CC-BY 2.0 license. You can use the material for education
purpose freely if attribution of source of the material is provided. For commercial inquiries please contact Ashfaque
Ahmed at ashfaque.a@gmail.com. Do not duplicate and do not give it to any other person or entity.
create_city_info.jsp: this is the placeholder file to keep sub-menus (links) for
entities related to a city (malls, restaurants, parks etc.) when these entities need to
be created.
create_college,jsp: this is the request part of college creation functionality.
create_hotel,jsp: this is the request part of hotel creation functionality.
create_hotel_res,jsp: this is the response part of college creation functionality.
create_industry,jsp: this is the request part of industry creation functionality.
create_library,jsp: this is the request part of library creation functionality.
create_library_res,jsp: this is the response part of library creation functionality.
create_college,jsp: this is the request part of college creation functionality.
create_mall,jsp: this is the request part of mall creation functionality.
create_mall_res,jsp: this is the response part of mall creation functionality.
create_museum,jsp: this is the request part of museum creation functionality.
create_museum_res,jsp: this is the response part of museum creation
functionality.
create_park,jsp: this is the request part of park creation functionality.
create_park_res,jsp: this is the response part of park creation functionality.
create_restaurant,jsp: this is the request part of restaurant creation functionality.
create_restaurant_res,jsp: this is the response part of restaurant creation
functionality.
create_zoo,jsp: this is the request part of zoo creation functionality.
create_zoo_res,jsp: this is the response part of zoo creation functionality.
edit_profile,jsp: this is the request part of editing a user profile functionality.
index.jsp: this is the welcome page when smart city system is accessed.
login,jsp: this file is used for login functionality for all types of users (student,
businessman, tourist, administrator).
logout,jsp: this file is used for logout functionality for all types of users (student,
businessman, tourist, administrator).
res.jsp: this file is used for response functionality for creation of entities where the
entity is created using create_servlet.
student_after_login.jsp: this is the response part of account creation for a student
functionality.
tourist_after_login.jsp: this is the response part of account creation for a tourist
functionality.
update_profile,jsp: this is the response part of editing a user profile functionality.
upload_map.jsp: this file is used to upload a city map.
view_city_info.jsp: this is the placeholder file to keep sub-menus (links) for
entities related to a city (malls, restaurants, parks etc.) when these entities need to
be viewed.
view_college.jsp: this file is used to view a list of colleges.
view_hotel.jsp: this file is used to view a list of hotels.
view_industry.jsp: this file is used to view a list of industries.
view_library.jsp: this file is used to view a list of libraries.
view_mall.jsp: this file is used to view a list of malls.
view_map.jsp: this file is used to view a map of the city.
view_museum.jsp: this file is used to view a list of museums.
Copyright material Distributed under Creative Commons CC-BY 2.0 license. You can use the material for education
purpose freely if attribution of source of the material is provided. For commercial inquiries please contact Ashfaque
Ahmed at ashfaque.a@gmail.com. Do not duplicate and do not give it to any other person or entity.
view_park.jsp: this file is used to view a list of parks.
view_restaurant.jsp: this file is used to view a list of restaurants.
view_zoo.jsp: this file is used to view a list of zoos.
8. Database: Any relational database engine e.g. Oracle, SQL Server, MySQL etc.
can be used to host the database for the smart city system. We have used Oracle
database. There are 11 tables and one sequence which needs to be created on the
database. So disk space required for the database is not much. If you are using any
other database engine instead of Oracle then you will need to modify the SQL
statements for creating database tables, sequences etc.
9. Database connection: database connection information is provided in
DB_initialize class file. You will need to change connection information as per
your installation of the database.
10. Database connector: You will need to install a database connector which can
connect the database to your software product. Generally these connectors can be
downloaded from the vendor website. Our software product is written in Java
language and we have used Oracle database. Generally for a Java based software
product which connects to an Oracle database, the database connector is named
“ojdbc” and is generally available as a Jar library. We have used a database
connector named “OJDBC6.JAR”.
11. Database scripts: database scripts to create tables, sequences and populate tables
are provided in the file “database-script.doc” file.
12. configuration: There is a web.xml file located at
<application_root>/WebContent/WEB-INF/lib. This file contains information
about the servlets (controllers). It is currently configured as per the application is
deployed. If you change any deployment configuration then you will also need to
set path of the servlet accordingly.
13. Configuration: for the file upload functionality, we need to use special jar files
which help in achieving this functionality. These jar files are commons-
fileupload-1.3.3.jar, commons-fileupload-1.3.3-javadoc.jar, commons-fileupload-
1.3.3-sources.jar, commons-fileupload-1.3.3-tests.jar, commons-fileupload-1.3.3-
test-sources.jar, commons-io-2.5.jar, commons-io-2.5-javadoc.jar. Please
download these files from Apache website and keep them in the
<application_root>/WebContent/WEB-INF/lib folder.
14. Index file: Most websites have a default (HTML or any other file like JSP file
containing HTML content) file which gets loaded when the website is accessed.
Fir example when you type http://www.microsoft.com in your browser URL box
and direct your browser then actually it is the index.html file which is shown to
you. This is because in the web server which hosts Microsoft website, it is defined
that index.html file is the default file when http://microsoft.com website is
accessed. This is done by entering the default web page definition in web.xml file.
In smart city system, we have provided index.jsp file. So if in your web.xml file
no default file is defined then you will need to modify this web.xml file so that
smart city system can work.
Copyright material Distributed under Creative Commons CC-BY 2.0 license. You can use the material for education
purpose freely if attribution of source of the material is provided. For commercial inquiries please contact Ashfaque
Ahmed at ashfaque.a@gmail.com. Do not duplicate and do not give it to any other person or entity.
How smart city system is built?
Smart city system is designed and built as part of the case study for the book
“Foundations of software engineering” published by CRC Press, USA. This case study
contains all the information which is extremely useful for students to learn how software
products are built in the software industry.
You can read the requirement specifications to understand how requirements for the
Smart city system were developed. The requirement specifications for the Smart city
system are provided in the file ”user-stories” file and is a supplementary material for the
book “Foundations of Software Engineering”. The mock up screens are helpful in
understanding how the user screens look like and how the navigation from one user
screen to the next user screen takes place. The mock up screens for the Smart city system
are provided in the “design” file. These are the design documents for the user interface.
The high level software design containing component diagrams and data flow diagrams
for the Smart city system are provided again in the design file. The business logic
implementation including class, object, statechart, sequence etc. diagrams for the Smart
city system are provided again in the design file. Entity relationship (ER) diagrams for
the Smart city system are also provided in the design file.
Technical documentation
Here is a brief description about how functionality for tasks such as user account
creation, entities creation, map upload, view entities etc. is implemented. Complete
software requirements, design and construction details are provided in user stories, design
etc. documents which are supplementary material for the book “Foundations of software
engineering”. Here we are providing information about how Smart city system design
and construction is linked to various Java classes and components with actual names used
in building this system.
Create account
On many jsp pages like create_acc_admin_req.jsp, create_acc_student_req.jsp etc.; a user
creation form is present. User fills this form with information such as username,
password, re-password, phone, address etc. The information provided by the user is first
checked through client side validation using JavaScript to ensure that user provides
complete and correct information. Once the user clicks the submit button and the user
input is valid then this information is sent to a controller component named
registration_servlet. This component is written in a compiled java class. This controller
then checks the user input information and then sends this information to register_user
class. The register_user class creates a new user account in the system by creating a new
record in the database. If a new account is created successfully by the register_user class
then the controlled (registration_servlet) sends this information to files
create_acc_admin_res.jsp, create_acc_student_res.jsp etc.. These jsp files prepare a
Copyright material Distributed under Creative Commons CC-BY 2.0 license. You can use the material for education
purpose freely if attribution of source of the material is provided. For commercial inquiries please contact Ashfaque
Ahmed at ashfaque.a@gmail.com. Do not duplicate and do not give it to any other person or entity.
report about this new account and displays it to the user. The user can now access the
system using the registered username and password.
The Smart city system has the facility to create 4 types of users: student, businessman,
tourist and administrator. Depending on the type of user, privileges are provided in the
system to create entities or view entities.
For security reasons, administrator account creation is hidden from other types of users.
So where as other users can create their account from the welcome page using
appropriate link; administrator accounts can be created from a URL similar to
http://localhost:8081/smart_city4/create_acc_admin_req.jsp.
Update Account
Any user can edit its user profile information saved in the system. Once the user saves
this information by clicking on the submit button then user’s profile information will be
updated. The request file for edit user information is edit_profile.jsp and the response file
is update_profile.jsp.
Login
Registered Users can login at login.jsp page. On the page, the user needs to provide
information about username, password, and re-password.. There is also a drop down field
called user type. The information provided by the user is first checked through client side
validation using JavaScript to ensure that user provides complete and correct information.
Once the user clicks the submit button and entries in the fields are valid, the user
information is directed to login_servlet controller. The controller checks for validity of
user data using a call to verify_user component. This component is a compiled java class
file. If user information is correct then the controller checks if the user account is valid.
Valid registered user will be able login and can view pages relevant for them.
Logout
Users can logout of the system anytime during their browsing of the smart city website.
When they click on the logout link, the logout.jsp page is called and users are logged out
of the system. They can login again by clicking on the login link.
Create entities
There are lots of entities which need to be created in the system. Using an administrator
account, it is possible to create entities including hotels, colleges, libraries, industries,
malls, restaurants, parks, zoos, and museums. To create these entities, a servlet named
create_servlet has been used. In conjunction with create_entities class, this servlet is used
to create many of these entities. Some entities are also created on their respective web
pages using either create_entities or create_city_info classes.
Copyright material Distributed under Creative Commons CC-BY 2.0 license. You can use the material for education
purpose freely if attribution of source of the material is provided. For commercial inquiries please contact Ashfaque
Ahmed at ashfaque.a@gmail.com. Do not duplicate and do not give it to any other person or entity.
Upload map
A web page has been provided for uploading a city map. This functionality uses a servlet
named upload_servlet which in conjunction with the upload_map.jsp file achieves this
functionality.
View entities
Users like students, tourists and businessmen can view information about colleges,
libraries etc. Many pages including view_college.jsp, view_park.jsp etc. have been
created so that relevant view can be available to different types of users depending on
their privileges.
Copyright material Distributed under Creative Commons CC-BY 2.0 license. You can use the material for education
purpose freely if attribution of source of the material is provided. For commercial inquiries please contact Ashfaque
Ahmed at ashfaque.a@gmail.com. Do not duplicate and do not give it to any other person or entity.