Package sources.client
Class ConsoleClient
java.lang.Object
sources.client.ConsoleClient
- All Implemented Interfaces:
Client
The ConsoleClient class implements the Client interface and is responsible for
interacting with the user through the console. It initializes the Invoker and Receiver,
reads user input, executes commands and handles exceptions.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidexecuteScript(String path) Executes a script file containing a list of commands.voidexit()Terminates the program.voidhelp()Displays a list of available commands and their descriptions to the user.voidhistory()Displays a list of previously executed commands to the user.voidmain()Main method of the ConsoleClient class.
-
Field Details
-
Constructor Details
-
ConsoleClient
public ConsoleClient()
-
-
Method Details
-
main
public void main()Main method of the ConsoleClient class. Initializes the Invoker, Receiver and Reader and starts an interactive loop to read user input and execute commands. -
help
public void help()Displays a list of available commands and their descriptions to the user. -
exit
public void exit()Terminates the program. -
history
public void history()Displays a list of previously executed commands to the user. -
executeScript
Executes a script file containing a list of commands.- Specified by:
executeScriptin interfaceClient- Parameters:
path- the path of the script file to execute- Throws:
CustomIOException- if there is an error reading the script file
-