Skip to content

Java Spring application that enables a list of commands in the command line prompt (by using Spring Shell) and can be used to retrieve up-to-date status for several websites on-demand

Notifications You must be signed in to change notification settings

jcreis/SS_StatusRetriever

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spring Shell Status Retriever app

To make this project I used the framework Spring Shell, which is an extension of the Spring Framework that provides an interactive shell that allows the program to receive custom made commands while using a Spring based project. It can be extended to make an API capable of making HTTP requests via shell, making the process of testing the API simple and quick.

It's kind of a recent tool, so it's still quiet limited, but I though it would be a nice choice to deepen my knowledge in a framework I've been using a lot lately - Spring. Even so, I was still able to make the whole commands work as shown in the Challenge description file, but some with a few adjustments due to some limitations from the framework, but nothing special.

As for the language chosen, the program it's written in Java, as expected due to the usage of Spring framework.

To run the program:

1- Must have:

  • java-8 (1.8.0_201)
  • Apache Maven (latest patch eg: version 3.5.2)
  • Internet connection

2- Open command prompt

3- Go to root directory /something/something_else/projectFolder where the project is saved locally

4- Run the command (in the root directory):

$mvn -DskipTests=true clean install && java -jar target/cli-app-0.0.1-SNAPSHOT.jar

or simply:

$mvn spring-boot:run

and wait for the shell:> print to appear, where you can now use commands

5- Use the command help, so you know what commands are available, what is the exact command and, finally, what each command does exactly.

It will show something like this:

Available Commands:

:>poll [--only] onlyArg1,onlyArg2 [--exclude] excludeArg1,excludeArg2

:>(...)

poll: Retrieves the status from of all configured services.

The commands inside brackets (eg: [--only]) are optional commands (or flags) that receives arguments as it is shown on the display .

In the poll case, it receives a String where the commas ',' separates the different arguments. For example:

:>poll --only bitbucket,slack,google

will make the program display only information regarding the endpoints bitbucket, slack and google.

  • the flag [--only] filters what is displayed into just the given Endpoint(s) send as arguments (eg: :> poll --only bitbucket,slack) will display only the information regarding these two endpoints;

  • the flag [--exclude] excludes the information of the given endpoints from the display shown;

  • the flag [--refresh] (from the fetch command) sets the timer to the value given (in seconds) as argument;

  • the flag [--format] (from the backup command) indicates the format that the backup file will have (either txt or csv);

  • the flag [--merge] (from the restore command) is a boolean that will merge the backup file to the output file, or not, depending if it's used or not in the restore command.

Special attention to:

-> the file output.json can't be empty to be read, if the intention is to start with an empty Local Storage, change the data in the output.json file to

[]

-> in the backup command, the argument passed as pathToFile must refer to the directory where the backup file will be saved (with no '/' at the end)

(eg: /home/user/desktop/backup_folder)

-> still in the backup command, the format given must not have the dot '.'

(eg: :> (...) --format csv)

-> in the restore command, the argument passed as pathToFile must refer to the file itself

(eg: /home/user/desktop/backup_folder/backup.csv)

Myself

João Reis - jcreiswork@gmail.com

About

Java Spring application that enables a list of commands in the command line prompt (by using Spring Shell) and can be used to retrieve up-to-date status for several websites on-demand

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages