public class ConsoleUtils extends Object
Constructor and Description |
---|
ConsoleUtils() |
Modifier and Type | Method and Description |
---|---|
static String |
askUserWithAuthorizedAnswer(org.apache.karaf.shell.api.console.Session session,
String msg,
List<String> authorizedAnswer)
This method allow you to ask a question to the user.
|
static String |
askUserWithDefaultAnswer(org.apache.karaf.shell.api.console.Session session,
String msg,
String defaultAnswer)
This will ask a question to the user and return the default answer if the user does not answer.
|
static void |
printException(org.apache.karaf.shell.api.console.Session session,
String msg,
Throwable t)
Print an exception along with a message in the console.
|
static void |
printMessage(org.apache.karaf.shell.api.console.Session session,
String msg)
Print a message in the console.
|
static String |
promptMessageToUser(org.apache.karaf.shell.api.console.Session session,
String msg)
This method allow you to prompt a message to the user.
|
public static String askUserWithDefaultAnswer(org.apache.karaf.shell.api.console.Session session, String msg, String defaultAnswer) throws IOException
session
- the shell's sessionmsg
- String message to askdefaultAnswer
- String default answerIOException
- if there was a problem reading input from the consolepublic static String askUserWithAuthorizedAnswer(org.apache.karaf.shell.api.console.Session session, String msg, List<String> authorizedAnswer) throws IOException
session
- the shell's sessionmsg
- String message to askauthorizedAnswer
- Array of possible answer, all answer must be in lower caseIOException
- if there was an error retrieving an answer from the user on the consolepublic static String promptMessageToUser(org.apache.karaf.shell.api.console.Session session, String msg) throws IOException
session
- the shell's sessionmsg
- String message to promptIOException
- if there was an error retrieving an answer from the user on the consolepublic static void printMessage(org.apache.karaf.shell.api.console.Session session, String msg)
session
- the shell's sessionmsg
- the message to print out with a newlinepublic static void printException(org.apache.karaf.shell.api.console.Session session, String msg, Throwable t)
session
- the shell's sessionmsg
- the message to print out with a newlinet
- the exception to dump in the shell console after the messageCopyright © 2014–2022 Apache Software Foundation. All rights reserved.