Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CS405 Spring 2018 Team Project (80pts) Operating a Car Rental Data Warehouse with Linux Shell Programming Deadline: Tuesday April 24, at the beginning of the

CS405 Spring 2018 Team Project (80pts) Operating a Car Rental Data Warehouse with Linux Shell Programming Deadline: Tuesday April 24, at the beginning of the class Overview Data warehouse is widely used today for data storage, retrieval and analysis in many applications. Data Warehouse Application Examples 2 In this project, you are required to write a shell script to create, edit and view a data warehouse that contains car rental records. The shell script has to be written in Bourne shell syntax (i.e., bash). You may use any bash feature or Linux command available, but cannot use any high-level programming languages such as C++, Java, C#. The first parameter for your script is always the data warehouse name being queried. The second parameter is always the command that will be executed. Any parameters that follow are specific to the command that was issued. The general syntax of script invocation is: autodb dbname command param1 ... paramN where: ? Autodb is the name of the shell script file ? dbname is the name of the data warehouse file that contains the data records ? command is one of: create, add, view or delete ? param1 ... paramN are paramemters to the specified command Description of commands and parameters ? create title text creates a new data warehouse with name dbname. Any text following the create command will become the first line in the data warehouse file. If no text is given, the default is "Car Rental Data Warehouse". An error occurs if the data warehouse file already exists. Upon success, the create command reports "New data warehouse created". ? add make model color customer adds a new record to the data warehouse. Up to 4 parameters can be listed in this order: make, model, color, customer. If only 3 parameters are given then the script will prompt for the fourth; if only 2 are given it will prompt for parameter 3 and 4; if only one parameter is given it will prompt for parameters 2 to 4; if no parameters are given then it prompts for all 4. All parameters are strings. Upon success, the add command reports "Successfully added a record to the data warehouse". ? view all view single number view range number1 number2 allows the user to view all records, just a single record or a range of records in 3 the data warehouse. To view a single record the record number is specified after the keyword "single". To view a range of records the 2 numbers after the keyword "range" indicate the start and the end of the range, they are inclusive. The second number must be larger than the first. The output of the view command lists records in the data warehouse. The first line of output always is the title text from the data warehouse. Then follow the lines for the requested entries in the data warehouse, either all, a single line, or a range. An example "view all" output looks like this: Car Rental Data Warehouse Ford, Mustang, blue, Joshua Mitsubishi, Lancer, white, Linda Toyota, Camry LE, black, Ken Porsche, Cayenne S, red, Amy An example "view range 2 3" output looks like this: Car Rental Data Warehouse Mitsubishi, Lancer, white, Linda Toyota, Camry LE, black, Ken ? (10 Bonus points) For the following: delete all delete single number delete range number1 number2 allows the user to delete records: either all, just a single record or a range of records. To delete a single record the record number is specified after the keyword "single". To delete a range of records the 2 numbers after the keyword "range" indicate the start and the end of the range, they are inclusive. The second number must be larger than the first. The delete command reports the number of lines deleted, such as "Successfully deleted 4 records from the data warehouse". Note that the title line in the data warehouse is never deleted. Error checking If an error occurs, print an error message and exit the script. Specifically your script should: ? ensure that the command is spelled correctly; ? ensure that all required parameters to the appropriate command are present; ? ensure that line numbers fall within the lines present in the data warehouse file; 4 ? ensure that the data warehouse file exists and is readable, and in the case of "add", "delete" and "edit" also writable ? if the file is empty (i.e., no records), your script should print out a message that no records are found Data Warehouse file format The first line in the data warehouse file contains the title text specified in the "create" command. The remaining lines specify car rental entries with fields that are separated by ", ". For example, the data warehouse file for the above "view all" command would contain: Car Rental Data Warehouse Ford, Mustang, blue, Joshua Mitsubishi, Lancer, white, Linda Toyota, Camry LE, black, Ken Porsche, Cayenne S, red, Amy Example run $ ./autodb DB create Example for Assignment New data warehouse created $ ./autodb DB add Ford Mustang blue Joshua Successfully added a record to the data warehouse $ ./autodb DB add Mitsubishi Lancer white Linda Successfully added a record to the data warehouse $ ./autodb DB add Toyota "Camry LE" black Ken Successfully added a record to the data warehouse $ ./autodb DB add Porsche "Cayenne S" red Amy Successfully added a record to the data warehouse $ ./autodb DB view all Car Rental Data Warehouse Ford, Mustang, blue, Joshua Mitsubishi, Lancer, white, Linda Toyota, Camry LE, black, Ken Porsche, Cayenne S, red, Amy $ ./autodb DB delete single 2 1 record deleted $ ./autodb DB view all Car Rental Data Warehouse Ford, Mustang, blue, Joshua Toyota, Camry LE, black, Ken Porsche, Cayenne S, red, Amy $ cat DB 5 Car Rental Data Warehouse Ford, Mustang, blue, Joshua Toyota, Camry LE, black, Ken Porsche, Cayenne S, red, Amy Additional Requirements ? Be sure to test your script thoroughly. ? Your file must mention /bin/bash in its shebang line. ? Make sure your script does not leave any temporary files behind. ? Make sure that your autodb file is a regular Linux shell script file.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems Introduction To Databases And Data Warehouses

Authors: Nenad Jukic, Susan Vrbsky, Svetlozar Nestorov

1st Edition

1943153191, 978-1943153190

More Books

Students also viewed these Databases questions

Question

6. Do you currently have a team agreement?

Answered: 1 week ago

Question

What is the basis for Security Concerns in Cloud Computing?

Answered: 1 week ago

Question

Describe the three main Cloud Computing Environments.

Answered: 1 week ago