The task is to build server for the defined protocol "Order3901/1.0" to interact with northwind client to place order by using socket programming.
- Only one client is allowed to interact with server at an instance.
- Server needs to be restarted when client shutdowns.
The main server starting point.
Methods
-
Server Contructor defining all the required params (like port) to start a server.
-
pullIncomingMessage Reads the incoming message from socket buffer
Processes the incoming message and writes the ouput in the socket buffer.
Methods
-
incomingMessage Process the incoming message and decodes the header values. Checks for valid incoming message throws exception if error exists.
-
processBody Reads the body content based on the header's content-length.
-
performOperation Checks for valid user before performing any operation. Performs the given operation and handles the state exceptions. Handles any operation specific exception cases.
-
WriteOutgoingMessage Writes the ouput to the ouput socket buffer from which client reads.
-
shutdownConnection Clears all the user and order details
Has username, password and database for identity purpose.
Has database operations and computations for northwind.
Methods
- authenticate: Checks for valid user using lastname and dateofbirth
- placeOrder: Places the given order; Also checks for any invalid cases and throws exception. Inserts orderdetails on successfull order placement.
- listElements: Lists the customer, products and products in the order based on the target
- checkProduct: Checks whether the product added in current order is valid
POJO class for storing order details
POJO class for storing user and session details
- Generate random String of given size in Java. (2018, December 11). Retrieved from https://www.geeksforgeeks.org/generate-random-string-of-given-size-in-java/