Assignment title: Information
Assessment details for ALL students
Assessment item 2— Assignment 2
Due date: Friday of Week 10
ASSESSMENT
Weighting: 35%
Length: NA 1
Objectives
The purpose of this assignment is to assess your competency in the use of networking
protocols, thread programming, and database access in the development of distributed
applications.
Assessment task: Paired Programming
Your task for this assignment is to design, implement, test and document a client/server
application that allows multiple users to access stored data, or add new data. A distributed
system often has a backend database for storing and retrieving business data. In this
assignment, you are to implement a multiple-threaded client/server application for managing
home inventory allowing all adult residents of the house access the stored details. The
application also allows the house owner to add new item to the inventory.
All users accessing the home inventory system should able to view the following data:
1. List of available categories of items stored
2. List of purchases of items
3. Specific details of all the items within a chosen category
The home owner accessing the Home Inventory System should able to add a new
purchased item to the list of purchases and additional details to the list within the specific
category.
Sever side
Request for view Inventory
The server creates a new thread for each client connection (thread-per-connection
model). The server side receives client requests, processes them and return results. If the client
request is to view information related to inventory, the server should parse the request received
from the client and execute appropriate queries to extract data from the database and send the
data back to the client. Multiple read requests are executed concurrently.Request for add inventory item
If the client request is to add inventory item, the server should parse the request, execute
database query to add the details to the appropriate table. This should be synchronised as
multiple clients will be running through multiple threads.
Client side
The client side interacts with the user, parses the request and sends it to the server. It
receives messages from the server and displays to the user. The query frontend provides a menu
to let a user choose any of the functions continuously until the user chooses to exit the system.
The Category list contains three categories and these are:
1. Furniture
2. Kitchenware
3. Appliance
The database should have 4 tables and these are:
1. List of categories
2. List of purchases
3. List of furniture
4. List of appliances
If the user selects the category 2 Kitchenware a message should be displayed informing no
items are added yet. If the user wants to add an item, initially the purchase details should be
collected followed by the data required within the category. There is no validation of users
required. Assume the users do the right access and only the owner will choose the option to
add an item.
The test data required for the assignment are given in the file COIT20257Assign2Data.csv.
Please refer to example source code given in Week 9 folder to access database
programmatically, use prepared statements to insert and query database.
Data Structures
You may follow the following class design.
Category class
To store the name of categories.
Purchase class
To store and manipulate the details read from the given file including purchase
date, price, supplier and location. It is assumed that all the purchases are from
shops (no online purchases).
Furniture class
This class stores the following details of a furniture:
FurnitureType, setName, Warranty, and No. Of Pieces. A Funrniture purchase can
be a set for example dining which includes table and number of chairs.
Appliance class
This class stores the following details of an appliance:
applianceType, make, modelNumber, warrantyDatabase Utility class
This class will have necessary data structures and methods to create the database
and the Tables of Category, Purchase, and Furniture, Appliance, populate the tables,
and extract data from the tables. Use Prepared Statements to populate the tables
using values loaded from the file. Also use Prepared Statements to extract data and
store in appropriate data structures.
InventoryServer class
This class will have necessary data structures and methods to create the sockets for
client connection, creating threads for each client. This class will have main()
method to invoke methods from other classes to run the application.
InventoryClient class
This class will display menus, take the user input, create socket and request
connection to the server. This class will also send/receive the messages between the
client/server.
Coding
Include necessary accessor, mutator methods, constructors, and toString() method for
each class. Also, follow good coding practices, using meaningful names, camel case notation
for naming, constants as necessary, and include meaningful comments.
Paired Programming
Complete the program design and coding in pairs. You choose another student from your
tutorial to work with in consultation with your tutor. Distance students also can work in pairs.
If there are any problems please contact the Unit Coordinator.
Individual Report
Your report should be written individually and submitted by each one of you. In your
report clearly show your partner for the application development.
Ideally, the Home Inventory System should be a cloud based application. This should
allow the vendors to upload purchase details and documents such as Warranty certificate,
purchase receipt, and instructions manual. Also, a user may want to access information while
away from home, for example, while purchasing spare parts. When theft or damage caused by
natural calamities happen, the data stored in a cloud can be accessed.
The added convenience of having ubiquitous availability of access to Home Inventory
System creates the necessity for additional security as home inventory is part of assets owned
by individuals or families.
1. Write how the Home Inventory System can be extended to a ubiquitous distributed
system focusing on the additional cyber security requirements and Java language
constructs that could be used for implementation. You need to write a maximum of 500
words.
2. Provide a diagrammatic representation of the system architecture.
3. Include a test plan, and user instructions.Sample Output – Client side (user entries are shown in bold)
Welcome to Home Invenotry System
Enter a number beside the menu
1. Purchase Details
2. Appliance List
3. Furniture List
4. Kitchenware
5. Add a new Purchase
6. Exit
1
Purchase date Price SupplierName Location
25/05/2005 2500 Amart Mcgreggor
15/10/2009 350 Myer GardenCity
15/01/2006 1300 Freedom Milton
24/03/2012 800 Good Guys Big Top
Select an option by entering the number of the option
1. Purchase Details
2. Appliance List
3. Furniture List
4. Kitchenware
5. Add a new Purchase
6. Exit
2
ApplianceType make ModelNumber Warranty
WashingMachine LG WD12021D6 3
Refrigerator Electrolux EHE5267SA 5
Select an option by entering the number of the option
1. Purchase Details
2. Appliance List
3. Furniture List
4. Kitchenware
5. Add a new Purchase
6. Exit
5Sample Output – Server side
Enter Purchase details each part separated by semicolon
Example: 20/06/2015; 1800;JB Hi-Fi; Carindale; appliance
appliance;20/08/2014; 1479;Harvey Norman; Spring Hill
Enter appliance details:
Robotic Vaccum Cleaner; VR66803VMNP; 5
Select an option by entering the number of the option
1. Purchase Details
2. Appliance List
3. Furniture List
4. Kitchenware
5. Add a new Purchase
6. Exit
6
*** Bye ***
Request received from Client on
Thread Thread-0
Thread Id 10
Welcome message sent to Client
Purchase Details request received from Client
Purchase Details sent to Client
Appliance listing request received from Client
Appliance listing sent to Client
Add item request received from Client
Item added
Client ExitingNote: For your testing purposes using multiple clients run the InvenotryClient
application from multiple JVM.
Software Tools for Building the Application
You can use TexPad or NetBeans to develop your application. You have to install MySql server
and configure to work within NetBeans and use the java program to create database, populate
it and query the database.
Follow incremental building of application. Test the programmatic operation of database
before creating multiple threads.
References and Source Code Files.
Refer to the file obtained from the following link for installing and setting up the MySql server.
MySql Server Installation and set up File
Please refer to the given files in Week 9 available from the link given below.
Example of Programmatic Database Operation of MySql database File .
Note: The data file COIT20257Assign2Data.csv is also available from Week 10 folder.
Assignment Submission
One student from each pair should submit the source code files using the Moodle online
submission system as one zip file (Note: the file names/class names could be changed to
meaningful names). A list of source code files are given below. You may include any
additional file as required.
Purchase.java – Source code for the Purchase class
Furniture.java – Source code for the Furniture class
Appliance.java – Source code for the Appliance class
InventoryServer.java – Source code for the InventoryServer class
InventoryClient.java – Source code for the Client class
DatabaseUtility.java – Source code for database creation and access
Individual Submission
Report.doc – word document containing the report as specified above.Assessment Item 2 Marking criteria
S.No Total Marks - 35 Marks
Allocated
Marks
Scored
1 The InventoryClient class enabling
send/receive of messages and appropriate
handling of user input, proper formatting and
display of user outputs
3
2 The InventoryServer class enabling
acceptance of client request, creation of
thread per client which processes and
responds to client request.
5
3 DatabaseUtility class enabling creation
of database and tables, populating database
tables with data from file, and extraction of
data as requested by the client.
4
4 Other classes enabling the extraction
and manipulation of data from database.
4
Correct use of Synchronisation for
adding new purchase details
3
5 Programmatic creation of tables and
correct database connectivity
3
12 Good coding practices (Indentation,
Comments, Naming Conventions,
Readability)
3
13 Well presented report with student
details, and cyber security requirements, and
Java language constructs
5
System architecture, test plan, and user
instructions
5
Penalties
Late penalty -1.75
(5% per
working day)
Plagiarism As per policy
Total 35