public abstract class SubjectCommands extends CommandSupport
Modifier and Type | Field and Description |
---|---|
protected org.apache.karaf.shell.api.console.Session |
session |
protected String |
user |
console, ERROR_COLOR, MS_PER_SECOND
Modifier | Constructor and Description |
---|---|
protected |
SubjectCommands() |
Modifier and Type | Method and Description |
---|---|
Object |
execute()
Executes the command using the user name provided using the
--user option and prompts
for a password. |
protected abstract Object |
executeWithSubject()
Executes the command once the user has been properly authorized.
|
calculateRecordsPerSecond, printColor, printErrorMessage, printHeaderMessage, printProgressAndFlush, printSuccessMessage
protected String user
protected org.apache.karaf.shell.api.console.Session session
protected abstract Object executeWithSubject() throws Exception
Exception
- if the command failed to runpublic Object execute() throws Exception
--user
option and prompts
for a password. If no user name was provided, tries to run the command using the current Subject
, or elevates to the system subject is the user has permission to do so.
An error message will be printed out if the user name/password combination is invalid or if the user doesn't have the permission to run the command.
executeWithSubject()
, or null
if the command failedInvocationTargetException
- thrown if an exception occurred while executing the commandException
- if any other unexpected exception occurredThis work is licensed under a Creative Commons Attribution 4.0 International License.