Client-Server app for buying, selling and managing wines.
Allows you to register in the app through an authentication process. Then, you can do various operations, such as add a Wine, sell it, inspect, buy some other Wine and rate them. There are also other functionallities related to user interaction such as communicating with others users and checking you balance.
Once logged in, a menu will appear and you can choose witch operation to do. Here's an 101 of how they work:
- add
wine
image
: Adds a wine to the app with the namewine
and the imageimage
. - sell
wine
value
quantity
: Puts a wine with the namewine
for sale, selling each bottle forvalue
.quantity
bottles will be put up for sale. - view
wine
: Shows the info aboutwine
, such as name, file image name, avg of ratings(1-5) and, if exists, any sale of that wine (seller, price for bottle and quantity). - buy
wine
seller
quantity
: Buysquantity
bottles of wine with namewine
to the sellerseller
. - wallet : Shows the balance
- classify
wine
stars
: Classifies the winewine
withstar
. - talk
user
message
: Sends a messagemessage
to useruser
. - read : Shows all the messages received
- exit : Exits the app
Here are some of the operation limitations:
- add
wine
image
:wine
must be a String andimage
must be a String path to the file containing the image. It's imperative that the image exists in the clientFiles directory, otherwise client is shutdown. - sell
wine
value
quantity
:wine
must be a String, whilevalue
andquantity
both must be positive Integers. It's only possible to sell existing wines. - view
wine
:wine
must be a String andwine
must exist. - buy
wine
seller
quantity
:wine
must be a String andwine
must exist.seller
must be a String andseller
must be an existing user. Alsoseller
cant be the user itself.quantity
must be a positive Integer. - classify
wine
stars
:wine
must be a String andwine
must exist. - talk
user
message
:user
must be a String anduser
must exist.message
must be a String.user
cannot be the user itself.
File organization:
Contains the .txt files that store all data from the app.
- authentication.txt contains the credentials of every user in
clientID:passwd
format. - balance.txt contains the balance of every registered user in
clientID;balance
format. - chat.txt contains all sent messages that weren't yet read in
sender;receiver;msg
format. - forSale.txt contains all sales from all users in
wineName;seller;price;quantity
format. - wines.txt contains all added wines in format
wineName;imageFileName;[stars]
format.
These files are updated through the app execution, by structures in the server memory.
Contains image files of the wines to be added. When view operation is called, the file that contains the image of the wine passed as arg in the view operation is overwritten.
Contains image files of the wines added.
There are structures used to operate in the data bases. They are updated from the data_bases directory .txt files when the server starts.
ArrayList<Utilizador>
listaUts : Stores all registered users.ArrayList<Wine>
listaWines : Stores all added wines.HashMap<Utilizador,ArrayList<Sale>>
forSale : Stores all sales, mapping each list of sales to its seller (user).
Utilizador
is an object that represents an user, defined by a idclientID
and a balancebalance
.Wine
is and object that represents a wine, defined by a namename
, image file nameimage
and all ratings (1-5)stars
.Sale
is an object that represents a sale, defined by a winewine
, a pricevalue
and a quantityquantity
.
To compile and run server:
java -jar TintolmarketServer.jar
To compile and run client:
java -jar Tintolmarket.jar <serverAddress> <userID> [password]
Segurança e Confiabilidade @ Faculdade de Ciencias, University of Lisbon